-
Wargame.kr strcmpWebHacking/Wargame.kr 2018. 2. 25. 06:35
strcmp
550point / bughelaif you can bypass the strcmp function, you get the flag.
이번 문제는 strcmp함수 문제인것같다.
1234567891011121314151617181920212223242526<?phprequire("../lib.php"); // for auth_code function$password = sha1(md5(rand().file_get_contents("/var/lib/dummy_file")).rand());if (isset($_GET['view-source'])) {show_source(__FILE__);exit();}else if(isset($_POST['password'])){sleep(1); // do not brute force!if (strcmp($_POST['password'], $password) == 0) {echo "Congratulations! Flag is <b>" . auth_code("strcmp") ."</b>";exit();} else {echo "Wrong password..";}}?><br /><br /><form method="POST">password : <input type="text" name="password" /> <input type="submit" value="chk"></form><br /><a href="?view-source">view-source</a>cs == 함수에서 NULL과 0은 같다.
php 5.3버전에서는 str과 배열을 비교할때 NULL을 반환 시켜주는데 위에 적어 놓은 것처럼 NULL은 0과 같으니 $_POST['password']가 배열이라면 NULL을 반환 할 것이고 플래그를 얻을 수 있을 것 이다.
'WebHacking > Wargame.kr' 카테고리의 다른 글
Wargame.kr SimpleBoard (0) 2018.02.26 Wargame.kr tmitter (0) 2018.02.25 Wargame.kr type confusion (0) 2018.02.25 Wargame.kr md5 password (0) 2018.02.25 Wargame.kr md5 compare (0) 2018.02.25