Executive brief
link-preview-js is a JavaScript library that fetches and extracts metadata from web links. A flaw in its SSRF protection allows attackers to bypass the security check through DNS rebinding: the library validates one IP address but then connects to the original hostname, which can resolve to an internal or loopback address on the second lookup. This could expose internal services, metadata, or credentials accessible from the server.
Technical details
This vulnerability exists in link-preview-js versions up to 4.0.3 and is a bypass of the incomplete SSRF fix introduced in CVE-2026-43897. The root cause is a time-of-check/time-of-use (TOCTOU) vulnerability: the library calls resolveDNSHost to validate a single resolved IP address but later performs fetch() against the original hostname without binding the connection to that validated IP. An attacker controlling a DNS server can exploit this by returning a legitimate public IP during the validation phase, then returning a loopback (127.0.0.1) or internal address (10.x.x.x, 172.16.x.x, 192.168.x.x) during the actual fetch, achieving DNS rebinding. Attack vector is network-based, requires no authentication, and is triggered when the application processes a malicious URL. The fix is available in version 4.0.4 and later.
Affected products
- OP-Engineering link-preview-js <= 4.0.3
Timeline
- 2026-06-23: disclosed: Disclosed by GitHub Security Advisory GHSA-cpjf-6666-r8fx
- 2026-08-20: other: Published to National Vulnerability Database
- 2026-09-02: patched: Fixed in version 4.0.4