Upload folder using huggingface_hub
#1
by ResponsibleReport - opened
- README.md +32 -0
- malicious_projector.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# llama.cpp torch.load() RCE PoC
|
| 2 |
+
|
| 3 |
+
## Vulnerability
|
| 4 |
+
Multiple conversion scripts in llama.cpp use `torch.load()` without `weights_only=True`, allowing arbitrary code execution.
|
| 5 |
+
|
| 6 |
+
## Affected Files
|
| 7 |
+
- `tools/mtmd/legacy-models/glmedge-convert-image-encoder-to-gguf.py`
|
| 8 |
+
- `tools/mtmd/legacy-models/minicpmv-convert-image-encoder-to-gguf.py`
|
| 9 |
+
- `tools/mtmd/legacy-models/convert_image_encoder_to_gguf.py`
|
| 10 |
+
|
| 11 |
+
## PoC
|
| 12 |
+
`malicious_projector.pt` contains a pickle payload that executes `touch /tmp/llama_cpp_rce_poc` when loaded.
|
| 13 |
+
|
| 14 |
+
## Reproduction
|
| 15 |
+
```bash
|
| 16 |
+
git clone https://github.com/ggml-org/llama.cpp
|
| 17 |
+
cd llama.cpp
|
| 18 |
+
|
| 19 |
+
python tools/mtmd/legacy-models/convert_image_encoder_to_gguf.py \
|
| 20 |
+
--llava-projector path/to/malicious_projector.pt \
|
| 21 |
+
--model-dir /tmp
|
| 22 |
+
|
| 23 |
+
ls /tmp/llama_cpp_rce_poc # File created = RCE
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
## Impact
|
| 27 |
+
RCE when users convert untrusted PyTorch models to GGUF format.
|
| 28 |
+
|
| 29 |
+
## Fix
|
| 30 |
+
```python
|
| 31 |
+
projector = torch.load(args.llava_projector, weights_only=True)
|
| 32 |
+
```
|
malicious_projector.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b975ecf92eaf178254d08732422ecf238a9ebf38cbbbcf1edf6a654a30184471
|
| 3 |
+
size 2053
|