Cambricon CNRT partial-handle query segfault PoC
This repository contains a Cambricon .mef sample copied from Cambricon's
public Docker image plus a full-size mutated variant.
Observed behavior in CNRT 4.9.1:
- control sample:
cnrtLoadModelFromMem()succeedscnrtQueryModelParallelism()succeeds
- malicious full-size sample with bytes
8..11 = 00 00 00 00:cnrtGetModelSize()returns handled error632011cnrtGetModelLevelFromFile()still succeeds with level6cnrtLoadModelFromMem()returns handled error632007but leaves a non-zeromodel_ptrcnrtQueryModelParallelism()on that returned handle exits139
Files:
control_mlp_mlu270.mef: control sample from the public imagemalicious_headerword_zero_offset8.mef: crafted full-size header mutationprobe_partial_handle.py: minimal metadata, load, and post-load query probereproduce.py: control-vs-malicious host-side reproducer
Public repo:
- Repo:
https://huggingface.co/hacnho/cambricon-cnrt-loadmodelfrommem-partial-handle-query-segfault-poc - Control file:
https://huggingface.co/hacnho/cambricon-cnrt-loadmodelfrommem-partial-handle-query-segfault-poc/resolve/main/control_mlp_mlu270.mef - Malicious file:
https://huggingface.co/hacnho/cambricon-cnrt-loadmodelfrommem-partial-handle-query-segfault-poc/resolve/main/malicious_headerword_zero_offset8.mef - Reproducer:
https://huggingface.co/hacnho/cambricon-cnrt-loadmodelfrommem-partial-handle-query-segfault-poc/resolve/main/reproduce.py - Probe:
https://huggingface.co/hacnho/cambricon-cnrt-loadmodelfrommem-partial-handle-query-segfault-poc/resolve/main/probe_partial_handle.py - Repo state at verification time:
private=false, commitbb7d0a5beca5d5379dfa4b5b9829505ab53f9726
Reproduction:
python3 build_poc.py
python3 reproduce.py
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support