This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [CVE-2022-26488] Escalation of privilege via Windows Installer
Type: security Stage: resolved
Components: Windows Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: gregory.p.smith, lukasz.langa, miss-islington, ned.deily, pablogsal, paul.moore, steve.dower, tim.golden, zach.ware
Priority: release blocker Keywords: patch

Created on 2022-03-07 16:33 by steve.dower, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 31726 merged steve.dower, 2022-03-07 16:36
PR 31727 merged steve.dower, 2022-03-07 16:38
PR 31728 merged steve.dower, 2022-03-07 16:40
PR 31729 merged steve.dower, 2022-03-07 16:42
PR 31730 merged steve.dower, 2022-03-07 16:43
PR 31920 merged steve.dower, 2022-03-16 00:18
PR 31922 merged miss-islington, 2022-03-16 00:46
PR 31923 merged miss-islington, 2022-03-16 00:46
PR 31924 merged miss-islington, 2022-03-16 00:47
PR 31925 merged miss-islington, 2022-03-16 00:47
Messages (16)
msg414673 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-07 16:33
CVE-2022-26488 is an escalation of privilege vulnerability in the Windows installer for the following releases of CPython:

* 3.11.0a6 and earlier
* 3.10.2 and earlier
* 3.9.10 and earlier
* 3.8.12 and earlier
* All end-of-life releases of 3.5, 3.6 and 3.7

The vulnerability exists when installed for all users, and when the "Add Python to PATH" option has been selected. A local user without administrative permissions can trigger a repair operation that adds incorrect additional paths to the system PATH variable, and then use search path hijacking to achieve escalation of privilege. Per-user installs (the default) are also affected, but cannot be used for escalation of privilege.

Besides updating, this vulnerability may be mitigated by modifying an existing install to disable the "Add Python to PATH" or "Add Python to environment variables" option. Manually adding the install directory to PATH is not affected.

Thanks to the Lockheed Martin Red Team for detecting and reporting the issue to the Python Security Response Team.
msg414678 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2022-03-07 17:05
The 3.11.0a6 release is ongoing. I assume is ok to not block this release on this issue, given that an alpha is inherently unsafe
msg414679 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-07 17:12
Yeah, this is fine to still be in alpha 6. Very unlikely that anyone is making it a system-wide default anyway, and certainly not in secure/production systems.
msg414681 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-07 17:23
New changeset 136842c91b5783e205e217c4855baa9dadd4ad41 by Steve Dower in branch '3.10':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses the install path during repair (GH-31727)
https://github.com/python/cpython/commit/136842c91b5783e205e217c4855baa9dadd4ad41
msg414682 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-07 17:23
New changeset 77446d2aa56e9e3262d9d2247342bbbb0ff5e907 by Steve Dower in branch 'main':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses the install path during repair (GH-31726)
https://github.com/python/cpython/commit/77446d2aa56e9e3262d9d2247342bbbb0ff5e907
msg414683 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-07 17:23
New changeset 101a1bee1953b82339115c5e648e1717359c78eb by Steve Dower in branch '3.9':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses the install path during repair (GH-31728)
https://github.com/python/cpython/commit/101a1bee1953b82339115c5e648e1717359c78eb
msg414685 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2022-03-07 17:37
New changeset 97476271275a4bd1340230677b7301d7b78b3317 by Steve Dower in branch '3.7':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses the install path during repair (GH-31730)
https://github.com/python/cpython/commit/97476271275a4bd1340230677b7301d7b78b3317
msg414711 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-03-08 01:56
Is there anything on our end we can do to prevent this kind of issue in the future?

Am I wrong to see this as just fixing our package to avoid a design flaw in Windows OS level package management?

Certainly other packages in the world must run into similar problems.
msg414733 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2022-03-08 09:04
New changeset cff1b78c1dfb2a62b1e16fabc5f43bc3634d9de7 by Steve Dower in branch '3.8':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses the install path during repair (GH-31729)
https://github.com/python/cpython/commit/cff1b78c1dfb2a62b1e16fabc5f43bc3634d9de7
msg414752 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-08 13:29
> Is there anything on our end we can do to prevent this kind of issue in the future?

Probably not, I think it's just a lesson learned about the capabilities of the MSI format and its integration with Windows (well, we could hurry up moving everyone to the Windows Store, which doesn't have this issue, but that seems unlikely ;) )

