[issue37093] http.client aborts header parsing upon encountering non-ASCII header names

Tim Burke report at bugs.python.org
Mon Dec 23 15:35:39 EST 2019


Tim Burke <tim.burke at gmail.com> added the comment:

Note that because http.server uses http.client to parse headers [0], this can pose a request-smuggling vector depending on how you've designed your system. For example, you might have a storage system with a user-facing HTTP server that is in charge of

* authenticating and authorizing users,
* determining where data should be stored, and
* proxying the user request to the backend

and a separate (unauthenticated) HTTP server for actually storing that data. If the proxy and backend are running different versions of CPython (say, because you're trying to upgrade an existing py2 cluster to run on py3), they may disagree about where the request begins and ends -- potentially causing the backend to process multiple requests, only the first of which was authorized.

See, for example, https://bugs.launchpad.net/swift/+bug/1840507

For what it's worth, most http server libraries (that I tested; take it with a grain of salt) seem to implement their own header parsing. Eventlet was a notable exception [1].

[0] https://github.com/python/cpython/blob/v3.8.0/Lib/http/server.py#L336-L337
[1] https://github.com/eventlet/eventlet/pull/574

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37093>
_______________________________________


More information about the Python-bugs-list mailing list