Miggo Logo

CVE-2025-54590: webfinger.js Blind SSRF Vulnerability

N/A

CVSS Score

Basic Information

EPSS Score
-
Published
7/28/2025
Updated
7/31/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
webfinger.jsnpm<= 2.8.02.8.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is a classic Server-Side Request Forgery (SSRF) in the webfinger.js library. The root cause lies in insufficient validation of user-provided addresses within the lookup function. The function would extract the host from an address string (e.g., user@host) by simply taking the substring after the '@' symbol. This allowed an attacker to include a path and query parameters in the host portion (e.g., user@internal-server/admin/delete?user=victim), causing the library to make a request to an arbitrary internal endpoint.

The patch addresses this in multiple layers:

  1. Host Sanitization: A new validateHost function is introduced to strip any path components (/, ?, #) from the extracted host, ensuring only a valid hostname or IP address is used.
  2. Private Address Blocking: A new isPrivateAddress function checks the sanitized host against a comprehensive blocklist of private, local, and reserved IP ranges (both IPv4 and IPv6). This is the primary defense against SSRF.
  3. DNS-based SSRF Protection: For Node.js environments, a validateDNSResolution function was added. It resolves hostnames to their IP addresses and checks if any of them are in the private address blocklist. This prevents attacks where a public domain resolves to a private IP (e.g., localtest.me resolving to 127.0.0.1).
  4. Redirect Validation: The fetchJRD function was modified to handle redirects manually. It now validates the Location header of any redirect response to ensure it does not point to a private address, closing another potential SSRF vector.

The primary vulnerable function is WebFinger.lookup, as it's the entry point that consumes the malicious input. The WebFinger.fetchJRD function was also vulnerable due to its handling of redirects. The new functions (validateHost, isPrivateAddress, validateDNSResolution) represent the security controls that were missing.

Vulnerable functions

WebFinger.lookup
src/webfinger.ts
The `lookup` function is the primary entry point for the vulnerability. It takes a user-provided address and, prior to the patch, would extract the host without proper validation. An attacker could provide a crafted address like 'user@localhost:1234/secret.txt?', causing the application to treat 'localhost:1234/secret.txt?' as the host. This host was then used to construct a request URL, leading to a Server-Side Request Forgery (SSRF) vulnerability. The patch adds calls to `validateHost`, `isPrivateAddress`, and `validateDNSResolution` to sanitize and validate the host before making any requests.
WebFinger.fetchJRD
src/webfinger.ts
The `fetchJRD` function was implicitly vulnerable as it did not validate the destination of HTTP redirects. An attacker could set up a malicious server that, when contacted, would redirect the `webfinger.js` client to an internal or private address. The original implementation would follow these redirects transparently. The patch mitigates this by setting `redirect: 'manual'` and adding logic to manually inspect the `Location` header, validate the redirect host using `validateHost` and `isPrivateAddress`, and only then follow the redirect.

WAF Protection Rules

WAF Rule

### **s*ription T** lookup *un*tion t*k*s * us*r ***r*ss *or ****kin* ***ounts *s * ***tur*, *ow*v*r, *s p*r t** **tivityPu* sp** (*ttps://www.w*.or*/TR/**tivitypu*/#s**urity-*onsi**r*tions), on t** s**urity *onsi**r*tions s**tion *t *.*, ****ss to L

Reasoning

T** vuln*r**ility is * *l*ssi* S*rv*r-Si** R*qu*st *or**ry (SSR*) in t** `w***in**r.js` li*r*ry. T** root **us* li*s in insu**i*i*nt v*li**tion o* us*r-provi*** ***r*ss*s wit*in t** `lookup` *un*tion. T** *un*tion woul* *xtr**t t** *ost *rom *n ***r*