{ "canonical_id": "undici--CVE-2022-35949", "system_id": "undici", "display_name": "Undici", "category": "frameworks", "advisory_mode": "core", "title": "`undici.request` vulnerable to SSRF using absolute URL on `pathname`", "summary": "### Impact\n\n`undici` is vulnerable to SSRF (Server-side Request Forgery) when an application takes in **user input** into the `path/pathname` option of `undici.request`.\n\nIf a user specifies a URL such as `http://127.0.0.1` or `//127.0.0.1`\n\n```js\nconst undici = require(\"undici\")\nundici.request({origin: \"http://example.com\", pathname: \"//127.0.0.1\"})\n```\n\nInstead 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`.\n\nIf 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.\n\n### Patches\n\nThis issue was fixed in `undici@5.8.1`.\n\n### Workarounds\n\nThe best workaround is to validate user input before passing it to the `undici.request` call.\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\n", "published_at": "2022-08-18T18:59:46Z", "updated_at": "2023-11-08T04:09:53.898548Z", "severity": "medium", "cvss_score": 3.1, "exploit_status": "unknown", "source_confidence": "official", "official_source_url": "https://github.com/nodejs/undici/security/advisories/GHSA-8qr4-xgw6-wmr3", "secondary_source_urls": [ "https://github.com/nodejs/undici/commit/124f7ebf705366b2e1844dff721928d270f87895", "https://nvd.nist.gov/vuln/detail/CVE-2022-35949", "https://github.com/nodejs/undici", "https://github.com/nodejs/undici/releases/tag/v5.8.2" ], "aliases": [ "CVE-2022-35949", "GHSA-8qr4-xgw6-wmr3" ], "cve_ids": [ "CVE-2022-35949" ], "ghsa_ids": [ "GHSA-8qr4-xgw6-wmr3" ], "osv_ids": [ "GHSA-8qr4-xgw6-wmr3" ], "affected_versions": [ "introduced=0, fixed<5.8.2" ], "fixed_versions": [ "5.8.2" ], "package_name": "undici", "render_markdown": true, "case_path": "07-framework-security/frameworks/undici/cases/undici-cve-2022-35949.md", "secure_code_topics": [ "ssrf-url-validation", "proxy-trust-boundary", "dependency-upgrade-policy" ], "status": "generated", "triage_reasons": [], "verification_status": "triage-manual", "verification_mode": "synthetic", "last_verified_at": null, "last_run_id": null, "evidence_bundle": null, "historical_status": null, "latest_status": null, "browser_evidence": { "required": false, "present": false, "refs": [] }, "repro_profile_id": "undici-ssrf", "artifact_mode": "synthetic", "blocked_reason": null, "metadata": { "source_names": [ "OSV Undici", "NVD Undici" ], "source_kinds": [ "osv-batch", "nvd-search" ], "candidate_count": 2 } }