# XZ Utils 后门事件

XZ Utils 后门是一枚恶意植入程序，其构建期组件被放入 xz 5.6.0 和 5.6.1 于 2024 年 2 月和 3 月发布的发行版压缩包中。在 x86-64 Linux 系统的特定构建与运行条件下，该植入程序能够劫持 OpenSSH 服务器的认证路径，从而在登录之前实现远程代码执行。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[3](https://luj.fr/assets/20251001T000000==public--xz-nixos-paper.pdf)</sup> 它由微软的 [PostgreSQL](https://www.edgepedia.org/zh/postgresql) 开发者安德烈斯·弗罗因德（Andres Freund）于 2024 年 3 月 28 日至 29 日发现，编号为 CVE-2024-3094，CVSS 评分为 10 分（满分 10 分）。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[3](https://luj.fr/assets/20251001T000000==public--xz-nixos-paper.pdf)</sup> 由于该植入程序是通过一场针对资源匮乏的开源项目、持续多年的社会工程行动植入的，而非一次性的代码补丁，卡巴斯基（Kaspersky）评估认为，这起构建过程攻击唯有 [SolarWinds](https://www.edgepedia.org/zh/solarwinds) 事件可与之相比。<sup>[4](https://securelist.com/xz-backdoor-story-part-2-social-engineering/112476/)</sup>

| 关键事实 | 详情 |
|---|---|
| 受影响版本 | xz 5.6.0（2024-02-24 发布）和 5.6.1（2024-03-09 发布）；恶意构建指令仅存在于发行版压缩包中，不在 git 仓库中<sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup><sup> • </sup><sup>[6](https://access.redhat.com/security/cve/cve-2024-3094)</sup> |
| 标识符 | CVE-2024-3094，CVSS 10.0<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup> |
| 目标 | 那些对 OpenSSH 打了补丁、使其链接 libsystemd（而 libsystemd 依赖 liblzma）的发行版上的 x86-64 Linux sshd<sup>[7](https://lwn.net/Articles/967192/)</sup> |
| 效果 | 认证前远程代码执行：载荷替换了 RSA_public_decrypt 函数指针，并执行从用攻击者密钥签名的客户端证书中提取的命令<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup> |
| 发现 | 安德烈斯·弗罗因德在调查 Debian unstable 上一处约 500 毫秒的 ssh 登录延迟回归（约 0.3 至 0.8 秒）时，追踪到了 liblzma<sup>[3](https://luj.fr/assets/20251001T000000==public--xz-nixos-paper.pdf)</sup> |
| 现实世界暴露面 | 非常有限：受污染的版本主要短暂出现在滚动发行版和预发布渠道中，如 Debian sid、Fedora Rawhide、Fedora 40 beta、openSUSE Tumbleweed 和 Kali Linux<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup> |
| 归因 | 除“老练的、持续多年的、国家级别”之外，没有公开归因；没有任何政府点名具体国家<sup>[8](https://safeguard.sh/resources/blog/xz-utils-aftermath-one-year-retrospective)</sup> |

## 背景：xz 及其维护情况

XZ Utils 提供 xz 文件格式和 liblzma 压缩库，后者是 systemd 的依赖项。<sup>[6](https://access.redhat.com/security/cve/cve-2024-3094)</sup> 该项目由拉斯·科林（Lasse Collin）作为无偿爱好维护。<sup>[4](https://securelist.com/xz-backdoor-story-part-2-social-engineering/112476/)</sup><sup> • </sup><sup>[9](https://arxiv.org/html/2404.08987v1)</sup>

化名“Jia Tan”（亦写作“Jia Cheong Tan”，据推测为虚构身份）背后的操作者于 2021 年开始向 XZ Utils 贡献代码；以用户名 JiaT75 提交的第一个可疑提交 可追溯至 2021 年 11 月的 libarchive 项目。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup> 2022 年 4 月，一个名为“Jigar Kumar”的用户就项目发布进度缓慢向科林施压；科林回复称该项目是无偿爱好，并说他已与 Jia Tan 取得联系，后者“未来将发挥更大作用”。第一个完全由 Jia Tan 合并的提交 可追溯至 2022 年 12 月，表明其已被提升为共同维护者。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup> 2023 年 3 月，xz 的 Google OSS-Fuzz 联系人从科林的地址改为 jiat0218@gmail.com，并获科林批准，确认 Jia Tan 为正式共同维护者。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup> 一位使用“Hans Jansen”之名的贡献者后来提供了与 IFUNC 相关的补丁，这些补丁成为后门的函数挂钩机制；Jia Tan 还让 OSS-Fuzz 在模糊测试构建中禁用 IFUNC，从而移除了该项覆盖；“Hans Jansen”账号还向 Debian 等 Linux 发行版施压，要求采纳恶意版本。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup> 科林后来确认，5.6.0 和 5.6.1 压缩包由 Jia Tan 创建并签名，且 Tan 仅能访问 GitHub 托管的资源，无法访问 tukaani.org 基础设施。<sup>[10](https://www.tukaani.org/xz-backdoor/)</sup>

## 后门的技术剖析

**压缩包中的布置。** 恶意构建触发器仅存在于 5.6.0 和 5.6.1 的发行压缩包中。一个经过混淆的脚本被注入，在 configure 阶段结束时运行，从仓库中的“测试”用 .xz 文件中提取数据。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup> 压缩包中包含了额外的 .m4 文件，带有 automake 构建指令，而这些在 git 仓库中并不存在；git 仓库中的版本缺少触发恶意构建的 M4 宏，这就是为什么从 git 构建会生成干净的二进制文件。<sup>[6](https://access.redhat.com/security/cve/cve-2024-3094)</sup><sup> • </sup><sup>[11](https://www.ncsc.gov.ie/pdfs/2403290139_Critical_vulnerability_in_XZ_Utils.pdf)</sup> 2024 年 2 月 23 日，Jia Tan 添加了测试文件 bad-3-corrupt_lzma2.xz 和 good-large_compressed.lzma，其中包含二进制后门和经过混淆的注入代码，并将 build-to-host.m4 加入 .gitignore，使其源码不会被推送到仓库。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup>

**构建期注入。** 从总体上看，攻击分为两部分：一个 shell 脚本和一个目标文件。恶意构建脚本 build-to-host.m4 在库的构建过程中运行，将 bad-3-corrupt_lzma2.xz 解码为一个 bash 脚本，该脚本再解码 good-large_compressed.lzma，并将共享对象 liblzma_la-crc64-fast.o 提取到 liblzma 编译中。<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[12](https://research.swtch.com/xz-script)</sup> 看似无害的文件名提供了合理的推诿空间。<sup>[7](https://lwn.net/Articles/967192/)</sup>

**IFUNC 挂钩。** 载荷利用了 IFUNC（间接函数）机制——该机制允许库在加载时选择实现——来介入动态链接：它将 ifunc 解析器 crc32_resolve() 和 crc64_resolve() 替换为不同的代码。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup> 恶意的 _get_cpuid 函数在早期动态链接期间作为 IFUNC 解析器运行，此时 GOT 和 PLT 尚未被映射为只读，因此它可以重写函数指针。<sup>[12](https://research.swtch.com/xz-script)</sup> 它等待 RSA_public_decrypt@....plt 被解析，并在被调用时将该 PLT 条目改为指向自己的代码。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup>

**为何是 sshd。** OpenSSH 并不直接链接 liblzma，但在若干基于 systemd 的发行版上（包括 Ubuntu、Debian 和 [Red Hat](https://www.edgepedia.org/zh/red-hat)/Fedora），OpenSSH 被打补丁以使用 systemd 特性，而 libsystemd 依赖 liblzma 来压缩日志文件，因此 sshd 的进程携带了恶意库。<sup>[6](https://access.redhat.com/security/cve/cve-2024-3094)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup><sup> • </sup><sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup> 挂钩之所以奏效，是因为 sshd 以 -Wl,-z,now 构建，导致所有符号在启动时即被提前解析；以 LD_BIND_NOT=1 启动 sshd 可禁用后门。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup>

**载荷。** 当客户端出示 RSA 证书时，载荷从其公钥字段中提取一条命令，验证其由攻击者私钥签名，然后以运行 sshd 的用户身份（通常为 root）通过 system() 执行该命令，从而实现认证前远程代码执行。<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup> 后门仅在特定条件下激活：非图形环境、以 root 运行、二进制文件位于 /usr/sbin/sshd、具有预期的 ELF 头，且没有调试器断点。<sup>[7](https://lwn.net/Articles/967192/)</sup> Jia Tan 还做了改动，以破坏 Landlock 安全特性等沙箱措施，并重定向安全报告，使检测和缓解更加困难。<sup>[7](https://lwn.net/Articles/967192/)</sup><sup> • </sup><sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup>

## 发现与披露

弗罗因德最初的线索是 Debian sid 安装环境中围绕 liblzma 的异常症状：ssh 登录消耗大量 CPU 以及 valgrind 报错。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup> 一个可复现的性能异常锚定了调查：在数台 Debian unstable 机器上，ssh 登录延迟上升了约 500 毫秒，从约 0.3 秒增至约 0.8 秒。<sup>[3](https://luj.fr/assets/20251001T000000==public--xz-nixos-paper.pdf)</sup> 卡巴斯基的时间线记录显示，后门于 2024 年 3 月 4 日引发 [Valgrind](https://www.edgepedia.org/zh/valgrind) 问题，漏洞于 3 月 28 日被发现并通知 Debian 和 Red Hat，Red Hat 于 3 月 29 日确认 Fedora Rawhide 和 Fedora 40 beta 已发布含后门的 xz。<sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup> 弗罗因德于 2024 年 3 月 29 日在 oss-security 邮件列表上发布了完整披露。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup> 响应迅速：各发行版在数日内撤下了受影响软件包，漏洞利用被及时捕获，几乎没有用户受到影响。<sup>[7](https://lwn.net/Articles/967192/)</sup>

## 影响与暴露面

该后门仅在特定构建与运行条件下才能影响 x86-64 Linux 系统，包括 Debian 或 RPM 软件包构建，以及带有 systemd 且 sshd 通过 libsystemd 链接到 liblzma 的系统。它不针对 BSD、Android 手机、Wi-Fi 路由器、物联网设备或树莓派。<sup>[13](https://www.redhat.com/en/blog/understanding-red-hats-response-xz-security-incident)</sup>

短暂发布过受污染软件包的发行版包括 Debian sid（testing、unstable 和 experimental，从 5.5.1alpha-0.1 到 5.6.1-1）、Fedora Rawhide、Fedora 40 beta、openSUSE [Tumbleweed](https://www.edgepedia.org/zh/tumbleweed) 和 MicroOS（2024 年 3 月 7 日至 28 日之间）、[Kali Linux](https://www.edgepedia.org/zh/kali-linux)（2024 年 3 月 26 日至 29 日之间），以及 [Arch Linux](https://www.edgepedia.org/zh/arch-linux) 的 5.6.0-1 和 5.6.1-1 软件包。<sup>[7](https://lwn.net/Articles/967192/)</sup><sup> • </sup><sup>[11](https://www.ncsc.gov.ie/pdfs/2403290139_Critical_vulnerability_in_XZ_Utils.pdf)</sup> NixOS unstable 也发布过，但并不受影响，因为它没有对 OpenSSH 打补丁以链接 libsystemd。<sup>[7](https://lwn.net/Articles/967192/)</sup> Ubuntu、Alpine、Amazon Linux、RHEL、Gentoo 和 Linux Mint 未受影响。<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup> Red Hat 认定 RHEL 和 Fedora 稳定分支未受影响；只有 Fedora 40 beta 的每夜构建携带了植入程序，且未发现受影响系统中有进一步篡改的证据。<sup>[13](https://www.redhat.com/en/blog/understanding-red-hats-response-xz-security-incident)</sup>

公开公告之间有两点存在差异。关于 Fedora，爱尔兰国家网络安全中心（NCSC）将 Fedora 41 和 Rawhide 列入受影响产品<sup>[11](https://www.ncsc.gov.ie/pdfs/2403290139_Critical_vulnerability_in_XZ_Utils.pdf)</sup>，而 CERT-EU 和 Red Hat 则将 Fedora 40 beta 和 Rawhide 确定为受影响渠道<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup><sup> • </sup><sup>[13](https://www.redhat.com/en/blog/understanding-red-hats-response-xz-security-incident)</sup>。关于载荷完整性，Elastic 的分析发现恶意代码似乎并未处于其最终目标状态<sup>[14](https://www.elastic.co/security-labs/500ms-to-midnight)</sup>，而 CERT-EU 描述了一条可用的认证前远程代码执行路径<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup>。尚无关于暴露或受损生产系统的绝对计数公布；一致的发现是，暴露集中在预发布和滚动发布渠道。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[7](https://lwn.net/Articles/967192/)</sup>

## 关键数字

- CVSS 评分：CVE-2024-3094 为 10.0 分（满分 10 分）。<sup>[2](https://cert.europa.eu/publications/security-advisories/2024-032/)</sup>
- 2024 年 2 月 15 日：build-to-host.m4 被加入 .gitignore；2 月 23 日：引入恶意测试文件；2 月 24 日：xz 5.6.0 发布；2 月 26 日：一次对 CMakeLists.txt 的提交破坏了 Landlock 安全特性；3 月 9 日：xz 5.6.1 发布，更新了测试文件以修复 Valgrind 问题；3 月 28 日：发现并通知厂商；3 月 29 日：公开披露。<sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup>
- 脆弱窗口：从 5.6.0 发布到披露约五周，在此期间受影响版本主要进入预发布渠道。<sup>[1](https://www.openwall.com/lists/oss-security/2024/03/29/4)</sup><sup> • </sup><sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup>
- 行动持续时间：从 2021 年 11 月第一个可疑提交到 2024 年 3 月披露，约两年半。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup>

## 与其他供应链攻击的比较

卡巴斯基评估认为，XZ 构建过程攻击唯有 SolarWinds 事件可与之相比——在 SolarWinds 事件中，SUNSPOT 植入程序监视 SolarWinds 构建并在构建执行期间插入恶意代码，该事件被归因于 CozyDuke/DarkHalo/APT29/NOBELIUM。<sup>[4](https://securelist.com/xz-backdoor-story-part-2-social-engineering/112476/)</sup> 与先前 Node.js、PyPI、F-Droid 和 [Linux 内核](https://www.edgepedia.org/zh/linux-kernel)中的供应链攻击（大多由原子式恶意补丁、伪造软件包和抢注相似包名构成）不同，XZ 事件是一次多阶段行动，险些攻陷全球 SSH 服务器。<sup>[5](https://securelist.com/xz-backdoor-story-part-1/112354/)</sup> 社会工程使攻击者得以进入开发环境，其技术要求远低于 SolarWinds、M.E.Doc ExPetya 事件或华硕 ShadowHammer。<sup>[4](https://securelist.com/xz-backdoor-story-part-2-social-engineering/112476/)</sup> 一项同行评审的软件工程分析得出结论：攻击者利用的不仅是代码，而是整个开源开发过程，尤其是在关键但资源匮乏的项目中。<sup>[15](https://dl.acm.org/doi/abs/10.1109/MSR66628.2025.00026)</sup> 载荷的老练程度——隐藏在测试归档中的分阶段目标文件、对攻击者密钥的签名校验、环境门控以及反调试条件——使一项学术分析的作者评估认为，威胁行为者属于一个资金稳定的高度老练组织。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup>

## 后续与近期进展

**项目恢复。** 科林的 GitHub 账号于 2024 年 4 月 2 日被暂停后恢复。<sup>[10](https://www.tukaani.org/xz-backdoor/)</sup> 新的干净 XZ Utils 版本以及 XZ Utils 审查笔记 1.0 版于 2024 年 5 月 29 日发布，项目主页也已恢复。<sup>[10](https://www.tukaani.org/xz-backdoor/)</sup> 项目发布了 5.6.2 作为清理步骤，随后转向 5.8.0，使 5.6.x 编号寿命短暂。<sup>[10](https://www.tukaani.org/xz-backdoor/)</sup> 维护工作持续进行：XZ Utils 5.8.4 于 2026 年 9 月 9 日发布，修复了若干 liblzma 解码器函数中内存分配失败后的无效内存访问问题。<sup>[16](https://www.openwall.com/lists/oss-security/2026/09/09/5)</sup>

**归因。** 事件发生一年后，除“老练的、持续多年的、国家级别”之外，各国政府尚未确认任何公开归因。其机制和行动模式指向一个资源充足的行为体，FBI 和 GCHQ 公开承认对此感兴趣，但均未点名具体国家。<sup>[8](https://safeguard.sh/resources/blog/xz-utils-aftermath-one-year-retrospective)</sup>

**治理与工具变革。** 事件后的改进包括：[OpenSSF](https://www.edgepedia.org/zh/openssf) 增加对关键单维护者项目的资助、扩大 Sigstore 签名采用范围、主要 Linux 发行版中更好的 SLSA 来源信息、systemd 着手减少加载到 sshd 进程中的非必要依赖，以及 Alpha-Omega 向维护者付费并资助审计。<sup>[8](https://safeguard.sh/resources/blog/xz-utils-aftermath-one-year-retrospective)</sup> 在技术层面，可复现构建结合透明日志是一种被提议的防御手段：如果某个产物能够从特定版本的源代码可复现地构建出来，验证者便可将从已记录源代码重新构建的哈希与分发的产物进行比对，这本来可以暴露仅存在于压缩包中的植入程序。<sup>[9](https://arxiv.org/html/2404.08987v1)</sup> 若干发行版还转向了不含 Jia Tan 任何提交的 xz 版本。<sup>[7](https://lwn.net/Articles/967192/)</sup>

## References

1. [Andres Freund (2024). backdoor in upstream xz/liblzma leading to ssh server compromise. oss-security.](https://www.openwall.com/lists/oss-security/2024/03/29/4)
2. [CERT-EU Security Advisory 2024-032: Critical Vulnerability in XZ Utils.](https://cert.europa.eu/publications/security-advisories/2024-032/)
3. [How NixOS could have detected the XZ supply-chain attack thanks to reproducible-builds.](https://luj.fr/assets/20251001T000000==public--xz-nixos-paper.pdf)
4. [Social engineering aspect of the XZ incident. Kaspersky Securelist.](https://securelist.com/xz-backdoor-story-part-2-social-engineering/112476/)
5. [Kaspersky analysis of the backdoor in XZ (timeline). Kaspersky Securelist.](https://securelist.com/xz-backdoor-story-part-1/112354/)
6. [CVE-2024-3094. Red Hat Customer Portal.](https://access.redhat.com/security/cve/cve-2024-3094)
7. [How the XZ backdoor works. LWN.net.](https://lwn.net/Articles/967192/)
8. [XZ Utils Backdoor One Year Retrospective: CVE-2024-3094. Safeguard.](https://safeguard.sh/resources/blog/xz-utils-aftermath-one-year-retrospective)
9. [On the critical path to implant backdoors and the effectiveness of potential mitigation techniques: Early learnings from XZ. arXiv.](https://arxiv.org/html/2404.08987v1)
10. [XZ backdoor. tukaani.org official project statement.](https://www.tukaani.org/xz-backdoor/)
11. [NCSC (Ireland) Alert: Critical vulnerability in XZ Utils.](https://www.ncsc.gov.ie/pdfs/2403290139_Critical_vulnerability_in_XZ_Utils.pdf)
12. [The xz attack shell script. research!rsc.](https://research.swtch.com/xz-script)
13. [Understanding Red Hat's response to the XZ security incident. Red Hat.](https://www.redhat.com/en/blog/understanding-red-hats-response-xz-security-incident)
14. [500ms to midnight: XZ A.K.A. liblzma backdoor. Elastic Security Labs.](https://www.elastic.co/security-labs/500ms-to-midnight)
15. [Wolves in the Repository: A Software Engineering Analysis of the XZ Utils Supply Chain Attack. MSR 2025.](https://dl.acm.org/doi/abs/10.1109/MSR66628.2025.00026)
16. [XZ Utils 5.8.4 and a security fix. oss-security.](https://www.openwall.com/lists/oss-security/2026/09/09/5)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Malware and endpoint threats › Named malware specimens

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/xz-utils-backdoor

English original: https://www.edgepedia.org/xz-utils-backdoor
