메뉴 건너뛰기

노루발의 개인 게시판

이번에도 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

분류 :
망한거
조회 수 :
19
등록일 :
2020.03.17
00:17:50 (*.47.15.250)
엮인글 :
게시글 주소 :
https://hondoom.com/zbxe/index.php?mid=noru&document_srl=818148
파일 첨부

여기에 파일을 끌어 놓거나 파일 첨부 버튼을 클릭하세요.

파일 크기 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )
옵션 :
:
:
List of Articles