Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- security
|
| 5 |
+
- proof-of-concept
|
| 6 |
+
- avro
|
| 7 |
+
- denial-of-service
|
| 8 |
+
- model-format-vulnerability
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Avro huge declared metadata length memory DoS PoC
|
| 12 |
+
|
| 13 |
+
Benign security PoC for a Model Format Vulnerability report.
|
| 14 |
+
|
| 15 |
+
The malicious Avro object-container file is 158 bytes. It is generated from a valid control Avro file, then the encoded byte length of the `avro.schema` metadata value is changed to `2147483647`.
|
| 16 |
+
|
| 17 |
+
When loaded, both latest Python Avro readers tested allocate/read based on the attacker-controlled declared length before validating that the tiny file contains that many bytes:
|
| 18 |
+
|
| 19 |
+
- `fastavro==1.12.2`
|
| 20 |
+
- `avro==1.12.1`
|
| 21 |
+
|
| 22 |
+
The reproducer runs each loader in a child process with a 512 MB address-space limit so the host is not exhausted.
|
| 23 |
+
|
| 24 |
+
## Files
|
| 25 |
+
|
| 26 |
+
- `control.avro` - valid 155-byte Avro object-container file.
|
| 27 |
+
- `malicious-huge-avro-schema-length.avro` - 158-byte mutated file.
|
| 28 |
+
- `reproduce.py` - self-contained generator and loader reproducer.
|
| 29 |
+
- `reproduce-result.json` - local run output.
|
| 30 |
+
- `picklescan-malicious.txt` - picklescan output.
|
| 31 |
+
- `modelscan-malicious.txt` - modelscan output.
|
| 32 |
+
- `SHA256SUMS.txt` - artifact hashes.
|
| 33 |
+
|
| 34 |
+
## Reproduce
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
python3 -m venv /tmp/avro-mfvpoc
|
| 38 |
+
/tmp/avro-mfvpoc/bin/python -m pip install --upgrade pip fastavro==1.12.2 avro==1.12.1
|
| 39 |
+
/tmp/avro-mfvpoc/bin/python reproduce.py
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Expected result:
|
| 43 |
+
|
| 44 |
+
```text
|
| 45 |
+
control.avro + fastavro: loads successfully
|
| 46 |
+
control.avro + apache-avro: loads successfully
|
| 47 |
+
malicious-huge-avro-schema-length.avro + fastavro: MemoryError
|
| 48 |
+
malicious-huge-avro-schema-length.avro + apache-avro: MemoryError
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
The PoC does not execute code and does not write outside its temporary working directory.
|