Dangerous chain: exec() wrapping compile
Critical
- Category
- Dangerous Code Execution
- Content
return selftest() if not (a.data and a.predict and a.instance): print("用法: attributor.py --data d.json --predict p.py --instance i.json [--label label]"); sys.exit(2) ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns) predict = ns["predict"] rows = json.load(open(a.data, encoding="utf-8")) inst = json.load(open(a.instance, encoding="utf-8"))- Confidence
- 99% confidence
- Finding
- The script reads a user-supplied Python file from --predict and executes it with exec(compile(...)). This gives arbitrary code execution with the privileges of the process, not merely evaluation of a prediction function, so a crafted model file can run OS commands, exfiltrate data, or alter the environment.
