当前位置:网站首页>攻防世界----ics-05
攻防世界----ics-05
2022-07-19 21:00:00 【jjj34】
拿到靶场后,做一下目录扫描
1.访问 /start.sh
获得了网站的路径
2.访问/index.php/login
拿到一个page的参数,因为page的内容是可以回显的因此尝试利用伪协议读取任意文件漏洞
?page=php://filter/read=convert.base64-encode/resource=index.php
?page=file:///var/www/html/index.php
两种方法都尝试,发现php伪协议成功拿到源码
将这一串源码拿去base64解密(因为我们读取源码采用了base64加密)
对源码进行过滤,发现利用点
if ($_SERVER['HTTP_X_FORWARDED_FOR'] === '127.0.0.1') {
echo "<br >Welcome My Admin ! <br >";
$pattern = $_GET[pat];
$replacement = $_GET[rep];
$subject = $_GET[sub];
if (isset($pattern) && isset($replacement) && isset($subject)) {
preg_replace($pattern, $replacement, $subject);
}else{
die();
}
}
知识点1: xff伪造
就是在Host下面添加一条 X-Forwarded-For
知识点2 preg_replace() /e 漏洞
preg_replace() 函数,该函数执行一个正则表达式的搜索和替换。
搜索 subject 中匹配 pattern 的部分, 以 replacement 进行替换。
参数说明:
$pattern: 要搜索的模式,可以是字符串或一个字符串数组。
$replacement: 用于替换的字符串或字符串数组。
$subject: 要搜索替换的目标字符串或字符串数组。
$limit: 可选,对于每个模式用于每个 subject 字符串的最大可替换次数。 默认是-1(无限制)。
$count: 可选,为替换执行的次数。
源码中
pat传入一个正则,rep传入命令执行的函数,sub需要和pat的正则进行匹配
/e 的原理就是 搜索 subject 中匹配 pattern 的部分, 以 replacement 进行替换,然后执行sub的内容
如图,命令被执行了
接下来就是常规的命令执行,找flag
由于空格会导致字符失效,因此,利用+来替代空格(url中+就是空格)
边栏推荐
- ArrayList源码解析
- Microservice testing
- Mongo index backup
- English sentence pattern reference exclusive Edition - object clause
- Introduction to Golan language, realize 99 multiplication table
- Goland语言入门,实现九九乘法表
- Using redis + Lua script to realize distributed flow restriction
- 2022 Henan Mengxin League game 2: Henan University of technology L - HPU
- PyTorch随笔 - ConvMixer - Patches Are All You Need
- 在idea中设置文档注释的方法(图文版)
猜你喜欢
Enter the real situation of maker education curriculum practice
面试官问我JVM的GC分代收集算法为什么这么设计
xadmin对ueditor的使用
Simple examples of pointer arrays and array pointers
PyTorch随笔 - ConvMixer - Patches Are All You Need
完善镜像站配置信息 — 镜像站体验官
【IEEE出版】2022年自然语言处理与信息检索国际会议(ECNLPIR 2022)
Solution to the fourth weekly test of ACM intensive training of Hunan Institute of technology in 2022
MySQL Authentication ‘root‘ ‘mysql_ native_ password‘ failed: Reading from the stream has failed
模拟实现库函数strstr--查找子字符串
随机推荐
2022徐特立科学营&BIT机器人队电控课程讲义
How does redis realize inventory deduction and prevent oversold?
Basic principle of index push down
PMP practice once a day | don't get lost in the exam -7.19
Niuke multi school first game I question chiitoitsu expectation + probability DP
[QNX hypervisor 2.2 user manual]8.4 interprocessor interrupt
Set aside 300 hours to teach you how to make a Lego submarine! Netizens read all the masterpieces
Starting from mathematical derivation, 70000 words will definitely take you to learn support vector machine (free PDF download)
2022河南萌新联赛第(二)场:河南理工大学 F - 手办
OTT大屏“新收视率体系”来了,广告主不再迷茫?
Simulate the implementation library function strcat-- append a copy of the source string to the target string (understand the memory overlap problem)
记一次爬虫逆向攻防的详细过程
7 位艺术家因 NFT 而改变了自己的生活
操作元素案例合集
Microservice testing
史上最全的 IDEA Debug 调试技巧(超详细案例)
首个X光下的小样本检测基准和弱特征增强网络,北航、讯飞新研究入选ACM MM 2022
(JS)数组去除重复
相爱相杀大半年,马斯克和推特是怎么“分手”的?
从数学推导开始,7万字一定带你学会支持向量机(免费PDF下载)