Downloads · 30 days
0
ericblackgachara/avro-variant-cwe400-poc
avro-variant-cwe400-poc is a machine learning model from ericblackgachara. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jun 3, 2026
Repo size
309 KB
Likes
0
Public
Click a slice to open those files.
.pdf155 KB · 88%
From the Hugging Face model README
| Field | Value |
|---|---|
| Library | apache/avro (Python) |
| Commit | bd70a0859b9d739aad0547aa61bd17291049773b |
| File | lang/py/avro/io.py |
| Function | BinaryDecoder.read_long() |
| Lines | 241–252 |
| Platform | huntr.com |
| Est. payout | $1,500 |
read_long() decodes varints with no iteration cap. The Avro spec limits longs to 64-bit (max 10 varint bytes), but the library accepts any length. Python big-integer bit-shifts grow proportionally with the integer's bit-width, making the total cost O(N²) in varint bytes consumed.
while (b & 0x80) != 0: # NO iteration limit
b = ord(self.read(1))
n |= (b & 0x7F) << shift # shift grows → n grows → O(N) per step
shift += 7
Crafted .avro file → DataFileReader.__init__() → read_header() → read_meta() → read_long() at metadata map block_count → O(N²) CPU burn before any error.
# Setup (from apache/avro repo root)
python -m venv venv && source venv/bin/activate
pip install -e lang/py
# Run PoC
python poc_avro_cwe400_varint.py
Expected output:
Scaling test (confirms O(N^2) CPU growth):
1,000 varint bytes -> 0.0016s
10,000 varint bytes -> 0.0113s
100,000 varint bytes -> 0.5137s
Demo: 200,000-byte varint in file header (200,005 bytes total)
CPU time before error: 2.03s
Error: InvalidAvroBinaryEncoding: Read 0 bytes, expected 1 bytes
| File size | CPU time |
|---|---|
| 200 KB | 2s (measured) |
| 1 MB | 127s (measured) |
| 10 MB | ~2 hrs (extrapolated) |
| File | Purpose |
|---|---|
poc_avro_cwe400_varint.py | Working PoC |
submission.md | Full technical writeup (markdown) |
report.md | Plain prose — paste into huntr form |
poc-evidence.html | Styled evidence page with terminal output |
README.md | This file |
Add MAX_VARINT_BYTES = 10 and a counter in read_long(). Reject any varint exceeding 10 bytes — the spec guarantees valid input will never need more.