漏洞总结 漏洞概述 该漏洞(编号 CVE-2024-32288)存在于 Go 语言标准库的 包中。在解析旧 GNU 稀疏格式(old GNU sparse format)的 tar 文件时,程序未对稀疏映射(sparse maps)的最大大小设置限制。攻击者可以利用此漏洞构造包含极大稀疏映射的恶意 tar 文件,导致服务器资源(如内存或 CPU)耗尽,从而引发拒绝服务(DoS)攻击。 影响范围 组件: Go 标准库 包。 涉及文件: 和 。 修复方案 1. 限制稀疏映射大小: 基于用于编码映射的扩展块(extension blocks)的累积大小,设置稀疏映射的最大限制。这与限制其他格式稀疏映射大小的方式保持一致。 2. 限制条目总数: 对所有稀疏格式添加额外的限制,限制稀疏文件条目的总数,无论其编码方式如何。 代码/POC 截图中未包含具体的 POC 代码或利用代码,仅展示了修复逻辑的描述。核心修复逻辑如下: > "We did not set a limit on the maximum size of sparse maps in the old GNU sparse format. Set a limit based on the cumulative size of the extension blocks used to encode the map (consistent with how we limit the sparse map size for other formats). Add an additional limit to the total number of sparse file entries, regardless of encoding, to all sparse formats."