Skip to content
OpenAdvisories
High · 7.1 CVE-2024-4030 EUVD-2024-32595GHSA-2w87-6hh6-mqrj

tempfile.mkdtemp() may be readable and writeable by all users on Windows

Published May 7, 2024 · Updated Sep 7, 2024 · Assigned by PSF

Description

On Windows a directory returned by tempfile.mkdtemp() would not always have permissions set to restrict reading and writing to the temporary directory by other users, instead usually inheriting the correct permissions from the default location. Alternate configurations or users without a profile directory may not have the intended permissions.

If you’re not using Windows or haven’t changed the temporary directory location then you aren’t affected by this vulnerability. On other platforms the returned directory is consistently readable and writable only by the current user.

This issue was caused by Python not supporting Unix permissions on Windows. The fix adds support for Unix “700” for the mkdir function on Windows which is used by mkdtemp() to ensure the newly created directory has the proper permissions.

Affected products

VendorProductAffectedFixed
Python Software Foundation CPython < 3.8.20, 3.9.0 – < 3.9.20, 3.10.0 – < 3.10.15, 3.11.0 – < 3.11.10, 3.12.0 – < 3.12.4, 3.13.0a1 – < 3.13.0b1 3.8.20

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
SLES 3 python312 +1 3.12.4-150600.3.3.1 SUSE-SU-2024:2572-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLE Micro 6.1 python311 +1 3.11.12-slfo.1.1_1.1 SUSE-SU-2025:20374-1
SLE Micro 6.0 python311 +1 3.11.11-1.1 SUSE-SU-2025:20154-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python310 3.10.15-1.1 openSUSE-SU-2024:14345-1
openSUSE Tumbleweed python311 3.11.9-7.1 openSUSE-SU-2024:14346-1
openSUSE Tumbleweed python312 3.12.5-1.1 openSUSE-SU-2024:14295-1
openSUSE Tumbleweed python313 3.13.0~b3-1.1 openSUSE-SU-2024:14109-1
openSUSE Tumbleweed python314 3.14.0~a1-1.1 openSUSE-SU-2024:14434-1
openSUSE Tumbleweed python315 3.15.0~a1-1.1 openSUSE-SU-2025:15713-1
openSUSE Tumbleweed python38 3.8.20-1.1 openSUSE-SU-2024:14340-1
openSUSE Tumbleweed python39 3.9.20-1.1 openSUSE-SU-2024:14331-1
openSUSE Leap 15.6 python312 +2 3.12.4-150600.3.3.1 SUSE-SU-2024:2572-1

Advisories 15

References