Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TensorRT Engine File RCE PoC
|
| 2 |
+
|
| 3 |
+
## Vulnerability
|
| 4 |
+
|
| 5 |
+
Arbitrary code execution via embedded native shared libraries (DLL/SO) in TensorRT engine files (.engine/.trt/.plan). The embedded library's constructor (`DllMain`/`__attribute__((constructor))`) executes automatically when the engine is deserialized with `engine_host_code_allowed=True`.
|
| 6 |
+
|
| 7 |
+
## Files
|
| 8 |
+
|
| 9 |
+
| File | Description |
|
| 10 |
+
|---|---|
|
| 11 |
+
| `malicious_model.engine` | Crafted TensorRT engine with embedded malicious DLL |
|
| 12 |
+
| `malicious_plugin.c` | Source code of the malicious plugin |
|
| 13 |
+
| `build_poc.py` | Script to build the malicious engine |
|
| 14 |
+
| `load_poc.py` | Script to load the engine and trigger RCE |
|
| 15 |
+
|
| 16 |
+
## Reproduction
|
| 17 |
+
|
| 18 |
+
### Prerequisites
|
| 19 |
+
- NVIDIA GPU with CUDA drivers
|
| 20 |
+
- TensorRT 8.6+ (`pip install tensorrt`)
|
| 21 |
+
- C compiler (MSVC on Windows, GCC on Linux)
|
| 22 |
+
|
| 23 |
+
### Steps
|
| 24 |
+
|
| 25 |
+
```bash
|
| 26 |
+
# 1. Build the malicious engine (or use the pre-built malicious_model.engine)
|
| 27 |
+
python build_poc.py
|
| 28 |
+
|
| 29 |
+
# 2. Load the engine — triggers arbitrary code execution
|
| 30 |
+
python load_poc.py evidence/malicious_model.engine
|
| 31 |
+
|
| 32 |
+
# 3. Verify code execution
|
| 33 |
+
# Windows: check C:\temp\tensorrt_rce_poc.txt
|
| 34 |
+
# Linux: check /tmp/tensorrt_rce_poc
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### Expected Output
|
| 38 |
+
|
| 39 |
+
```
|
| 40 |
+
[!] TensorRT RCE PoC: Arbitrary code executed via embedded plugin!
|
| 41 |
+
[!] Proof written to tensorrt_rce_poc.txt
|
| 42 |
+
[!] PID: <process_id>
|
| 43 |
+
|
| 44 |
+
[!!!] CODE EXECUTION CONFIRMED: C:\temp\tensorrt_rce_poc.txt
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Tested Environment
|
| 48 |
+
- Windows 10/11, NVIDIA RTX 4080 Super
|
| 49 |
+
- CUDA 13.0, TensorRT 10.15.1.29
|
| 50 |
+
- Python 3.12
|