CVE-2022-35948: CRLF Injection in Nodejs ‘undici’ via Content-Type

Published Aug 9, 2022
·
Updated

A flaw was found in the undici package. When requesting unsanitized input on content-type headers, it is possible to inject additional requests via Carriage Return/Line Feed (CRLF).

Other sources

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.

undici up to and including 5.8.1 is vulnerable to CRLF (Carriage Return / Line Feed) Injection on headers when using unsanitized input as request headers, 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 }, })

— Red Hat

Affected Software

6 affected componentsFixes available
redhat/undici<5.8.2
5.8.2
Nodejs Undici Node.js<5.8.2
debian/node-undici<5.8.2+dfsg1+~cs18.9.18.1-1
5.8.2+dfsg1+~cs18.9.18.1-1
debian/node-undici<5.8.2+dfsg1+~cs18.9.18.1-1
5.8.2+dfsg1+~cs18.9.18.1-1
debian/node-undici<5.8.2+dfsg1+~cs18.9.18.1-1
5.8.2+dfsg1+~cs18.9.18.1-1
debian/node-undici
5.15.0+dfsg1+~cs20.10.9.3-1+deb12u45.15.0+dfsg1+~cs20.10.9.3-1+deb12u37.3.0+dfsg1+~cs24.12.11-18.12.2+dfsg+~cs3.2.3-2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/undici to a version that resolves this vulnerability.

    Fixed in 5.8.2
  2. Upgrade

    Upgrade debian/node-undici to a version that resolves this vulnerability.

    Fixed in 5.15.0+dfsg1+~cs20.10.9.3-1+deb12u4Fixed in 5.15.0+dfsg1+~cs20.10.9.3-1+deb12u3Fixed in 7.3.0+dfsg1+~cs24.12.11-1Fixed in 8.12.2+dfsg+~cs3.2.3-2
  3. Upgrade

    Upgrade debian/node-undici to a version that resolves this vulnerability.

    Fixed in 5.8.2+dfsg1+~cs18.9.18.1-1
  4. Upgrade

    Upgrade undici to a version that resolves this vulnerability.

    Fixed in 5.8.1
  5. Configuration

    Sanitize user input before sending it in content-type headers as a workaround.

    undici content-type header input = sanitized

Event History

Aug 9, 2022
CVE Published
12:00 AM
Data Sourced
12:00 AM
RemedyDescriptionSeverityWeakness
Aug 13, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Aug 15, 2022
Data Sourced
via OSV·11:21 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is CVE-2022-35948?

CVE-2022-35948 is a vulnerability in the undici package that allows for CRLF Injection on headers when unsanitized input is used in the content-type header.

2

What is the severity of CVE-2022-35948?

The severity of CVE-2022-35948 is medium with a severity value of 5.3.

3

How does CVE-2022-35948 affect undici users?

Undici users with versions up to exclusive 5.8.2 are vulnerable to the CRLF Injection vulnerability on headers when unsanitized input is used in the content-type header.

4

How can I fix CVE-2022-35948?

To fix CVE-2022-35948, undici users should upgrade to version 5.8.2 or higher.

5

Where can I find more information about CVE-2022-35948?

You can find more information about CVE-2022-35948 on the Red Hat Security Advisory (RHSA-2022:7276) and the official CVE page.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203