Description
Frappe Framework ERPNext 13.4.0 contains a sandbox escape vulnerability in RestrictedPython that allows authenticated users with System Manager role to execute arbitrary code by exploiting frame introspection. Attackers can create a server script via the /app/server-script endpoint and access the gi_frame attribute to traverse the call stack and invoke os.popen to execute system commands.
Problem types
Improper Control of Generation of Code ('Code Injection')
Product status
Credits
Sander Ferdinand
References
www.exploit-db.com/exploits/51580 (ExploitDB-51580)
erpnext.org (Official Product Homepage)
github.com/frappe/frappe/ (Product Reference)
ur4ndom.dev/posts/2023-07-02-uiuctf-rattler-read/ (Reference)
gist.github.com/lebr0nli/c2fc617390451f0e5a4c31c87d8720b6 (Source Code Repository)
frappeframework.com/.../user/en/desk/scripting/server-script (Reference)
github.com/.../frappe/blob/v13.4.0/frappe/utils/safe_exec.py (Source Code Repository)
www.vulncheck.com/...framework-erpnext-remote-code-execution (VulnCheck Advisory: Frappe Framework ERPNext 13.4.0 Remote Code Execution)