menu arrow_back 湛蓝安全空间 |狂野湛蓝,暴躁每天 chevron_right ... chevron_right (CVE-2017-14596)Joomla! 1.5 = 3.7.5 LDAP注入绕过登录认证 chevron_right (CVE-2017-14596)Joomla! 1.5 = 3.7.5 LDAP注入绕过登录认证.md
  • home 首页
  • brightness_4 暗黑模式
  • cloud
    xLIYhHS7e34ez7Ma
    cloud
    湛蓝安全
    code
    Github
    (CVE-2017-14596)Joomla! 1.5 = 3.7.5 LDAP注入绕过登录认证.md
    3.86 KB / 2021-07-15 19:54:56
        (CVE-2017-14596)Joomla! 1.5 \<= 3.7.5 LDAP注入绕过登录认证
    ============================================================
    
    一、漏洞简介
    ------------
    
    通过在登录页面利用该漏洞进行攻击,非特权的远程攻击者可以提取出LDAP服务器中所有的用户凭证(用于安装Joomla!),这些凭证包括特权用户以及Joomla!管理员的用户名以及密码。获取到这些凭证之后,攻击者就可以使用这些信息来登录Joomla!的管理员控制面板并完全接管Joomla!,或者通过上传自定义的Joomla!扩展实现远程代码执行并相关的Web服务器。
    
    二、漏洞影响
    ------------
    
    Joomla! 1.5 \<= 3.7.5
    
    三、复现过程
    ------------
    
    ### 漏洞分析
    
    我们的代码分析解决方案RIPS能够自动化识别出下列代码段中的安全漏洞。首先在LoginController中,Joomla!应用可以从登录表单中接收用户提供的凭证数据。
    
    ### /administrator/components/com\_login/controller.php
    
    ![1.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId26.png)
    
    凭证数据会被传递给login方法,而login方法中又会调用authenticate方法。
    
    ### /libraries/cms/application/cms.php
    
    ![2.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId28.png)
    
    ### /libraries/joomla/authentication/authentication.php
    
    ![3.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId30.png)
    
    authenticate方法可以向onUserAuthenticate方法发送用户凭证,具体方法取决于管理员所使用的身份验证插件。如果Joomla!在进行身份验证时使用的是LDAP,那么这里将需要调用LDAP插件的内置方法。
    
    ### /plugins/authentication/ldap/ldap.php
    
    ![4.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId32.png)
    
    在LDAP插件中,username嵌入在LDAP查询语句(在search\_string选项中指定)中。根据Joomla!的官方文档,search\_string配置选项是一个用于搜索用户的查询字符串,其中的\[search\]会被登录表单中的搜索文本直接替换,例如"uid=\[search\]"。接下来,LDAP查询语句会被传递给LdapClient中的simple\_search方法,这个函数负责与LDAP服务器建立连接并执行ldap\_search方法。
    
    ### /libraries/vendor/joomla/ldap/src/LdapClient.php
    
    ![5.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId34.png)
    
    即使RIPS没有能够发现LDAP查询字符串是从一个外部配置文件加载进来的,但RIPS仍然能够成功检测并报告这个漏洞的根本原因:传递给ldap\_search函数的用户输入虽然嵌入在了LDAP查询语句中,但输入数据并没有经过数据清洗。
    
    ### 漏洞复现
    
    由于没有对LDAP查询语句中的username数据进行过滤,这将导致攻击者能够修改LDAP搜索的结果集合。通过使用特殊字符并观察不同的认证错误信息,攻击者将能够通过不断地发送测试payload来暴力破解出凭证字符。
    
        XXX;(&(uid=Admin)(userPassword=A*))
        XXX;(&(uid=Admin)(userPassword=B*))
        XXX;(&(uid=Admin)(userPassword=C*))
        ...
        XXX;(&(uid=Admin)(userPassword=s*))
        ...
        XXX;(&(uid=Admin)(userPassword=se*))
        ...
        XXX;(&(uid=Admin)(userPassword=sec*))
        ...
        XXX;(&(uid=Admin)(userPassword=secretPassword))
    
    其中的每一行Payload代码都可以从LDAP服务器中提取出目标数据,而这也是一种相对非常高效的LDAP盲注攻击方式。
    
    可通过一次次爆破尝试出后台账号密码![6.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId36.png)![7.png](./resource/(CVE-2017-14596)Joomla!1.5<=3.7.5LDAP注入绕过登录认证/media/rId37.png)
    
    参考链接
    --------
    
    > https://www.freebuf.com/articles/web/149059.html
    >
    > https://twitter.com/ripstech/status/1094999251417993216
    
    
    links
    file_download