CVE-2026-1527
JSON

4.6medium

undici is vulnerable to CRLF Injection via upgrade option

Severity
4.6medium CVSS:3.1 by openjs
Exploit likelihood
0.32% (higher than 26% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
openjs
Also known as
GHSA-4992-7rv2-5pvq

Description

ImpactWhen an application passes user-controlled input to the upgrade option of client.request(), an attacker can inject CRLF sequences (\r\n) to: * Inject arbitrary HTTP headers * Terminate the HTTP request prematurely and smuggle raw data to non-HTTP services (Redis, Memcached, Elasticsearch) The vulnerability exists because undici writes the upgrade value directly to the socket without validating for invalid header characters: // lib/dispatcher/client-h1.js:1121 if (upgrade) { header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` }

Affected

Product or packageVersionsReported by
undici< 6.24.0; 7.0.0 < 7.24.0
Not affected: 6.24.0: 7.24.0
CVE List
undici (npm)before 6.24.0, from 7.0.0 before 7.24.0GitHub Advisory Database
nodejs undicibefore 6.24.0, from 7.0.0 before 7.24.0NVD

All scores

openjs4.6medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N
GitHub4.6medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N

Classification

CWE-93

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

ImpactWhen an application passes user-controlled input to the upgrade option of client.request(), an attacker can inject CRLF sequences (\r\n) to: * Inject arbitrary HTTP headers * Terminate the HTTP request prematurely and smuggle raw data to non-HTTP services (Redis, Memcached, Elasticsearch) The vulnerability exists because undici writes the upgrade value directly to the socket without validating for invalid header characters: // lib/dispatcher/client-h1.js:1121 if (upgrade) { header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` }

GitHub Advisory Database
Impact

When an application passes user-controlled input to the upgrade option of client.request(), an attacker can inject CRLF sequences (\r\n) to:

  1. Inject arbitrary HTTP headers
  2. Terminate the HTTP request prematurely and smuggle raw data to non-HTTP services (Redis, Memcached, Elasticsearch)

The vulnerability exists because undici writes the upgrade value directly to the socket without validating for invalid header characters:

// lib/dispatcher/client-h1.js:1121
if (upgrade) {
  header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n`
}
Patches

Patched in the undici version v7.24.0 and v6.24.0. Users should upgrade to this version or later.

Workarounds

Sanitize the upgrade option string before passing to undici:

function sanitizeUpgrade(value) {
  if (/[\r\n]/.test(value)) {
    throw new Error('Invalid upgrade value')
  }
  return value
}

client.request({
  upgrade: sanitizeUpgrade(userInput)
})
NVD (es)

ImpactoCuando una aplicación pasa entrada controlada por el usuario a la opción upgrade de client.request(), un atacante puede inyectar secuencias CRLF (\r\n) para: * Inyectar encabezados HTTP arbitrarios * Terminar la solicitud HTTP prematuramente y contrabandear datos sin procesar a servicios no HTTP (Redis, Memcached, Elasticsearch) La vulnerabilidad existe porque undici escribe el valor upgrade directamente al socket sin validar caracteres de encabezado no válidos: // lib/dispatcher/client-h1.js:1121 if (upgrade) { header += `connection: upgrade\r\nupgrade: ${upgrade}\r\n` }

References

Sources

SourceRecordLicence
CVE ListCVE-2026-1527 changed 2026-03-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-4992-7rv2-5pvq changed 2026-09-10CC-BY-4.0
NVDCVE-2026-1527 changed 2026-06-17Public domain