[DreamHack] [wargame.kr] type confusion
Wargame/DreamHack
https://dreamhack.io/wargame/challenges/329 Simple Compare Challenge. hint? you can see the title of this challenge. :D Analysis $json->key와 $key가 같으면 플래그를 획득할 수 있는데, ==로 loose comparison을 수행합니다. https://www.php.net/manual/en/types.comparisons.php null이 아닌 문자열과 true를 비교하면 true가 됩니다. 따라서 $json->key가 true이면 $key의 값에 관계없이 조건이 참이 됩니다. Exploit 이렇게 입력을 주면 nope이 뜹니다. 그 이유는, 입력한 문자열이 URL encode되기 때문입니다...
[DreamHack] [wargame.kr] strcmp
Wargame/DreamHack
https://dreamhack.io/wargame/challenges/328/ if you can bypass the strcmp function, you get the flag. Analysis password : view-source 입력한 패스워드와 랜덤한 sha1 해쉬 값인 $password를 strcmp()로 비교했을 때 0을 반환하면 플래그를 준다. 그런데 strcmp()의 반환값과 0을 느슨한 비교로 체크하기 때문에 strcmp()가 0이 아니라 NULL을 반환해도 조건은 참이 된다. PHP 5.3 이상 버전부터는 strcmp()로 배열과 문자열을 비교하면 NULL을 반환한다. 이를 이용하여 플래그를 획득할 수 있다. Exploit 패스워드를 입력하고 패킷을 잡아보면 다음과 같다. 패스워드..
h0meb0dy_
'loose comparison' 태그의 글 목록