我如何获取 777 - CHMOD php 文件的源代码?
我拥有的一个论坛的版主这样做了。我仍然不敢相信,也不明白他是怎么做到的。有人能给我解释一下吗? 他说他只使用 HTTP GET 请求
主持人说服务器(nginx)通常会发送执行的 php 文件的输出,但由于文件是 777,因此他可以在 URL 中添加一些参数来获取它的未解析版本。
谢谢
A moderator of a forum i own did so. I still can't belive on it, and i can't understand how he did it. Can someone explain me?
He said he used only HTTP GET requests
The moderator said that the server (nginx) would normally send the output of the executed php files, but since that the files are 777 adding some parameters to the URL he can get the unparsed version of it.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果网站上的下载脚本写得不好,那么只需重写 url 即可下载任何文件(包括 PHP 源文件)。这可能正是他所做的,因此您最好检查您正在使用的论坛软件(以及安装的第三方模块)是否不包含任何已知的漏洞。
If there's a badly written download script on the site then it's as easy as rewriting the url to download any file (including PHP source files). That could be just what he did, so you'd better check if the forum software (and installed 3rd party modules) you are using don't contain any known vulnerabilities.
正确配置的服务器只会执行 .php 文件,而不会泄露其源代码。但是配置不当的服务器可以通过指向原始文件的 .phps 符号链接来提供 PHP 源代码。
除此之外,查询参数不能告诉 PHP 提供源代码,除非有问题的源代码中有后门,例如:
当然,由于文件的模式 777,如果您可以进入它所在的目录,您可以获得直接打开文件,或者简单地打开后门。
A properly configured server will only execute .php files, not reveal their source. But a badly configured server CAN serve up the PHP source via a .phps symbolic link pointing at the original file.
Beyond that, query parameters cannot tell PHP to serve up the source, unless the source in question has a backdoor in it, something like:
Of course, since the file's mode 777, if you can get into the directory it's in, you can get the file directly, or slap in the backdoor trivially.