input secret에 맞는 값을 입력해야 풀 수 있는 것 같다. hello를 입력해보았더니 Wrong secret을 띄웠다.
소스코드를 보는 게 힌트인 것 같아 확인해보았다.
<html><head><!-- This stuff in the header has nothing to do with the level --><linkrel="stylesheet"type="text/css"href="http://natas.labs.overthewire.org/css/level.css"><linkrel="stylesheet"href="http://natas.labs.overthewire.org/css/jquery-ui.css" /><linkrel="stylesheet"href="http://natas.labs.overthewire.org/css/wechall.css" /><scriptsrc="http://natas.labs.overthewire.org/js/jquery-1.9.1.js"></script><scriptsrc="http://natas.labs.overthewire.org/js/jquery-ui.js"></script><scriptsrc=http://natas.labs.overthewire.org/js/wechall-data.js></script><scriptsrc="http://natas.labs.overthewire.org/js/wechall.js"></script><script>var wechallinfo = { "level": "natas6", "pass": "<censored>" };</script></head><body><h1>natas6</h1><divid="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";
}
}
?>
<formmethod=post>
Input secret: <inputname=secret><br><inputtype=submitname=submit></form><divid="viewsource"><ahref="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을 알 수 있었다.