/

CVE-2026-61704

Severity:

HIGH RISK

(7.5)

SSRF (CWE-918) in Link Preview JS DNS Validation Bug

CVE-2026-61704

Deferred

Vulnerability type

Category:

Server-Side Request Forgery

CWE:

CWE-918

Impact:

Unauthorized access to internal network resources

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A server-side request forgery vulnerability in Link Preview JS allows DNS rebinding to bypass hostname and IP validation during link preview requests. If an attacker controls DNS responses for a requested hostname, the server may connect to loopback or internal HTTP services after validation succeeds against a public address.

Affected context

The issue affects Link Preview JS deployments before version 4.0.4 when the application resolves a hostname for SSRF protection but later fetches the original hostname. The risk is present when attacker-controlled DNS responses can change between validation and the final connection, including during redirect processing.

Exploit preconditions

  • Attack surface: Server-side link preview or metadata-fetching functionality
  • Required access: Ability to submit or cause the application to process a URL
  • Trigger point: DNS resolution followed by the preview HTTP request or redirect
  • Why exploitation is possible: The application validates one resolved address but connects using the hostname, allowing DNS rebinding to substitute an internal or loopback address afterward

Why this happens

The vulnerability results from a time-of-check-to-time-of-use mismatch in SSRF defenses. The application checks a resolved IP address but does not bind the subsequent connection to that validated address, so a hostname can resolve to a public address during validation and to a private address during use. This maps to CWE-918: Server-Side Request Forgery, with the same trust-boundary failure extending to redirect handling.

Potential impact

  • The server may access loopback services that are not externally exposed.
  • An attacker could retrieve information from internal HTTP endpoints.
  • Cloud or container metadata services could be targeted where reachable.
  • Internal administrative interfaces may be exposed through response handling.
  • Network reconnaissance or limited lateral movement could become possible.

General mitigation guidance

Mitigation generally focuses on making hostname validation and connection behavior consistent.

Common defensive patterns include:

  • Resolve the hostname and connect only to the validated address, rather than resolving it again implicitly.
  • Revalidate every redirect destination using the same SSRF policy.
  • Reject loopback, link-local, private, reserved, and other non-routable address ranges according to the deployment threat model.
  • Restrict outbound traffic with network policies, egress filtering, and service-level allowlists.
  • Limit the preview service's network and identity privileges.
  • Apply request timeouts, response-size limits, and protocol restrictions.

These controls reduce reliance on attacker-controlled DNS behavior and limit exposure if validation is bypassed.

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis for URL validation followed by separate hostname-based HTTP requests.
  • Code review checks for DNS resolution and connection logic that do not preserve the validated address.
  • Tests that simulate DNS changes between validation and connection.
  • Review of redirect handling to confirm that every destination receives SSRF checks.
  • Egress monitoring for preview services connecting to private, loopback, link-local, or metadata-service address ranges.
  • Policy enforcement requiring outbound allowlists for server-side fetchers.

Automated security review tools may help flag SSRF sinks, unsafe redirect behavior, and inconsistent DNS validation.

Sources

SourceLink
github.comgithub.com/OP-Engineering/link-preview-js/commit/6ee25043dd60b097eb70b4ce049aac94b28239e3
github.comgithub.com/OP-Engineering/link-preview-js/commit/f3a3dd84adbb9d32d06a933f44ff3eaa837f9a12
github.comgithub.com/OP-Engineering/link-preview-js/pull/181
github.comgithub.com/OP-Engineering/link-preview-js/releases/tag/4.0.4
github.comgithub.com/OP-Engineering/link-preview-js/security/advisories/GHSA-cpjf-6666-r8fx

Frequently asked

questions

Yes, where an attacker can submit a URL to a remotely reachable Link Preview JS service and influence DNS responses for the requested hostname.

Generally no. The vulnerable server performs the request from its own network position, although outbound controls and DNS behavior affect practical exploitability.

Make validation and connection use the same resolved destination, and apply the SSRF policy again to every redirect target.

Combine strict destination validation with outbound network restrictions, least-privilege service accounts, controlled DNS behavior, and tests covering rebinding and redirects.

Find out what's already
exploitable in your codebase.