简介
Openfire是一个开源的实时协作(RTC)服务器,采用开源Apache许可证。它是一个即时通讯(IM)和群聊服务器,使用Java编写并使用XMPP协议。它非常易于设置和管理,但提供了坚实的安全性和性能
影响版本
3.10.0
<= Openfire <4.6.8
4.7.0
<=Openfire <4.7.5
选择搭建的版本为4.7.4
,windos下搭建省心省力,下载链接
环境搭建

一直下一步

前提是环境已经安装过jdk


启动服务端,访问管理界面进行配置


掠过其它步骤,数据库无需配置,配置管理账户


漏洞复现
漏洞url

泄露日志文件,payload如下
/setup/setup-s/%u002e%u002e/%u002e%u002e/*.jsp
漏洞分析
查看配置文件xmppserver/src/main/webapp/WEB-INF/web.xm
<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
中已经修改

创建用户
通过未授权进行命令执行,可以直接使用编译好的工具获取admin用户组的用户密码登录

图片来自于github,工具我没有测试,有兴趣的可以参考
这个用户身份bypass详细有的师傅能发现跟之前某大厂OA基本一样。
命令执行
根据创建的用户登录之后上传webshell,从上面的地址上传别人封装好的jar包,插件位置上传jar包

上传成功

执行命令

