{"id":"CVE-2022-35949","published":"2022-08-12T00:00:00Z","modified":"2025-04-22T17:42:40Z","title":"`undici.request` vulnerable to SSRF using absolute URL on `pathname`","vendor":"nodejs","product":"undici","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.3,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01927,"percentile":0.80473,"provenance":"source"},"cwes":[{"id":"CWE-918","name":"Server-Side Request Forgery"}],"references":[{"url":"https://github.com/nodejs/undici/security/advisories/GHSA-8qr4-xgw6-wmr3","tags":[]},{"url":"https://github.com/nodejs/undici/commit/124f7ebf705366b2e1844dff721928d270f87895","tags":[]},{"url":"https://github.com/nodejs/undici/releases/tag/v5.8.2","tags":[]}],"priority":{"score":19.8,"factors":[{"name":"EPSS percentile","points":16.09},{"name":"CVSS severity","points":3.71}]},"vendorSlug":"nodejs","affectedVersions":[{"vendor":"nodejs","product":"undici","versions":["<= 5.8.1"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"partial","timestamp":"2025-04-22T15:39:52.001564Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"undici","vulnerableRanges":["<5.8.2"],"patched":["5.8.2"],"from":["GHSA-8qr4-xgw6-wmr3"],"provenance":"source"}],"summary":{"text":"The undici HTTP/1.1 client for Node.js, in its undici.request API, mishandles the pathname option: when application code passes user-supplied input into that option, an absolute URL or a protocol-relative path such as //127.0.0.1 causes the request to be sent to the attacker-chosen host instead of the intended origin. An attacker who can influence that input needs only network access to the application, with no authentication or user interaction required, and the application's configuration must pass untrusted input into pathname for the flaw to be reachable.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:18:05Z"},"euvd":{"id":"EUVD-2022-6518","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-nodejs-undici-cve-2022-35949","children":[{"from":"CVE-2022-35949","to":"CVE-2024-30260","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["lib/core/util.js"],"commits":["https://github.com/nodejs/undici/commit/124f7ebf705366b2e1844dff721928d270f87895","https://github.com/nodejs/undici/commit/64e3402da4e032e68de46acb52800c9a06aaea3f","https://github.com/nodejs/undici/commit/6805746680d27a5369d7fb67bc05f95a28247d75"],"basis":"rarely changed file"}]}],"packageHistory":[{"cve":"CVE-2022-31150","published":"2022-07-19","fixed":"5.8.0","kev":false},{"cve":"CVE-2022-31151","published":"2022-07-20","fixed":"5.8.0","kev":false,"link":{"from":"CVE-2022-31151","to":"CVE-2022-35949","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"npm:undici","fromFixed":"5.8.0","toFixed":"5.8.2","daysApart":23}]}},{"cve":"CVE-2022-35948","published":"2022-08-13","fixed":"5.8.2","kev":false},{"cve":"CVE-2022-35949","published":"2022-08-12","fixed":"5.8.2","kev":false},{"cve":"CVE-2023-23936","published":"2023-02-16","fixed":"5.19.1","kev":false},{"cve":"CVE-2023-24807","published":"2023-02-16","fixed":"5.19.1","kev":false},{"cve":"CVE-2023-45143","published":"2023-10-12","fixed":"5.26.2","kev":false}],"package":"npm:undici"}}