Environment variables injection in subprocess on Windows¶
Warning
This resource is maintained for historical reference and does not contain the latest vulnerability info for Python.
The canonical database for vulnerabilities affecting Python is available on GitHub in the Open Source Vulnerability (OSV) format. This database can be viewed online at the Open Source Vulnerability Database.
On Windows, prevent passing invalid environment variables and command arguments to subprocess.Popen.
It is possible to inject an environment variable in subprocess on Windows if a user data is passed to a subprocess via environment variable.
Check for invalid environment (variable names containing ‘=’) and command arguments (containing ‘0’).
Dates:
- Disclosure date: 2017-06-22 (Python issue bpo-30730 reported)
Fixed In¶
- Python 2.7.14 (2017-09-16) fixed by commit 9dda2ca (branch 2.7) (2017-06-24)
- Python 3.3.7 (2017-09-19) fixed by commit e46f1c1 (branch 3.3) (2017-07-19)
- Python 3.4.7 (2017-08-09) fixed by commit fe82c46 (branch 3.4) (2017-07-11)
- Python 3.5.4 (2017-08-07) fixed by commit a7c0264 (branch 3.5) (2017-06-23)
- Python 3.6.2 (2017-07-08) fixed by commit a9b16cf (branch 3.6) (2017-06-23)
- Python 3.7.0 (2018-06-27) fixed by commit d174d24 (branch 3.7) (2017-06-23)
Python issue¶
[security] Injecting environment variable in subprocess on Windows.
- Python issue: bpo-30730
- Creation date: 2017-06-22
- Reporter: Serhiy Storchaka
Timeline¶
Timeline using the disclosure date 2017-06-22 as reference:
- 2017-06-22: Python issue bpo-30730 reported by Serhiy Storchaka
- 2017-06-23 (+1 days): commit a7c0264 (branch 3.5)
- 2017-06-23 (+1 days): commit a9b16cf (branch 3.6)
- 2017-06-23 (+1 days): commit d174d24 (branch 3.7)
- 2017-06-24 (+2 days): commit 9dda2ca (branch 2.7)
- 2017-07-08 (+16 days): Python 3.6.2 released
- 2017-07-11 (+19 days): commit fe82c46 (branch 3.4)
- 2017-07-19 (+27 days): commit e46f1c1 (branch 3.3)
- 2017-08-07 (+46 days): Python 3.5.4 released
- 2017-08-09 (+48 days): Python 3.4.7 released
- 2017-09-16 (+86 days): Python 2.7.14 released
- 2017-09-19 (+89 days): Python 3.3.7 released
- 2018-06-27: Python 3.7.0 released