浅析CVE-2025-68645Zimbra属性覆盖导致本地文件包含漏洞

admin 2026-01-04 01:39:22 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文分析了ZimbraCVE-2025-68645漏洞,利用RestFilter属性覆盖机制与JspServlet处理逻辑,未授权用户可构造请求绕过Jetty保护限制。该漏洞导致本地文件包含,允许读取WEB-INF等敏感目录文件,影响Zimbra及ZimbraAdmin应用,需及时修补。 综合评分: 86 文章分类: 漏洞分析,WEB安全,漏洞POC,代码审计


cover_image

浅析 CVE-2025-68645 Zimbra 属性覆盖导致本地文件包含漏洞

原创

KCyber

自在安全

2026年1月3日 10:04 上海

近日 Zimbra 披露了一个本地文件包含漏洞 CVE-2025-68645 ,从公开信息看应该与前期朋友分享给我的一个漏洞撞了,下面就将简要分析过程分享给大家。该漏洞源于 RestFilter 过滤器对参数处理不当,导致未经身份认证的用户可以构造恶意请求,读取服务器 WebRoot 目录下的敏感文件。

RestFilter

Zimbra 使用Jetty作为底层Web容器。在ZimbraZimbraAdmin这两个应用的web.xml中均可以找到RestFilter配置,该Filter匹配/h/* 请求:

查看 com.zimbra.webClient.filters.RestFilter 实现代码,存在非常明显的 request 属性覆盖过程,即请求参数的值将会被复制给同名的属性:

那么此处的属性覆盖是否可以利用呢?

JspServlet

继续查看 web.xml ,发现多个 /h/* 请求被定义在 jsp-config 中,对应处理的 Servlet 类为 org.apache.jasper.servlet.JspServlet :

<jsp-config>
&nbsp; &nbsp; <jsp-property-group>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/changepass</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/imessage</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/postLoginRedirect</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printcalls</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printcalendar</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printvoicemails</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printappointments</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/rest</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printcontacts</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printconversations</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printmessage</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/printtasks</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/h/viewimages</url-pattern>
&nbsp; &nbsp; &nbsp; <url-pattern>/modern/</url-pattern>
&nbsp; &nbsp; </jsp-property-group>
&nbsp; </jsp-config>

在 JspServlet 中,当从 request 中提取 javax.servlet.include.servlet_path 属性非空时,url 将被赋值为该属性的值:

很容易想到 RestFilter 和 JspServlet 组合起来存在被利用的可能性。

组合实现文件包含

我们知道 Jetty 正常情况下无法直接访问类似 /WEB-INF/web.xml 的文件资源,原因是 Jetty 在 Handler 层会对 /WEB-INF 和 /META-INF 的访问进行拦截,处理代码位于 org.eclipse.jetty.server.handler.ContextHandler.doHandle ,该函数将调用 isProtectedTarget 判断请求是否属于被保护对象:

public void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
&nbsp; &nbsp; DispatcherType dispatch = baseRequest.getDispatcherType();
&nbsp; &nbsp; boolean new_context = baseRequest.takeNewContext();

&nbsp; &nbsp; try {
&nbsp; &nbsp; &nbsp; &nbsp; if (new_context) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.requestInitialized(baseRequest, request);
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; if (dispatch != DispatcherType.REQUEST || !this.isProtectedTarget(target)) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.nextHandle(target, baseRequest, request, response);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; baseRequest.setHandled(true);
&nbsp; &nbsp; &nbsp; &nbsp; response.sendError(404);
&nbsp; &nbsp; } finally {
&nbsp; &nbsp; &nbsp; &nbsp; if (new_context) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.requestDestroyed(baseRequest, request);
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; }

}

回顾 RestFilter 和 JspServlet 的处理逻辑可知,如果将两者结合起来就可以绕过上述检查机制,从而实现对 /WEB-INF 等限制目录的访问:

前面已经提到,Zimbra 和 ZimbraAdmin 都配置了 RestFilter ,因此这两个接口均可以实现 WebRoot 目录下的文件包含。读取 /WEB-INF/web.xml 过程如下:

由于传播、利用此文档提供的信息而造成任何直接或间接的后果及损害,均由使用本人负责,公众号及文章作者不为此承担任何责任。


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:自在安全 KCyber《浅析 CVE-2025-68645 Zimbra 属性覆盖导致本地文件包含漏洞》

评论:0   参与:  0