-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
gh-142533: Document CRLF injection vulnerability in http.server and wsgiref modules #143395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
b1edcf8
39c5198
2751d9b
d88da64
57ff6a9
0be4e58
3f8dd05
eb4fbfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,6 +287,10 @@ instantiation, of which this module provides three different variants: | |
| specifying its value. Note that, after the send_header calls are done, | ||
| :meth:`end_headers` MUST BE called in order to complete the operation. | ||
|
|
||
| This method does not reject input containing CRLF sequences allowing the | ||
| possibility of CRLF injection, where a single method call can inject | ||
| multiple arbitrary headers. | ||
|
|
||
| .. versionchanged:: 3.2 | ||
| Headers are stored in an internal buffer. | ||
|
|
||
|
|
@@ -555,6 +559,10 @@ Security considerations | |
| requests, this makes it possible for files outside of the specified directory | ||
| to be served. | ||
|
|
||
| The :meth:`BaseHTTPRequestHandler.send_header` method assumes sanitized input | ||
|
||
| and does not perform input validation such as checking for the presence of CRLF | ||
| sequences. Untrusted input may result in CRLF injection attacks. | ||
tadejmagajna marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Earlier versions of Python did not scrub control characters from the | ||
| log messages emitted to stderr from ``python -m http.server`` or the | ||
| default :class:`BaseHTTPRequestHandler` ``.log_message`` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,6 +263,9 @@ manipulation of WSGI response headers using a mapping-like interface. | |
|
|
||
| Content-Disposition: attachment; filename="bud.gif" | ||
|
|
||
| This method does not reject input containing CRLF sequences allowing the | ||
| possibility of CRLF injection, where a single method call can inject | ||
| multiple arbitrary headers. | ||
|
||
|
|
||
| .. versionchanged:: 3.5 | ||
| *headers* parameter is optional. | ||
|
|
@@ -896,4 +899,10 @@ directory and port number (default: 8000) on the command line:: | |
| print("Shutting down.") | ||
| httpd.server_close() | ||
|
|
||
| Security considerations | ||
| ----------------------- | ||
|
||
|
|
||
| The :class:`wsgiref.headers.Headers` class assumes sanitized input for header | ||
| names and values and does not perform input validation such as checking for the | ||
| presence of CRLF sequences. Untrusted input may result in CRLF injection | ||
| attacks. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only mention the possibility of CRLF injection in the security consideration section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion. Addressed for both modules