Over the Wire/natas

[natas] level 5 → 6

ruming 2021. 4. 10. 21:07

input secret에 맞는 값을 입력해야 풀 수 있는 것 같다. hello를 입력해보았더니 Wrong secret을 띄웠다.

소스코드를 보는 게 힌트인 것 같아 확인해보았다.

<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": "natas6", "pass": "<censored>" };</script></head>
<body>
<h1>natas6</h1>
<div id="content">

<?

include "includes/secret.inc";

    if(array_key_exists("submit", $_POST)) {
        if($secret == $_POST['secret']) {
        print "Access granted. The password for natas7 is <censored>";
    } else {
        print "Wrong secret";
    }
    }
?>

<form method=post>
Input secret: <input name=secret><br>
<input type=submit name=submit>
</form>

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

 

일단 이 부분을 보면

<?

include "includes/secret.inc";

    if(array_key_exists("submit", $_POST)) {
        if($secret == $_POST['secret']) {
        print "Access granted. The password for natas7 is <censored>";
    } else {
        print "Wrong secret";
    }
    }
?>

post 방식으로 secret값을 보내 맞으면 Access granted, 틀리면 Wrong secret을 띄우도록 되어있다.

 

includes/secret.inc가 대놓고 있는 게 수상해서 /includes 경로로 들어가보기로 했는데 다음과 같이 접근할 수 없다고 나왔다.

 

includes/secret.inc도 당연히 forbidden이겠지 하고 쳐봤는데 놀랍게도 secret을 알 수 있었다.

secret 보기▽

더보기

FOEIUWGHFEEUHOFUOIU

 

공격 성공~!

 

'Over the Wire > natas' 카테고리의 다른 글

[natas] level 7 → 8  (0) 2021.05.09
[natas] level 6 → 7  (0) 2021.04.10
[natas] level 4 → 5  (0) 2021.04.04
[natas] level 3 → 4  (0) 2021.04.02
[natas] OverTheWire : level 2 → 3  (0) 2021.04.02