当前位置:网站首页>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
边栏推荐
- Three years after graduation, write to you and me who may be confused [turn]
- Detailed explanation of 9 common reasons for MySQL index failure
- ISO 13400(DoIP)标准解读
- Geth installation
- 【小程序项目开发 -- 京东商城】uni-app 商品分类页面(上)
- 动态规划问题(八)
- Solution: direct local.Aar file dependencies are not supported when building an aar
- What do you need to bring with you for the NPDP exam? Stationery carrying instructions
- Idea2021.2 installation and configuration (continuous update)
- IDEA2021.2安装与配置(持续更新)
猜你喜欢

JS advanced ES6 ~ es13 new features

Detailed explanation of 9 common reasons for MySQL index failure

Install MySQL using Yum for Linux

“Method Not Allowed“,405问题分析及解决

Doip test development practice

How can Plato obtain premium income through elephant swap in a bear market?

Intelligent trash can (VII) -- Introduction and use of sg90 steering gear (Pico implementation of raspberry pie)

Build SSM project with JSP as view parser

Powercli VMware vCenter deploys conventional new VMS in batch through self built PXE server with one click

SQL实现将多行记录合并成一行
随机推荐
Web系统常见安全漏洞介绍及解决方案-CSRF攻击
@Detailed explanation of the use of transactional annotation
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?
Create AP hotspots for imx6 development board QT system based on rtl8723 cross compile iptables
DoIP测试开发实践
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
ISO 13400(DoIP)标准解读
Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
Do you know any formal part-time platforms?
Leetcode60. permutation sequence
Web系统常见安全漏洞介绍及解决方案-sql注入
JS advanced ES6 ~ es13 new features
跳表的原理
Solution: direct local.Aar file dependencies are not supported when building an aar
【微服务】Nacos集群搭建以及加载文件配置
110道 MySQL面试题及答案 (持续更新)
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Real time data warehouse: meituan reviews Flink's real-time data warehouse application sharing
研发效能的道法术器
Doip communication of canoe application case
Obviously, we want to execute the file containing flag, The conditions contained in the file should meet the last if,
