CVE-2022-35948: Undici Nodejs ‘undici’ Vulnerable To CRLF Vulnerability
MODERATECVE-2022-35948 is a MODERATE (CVSS 5.3) nodejs ‘undici’ vulnerable to crlf vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Undici libraries in the npm ecosystem. The issue involves nodejs ‘undici’ vulnerable to crlf injection via content-type. Remediation is available by upgrading affected packages to version 5.8.2.
CVE-2022-35948 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N).
How to Fix CVE-2022-35948
To remediate this vulnerability, upgrade all affected Undici dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install undici@5.8.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls undici
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-35948, inspect your project dependencies using npm:
npm ls undici
Analyze the terminal output to locate any version of Undici in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.8.2), your application is affected.
Note: The npm ls undici command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Undici, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-35948 Affected Undici Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
undici
|
npm |
< 5.8.2
|
5.8.2
|
References
Frequently Asked Questions
What is CVE-2022-35948?
Which Undici versions are affected?
What version fixes CVE-2022-35948?
Is undici affected?
What is the CVSS score of CVE-2022-35948?
What CWE is associated with CVE-2022-35948?
How can I check npm dependencies for CVE-2022-35948?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f772-66g8-q5h3",
"modified" : "2023-01-19T01:01:59Z",
"published" : "2022-08-18T19:02:56Z",
"aliases" : [ "CVE-2022-35948" ],
"summary" : "Nodejs ‘undici’ vulnerable to CRLF Injection via Content-Type",
"details" : "### Impact\n\n`=< 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.\n\nExample:\n\n```\nimport { request } from 'undici'\n\nconst unsanitizedContentTypeInput = 'application/json\\r\\n\\r\\nGET /foo2 HTTP/1.1'\n\nawait request('http://localhost:3000, {\n method: 'GET',\n headers: {\n 'content-type': unsanitizedContentTypeInput\n },\n})\n```\n\nThe above snippet will perform two requests in a single `request` API call:\n\n1) `http://localhost:3000/`\n2) `http://localhost:3000/foo2`\n\n### Patches\n\nThis issue was patched in Undici v5.8.1\n\n### Workarounds\n\nSanitize input when sending content-type headers using user input.\n\n## For more information\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [undici repository](https://github.com/nodejs/undici/issues)\n- To make a report, follow the [SECURITY](https://github.com/nodejs/node/blob/HEAD/SECURITY.md) document",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "undici"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.8.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.8.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/nodejs/undici/security/advisories/GHSA-f772-66g8-q5h3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-35948"
}, {
"type" : "WEB",
"url" : "https://github.com/nodejs/undici/commit/66165d604fd0aee70a93ed5c44ad4cc2df395f80"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nodejs/undici"
}, {
"type" : "WEB",
"url" : "https://github.com/nodejs/undici/releases/tag/v5.8.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74", "CWE-93" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-08-18T19:02:56Z",
"nvd_published_at" : "2022-08-15T11:21:00Z"
}
}