Web Hacking/Natas

[Natas] Level 21 > Level 22

SolB 2022. 11. 5. 15:58

위는 natas22의 초기화면이다.

 

아래 코드는 View sourcecode를 통해 확인해주었다.

<?php
session_start();

if(array_key_exists("revelio", $_GET)) {
    // only admins can reveal the password
    if(!($_SESSION and array_key_exists("admin", $_SESSION) and $_SESSION["admin"] == 1)) {
    header("Location: /");
    }
}
?>


<html>
<head>
<!-- This stuff in the header has nothing to do with the level -->
<link rel="stylesheet" type="text/css" href="http://natas.labs.overthewire.org/css/level.css">
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/jquery-ui.css" />
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/wechall.css" />
<script src="http://natas.labs.overthewire.org/js/jquery-1.9.1.js"></script>
<script src="http://natas.labs.overthewire.org/js/jquery-ui.js"></script>
<script src=http://natas.labs.overthewire.org/js/wechall-data.js></script><script src="http://natas.labs.overthewire.org/js/wechall.js"></script>
<script>var wechallinfo = { "level": "natas22", "pass": "<censored>" };</script></head>
<body>
<h1>natas22</h1>
<div id="content">

<?php
    if(array_key_exists("revelio", $_GET)) {
    print "You are an admin. The credentials for the next level are:<br>";
    print "<pre>Username: natas23\n";
    print "Password: <censored></pre>";
    }
?>

<div id="viewsource"><a href="index-source.html">View sourcecode</a></div>
</div>
</body>
</html>

$_GET에 revelio라는키가 있으면 natas23의 비밀번호를 획득할 수 있다.

burp suite로 location을 변경해보자.

 

먼저 location을 변경하지 않은 상태는 아래와 같았다.

 

위치를 revelio로 변경한 후의 burp suite는 아래와 같았으며, response에서 natas23의 비밀번호를 찾을 수 있었다.

 

|qjA8cOoKFTzJhtV0Fzvt92fgvxVnVRBj