-
Notifications
You must be signed in to change notification settings - Fork 239
[#31] parser_sandbox retains PYTHONPATH/HOME (sandbox escape vector) #1804
Copy link
Copy link
Open
Labels
area:backendBackend API, database, or service workBackend API, database, or service worklevel:advanced55 pts difficulty label for advanced contributor PRs55 pts difficulty label for advanced contributor PRspriority:highHigh-priority issueHigh-priority issuetype:bugBug fix work category bonus labelBug fix work category bonus labeltype:securitySecurity work category bonus labelSecurity work category bonus label
Description
Activity
Metadata
Metadata
Assignees
Labels
area:backendBackend API, database, or service workBackend API, database, or service worklevel:advanced55 pts difficulty label for advanced contributor PRs55 pts difficulty label for advanced contributor PRspriority:highHigh-priority issueHigh-priority issuetype:bugBug fix work category bonus labelBug fix work category bonus labeltype:securitySecurity work category bonus labelSecurity work category bonus label
parser_sandbox.py:109 _sanitised_env keeps PATH, PYTHONPATH, HOME, TMPDIR, etc. An inherited PYTHONPATH pointing at an attacker-controlled directory lets the 'sandboxed' parser import arbitrary modules. No privilege drop.
Fix: drop PYTHONPATH (or reset to a fixed safe value) and run the parser child as an unprivileged user.