Repository navigation
OOM a potential denial of service in the CGI server on Windows #119452
Copy link
Copy link
Closed
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-IOtype-securityA security issueA security issue
Description
When http.server.CGIHTTPRequestHandler on Windows (and other platforms without fork()) handles the POST request, it reads the whole body of the POST request in memory before sending it to the subprocess running the script. The underlying SocketIO allocates the amount of memory specified in the Content-Length header before actual reading the data, so a small request with incorrect Content-Length can cause consumption of the large amount of memory and CPU time and can be used in the DOS attack on the server.
Linked PRs
- [3.14] gh-119452: Fix a potential virtual memory allocation denial of service in http.server #119455
- [3.13] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455) #142130
- [3.12] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455) #142131
- [3.11] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455) #142132
- [3.10] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455) #142133
- [3.14] gh-119452: Block until data is read #142176
- [3.14] gh-119452: Remove select, skip 'truncated' test #142178
- [3.14] Try to fix the fix for gh-119452 #142180
- [3.14] gh-119452: Read/write CGI data using worker threads #142181
- [3.14] Revert "gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455)" #142184
- [3.13] Revert "gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-119455) (GH-142130)" #142185
- [3.14] gh-119452: Fix a potential virtual memory allocation denial of service in http.server #142216
- [3.13] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-142216) #142296
- [3.12] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-142216) #142297
- [3.11] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-142216) #142298
- [3.10] gh-119452: Fix a potential virtual memory allocation denial of service in http.server (GH-142216) #142299
- [3.14] gh-119452: test_large_content_length_truncated: Don't use the full LOOPBACK_TIMEOUT on Windows #156761
- [3.13] gh-119452: test_large_content_length_truncated: Don't use the full LOOPBACK_TIMEOUT on Windows (GH-156761) #156851
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-IOtype-securityA security issueA security issue
Projects
- StatusShow more project fieldsDone
Activity
picnixz commentedon Oct 26, 2025
Yes we need because those versions are still supported from a security perspective. So only 3.9-3.14 fixes.
[-]OOM vulnerability in the CGI server on Windows[/-][+]OOM a potential denial of service in the CGI server on Windows[/+]pythongh-119452: Fix OOM vulnerability in http.server
[3.14] gh-119452: Fix a potential virtual memory allocation denial of…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.13] gh-119452: Fix a potential virtual memory allocation denial of…
gpshead commentedon Dec 2, 2025
@colesbury flagged a buildbot failure - #119455 (comment)
looks like the select is non-blocking rather than blocking when we still needed more data. https://github.com/python/cpython/pull/119455/files#r2580013415
pythongh-119452: Remove select and 'truncated' test
pythongh-119452: Remove select, skip 'truncated' test
pythongh-119452: Remove select, skip 'truncated' test
[3.14] Try to fix the fix for pythongh-119452
Revert "[3.14] pythongh-119452: Fix a potential virtual memory alloca…
Revert "[3.13] pythongh-119452: Fix a potential virtual memory alloca…
[3.13] Revert "gh-119452: Fix a potential virtual memory allocation d…
[3.14] Revert "gh-119452: Fix a potential virtual memory allocation d…
pythongh-119452: Fix OOM vulnerability in http.server
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] gh-119452: Fix a potential virtual memory allocation denial of…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.14] pythongh-119452: Fix a potential virtual memory allocation den…
[3.13] gh-119452: Fix a potential virtual memory allocation denial of…
[3.12] gh-119452: Fix a potential virtual memory allocation denial of…
[3.10] gh-119452: Fix a potential virtual memory allocation denial of…
[3.11] gh-119452: Fix a potential virtual memory allocation denial of…
encukou commentedon Jan 26, 2026
All the backports are merged now.
vstinner commentedon May 13, 2026
The test is a little bit fragile. Example of failure on "AMD64 FreeBSD Refleaks 3.13" buildbot: https://buildbot.python.org/#/builders/1615/builds/1722
One explanation is the hardcoded timeout of 1 ms in the test:
This timeout is too low if the machine running the test has high system load.
For example,
./python -m test test_httpservers -v -m test_large_content_length_truncated -F -j10fails quickly.[3.14] gh-119452: test_large_content_length_truncated: Don't use the …
[3.13] gh-119452: test_large_content_length_truncated: Don't use the …