Unbounded per-hop stall in WebFinger lookup redirect following (no request timeout) in @fedify/webfinger
Description
The WebFinger lookup implementation in @fedify/webfinger follows HTTP redirects without enforcing any built-in timeout. lookupWebFingerInternal in packages/webfinger/src/lookup-impl.ts follows up to 5 redirects in a loop that bounds only the redirect count; it creates no internal timeout and, as invoked by Fedify's actor-resolution code, receives no AbortSignal. A remote attacker who controls a WebFinger endpoint (their own server) can accept each request and respond slowly, stalling the lookup for an attacker-controlled duration. Fedify applications can trigger the stall when they look up an attacker-controlled handle. Fedify can also reach WebFinger when re-fetching an unverified inbound activity by its ID falls back after a document-fetch failure. This is the same weakness class fixed in CVE-2026-34148 for the document loaders, but on an independent code path in a separate package that the fix never touched.
Root Cause
lookupWebFingerInternal resolves a WebFinger resource by issuing an HTTP request and following redirects in a while (true) loop. It increments a redirect counter and stops after DEFAULT_MAX_REDIRECTION (5) hops, but there is no internal timeout, no deadline spanning the operation, and no visited-URL set for cycle detection. The function accepts an optional options.signal, but the production callers that drive handle resolution do not supply one. The redirect count is bounded, but Fedify sets no deadline across the lookup: each of up to 6 requests (1 initial plus 5 redirects) depends on runtime network behavior. The CVE-2026-34148 fix added a timeout wrapper and visited set to the document loaders, but the WebFinger path retains only the count bound.
Vulnerable function: lookupWebFingerInternal
File: packages/webfinger/src/lookup-impl.ts
- while(true) redirect loop with a 5-hop count cap (no internal timeout, no visited set)
- optional options.signal is not provided by Fedify actor-resolution callersImpact
An attacker who operates a server whose handle is looked up (no privileges on the target) can cause a Fedify instance to issue WebFinger requests to an endpoint under the attacker's control. Because no built-in timeout exists and the actor-resolution callers pass no signal, each lookup can be held open by the attacker, stalling the operation for a prolonged, attacker-controlled period. Handle resolution chains multiple sequential WebFinger lookups (for example an initial lookup plus a cross-origin verification lookup), so one handle resolution can incur multiple stalls in series. Applications that look up attacker-controlled handles can encounter repeated stalls. Fedify can also fall back to WebFinger when re-fetching an unverified inbound activity by an attacker-controlled activity.id after document fetch fails. The resulting availability impact depends on how these lookups are used and how many run concurrently. No confidentiality or integrity impact is demonstrated.
Proof of Concept
Preconditions:
- A Fedify instance looking up an attacker-controlled handle or falling back
to WebFinger while re-fetching an unverified inbound activity.
- A remote HTTP server the attacker controls serving /.well-known/webfinger.The attacker's WebFinger endpoint accepts each request and either responds slowly or redirects while holding the connection open:
import http from "node:http";
// Attacker-controlled WebFinger endpoint.
const server = http.createServer((req, res) => {
// Hold each hop open; no short per-request deadline bounds this on
// the lookup has no library deadline, and the caller supplies no AbortSignal.
setTimeout(() => {
res.writeHead(302, {
Location: "https://attacker.example/.well-known/webfinger?next",
});
res.end();
}, 120_000); // ~2 minutes per hop, repeated across up to 5 redirects
});
server.listen(8080, "0.0.0.0");For an HTTPS WebFinger endpoint, this example server needs a TLS reverse proxy.
When the target resolves @user@attacker.example, lookupWebFingerInternal follows each redirect with no deadline, so Fedify sets no deadline for the entire lookup, and chained lookups during handle resolution can extend the delay.
Attack Chain
- Exposure: The attacker operates a server at
attacker.examplewith a WebFinger endpoint; the target application looks up a handle there, or Fedify re-fetches an unverified inbound activity whose ID points there and falls back to WebFinger. - Control: The attacker fully controls the WebFinger HTTP responses, including redirect
Locationheaders and response timing. - Path:
getActorHandleInternalandverifyCrossOriginActorHandleinpackages/vocab/src/actor.tscalllookupWebFingerwithout a signal. The unverified-activity path can also call it throughlookupObjectafter document fetch fails, reachinglookupWebFingerInternal(packages/webfinger/src/lookup-impl.ts). - Guard: The loop caps redirects at 5 but imposes no internal timeout and keeps no visited-URL set, so slow responses are not bounded.
- Primitive: Each of up to 6 requests per lookup can delay the lookup until a response or runtime network failure.
- Result: Affected lookups can stall for a prolonged period; repeated or concurrent lookups can reduce availability.
Bypass Evidence
The only relevant protection on this path is the 5-hop redirect count cap at packages/webfinger/src/lookup-impl.ts, which bounds request count but not request duration and therefore does not mitigate a slow-response attack. The optional options.signal could bound the time if supplied, but tracing the production callers in packages/vocab/src/actor.ts (getActorHandleInternal, getPortableActorHandle, verifyCrossOriginActorHandle) shows none passes a signal, and the function creates none internally. openPublicFetch in packages/vocab-runtime/src/public-fetch.ts provides address validation and uses its signal only for DNS resolution, not for the HTTP request. The document-loader timeout does not cover this lookup. A caller-supplied signal can bound it, but the library sets no default deadline; the redirect cap limits request count, not total elapsed time.
Affected Versions
- Ecosystem:
npm - Package:
@fedify/webfinger - Confirmed affected range:
>= 2.0.0, <= 2.4.5 - Latest release checked:
2.4.5(npm registry) - Fix status: not fixed
The redirect-following pattern with only a count cap and no default timeout is present at tag 2.0.0 and remains in the latest published release, 2.4.5.
Suggested Fix
Enforce a bounded per-operation deadline inside lookupWebFingerInternal, independent of whether a caller supplies a signal, consistent with the protection the CVE-2026-34148 fix added to the document loaders. Create and apply a default timeout (aborting in-flight hops when it elapses), add a visited-URL set so self-referential redirect chains terminate early, and propagate the deadline through the request and response body. It should span the full redirect sequence; callers that chain lookups should also bound their overall operation.
---
Reported by zx.