CVE-2022-35948: CRLF Injection in Nodejs ‘undici’ via Content-Type
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
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/undicito a version that resolves this vulnerability.Fixed in 5.8.2 - Upgrade
Upgrade
debian/node-undicito 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 - Upgrade
Upgrade
debian/node-undicito a version that resolves this vulnerability.Fixed in 5.8.2+dfsg1+~cs18.9.18.1-1 - Upgrade
Upgrade
undicito a version that resolves this vulnerability.Fixed in 5.8.1 - Configuration
Sanitize user input before sending it in content-type headers as a workaround.
undici content-type header input = sanitized
Event History
Frequently Asked Questions
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.
What is the severity of CVE-2022-35948?
The severity of CVE-2022-35948 is medium with a severity value of 5.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.
How can I fix CVE-2022-35948?
To fix CVE-2022-35948, undici users should upgrade to version 5.8.2 or higher.
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.