与之前做过的跟ssh和终端打交道的题目不同,在natas当中,我们通过寻找一个网站的漏洞来获得通向下一个关卡的钥匙。
在开始之前,先介绍一个工具:curl
curl是利用URL语法在命令行方式下工作的开源文件传输工具。在处理与web有关的问题时,简单易行的命令行有时候会比通过浏览器更加便捷。
使用curl能方便地修改get和post的参数,甚至cookie,以及http header当中的各个参数。
Natas 0
:
题目并无给出太多信息,如果通过浏览器打开,只能看到“You can find the password for the next level on this page.”这样一句话在空荡荡的屏幕上。这时候就轮到curl出场了。
curl -isu natas0:natas0 http://natas0.natas.labs.overthewire.org
HTTP/1.1 200 OK
Date: Sat, 16 Aug 2014 14:21:46 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Fri, 12 Jul 2013 13:35:26 GMT
ETag: "25fa6-396-4e15095574380"
Accept-Ranges: bytes
Content-Length: 918
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug
<!-- 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": "natas0", "pass": "natas0" };</script></head>
<h1>natas0</h1>
<div id="content">
You can find the password for the next level on this page.
<!--The password for natas1 is gtVrDuiDfck831PqWsLEZy5gyDz1clto -->
</body>
</html>
以上是输出,上半部分是-i选项输出的http请求头,下半部分是返回的html文档。可以很容易发现,文档中有这样一句话:
<!--The password for natas1 is gtVrDuiDfck831PqWsLEZy5gyDz1clto -->。这就是我们想要的密码了。
当然,查看源代码这个工作不需要curl也能做到,直接右键“view source code”或者在chrome或firefox下f12打开调试控制台,都可以很容易看到这句话。
Natas 1:
通过浏览器打开时,能看到这么一句话“You can find the password for thenext level on this page, but rightclicking has been blocked!”
.
理论上它应当是把右键屏蔽了。然而事实上我发现,无论是在chrome还是firefox当中,只要不点在中间那一块白色区域上,都能右键打开菜单。所以完全与上一题相同的三种方法,就能够找到答案了。
Natas 2:
这次的无论是网页还是源代码,可就真的空空如也了。有点让人头疼。可注意到“<img src="files/pixel.png">”这一句,就给我们提了个醒。它暴露了服务器的文件夹结构,如果没有设置合理的访问权限的话,我们或许能够获得一些信息。
curl -isu natas2:ZluruAthQk7Q2MqmDeTiUij2ZvWy2mBi http://natas2.natas.labs.overthewire.org/files/
很容易发现,该目录下有users.txt这么一个文件,它很像是我们需要的文件。而访问的结果也确实如此,在里面找到了natas3的密码。
Natas 3:
打开这个网页,你会发现,页面上如同上一题,什么都没有。
循着上一题的经验,你开始寻找源代码里有没有泄露服务器上文件结构的线索,仍然什么都没有。
于是你陷入了沉思。
nat
as11:
同样查看源码,审计。想要得到密码,需要使showpassword设置为yes,loadData函数是将cookie的值解密还原,存储与mydata数组中,并返回mydata。而savaData函数则是将传入的参数进行编码处理,存在COOKIE[“data”]中。
由此大体思路为,构造新的输入参数,是的showpassword值设置为yes,编码后得到新的data值。但完成这步,需...
我在做
nat
as11的时候发现了一个问题,问题的需求可以简化为:
$tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true);
其中xor_decode的实现为:
function xor_encrypt($in) {
$key = '&lt;censored&gt;';
$te...
有时您可能会遇到永远循环的服务,并且此可能会为您提供帮助。 此外,如果您想重新添加主机,只需删除/ var / lib / rancher / state中的文件即可。
在Docker-
War
中使用docker之前, 会将docker.sock的组从docker(998)更改为app(9999),以允许应用程序用户在此图像中调用docker。
$ sudo chgrp 9999 /run/docker.sock
覆盖单元测试和集成测试。
能够实时更改挑战。
将移到 。
(可选)使
前些日子,朋友给我推荐了一个网站,上面可以做跟渗透有关的题。正热衷于此苦于不得其门而入的我很高兴地入坑了。
一开始我做的题是vortex,这个系列的题是跟缓冲区溢出有关的,难度相对较大,做得我苦不堪言。当终于在第四道题上卡死,不知道自己错在哪儿。干脆去别的题目上消遣一下找找手感。
目标转向了,推荐的入门题,bandit。
注:这些题的形式基本相同,通过ssh和给定的用户名密码连接到一个