【发布时间】:2019-05-01 14:31:28
【问题描述】:
我正在研究一个 phpMyAdmin 安全漏洞 (CVE-2018–12613),但最好的文章并没有解释一个非常关键的技术细节。
它只是说:“index.php 运行包含 'sql.php?/../../etc/passwd',而 PHP 具有将路径转换为 ../etc/passwd 的魔力,无需检查是否目录sql.php?是否存在。"
谁能帮我理解这个? https://medium.com/@happyholic1203/phpmyadmin-4-8-0-4-8-1-remote-code-execution-257bcc146f8e
php 手册有一些关于此的信息,例如 John Carty 写了如何使用自己的网站注入一些代码,但这并不能解释我的情况。 https://www.php.net/manual/en/function.include.php
当我将以下行写入我自己的 apache2 laravel php 服务器时:
include('../../../etc/passwd');
然后我在我的页面上得到了etc/passwd的内容,但是写的是
include('sql.php?../../../etc/passwd');
或
include('index.php?../../../etc/passwd');
什么都不做。我错过了什么?
结果是包含命令:
include 'sql.php?/../../etc/passwd'
仅包括“../../../etc/passwd”
【问题讨论】:
-
@miken32 下一个最好的文章是中文 :D blog.vulnspy.com/2018/06/21/phpMyAdmin-4-8-x-LFI-Exploit 当然该字符串来自 URL,但是为什么硬编码到 php 时它的工作方式不一样呢?
-
重读后,试试
include('sql.php?../../../../etc/passwd');。sql.php?被视为一个目录,因此您需要一个额外的../才能上去。 -
@AdraCadaver ../ 的数量(3)对于我的安装是正确的。以及建议的 include('sql.php?../../../../etc/passwd');也没有用
-
@AdraCadaver 你是绝对正确的! 'include('sql.php?/../../../../etc/passwd');'工作!我需要一个额外的 /../ 以便 sql.php?被视为一个目录。
标签: php security include code-injection inclusion