
[!IMPORTANT]
preg_match过滤绕过及RCE重定向截断
0x01#
访问靶场,回显源码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| <?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-05 20:49:30
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-05 22:50:30
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/
if(isset($_GET['c'])){
$c=$_GET['c'];
if(!preg_match("/\;|cat|flag| |[0-9]|\*|more|less|head|sort|tail|sed|cut|tac|awk|strings|od|curl|\`|\%|\x09|\x26|\>|\</i", $c)){
system($c." >/dev/null 2>&1");
}
}else{
highlight_file(__FILE__);
}
|
0x02#
[!NOTE]
审计源码
过滤字段新增> <
标准输出被重定向
构造payload思路:使用${IFS}替代>以替代空格,使用||进行截断
0x03#
目录扫描过程此处不再赘述
提交payload,获得flag
