CVE-2022-31015: Waitress Uncaught Exception (due To A Vulnerability

HIGH
Advisory Identifier: GHSA-f5x9-8jwc-25rw
CVSS 6.5
CWE-362 CWE-248
Published
Advisory Summary

CVE-2022-31015 is a HIGH (CVSS 6.5) uncaught exception (due to a vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Waitress libraries in the PyPI ecosystem. The issue involves uncaught exception (due to a data race) leads to process termination in waitress. Remediation is available by upgrading affected packages to version 2.1.2.

CVE-2022-31015 at a Glance

CVE Identifier CVE-2022-31015
GHSA Identifier GHSA-f5x9-8jwc-25rw
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Waitress
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

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

How to Fix CVE-2022-31015

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

waitress fixed: 2.1.2
pip install waitress>=2.1.2
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 waitress

How to Check if You Are Affected

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

pip show waitress

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Waitress, 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

### Impact Waitress may terminate early due to a thread closing a socket while the main thread is about to call select(). This will lead to the main thread raising an exception that is not handled and then causing the entire application to be killed. ### Patches This issue has been fixed in Waitress 2.1.2 by no longer allowing the WSGI thread to close the socket, instead it is always delegated to the main thread. ### Workarounds There is no work-around, however users using waitress behind a reverse proxy server are less likely to have issues if the reverse proxy always reads the full response. ### For more information If you have any questions or comments about this advisory: * Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related) * email the Pylons Security mailing list: [pylons-project-security@googlegroups.com](mailto:pylons-project-security@googlegroups.com) (if security related)

CVE-2022-31015 Affected Waitress Versions

1 component(s)
Fixed Versions:
2.1.2
Product / Package Ecosystem Affected Versions Fixed Version
waitress
PyPI
≥ 2.1.0
< 2.1.2
2.1.2

References

Frequently Asked Questions

What is CVE-2022-31015?
CVE-2022-31015 is a security vulnerability in Waitress involving Uncaught Exception (due to a data race) leads to process termination in Waitress under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Waitress versions are affected?
Affected versions include releases prior to 2.1.2 across affected packages: waitress.
What version fixes CVE-2022-31015?
Upgrading to 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is waitress affected?
Yes, waitress is affected in releases prior to 2.1.2. Upgrade your dependency to 2.1.2 or later.
What is the CVSS score of CVE-2022-31015?
CVE-2022-31015 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-31015?
CVE-2022-31015 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check PyPI dependencies for CVE-2022-31015?
Run the dependency tree command: 'pip show waitress'. 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-f5x9-8jwc-25rw",
  "modified" : "2024-11-19T16:18:32Z",
  "published" : "2022-06-02T20:37:48Z",
  "aliases" : [ "CVE-2022-31015" ],
  "summary" : "Uncaught Exception (due to a data race) leads to process termination in Waitress",
  "details" : "### Impact\n\nWaitress may terminate early due to a thread closing a socket while the main thread is about to call select(). This will lead to the main thread raising an exception that is not handled and then causing the entire application to be killed.\n\n### Patches\n\nThis issue has been fixed in Waitress 2.1.2 by no longer allowing the WSGI thread to close the socket, instead it is always delegated to the main thread.\n\n### Workarounds\n\nThere is no work-around, however users using waitress behind a reverse proxy server are less likely to have issues if the reverse proxy always reads the full response.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related)\n* email the Pylons Security mailing list: [pylons-project-security@googlegroups.com](mailto:pylons-project-security@googlegroups.com) (if security related)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "waitress"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/security/advisories/GHSA-f5x9-8jwc-25rw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31015"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/issues/374"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/pull/377"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/commit/4f6789b035610e0552738cdc4b35ca809a592d48"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Pylons/waitress"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/waitress/PYSEC-2022-205.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248", "CWE-362" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-02T20:37:48Z",
    "nvd_published_at" : "2022-05-31T23:15:00Z"
  }
}