Similar issues have been reported to the Windows Installer team (e.g. CVE-2021-41379, CVE-2021-26415) that could have been fixed by disabling the unelevated repair function, but weren't. So I think it just has to become a known thing for people building MSIs that a "repair" can be run by non-elevated users, and install-time variables may not be preserved for the repair. (In our case, that means actually searching for the existing install rather than trusting the variable our bundle normally provides to the MSI.)
msg415306 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-16 00:07
The fix for this regressed the installer for the py.exe launcher, which breaks our release builds.

I'm patching it now. It's going under the same issue number because it will be needed for anyone applying this patch directly and then building the installer themselves.
msg415309 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-03-16 00:46
New changeset 708812085355c92f32e547d1f1d1f29aefbbc27e by Steve Dower in branch 'main':
bpo-46948: Fix launcher installer build failure due to first part of fix (GH-31920)
https://github.com/python/cpython/commit/708812085355c92f32e547d1f1d1f29aefbbc27e
msg415310 - (view) Author: miss-islington (miss-islington) Date: 2022-03-16 01:13
New changeset 58d30b992d67c8471f79a7307e4c1cda64311e3b by Miss Islington (bot) in branch '3.10':
bpo-46948: Fix launcher installer build failure due to first part of fix (GH-31920)
https://github.com/python/cpython/commit/58d30b992d67c8471f79a7307e4c1cda64311e3b
msg415314 - (view) Author: miss-islington (miss-islington) Date: 2022-03-16 01:30
New changeset 70eb9db39817a8f9abef801a2a4a7bb2c7411654 by Miss Islington (bot) in branch '3.9':
bpo-46948: Fix launcher installer build failure due to first part of fix (GH-31920)
https://github.com/python/cpython/commit/70eb9db39817a8f9abef801a2a4a7bb2c7411654
msg415317 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2022-03-16 02:00
New changeset 4a1d65fe8528c3a6e0cf2f4f9d4b58249164589d by Miss Islington (bot) in branch '3.7':
bpo-46948: Fix launcher installer build failure due to first part of fix (GH-31920) (GH-31925)
https://github.com/python/cpython/commit/4a1d65fe8528c3a6e0cf2f4f9d4b58249164589d
msg415331 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2022-03-16 10:12
New changeset 2b97cfdce8df9d0d455f65a22b1e0d34a29dc200 by Miss Islington (bot) in branch '3.8':
bpo-46948: Fix launcher installer build failure due to first part of fix (GH-31920) (GH-31924)
https://github.com/python/cpython/commit/2b97cfdce8df9d0d455f65a22b1e0d34a29dc200
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91104
2022-03-16 12:23:48steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-03-16 10:12:15lukasz.langasetmessages: + msg415331
2022-03-16 02:00:38ned.deilysetmessages: + msg415317
2022-03-16 01:30:14miss-islingtonsetmessages: + msg415314
2022-03-16 01:13:15miss-islingtonsetmessages: + msg415310
2022-03-16 00:47:07miss-islingtonsetpull_requests: + pull_request30016
2022-03-16 00:47:02miss-islingtonsetpull_requests: + pull_request30015
2022-03-16 00:46:54miss-islingtonsetpull_requests: + pull_request30014
2022-03-16 00:46:49miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request30013
2022-03-16 00:46:37steve.dowersetmessages: + msg415309
2022-03-16 00:18:38steve.dowersetstage: needs patch -> patch review
pull_requests: + pull_request30011
2022-03-16 00:07:13steve.dowersetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg415306

stage: resolved -> needs patch
2022-03-08 13:29:59steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg414752

stage: patch review -> resolved
2022-03-08 09:04:35lukasz.langasetmessages: + msg414733
2022-03-08 01:56:17gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg414711
2022-03-07 17:37:37ned.deilysetmessages: + msg414685
2022-03-07 17:23:35steve.dowersetmessages: + msg414683
2022-03-07 17:23:31steve.dowersetmessages: + msg414682
2022-03-07 17:23:31steve.dowersetmessages: + msg414681
2022-03-07 17:12:50steve.dowersetmessages: + msg414679
2022-03-07 17:05:48pablogsalsetmessages: + msg414678
2022-03-07 16:43:40steve.dowersetpull_requests: + pull_request29847
2022-03-07 16:42:33steve.dowersetpull_requests: + pull_request29846
2022-03-07 16:40:53steve.dowersetpull_requests: + pull_request29845
2022-03-07 16:38:53steve.dowersetpull_requests: + pull_request29844
2022-03-07 16:36:27steve.dowersetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request29843
2022-03-07 16:33:18steve.dowercreate