CVE-2022-35949
nodejs: undici.request vulnerable to SSRF
Overview
Description
undici is an HTTP/1.1 client, written from scratch for Node.js.undici is vulnerable to SSRF (Server-side Request Forgery) when an application takes in user input into the path/pathname option of undici.request. If a user specifies a URL such as http://127.0.0.1 or //127.0.0.1 js const undici = require("undici") undici.request({origin: "http://example.com", pathname: "//127.0.0.1"}) Instead of processing the request as http://example.org//127.0.0.1 (or http://example.org/http://127.0.0.1 when http://127.0.0.1 is used), it actually processes the request as http://127.0.0.1/ and sends it to http://127.0.0.1. If a developer passes in user input into path parameter of undici.request, it can result in an SSRF as they will assume that the hostname cannot change, when in actual fact it can change because the specified path parameter is combined with the base URL. This issue was fixed in undici@5.8.1. The best workaround is to validate user input before passing it to the undici.request call.
Source: OX vulnerability database
Severity
9.8 · CRITICAL
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness: CWE-918
Affected packages · 3
Operating systems · 7 fixes
SUSE Linux Enterprise 1 release · 1 package
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 15.4 | nodejs16 +3 | 16.17.0-150400.3.6.1 | SUSE-SU-2022:3250-1 |
debian 3 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 12 | node-undici | 5.8.2+dfsg1+~cs18.9.18.1-1 |
| 13 | node-undici | 5.8.2+dfsg1+~cs18.9.18.1-1 |
| 14 | node-undici | 5.8.2+dfsg1+~cs18.9.18.1-1 |
echo 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| node-undici | 5.8.2+dfsg1+~cs18.9.18.1-1 |
openSUSE 1 release · 1 package
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Tumbleweed | corepack16 +4 | 16.17.0-2.1 | openSUSE-SU-2024:12285-1 |
root.io debian 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 12 | rootio-node-undici | 5.8.2+dfsg1+~cs18.9.18.1-1 |
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2022-35949
- github.com https://github.com/nodejs/undici
- github.com https://github.com/nodejs/undici/commit/124f7ebf705366b2e1844dff721928d270f87895
- github.com https://github.com/nodejs/undici/releases/tag/v5.8.2
- github.com https://github.com/nodejs/undici/security/advisories/GHSA-8qr4-xgw6-wmr3
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2022-35949
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2022-35949
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.