{"id":"PSF-2024-3","details":"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.\n\nIf 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.\n\nThis 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.","aliases":["BIT-python-2024-4030","CVE-2024-4030"],"modified":"2025-10-09T01:08:17.516074Z","published":"2024-05-07T21:02:55.284Z","database_specific":{"cwe_ids":[]},"references":[{"type":"ADVISORY","url":"https://mail.python.org/archives/list/security-announce@python.org/thread/PRGS5OR3N3PNPT4BMV2VAGN5GMUI5636/"},{"type":"REPORT","url":"https://github.com/python/cpython/issues/118486"},{"type":"FIX","url":"https://github.com/python/cpython/commit/81939dad77001556c527485d31a2d0f4a759033e"},{"type":"FIX","url":"https://github.com/python/cpython/commit/8ed546679524140d8282175411fd141fe7df070d"},{"type":"FIX","url":"https://github.com/python/cpython/commit/35c799d79177b962ddace2fa068101465570a29a"},{"type":"FIX","url":"https://github.com/python/cpython/commit/5130731c9e779b97d00a24f54cdce73ce9975dfd"},{"type":"FIX","url":"https://github.com/python/cpython/commit/66f8bb76a15e64a1bb7688b177ed29e26230fdee"},{"type":"FIX","url":"https://github.com/python/cpython/commit/6d0850c4c8188035643586ab4d8ec2468abd699e"},{"type":"FIX","url":"https://github.com/python/cpython/commit/91e3669e01245185569d09e9e6e11641282971ee"},{"type":"FIX","url":"https://github.com/python/cpython/commit/94591dca510c796c7d40e9b4167ea56f2fdf28ca"},{"type":"FIX","url":"https://github.com/python/cpython/commit/c8f868dc52f98011d0f9b459b6487920bfb0ac4d"},{"type":"FIX","url":"https://github.com/python/cpython/commit/d86b49411753bf2c83291e3a14ae43fefded2f84"},{"type":"FIX","url":"https://github.com/python/cpython/commit/e1dfa978b1ad210d551385ad8073ec6154f53763"},{"type":"FIX","url":"https://github.com/python/cpython/commit/eb29e2f5905da93333d1ce78bc98b151e763ff46"},{"type":"WEB","url":"https://security.netapp.com/advisory/ntap-20240705-0005/"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/python/cpython","events":[{"introduced":"0"},{"fixed":"81939dad77001556c527485d31a2d0f4a759033e"},{"fixed":"8ed546679524140d8282175411fd141fe7df070d"},{"fixed":"35c799d79177b962ddace2fa068101465570a29a"},{"fixed":"5130731c9e779b97d00a24f54cdce73ce9975dfd"},{"fixed":"66f8bb76a15e64a1bb7688b177ed29e26230fdee"},{"fixed":"6d0850c4c8188035643586ab4d8ec2468abd699e"},{"fixed":"91e3669e01245185569d09e9e6e11641282971ee"},{"fixed":"94591dca510c796c7d40e9b4167ea56f2fdf28ca"},{"fixed":"c8f868dc52f98011d0f9b459b6487920bfb0ac4d"},{"fixed":"d86b49411753bf2c83291e3a14ae43fefded2f84"},{"fixed":"e1dfa978b1ad210d551385ad8073ec6154f53763"},{"fixed":"eb29e2f5905da93333d1ce78bc98b151e763ff46"}]}],"versions":["2.5","3.2","v0.9.8","v0.9.9","v1.0.1","v1.0.2","v1.1","v1.1.1","v1.2","v1.2b1","v1.2b2","v1.2b3","v1.2b4","v1.3","v1.3b1","v1.4","v1.4b1","v1.4b2","v1.4b3","v1.5","v1.5.1","v1.5.2","v1.5.2a1","v1.5.2a2","v1.5.2b1","v1.5.2b2","v1.5.2c1","v1.5a1","v1.5a2","v1.5a3","v1.5a4","v1.5b1","v1.5b2","v1.6a1","v1.6a2","v2.0","v2.0b1","v2.0b2","v2.0c1","v2.1","v2.1a1","v2.1a2","v2.1b1","v2.1b2","v2.1c1","v2.1c2","v2.2a3","v2.3c1","v2.3c2","v2.4","v2.4a1","v2.4a2","v2.4a3","v2.4b1","v2.4b2","v2.4c1","v2.5","v2.5.1","v2.5.1c1","v2.5.2","v2.5.2c1","v2.5.3","v2.5.3c1","v2.5.4","v2.5.5","v2.5.5c1","v2.5.5c2","v2.5.6","v2.5.6c1","v2.5a0","v2.5a1","v2.5a2","v2.5b1","v2.5b2","v2.5b3","v2.5c1","v2.5c2","v2.6","v2.6.1","v2.6.2","v2.6.2c1","v2.6.3","v2.6.3rc1","v2.6.4","v2.6.4rc1","v2.6.4rc2","v2.6.5","v2.6.5rc1","v2.6.5rc2","v2.6.6","v2.6.6rc1","v2.6.6rc2","v2.6.7","v2.6.8","v2.6.8rc1","v2.6.8rc2","v2.6a1","v2.6a2","v2.6a3","v2.6b1","v2.6b2","v2.6b3","v2.6rc1","v2.6rc2","v2.7","v2.7.1","v2.7.1rc1","v2.7.2","v2.7.2rc1","v2.7.3","v2.7.3rc1","v2.7.3rc2","v2.7.4rc1","v2.7a1","v2.7a2","v2.7a3","v2.7a4","v2.7b1","v2.7b2","v2.7rc1","v2.7rc2","v3.0a1","v3.0a2","v3.0a3","v3.0a4","v3.0a5","v3.0b1","v3.0b2","v3.0b3","v3.0rc1","v3.0rc2","v3.0rc3","v3.1","v3.1.1","v3.1.1rc1","v3.1.2","v3.1.2rc1","v3.1.3","v3.1.3rc1","v3.1.4","v3.1.4rc1","v3.1.5","v3.1.5rc1","v3.1.5rc2","v3.10.0","v3.10.0a1","v3.10.0a2","v3.10.0a3","v3.10.0a4","v3.10.0a5","v3.10.0a6","v3.10.0a7","v3.10.0b1","v3.10.0b2","v3.10.0b3","v3.10.0b4","v3.10.0rc1","v3.10.0rc2","v3.10.1","v3.10.10","v3.10.11","v3.10.12","v3.10.13","v3.10.14","v3.10.2","v3.10.3","v3.10.4","v3.10.5","v3.10.6","v3.10.7","v3.10.8","v3.10.9","v3.11.0","v3.11.0a1","v3.11.0a2","v3.11.0a3","v3.11.0a4","v3.11.0a5","v3.11.0a6","v3.11.0a7","v3.11.0b1","v3.11.0b2","v3.11.0b3","v3.11.0b4","v3.11.0b5","v3.11.0rc1","v3.11.0rc2","v3.11.1","v3.11.2","v3.11.3","v3.11.4","v3.11.5","v3.11.6","v3.11.7","v3.11.8","v3.11.9","v3.12.0","v3.12.0a1","v3.12.0a2","v3.12.0a3","v3.12.0a4","v3.12.0a5","v3.12.0a6","v3.12.0a7","v3.12.0b1","v3.12.0b2","v3.12.0b3","v3.12.0b4","v3.12.0rc1","v3.12.0rc2","v3.12.0rc3","v3.12.1","v3.12.2","v3.12.3","v3.13.0a1","v3.13.0a2","v3.13.0a3","v3.13.0a4","v3.13.0a5","v3.13.0a6","v3.1a1","v3.1a2","v3.1b1","v3.1rc1","v3.1rc2","v3.2","v3.2.1","v3.2.1b1","v3.2.1rc1","v3.2.1rc2","v3.2.2","v3.2.2rc1","v3.2.3","v3.2.3rc1","v3.2.3rc2","v3.2.4","v3.2.4rc1","v3.2.5","v3.2.6","v3.2.6rc1","v3.2a1","v3.2a2","v3.2a3","v3.2a4","v3.2b1","v3.2b2","v3.2rc1","v3.2rc2","v3.2rc3","v3.3.0","v3.3.0a1","v3.3.0a2","v3.3.0a3","v3.3.0a4","v3.3.0b1","v3.3.0b2","v3.3.0rc1","v3.3.0rc2","v3.3.0rc3","v3.3.1","v3.3.1rc1","v3.3.2","v3.3.3","v3.3.3rc1","v3.3.3rc2","v3.3.4","v3.3.4rc1","v3.3.5","v3.3.5rc1","v3.3.5rc2","v3.3.6","v3.3.6rc1","v3.4.0","v3.4.0a1","v3.4.0a2","v3.4.0a3","v3.4.0a4","v3.4.0b1","v3.4.0b2","v3.4.0b3","v3.4.0rc1","v3.4.0rc2","v3.4.0rc3","v3.4.1","v3.4.1rc1","v3.4.2","v3.4.2rc1","v3.4.3","v3.4.3rc1","v3.4.4","v3.4.4rc1","v3.4.5","v3.4.5rc1","v3.4.6","v3.4.6rc1","v3.5.0","v3.5.0a1","v3.5.0a2","v3.5.0a3","v3.5.0a4","v3.5.0b1","v3.5.0b2","v3.5.0b3","v3.5.0b4","v3.5.0rc1","v3.5.0rc2","v3.5.0rc3","v3.5.0rc4","v3.5.1","v3.5.1rc1","v3.5.2","v3.5.2rc1","v3.5.3","v3.5.3rc1","v3.6.0","v3.6.0a1","v3.6.0a2","v3.6.0a3","v3.6.0a4","v3.6.0b1","v3.6.0b2","v3.6.0b3","v3.6.0b4","v3.6.0rc1","v3.6.0rc2","v3.7.0a1","v3.7.0a2","v3.7.0a3","v3.7.0a4","v3.8.0a1","v3.8.0a2","v3.8.0a3","v3.8.0a4","v3.8.0b1","v3.9.0","v3.9.0a1","v3.9.0a2","v3.9.0a3","v3.9.0a4","v3.9.0a5","v3.9.0a6","v3.9.0b1","v3.9.0b2","v3.9.0b3","v3.9.0b4","v3.9.0b5","v3.9.0rc1","v3.9.0rc2","v3.9.1","v3.9.10","v3.9.11","v3.9.12","v3.9.13","v3.9.14","v3.9.15","v3.9.16","v3.9.17","v3.9.18","v3.9.19","v3.9.1rc1","v3.9.2","v3.9.2rc1","v3.9.3","v3.9.4","v3.9.5","v3.9.6","v3.9.7","v3.9.8","v3.9.9"],"database_specific":{"source":"https://github.com/psf/advisory-database/blob/main/advisories/python/PSF-2024-3.json","vanir_signatures":[{"deprecated":false,"digest":{"function_hash":"141725981885825210209145975876735285705","length":728},"id":"PSF-2024-3-0193e0f1","signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/91e3669e01245185569d09e9e6e11641282971ee","target":{"file":"Modules/posixmodule.c","function":"os_mkdir_impl"}},{"target":{"file":"Modules/posixmodule.c","function":"os_mkdir_impl"},"deprecated":false,"digest":{"function_hash":"203361257883980572572155006345752232681","length":932},"id":"PSF-2024-3-06d20414","signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/eb29e2f5905da93333d1ce78bc98b151e763ff46"},{"deprecated":false,"digest":{"line_hashes":["270081176181819706440030591238144421204","259534323621569013316056079494197640910","185327492403438520811619450633964532385","184425032856094676024123993687891377601","141085227263077147406075359740007391402","203501369421001481458072086376717658438","26906527378686371817038590855130935231","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9},"id":"PSF-2024-3-0a7e3e98","signature_type":"Line","signature_version":"v1","source":"https://github.com/python/cpython/commit/35c799d79177b962ddace2fa068101465570a29a","target":{"file":"Modules/posixmodule.c"}},{"deprecated":false,"digest":{"function_hash":"203361257883980572572155006345752232681","length":932},"id":"PSF-2024-3-14838947","signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/c8f868dc52f98011d0f9b459b6487920bfb0ac4d","target":{"file":"Modules/posixmodule.c","function":"os_mkdir_impl"}},{"id":"PSF-2024-3-18a460b1","signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/5130731c9e779b97d00a24f54cdce73ce9975dfd","target":{"file":"Modules/posixmodule.c","function":"os_mkdir_impl"},"deprecated":false,"digest":{"function_hash":"203361257883980572572155006345752232681","length":932}},{"id":"PSF-2024-3-200a4400","signature_type":"Line","signature_version":"v1","source":"https://github.com/python/cpython/commit/eb29e2f5905da93333d1ce78bc98b151e763ff46","target":{"file":"Modules/posixmodule.c"},"deprecated":false,"digest":{"line_hashes":["299662674114992443424585143853448906523","201810807594854939911956226372329047196","325970040706701504688551388730501713909","10098567356171616602959991184129389457","184425032856094676024123993687891377601","141085227263077147406075359740007391402","203501369421001481458072086376717658438","26906527378686371817038590855130935231","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9}},{"signature_version":"v1","source":"https://github.com/python/cpython/commit/91e3669e01245185569d09e9e6e11641282971ee","target":{"file":"Modules/posixmodule.c"},"deprecated":false,"digest":{"line_hashes":["109343152441041424152421007415791443330","107189144668054765186450169693319535513","272700545021657835167856747664739565733","77110071589402676215479669978108444277","126527602439772684885949380377855524891","257776066577225977616674797569698244669","180768876042291103729211429733887581490","184425032856094676024123993687891377601","271077746014091663940888332256282074785","195907005089816996242521021833817814448","81471489156567445035139410090496974092","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9},"id":"PSF-2024-3-50427d11","signature_type":"Line"},{"digest":{"function_hash":"203361257883980572572155006345752232681","length":932},"id":"PSF-2024-3-7081159b","signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/35c799d79177b962ddace2fa068101465570a29a","target":{"file":"Modules/posixmodule.c","function":"os_mkdir_impl"},"deprecated":false},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/python/cpython/commit/81939dad77001556c527485d31a2d0f4a759033e","target":{"function":"os_mkdir_impl","file":"Modules/posixmodule.c"},"deprecated":false,"digest":{"function_hash":"203361257883980572572155006345752232681","length":932},"id":"PSF-2024-3-81191f21"},{"target":{"file":"Modules/posixmodule.c"},"deprecated":false,"digest":{"line_hashes":["95052998454598825806333261047286815524","3366092791983197449404156970503101203","40895719949400102153226188188723186949","327704231819817249349606102660989429271","126527602439772684885949380377855524891","257776066577225977616674797569698244669","180768876042291103729211429733887581490","184425032856094676024123993687891377601","141085227263077147406075359740007391402","203501369421001481458072086376717658438","26906527378686371817038590855130935231","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9},"id":"PSF-2024-3-9d1402d5","signature_type":"Line","signature_version":"v1","source":"https://github.com/python/cpython/commit/c8f868dc52f98011d0f9b459b6487920bfb0ac4d"},{"signature_type":"Line","signature_version":"v1","source":"https://github.com/python/cpython/commit/5130731c9e779b97d00a24f54cdce73ce9975dfd","target":{"file":"Modules/posixmodule.c"},"deprecated":false,"digest":{"line_hashes":["278219574100845183864698531759519971725","444857797250924557157821033796136433","21412334854878206310341383438809282374","327704231819817249349606102660989429271","126527602439772684885949380377855524891","257776066577225977616674797569698244669","180768876042291103729211429733887581490","184425032856094676024123993687891377601","141085227263077147406075359740007391402","203501369421001481458072086376717658438","26906527378686371817038590855130935231","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9},"id":"PSF-2024-3-adf13265"},{"deprecated":false,"digest":{"line_hashes":["299662674114992443424585143853448906523","201810807594854939911956226372329047196","325970040706701504688551388730501713909","10098567356171616602959991184129389457","130625181941702787401458771135906259160","97110087927201153808235647132001287518","92002082695254694645763766392461502415","184425032856094676024123993687891377601","141085227263077147406075359740007391402","203501369421001481458072086376717658438","26906527378686371817038590855130935231","30896591332757826811017754175721672983","210664921021786762987606681945325008810","152037797396078602684476591377360481618","333178396334060819341524629754171304455","315133674876771344326847073116674482657","222335096325397557654645452420207402591","48104583785741173626396591314505935423"],"threshold":0.9},"id":"PSF-2024-3-bd8540e2","signature_type":"Line","signature_version":"v1","source":"https://github.com/python/cpython/commit/81939dad77001556c527485d31a2d0f4a759033e","target":{"file":"Modules/posixmodule.c"}}]}}],"schema_version":"1.7.3"}