CVE-2021-33880: Websockets Observable Timing Discrepancy Vulnerability

HIGH
Advisory Identifier: GHSA-8ch4-58qp-g3mp
CVSS 5.9
CWE-203 CWE-208
Published
Advisory Summary

CVE-2021-33880 is a HIGH (CVSS 5.9) observable timing discrepancy vulnerability (CWE-203: Observable Discrepancy) affecting Websockets libraries in the PyPI ecosystem. The issue involves observable timing discrepancy in aaugustin websockets library. Remediation is available by upgrading affected packages to version 9.1.

CVE-2021-33880 at a Glance

CVE Identifier CVE-2021-33880
GHSA Identifier GHSA-8ch4-58qp-g3mp
Severity HIGH
CVSS v3.1 Base Score 5.9
CWE Classification CWE-203: Observable Discrepancy
Affected Product Websockets
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-33880

To remediate this vulnerability, upgrade all affected Websockets dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

websockets fixed: 9.1
pip install websockets>=9.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show websockets

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-33880, inspect your installed packages using pip:

pip show websockets

Analyze the terminal output to locate any version of Websockets in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.1), your application is affected.

Note: The pip show websockets command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Websockets, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The aaugustin websockets library before 9.1 for Python has an Observable Timing Discrepancy on servers when HTTP Basic Authentication is enabled with basic_auth_protocol_factory(credentials=...). An attacker may be able to guess a password via a timing attack.

CVE-2021-33880 Affected Websockets Versions

1 component(s)
Fixed Versions:
9.1
Product / Package Ecosystem Affected Versions Fixed Version
websockets
PyPI
< 9.1
9.1

References

Frequently Asked Questions

What is CVE-2021-33880?
CVE-2021-33880 is a security vulnerability in Websockets involving Observable Timing Discrepancy in aaugustin websockets library under CWE-203: Observable Discrepancy.
Which Websockets versions are affected?
Affected versions include releases prior to 9.1 across affected packages: websockets.
What version fixes CVE-2021-33880?
Upgrading to 9.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is websockets affected?
Yes, websockets is affected in releases prior to 9.1. Upgrade your dependency to 9.1 or later.
What is the CVSS score of CVE-2021-33880?
CVE-2021-33880 has a CVSS v3.1 base score of 5.9 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-33880?
CVE-2021-33880 is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check PyPI dependencies for CVE-2021-33880?
Run the dependency tree command: 'pip show websockets'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8ch4-58qp-g3mp",
  "modified" : "2024-11-19T18:19:55Z",
  "published" : "2021-06-11T17:43:14Z",
  "aliases" : [ "CVE-2021-33880" ],
  "summary" : "Observable Timing Discrepancy in aaugustin websockets library",
  "details" : "The aaugustin websockets library before 9.1 for Python has an Observable Timing Discrepancy on servers when HTTP Basic Authentication is enabled with basic_auth_protocol_factory(credentials=...). An attacker may be able to guess a password via a timing attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "websockets"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-33880"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aaugustin/websockets/commit/547a26b685d08cac0aa64e5e65f7867ac0ea9bc0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aaugustin/websockets"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/websockets/PYSEC-2021-95.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203", "CWE-208" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-10T16:24:45Z",
    "nvd_published_at" : "2021-06-06T15:15:00Z"
  }
}