Skip to content
Heist/ feed
Back to feed
High

Memory allocation based on untrusted length in rust-websocket

Type: advisorySources: OSV

Rust-WebSocket is a WebSocket (RFC6455) library written in Rust. In versions prior to 0.26.5 untrusted websocket connections can cause an out-of-memory (OOM) process abort in a client or a server. The root cause of the issue is during dataframe parsing. Affected versions would allocate a buffer based on the declared dataframe size, which may come from an untrusted source. When `Vec::with_capacity` fails to allocate, the default Rust allocator will abort the current process, killing all threads. This affects only sync (non-Tokio) implementation. Async version also does not limit memory, but does not use `with_capacity`, so DoS can happen only when bytes for oversized dataframe or message actually got delivered by the attacker. The crashes are fixed in version 0.26.5 by imposing default dataframe size limits. Affected users are advised to update to this version. Users unable to upgrade are advised to filter websocket traffic externally or to only accept trusted traffic.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-35922
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 19:15 UTC · Revision 1

Source evidence

Memory allocation based on untrusted length in rust-websocket

core-osv · Original source

Published 1 Aug 2022, 21:35 UTC

Rust-WebSocket is a WebSocket (RFC6455) library written in Rust. In versions prior to 0.26.5 untrusted websocket connections can cause an out-of-memory (OOM) process abort in a client or a server. The root cause of the issue is during dataframe parsing. Affected versions would allocate a buffer based on the declared dataframe size, which may come from an untrusted source. When `Vec::with_capacity` fails to allocate, the default Rust allocator will abort the current process, killing all threads. This affects only sync (non-Tokio) implementation. Async version also does not limit memory, but does not use `with_capacity`, so DoS can happen only when bytes for oversized dataframe or message actually got delivered by the attacker. The crashes are fixed in version 0.26.5 by imposing default dataframe size limits. Affected users are advised to update to this version. Users unable to upgrade are advised to filter websocket traffic externally or to only accept trusted traffic.

osv:CVE-2022-35922
Complete source record
{
  "id": "3cc2a788a1926fa33c6f4544824c0299db35f31d4da5cb1a2e2b603152d514aa",
  "url": "https://osv.dev/vulnerability/CVE-2022-35922",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Memory allocation based on untrusted length in rust-websocket",
    "summary": "Rust-WebSocket is a WebSocket (RFC6455) library written in Rust. In versions prior to 0.26.5 untrusted websocket connections can cause an out-of-memory (OOM) process abort in a client or a server. The root cause of the issue is during dataframe parsing. Affected versions would allocate a buffer based on the declared dataframe size, which may come from an untrusted source. When `Vec::with_capacity` fails to allocate, the default Rust allocator will abort the current process, killing all threads. This affects only sync (non-Tokio) implementation. Async version also does not limit memory, but does not use `with_capacity`, so DoS can happen only when bytes for oversized dataframe or message actually got delivered by the attacker. The crashes are fixed in version 0.26.5 by imposing default dataframe size limits. Affected users are advised to update to this version. Users unable to upgrade are advised to filter websocket traffic externally or to only accept trusted traffic.",
    "evidence": "osv:CVE-2022-35922",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2022-35922",
      "aliases": [
        "CVE-2022-35922",
        "GHSA-qrjv-rf5q-qpxc",
        "RUSTSEC-2022-0035"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/websockets-rs/rust-websocket",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "74c82be3de282e1c4c35c51daac1a84b583ce8ea"
                },
                {
                  "fixed": "cbf6e9983e839d2ecad86de8cd1b3f20ed43390b"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:rust-websocket_project:rust-websocket:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.26.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "cbf6e9983e839d2ecad86de8cd1b3f20ed43390b"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.26.4",
            "v0.26.3",
            "v0.26.2",
            "v0.26.1",
            "v0.24.0",
            "v0.22.3",
            "v0.22.2",
            "v0.22.0",
            "v0.21.1",
            "v0.21.0",
            "v0.20.4",
            "v0.20.3",
            "v0.20.2",
            "v0.20.1",
            "v0.20.0",
            "v0.19.2",
            "v0.19.1",
            "v0.19.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-35922.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:38.581861206Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35922.json",
        "https://github.com/websockets-rs/rust-websocket/security/advisories/GHSA-qrjv-rf5q-qpxc",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4V2EOOU5OLEHVMKAH6BALQXKDKIZRXCI/",
        "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HYPNCM4H4OFBIZI6XMJ2DUTS54FT2TWP/",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-35922",
        "https://github.com/websockets-rs/rust-websocket/commit/cbf6e9983e839d2ecad86de8cd1b3f20ed43390b"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-400"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35922.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-35922",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 506063,
  "published_at": "2022-08-01T21:35:11+00:00"
}