Title: Undocumented risky behaviour in subprocess module · Issue #101283 · python/cpython · GitHub
Open Graph Title: Undocumented risky behaviour in subprocess module · Issue #101283 · python/cpython
X Title: Undocumented risky behaviour in subprocess module · Issue #101283 · python/cpython
Description: Bug report - Undocumented risky behaviour in subprocess module When using subprocess.Popen with shell=True on Windows and without a COMSPEC environment variable, a cmd.exe is launched. The problem is the cmd.exe full path is not written,...
Open Graph Description: Bug report - Undocumented risky behaviour in subprocess module When using subprocess.Popen with shell=True on Windows and without a COMSPEC environment variable, a cmd.exe is launched. The problem ...
X Description: Bug report - Undocumented risky behaviour in subprocess module When using subprocess.Popen with shell=True on Windows and without a COMSPEC environment variable, a cmd.exe is launched. The problem ...
Opengraph URL: https://github.com/python/cpython/issues/101283
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Undocumented risky behaviour in subprocess module","articleBody":"# Bug report - Undocumented risky behaviour in subprocess module\r\n\r\nWhen using `subprocess.Popen` with `shell=True` on Windows and without a `COMSPEC` environment variable, a `cmd.exe` is launched. The problem is the `cmd.exe` full path is not written, Windows will search the executable in the current directory and in the PATH. If an arbitrary executable file is written to the current directory or to a directory in the PATH, it can be run instead of the real cmd.exe.\r\n\r\nSee the code [here](https://github.com/python/cpython/blob/38cc24f119346e2947e316478b58e58f0dde307c/Lib/subprocess.py#L1480) and a POC [here](https://github.com/mauricelambert/PythonSubprocessVulnerabilityPOC).\r\n\r\n - This risky behaviour can be patched by replacing `cmd.exe` string by `C:\\WINDOWS\\system32\\cmd.exe`.\r\n - If the behavior was chosen by python developers, it should be documented.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-101286\n* gh-101708\n* gh-101709\n* gh-101710\n* gh-101711\n* gh-101712\n* gh-101713\n* gh-101719\n* gh-101721\n* gh-101728\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mauricelambert","@type":"Person","name":"mauricelambert"},"datePublished":"2023-01-24T11:19:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/101283/cpython/issues/101283"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4b7fe5bb-3482-0767-86b9-b532807dd496 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E100:20B5CF:84E8C9:BA9E79:6968E565 |
| html-safe-nonce | ac80c546bd7d6e6f49154f2441a2f2446b716b58f1cb5ad7e3649e843dbbb0ef |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTAwOjIwQjVDRjo4NEU4Qzk6QkE5RTc5OjY5NjhFNTY1IiwidmlzaXRvcl9pZCI6IjUzOTUwMzY0NTA5NTQyMDg2MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 862f5de9cb03853b124b0ec7251c28ce8c84a030beda1a620419d787e618fdfe |
| hovercard-subject-tag | issue:1554792320 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/101283/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df058aa3fd29ff72e5479a044012ba03e4faffbe6a268fa8e57d7cbeb030323f/python/cpython/issues/101283 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df058aa3fd29ff72e5479a044012ba03e4faffbe6a268fa8e57d7cbeb030323f/python/cpython/issues/101283 |
| og:image:alt | Bug report - Undocumented risky behaviour in subprocess module When using subprocess.Popen with shell=True on Windows and without a COMSPEC environment variable, a cmd.exe is launched. The problem ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mauricelambert |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5416305695900bdab7d289f90ea3d96bf36397112f2ab16f5a5a120f38de085 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 366035abf3d5b1e31841c97e2fa2ce02a3007a7b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width