이번에도 password를 입력해야 한다. 소스를 보자:
if(array_key_exists("passwd",$_REQUEST)){
if(!strcmp($_REQUEST["passwd"],"<censored>")){
echo "<br>The credentials for the next level are:<br>";
echo "<pre>Username: natas25 Password: <censored></pre>";
}
else{
echo "<br>Wrong!<br>";
}
}
// morla / 10111
<censored> 부분을 포함하는지 알아야 하는데 알 방법이 없다...
그래서 strcmp 함수에 대해 찾던 도중 다음의 내용을 알게 되었다:
https://www.php.net/manual/en/function.strcmp.php
If you rely on strcmp for safe string comparisons, both parameters must be strings, the result is otherwise extremely unpredictable.
For instance you may get an unexpected 0, or return values of NULL, -2, 2, 3 and -3.
string이 아니면 결과가 Null값이 나올 수 있다고 한다.
if(!strcmp($_REQUEST["passwd"],"<censored>")){
결과값을 비교하는 IF문은 True일 경우 password를 보여주고 False일 경우 wrong을 출력하게 되어 있지만
Null의 경우를 처리하지 않고 있다.
따라서 다음의 주소와 같이 passwd의 인자로 배열을 넘겨주면 다음 단계의 password를 볼 수 있다:
http://natas24.natas.labs.overthewire.org/?passwd[]=111