Moderate severityNVD Advisory· Published May 20, 2020· Updated Aug 4, 2024
CRLF injection in httplib2
CVE-2020-11078
Description
In httplib2 before version 0.18.0, an attacker controlling unescaped part of uri for httplib2.Http.request() could change request headers and body, send additional hidden requests to same server. This vulnerability impacts software that uses httplib2 with uri constructed by string concatenation, as opposed to proper urllib building with escaping. This has been fixed in 0.18.0.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
httplib2PyPI | < 0.18.0 | 0.18.0 |
Affected products
1- Range: < 0.81.0
Patches
1a1457cc31f32IMPORTANT security vulnerability CWE-93 CRLF injection
4 files changed · +37 −1
python2/httplib2/__init__.py+3 −0 modified@@ -1985,6 +1985,9 @@ def request( headers["user-agent"] = "Python-httplib2/%s (gzip)" % __version__ uri = iri2uri(uri) + # Prevent CWE-75 space injection to manipulate request via part of uri. + # Prevent CWE-93 CRLF injection to modify headers via part of uri. + uri = uri.replace(" ", "%20").replace("\r", "%0D").replace("\n", "%0A") (scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
python3/httplib2/__init__.py+3 −0 modified@@ -1790,6 +1790,9 @@ def request( headers["user-agent"] = "Python-httplib2/%s (gzip)" % __version__ uri = iri2uri(uri) + # Prevent CWE-75 space injection to manipulate request via part of uri. + # Prevent CWE-93 CRLF injection to modify headers via part of uri. + uri = uri.replace(" ", "%20").replace("\r", "%0D").replace("\n", "%0A") (scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
tests/__init__.py+1 −1 modified@@ -75,7 +75,7 @@ def _fill(self, target=1, more=None, untilend=False): chunk = b"" else: chunk = self._sock.recv(8 << 10) - # print('!!! recv', chunk) + # print("!!! recv", chunk) if not chunk: self._end = True if untilend:
tests/test_http.py+30 −0 modified@@ -703,3 +703,33 @@ def test_custom_redirect_codes(): response, content = http.request(uri, "GET") assert response.status == 301 assert response.previous is None + + +def test_cwe93_inject_crlf(): + # https://cwe.mitre.org/data/definitions/93.html + # GET /?q= HTTP/1.1 <- injected "HTTP/1.1" from attacker + # injected: attack + # ignore-http: HTTP/1.1 <- nominal "HTTP/1.1" from library + # Host: localhost:57285 + http = httplib2.Http() + with tests.server_reflect() as uri: + danger_url = urllib.parse.urljoin( + uri, "?q= HTTP/1.1\r\ninjected: attack\r\nignore-http:" + ) + response, content = http.request(danger_url, "GET") + assert response.status == 200 + req = tests.HttpRequest.from_bytes(content) + assert req.headers.get("injected") is None + + +def test_inject_space(): + # Injecting space into request line is precursor to CWE-93 and possibly other injections + http = httplib2.Http() + with tests.server_reflect() as uri: + # "\r\nignore-http:" suffix is nuance for current server implementation + # please only pay attention to space after "?q=" + danger_url = urllib.parse.urljoin(uri, "?q= HTTP/1.1\r\nignore-http:") + response, content = http.request(danger_url, "GET") + assert response.status == 200 + req = tests.HttpRequest.from_bytes(content) + assert req.uri == "/?q=%20HTTP/1.1%0D%0Aignore-http:"
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
22- github.com/advisories/GHSA-gg84-qgv9-w4pqghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IXCX2AWROGWGY5GXR7VN3BKF34A2FO6J/mitrevendor-advisoryx_refsource_FEDORA
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PZJ3D6JSM7CFZESZZKGUW2VX55BOSOXI/mitrevendor-advisoryx_refsource_FEDORA
- nvd.nist.gov/vuln/detail/CVE-2020-11078ghsaADVISORY
- github.com/httplib2/httplib2/commit/a1457cc31f3206cf691d11d2bf34e98865873e9eghsax_refsource_MISCWEB
- github.com/httplib2/httplib2/security/advisories/GHSA-gg84-qgv9-w4pqghsax_refsource_CONFIRMWEB
- github.com/pypa/advisory-database/tree/main/vulns/httplib2/PYSEC-2020-46.yamlghsaWEB
- lists.apache.org/thread.html/r23711190c2e98152cb6f216b95090d5eeb978543bb7e0bad22ce47fc%40%3Cissues.beam.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/r23711190c2e98152cb6f216b95090d5eeb978543bb7e0bad22ce47fc@%3Cissues.beam.apache.org%3EghsaWEB
- lists.apache.org/thread.html/r4d35dac106fab979f0db75a07fc4e320ad848b722103e79667ff99e1%40%3Cissues.beam.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/r4d35dac106fab979f0db75a07fc4e320ad848b722103e79667ff99e1@%3Cissues.beam.apache.org%3EghsaWEB
- lists.apache.org/thread.html/r69a462e690b5f2c3d418a288a2c98ae764d58587bd0b5d6ab141f25f%40%3Cissues.beam.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/r69a462e690b5f2c3d418a288a2c98ae764d58587bd0b5d6ab141f25f@%3Cissues.beam.apache.org%3EghsaWEB
- lists.apache.org/thread.html/r7f364000066748299b331b615ba51c62f55ab5b201ddce9a22d98202%40%3Cissues.beam.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/r7f364000066748299b331b615ba51c62f55ab5b201ddce9a22d98202@%3Cissues.beam.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rad8872fc99f670958c2774e2bf84ee32a3a0562a0c787465cf3dfa23%40%3Cissues.beam.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/rad8872fc99f670958c2774e2bf84ee32a3a0562a0c787465cf3dfa23@%3Cissues.beam.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rc9eff9572946142b657c900fe63ea4bbd3535911e8d4ce4d08fe4b89%40%3Ccommits.allura.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/rc9eff9572946142b657c900fe63ea4bbd3535911e8d4ce4d08fe4b89@%3Ccommits.allura.apache.org%3EghsaWEB
- lists.debian.org/debian-lts-announce/2020/06/msg00000.htmlghsamailing-listx_refsource_MLISTWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/IXCX2AWROGWGY5GXR7VN3BKF34A2FO6JghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PZJ3D6JSM7CFZESZZKGUW2VX55BOSOXIghsaWEB
News mentions
0No linked articles in our index yet.