Skip to content
Heist/ feed
Back to feed
Medium

CRLF Injection in Nodejs ‘undici’ via Content-Type

Type: advisorySources: OSV

undici is an HTTP/1.1 client, written from scratch for Node.js.`=< undici@5.8.0` users are vulnerable to _CRLF Injection_ on headers when using unsanitized input as request headers, more specifically, inside the `content-type` header. Example: ``` import { request } from 'undici' const unsanitizedContentTypeInput = 'application/json\r\n\r\nGET /foo2 HTTP/1.1' await request('http://localhost:3000, { method: 'GET', headers: { 'content-type': unsanitizedContentTypeInput }, }) ``` The above snippet will perform two requests in a single `request` API call: 1) `http://localhost:3000/` 2) `http://localhost:3000/foo2` This issue was patched in Undici v5.8.1. Sanitize input when sending content-type headers using user input as a workaround.

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

Source evidence

CRLF Injection in Nodejs ‘undici’ via Content-Type

core-osv · Original source

Published 13 Aug 2022, 00:00 UTC

undici is an HTTP/1.1 client, written from scratch for Node.js.`=< undici@5.8.0` users are vulnerable to _CRLF Injection_ on headers when using unsanitized input as request headers, more specifically, inside the `content-type` header. Example: ``` import { request } from 'undici' const unsanitizedContentTypeInput = 'application/json\r\n\r\nGET /foo2 HTTP/1.1' await request('http://localhost:3000, { method: 'GET', headers: { 'content-type': unsanitizedContentTypeInput }, }) ``` The above snippet will perform two requests in a single `request` API call: 1) `http://localhost:3000/` 2) `http://localhost:3000/foo2` This issue was patched in Undici v5.8.1. Sanitize input when sending content-type headers using user input as a workaround.

osv:CVE-2022-35948
Complete source record
{
  "id": "2502d2bd5eb887e02a88e895459701a1df0e5269e39fbcddcdd7b2e5a8c2ccea",
  "url": "https://osv.dev/vulnerability/CVE-2022-35948",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CRLF Injection in Nodejs ‘undici’ via Content-Type",
    "summary": "undici is an HTTP/1.1 client, written from scratch for Node.js.`=< undici@5.8.0` users are vulnerable to _CRLF Injection_ on headers when using unsanitized input as request headers, more specifically, inside the `content-type` header. Example: ``` import { request } from 'undici' const unsanitizedContentTypeInput = 'application/json\\r\\n\\r\\nGET /foo2 HTTP/1.1' await request('http://localhost:3000, { method: 'GET', headers: { 'content-type': unsanitizedContentTypeInput }, }) ``` The above snippet will perform two requests in a single `request` API call: 1) `http://localhost:3000/` 2) `http://localhost:3000/foo2` This issue was patched in Undici v5.8.1. Sanitize input when sending content-type headers using user input as a workaround.",
    "evidence": "osv:CVE-2022-35948",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2022-35948",
      "aliases": [
        "CVE-2022-35948",
        "GHSA-f772-66g8-q5h3"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/nodejs/undici",
              "type": "GIT",
              "events": [
                {
                  "introduced": "26f60b7b6e612bb831133d7f85914963d1955011"
                },
                {
                  "fixed": "52d1ce56f7641d0c0d8359fc76537ebe15473e7e"
                },
                {
                  "fixed": "66165d604fd0aee70a93ed5c44ad4cc2df395f80"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "=< 5.8.0"
                      },
                      {
                        "last_affected": "=< 5.8.0"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandaloneSingleVersion"
                  },
                  {
                    "range": [
                      {
                        "fixed": "52d1ce56f7641d0c0d8359fc76537ebe15473e7e"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "v5.8.2"
                  },
                  {
                    "range": [
                      {
                        "fixed": "66165d604fd0aee70a93ed5c44ad4cc2df395f80"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "=< 5.8.0",
            "v5.8.1",
            "v5.8.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-35948.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:35.878823028Z",
      "provider": "osv",
      "references": [
        "https://github.com/nodejs/undici/releases/tag/v5.8.2",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35948.json",
        "https://github.com/nodejs/undici/security/advisories/GHSA-f772-66g8-q5h3",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-35948",
        "https://github.com/nodejs/undici/commit/66165d604fd0aee70a93ed5c44ad4cc2df395f80"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-74",
          "CWE-93"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/35xxx/CVE-2022-35948.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-35948",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 503252,
  "published_at": "2022-08-13T00:00:00+00:00"
}