Skip to content
OpenAdvisories
Medium · 5.3 CVE-2022-35949 EUVD-2022-6518GHSA-8qr4-xgw6-wmr3

`undici.request` vulnerable to SSRF using absolute URL on `pathname`

Published Aug 12, 2022 · Updated Apr 22, 2025 · Assigned by GitHub_M

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.

Affected products

VendorProductAffectedFixed
nodejs undici <= 5.8.1 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 node-undici 5.8.2+dfsg1+~cs18.9.18.1-1 —
Debian 13 node-undici 5.8.2+dfsg1+~cs18.9.18.1-1 —
Debian 12 node-undici 5.8.2+dfsg1+~cs18.9.18.1-1 —
ReleasePackageFixed inAdvisory
SLES 15 SP4 nodejs16 16.17.0-150400.3.6.1 SUSE-SU-2022:3250-1
SLES 15 SP3 nodejs16 16.17.0-150300.7.9.1 SUSE-SU-2022:3251-1
SLES 12 nodejs16 16.17.0-8.9.1 SUSE-SU-2022:3196-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed nodejs16 16.17.0-2.1 openSUSE-SU-2024:12285-1
openSUSE Leap 15.4 nodejs16 16.17.0-150400.3.6.1 SUSE-SU-2022:3250-1
openSUSE Leap 15.3 nodejs16 16.17.0-150300.7.9.1 SUSE-SU-2022:3251-1

Affected packages

EcosystemPackageAffectedFixedRecord
npm undici < 5.8.2 5.8.2 GHSA-8qr4-xgw6-wmr3

Advisories 5

References