type confusion view-source code
Simple Compare Challenge.
hint? you can see the title of this challenge.
:D
<?php
if (isset($_GET['view-source'])) {
show_source(__FILE__);
exit();
}
if (isset($_POST['json'])) {
usleep(500000);
require("../lib.php"); // include for auth_code function.
$json = json_decode($_POST['json']);
$key = gen_key();
if ($json->key == $key) {
$ret = ["code" => true, "flag" => auth_code("type confusion")];
} else {
$ret = ["code" => false];
}
die(json_encode($ret));
}
function gen_key(){
$key = uniqid("welcome to wargame.kr!_", true);
$key = sha1($key);
return $key;
}
?>
쉽게 설명하면, gen_key에서 만들어지는 sha1 랜덤 값과, 입력한 json->key 값이 같아야한다.
==로 느슨한 비교를 하니, if문을 참으로 만들어주면 될 듯하다.
문자열은 항상 참이므로, TRUE에 맞는 값을 Burp Suite를 이용해 넣어주자.
'Wargame > wargame.kr' 카테고리의 다른 글
[Wargame.kr] php? c? 풀이 (291p) (0) | 2020.07.29 |
---|---|
[Wargame.kr] img recovery 풀이 (288p) (0) | 2020.07.29 |
[Wargame.kr] tmitter 풀이 (266p) (0) | 2020.07.29 |
[Wargame.kr] md5_compare 풀이 (236p) (0) | 2020.07.29 |
[Wargame.kr] DB is really GOOD 풀이 (220p) (0) | 2020.07.29 |