当前位置:网站首页>【无标题】
【无标题】
2022-07-23 11:18:00 【一只Traveler】
知识点:
$$变量覆盖漏洞
变量覆盖漏洞详解_poggioxay的博客-CSDN博客_变量覆盖漏洞
参考,意思就是说,存在一些函数比如exit()extract()函数使用不当,parse_str()函数使用不当,import_request_variables()使用不当,包含了变量,如果get传参等方式就会覆盖之前的变量,达到控制变量而读取flag;诸如出现echo xxx .$flag
$$特殊符号
不仅仅是函数会导致变量覆盖,有些特殊符号的特殊搭配也会引起变量覆盖漏洞,比如
$$。$$导致的变量覆盖问题在CTF代码审计题目中经常在foreach中出现,如以下的示例代码,使用foreach来遍历数组中的值,然后再将获取到的数组键名作为变量,数组中的值作为变量的值,因此就产生了变量覆盖漏洞。请求?name=test会将$name的值覆盖,变为test。
比如这道题的代码如下:
index.php最后的代码:
<?php
include 'flag.php';
$yds = "dog";
$is = "cat";
$handsome = 'yds';
foreach($_POST as $x => $y){
$$x = $y;
}
foreach($_GET as $x => $y){
$$x = $$y;
}
foreach($_GET as $x => $y){
if($_GET['flag'] === $x && $x !== 'flag'){
exit($handsome);
}
}
if(!isset($_GET['flag']) && !isset($_POST['flag'])){
exit($yds);
}
if($_POST['flag'] === 'flag' || $_GET['flag'] === 'flag'){
exit($is);
}
echo "the flag is: ".$flag;可以通过构造三个exit()的其中一个来实现达到读取flag
第一个:?handsome=flag&flag=b&b=flag
不是很理解;
第二个最简单:
直接?yds=flag
第三个:
?flag=flag&is=flag

边栏推荐
猜你喜欢

在一个有序数组中查找具体的某个数字(二分查找or折半查找)

Remember SQL optimization once

对C语言最基本的代码解释

Idea starts multiple projects at once

Mercedes Benz new energy product line: luxury new energy market may change the pattern

uniapp路由跳转的六种方式

Application of ERP management system in equipment manufacturing enterprise management

Can multithreading optimize program performance?

老照片上色——DeOldify快速上手

Safe operation 7.22
随机推荐
VSCode 更新後與tab相關快捷鍵無法使用
What is the real HTAP? (2) Challenge article
STL map attribute
可穿戴设备的自电容触摸控制器IT7259Q-13,IT7259EX-24
[pyGame practice] playing poker? Win or lose? This card game makes me forget to eat and sleep.
Redis的过期策略以及内存淘汰机制,Key过期了为什么没释放内存
aws篇3 go语言如何publish message 到iot的MQTT
Remember SQL optimization once
【运维】ssh tunneling 依靠ssh的22端口实现访问远程服务器的接口服务
什么是真正的 HTAP ?(二)挑战篇
Six ways of uniapp route jump
C # close current computer command
《快速掌握QML》第五章 组件
一个悄然崛起的国产软件,太强了!
Axure advanced
[ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}
Redis中 LRU和LFU的淘汰策略区别
Application of ERP management system in equipment manufacturing enterprise management
种种迹象表明,Apple将有望支持AV1
3D数学 - 矢量