Web
flags
打开给了源码:
<?php
highlight_file(__FILE__);
$lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'ot';
$lang = explode(',', $lang)[0];
$lang = str_replace('../', '', $lang);
$c = file_get_contents("flags/$lang");
if (!$c) $c = file_get_contents("flags/ot");
echo '<img src="data:image/jpeg;base64,' . base64_encode($c) . '">';
![](https://img.haomeiwen.com/i11900959/b555312976809822.png)
主要是控制接收的
HTTP_ACCEPT_LANGUAGE
。通过
....//
来绕过str_replace('../', '', $lang);
。这样....//
会变成../
。构造:
![](https://img.haomeiwen.com/i11900959/8e4472ee918b6898.png)
把图片另存为
1.php
后可以得到flag。![](https://img.haomeiwen.com/i11900959/7f1c06a89f5fc221.png)
Mc Donald
访问robots.txt
发现DS.Store
泄露。
![](https://img.haomeiwen.com/i11900959/94d39713af5b752c.png)
使用工具得到:
![](https://img.haomeiwen.com/i11900959/0eaae334e655566c.png)
![](https://img.haomeiwen.com/i11900959/75de855e90e18aca.png)
Logged In
首先登录。
![](https://img.haomeiwen.com/i11900959/86f6e2b7ae67cce9.png)
抓包得到验证码。
![](https://img.haomeiwen.com/i11900959/b219f2685b9bbb75.png)
这里有一个功能,能创建小程序玩。
![](https://img.haomeiwen.com/i11900959/9a31f0cd1ed316d2.png)
访问
http://35.207.132.47/pyserver/server.py
得到源码。看得出是拿
flask
写的。通过阅读源码知道了管理员是
admin
。尝试用admin
登录:![](https://img.haomeiwen.com/i11900959/191f36fdbc6d0d21.png)
cookie
里给了flag:![](https://img.haomeiwen.com/i11900959/e877a9d20a0f743a.png)
saltfish
给了源码:
<?php
require_once('flag.php');
if ($_ = @$_GET['pass']) {
$ua = $_SERVER['HTTP_USER_AGENT'];
if (md5($_) + $_[0] == md5($ua)) {
if ($_[0] == md5($_[0] . $flag)[0]) {
echo $flag;
}
}
} else {
highlight_file(__FILE__);
}
第一个条件:md5($_) + $_[0] == md5($ua)
。绕过方法:
![](https://img.haomeiwen.com/i11900959/0fed7ee957e4f0cf.png)
第二个条件:
$_[0] == md5($_[0] . $flag)[0]
。这里两个字符串的第一个字符必须要一样。使用python:
from hashlib import md5
import string
import itertools
good = string.ascii_letters + string.digits
for i in itertools.product(good, good, good, good, good):
hashed = md5("".join(i).encode('utf-8')).hexdigest()
if hashed[:2] == "0e" and hashed[2:].isdigit(): # 需要字符串0e开头且后面都要是数字
print(hashed,("".join(i)))
得到byGcY
。
![](https://img.haomeiwen.com/i11900959/5d75cc40352b44a6.png)
最后payload:
![](https://img.haomeiwen.com/i11900959/8517acc015c4ff87.png)
网友评论