#攻击标题:uWSGI PHP Plugin目录遍历

#日期:2018年3月1日

#开发作者:Marios Nicolaides-RUNESEC

#评审人:西蒙·洛伊齐德斯和尼古拉斯·马基塔尼斯-鲁内塞克

#供应商主页:https://uwsgi-docs.readthedocs.io

#受影响的软件:2.0.17之前的uWSGI PHP Plugin

#测试依据:uWSGI 2.0.12和2.0.15

#公司代码:CVE-2018-7490

#类别:Web应用程序

概述

--------

在没有指定“PHP allowed docroot”选项的情况下,2.0.17之前的uWSGI PHP插件容易被目录遍历。

该漏洞是由于请求通过“php docroot”指定的DOCUMENT_ROOT目录下的资源时对文件路径的验证不正确造成的。

远程攻击者可以利用此漏洞,使用路径遍历序列(“..%2f”)从易受攻击的系统中读取任意文件。

这在uWSGI 2.0.12和2.0.15上进行了测试。2.0.17之前的所有版本都会受到影响。

细节

-------

uWSGI的文档指出,phpdocroot选项用于将我们的php环境囚禁在一个项目目录中(http://uwsgi docs.readthedocs.io/en/latest/PHP.html\run-php-apps-without-a-frontend-server)。

;将我们的php环境囚禁在project_dir中

php docroot=%(项目目录)

在测试过程中,观察到uWSGI在作为独立(没有前端web服务器)执行时受到目录遍历漏洞的影响,同时使用“php docroot”选项来强制web应用程序的DOCUMENT_ROOT。

uwsgi--http套接字:1337--protocol=http--plugin php--php索引索引.php--php docroot/home/testing/webapp/

攻击者可以通过使用路径遍历序列(“…%2f”)访问敏感信息来攻击此漏洞,如下所示:

http://example.runesec.com%2f….%2f….%2f….%2f/

我们注意到,当执行目录遍历攻击时,uWSGI发出以下安全错误:

[uwsgi fileserve]安全错误:/etc/passwd不在/home/testing/webapp下或安全路径下

但是,请求文件的内容(即/etc/passwd)仍然返回给用户。

在搜索了web上可能的解决方案之后,我们注意到“php-allowed-docroot”选项以前被添加到uWSGI中,以获得更好的安全性,并且可以用来列出允许的文档根,但是没有进一步的细节(http://lists.unbit.it/pipermail/uwsgi/2011-December/003180.html).

在进一步的测试中,我们发现当使用“php allowed docroot”而不是“php docroot”选项时,它不受目录遍历攻击的影响。

uwsgi--http套接字:1337--protocol=http--plugin php--php索引索引.php--允许的根目录/php/webapp测试/

在与uWSGI项目进行了一次非常有建设性和有帮助的谈话之后,他们发布了一个更新,在使用“php docroot”选项来防止目录遍历攻击时,强制执行文档根检查。请参阅缓解部分了解更多信息。

影响

------

攻击者可以利用此漏洞获取对位于web根目录之外的敏感文件的未经授权的读取权限。

缓解

----------

建议更新至uWSGI 2.0.17-https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.17.html

参考文献

----------

https://blog.runesec.com/2018/03/01/uwsgi-path-traversal/

https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.17.html

https://cve.mitre.org/cgi-bin/cvename.cgi?名称=CVE-2018-7490

https://nvd.nist.gov/vuln/detail/CVE-2018-7490

https://www.owasp.org/index.php/Testing_Directory_traversal/file_include_(OTG-AUTHZ-001)

时间轴

--------

2017年6月26日-uWSGI项目告知了该问题

2018年2月26日-uWSGI项目发布了一个补丁

2018年3月1日-公开披露

phpinfo

Server API

uWSGI

可能会存在。此漏洞

https://www.exploit-db.com/exploits/44223

# Exploit Title: uWSGI PHP Plugin Directory Traversal
# Date: 01-03-2018
# Exploit Author: Marios Nicolaides - RUNESEC
# Reviewers: Simon Loizides and Nicolas Markitanis - RUNESEC
# Vendor Homepage: https://uwsgi-docs.readthedocs.io
# Affected Software: uWSGI PHP Plugin before 2.0.17
# Tested on: uWSGI 2.0.12 and 2.0.15
# CVE: CVE-2018-7490
# Category: Web ApplicationOVERVIEW
--------
The uWSGI PHP plugin before 2.0.17 is vulnerable to Directory Traversal when used without specifying the "php-allowed-docroot" option.The vulnerability exists due to improper validation of the file path when requesting a resource under the DOCUMENT_ROOT directory which is specified via "php-docroot".A remote attacker could exploit this weakness to read arbitrary files from the vulnerable system using path traversal sequences ("..%2f").This was tested on uWSGI 2.0.12 and 2.0.15. All versions before 2.0.17 are affected.DETAILS
-------
The documentation of uWSGI states that the php-docroot option is used to jail our php environment to a project directory (http://uwsgi-docs.readthedocs.io/en/latest/PHP.html#run-php-apps-without-a-frontend-server).; jail our php environment to project_dirphp-docroot = %(project_dir)During testing it was observed that uWSGI was affected by a Directory Traversal vulnerability when executed as a standalone (without a front-end web server) along with the "php-docroot" option to enforce the DOCUMENT_ROOT of the web application.uwsgi --http-socket :1337 --protocol=http --plugin php --php-index index.php --php-docroot /home/testing/webapp/An attacker could exploit this vulnerability by using path traversal sequences ("..%2f") to access sensitive information as demonstrated below:http://example.runesec.com:1337/..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwdWe noticed that when a Directory Traversal attack was performed, uWSGI was issuing the following security error:[uwsgi-fileserve] security error: /etc/passwd is not under /home/testing/webapp or a safe pathHowever, the contents of the requested file (i.e., /etc/passwd) were still returned to the user.After searching the web for possible solutions, we noticed that the "php-allowed-docroot" option was previously added to uWSGI for better security and could be used to list the allowed document roots but no further details were available (http://lists.unbit.it/pipermail/uwsgi/2011-December/003180.html).Upon further testing, we observed that when the "php-allowed-docroot" was used instead of the "php-docroot" option, it was not affected by Directory Traversal attacks.uwsgi --http-socket :1337 --protocol=http --plugin php --php-index index.php --php-allowed-docroot /home/testing/webapp/After a very constructive and helpful talk with the uWSGI Project, they released an update which enforces a DOCUMENT_ROOT check when using the "php-docroot" option to prevent Directory Traversal attacks. Please see the MITIGATION section for more information.IMPACT
------
An attacker could exploit this vulnerability to gain unauthorized read access to sensitive files located outside of the web root directory.MITIGATION
----------
It is recommended to update to uWSGI 2.0.17 - https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.17.htmlREFERENCES
----------
https://blog.runesec.com/2018/03/01/uwsgi-path-traversal/
https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.17.html
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7490
https://nvd.nist.gov/vuln/detail/CVE-2018-7490
https://www.owasp.org/index.php/Testing_Directory_traversal/file_include_(OTG-AUTHZ-001)TIMELINE
--------
26 June 2017 - uWSGI Project informed about the issue
26 February 2018 - uWSGI Project released a patch
1 March 2018 - Exploit publicly disclosed

CVE-2018-7490 uWSGI PHP Plugin目录遍历相关推荐

  1. linux遍历目录漏洞,Mutiny 多个目录遍历漏洞(CVE-2013-0136)

    发布日期:2013-05-15 更新日期:2013-06-02 受影响系统: Mutiny Mutiny 5 描述: ----------------------------------------- ...

  2. linux bootstrap强制结束,Cisco UCCX bootstrap服务目录遍历漏洞

    发布日期:2010-06-10 更新日期:2010-06-12 受影响系统: Cisco CRS 7.x Cisco CRS 6.x Cisco CRS 5.x Cisco Unified IP IV ...

  3. niagara在linux系统上的安装,TRIDIUM NiagaraAX目录遍历漏洞

    发布日期:2013-02-14 更新日期:2013-03-01 受影响系统: TriDComm NiagaraAX 3.7 TriDComm NiagaraAX 3.6 TriDComm Niagar ...

  4. Linux防止目录遍历,ubuntu linux 目录遍历破绽(CVE-2019-14452)

    破绽形貌 目录遍历 在0.9.16之前的Sigil容易受到目录遍历的攻击,允许攻击者通过在提取时代处置欠妥的ZIP存档条目中的../(点点斜杠)写入随便文件. 基本信息 CVE编号: CVE-2019 ...

  5. linux遍历目录漏洞,ubuntu linux 目录遍历漏洞(CVE-2019-14452)

    漏洞描述 目录遍历 在0.9.16之前的Sigil容易受到目录遍历的攻击,允许攻击者通过在提取期间处理不当的ZIP存档条目中的../(点点斜杠)写入任意文件.d S k O 基本信息 CVE编号: C ...

  6. web漏洞(CSRF-SSRF-文件包含-文件解释-文件下载-目录遍历-sql注入-文件上传-反序列化-XSS-XXE-RCE-逻辑越权)

    1.CSRF(跨站请求伪造)(需要对方是在登录的情况下)--主要用于骗转账等等 原理:A在已经登录了银行的网站,并且此时去访问了B所构造的网页添加了特殊代码,A点击了B,由于A已经登录了,就造成了A直 ...

  7. bloody download.php,WordPress DB Backup插件\'download.php\'目录遍历漏洞

    WordPress DB Backup插件\'download.php\'目录遍历漏洞 发表日期:2014-12-08 14:57:00 WordPress DB Backup插件\'download ...

  8. php dir类,PHP基于dir类实现目录遍历删除

    这篇文章主要介绍了PHP使用内置dir类实现目录遍历删除的方法,涉及php中dir类的使用技巧,具有一定参考借鉴价值,需要的朋友可以参考下 本文实例讲述了PHP使用内置dir类实现目录遍历删除的方法. ...

  9. nginx配置错误而导致目录遍历漏洞

    漏洞版本:nginx(Tested at 1.1.10) 漏洞描述:nginx是一款高性能的web服务器,使用非常广泛,其不仅经常被用作反向代理,也是一个 IMAP/POP3/SMTP 代理服务器. ...

  10. python遍历文件目录_python目录遍历

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 我曾经写了c语言的遍历目录.php的遍历目录,今天来说一下python遍历目录, ...

最新文章

  1. ide硬盘接口图 sata硬盘接口图 SCSI硬盘接口图
  2. Ubuntu下安装zsteg隐写工具
  3. [文章备份]源代码制图工具Understand最新可用注册码
  4. Qmake建立常见的项目类型
  5. LeetCode 462. 最少移动次数使数组元素相等 II(数学)
  6. 怎样更换UC浏览器的字体?更换UC浏览器的字体的方法
  7. 【note】PAT甲级题目中的单词整理
  8. myeclipse 快捷键(转载)
  9. 修改笔记-批量去除附件售价
  10. Netty4.0学习笔记系列之四:混合使用coder和handler
  11. Unity3D视图介绍
  12. android权限管理, API劫持, xposed, xprivacy
  13. 基于推特数据挖掘交通事件的城市交通流深度学习预测模型
  14. java cobar_alibaba的COBAR真是强大.
  15. linux 光功率 模块_光模块基本参数-消光比/光功率/灵敏度
  16. 【数据集】人工智能领域比较常见的数据集汇总
  17. 单片机实例1——闪烁灯(硬件电路图+汇编程序+C语言程序)
  18. 开机提示:one of your disks needs to be checked解决方法
  19. 电影和电视Movies and TV
  20. 几种kafka多线程消费方式

热门文章

  1. 手机企业邮箱客户端哪个好用?
  2. 推荐一份完整的大数据教学视频
  3. 直播提醒|今晚八点半,最硬核情感分析技术讲解来袭!内附SKEP详解+大作业指导!...
  4. CF 285D 285E
  5. 刑法285.286.287 条
  6. 跨站脚本攻击(XSS)及防范措施
  7. idea git 颜色代表什么意思
  8. 10015---Linux IO模式及 select、poll、epoll详解
  9. HTML学生个人网站作业设计:动漫网站设计——蜡笔小新(3页) HTML+CSS+JavaScript 简单DIV布局个人介绍网页模板代码 DW学生个人网站制作成品下载
  10. 百度导航怎么不显示服务器,win7系统百度首页导航不见了怎么办