Over the Wire/natas

[OvertheWire:Natas] natas 22 → 23 / natas 23

ruming 2021. 8. 3. 12:04

password를 직접 입력하는 문제인가?

 

소스코드

Password:
<form name="input" method="get">
    <input type="text" name="passwd" size=20>
    <input type="submit" value="Login">
</form>

<?php
    if(array_key_exists("passwd",$_REQUEST)){
        if(strstr($_REQUEST["passwd"],"iloveyou") && ($_REQUEST["passwd"] > 10 )){
            echo "<br>The credentials for the next level are:<br>";
            echo "<pre>Username: natas24 Password: <censored></pre>";
        }
        else{
            echo "<br>Wrong!<br>";
        }
    }
    // morla / 10111
?>

$_REQUEST로 패스워드를 받는다.

 

strstr함수는 찾고 싶은 문자를 찾은 후 매치되는 문자열을 반환하는 함수다. 대소문자 구분이 없다.

패스워드에 iloveyou가 들어있는 것 같다.

 

10보다 큰 수를 넣고 iloveyou를 입력하면 문제를 해결할 수 있다.

숫자를 먼저 넣어야 한다.

OsRmXFguozKpTZZ5X14zNO43379LZveg