Executive brief
link-preview-js is a JavaScript library that extracts metadata (title, description, images) from web links. The library failed to properly validate IPv6 loopback addresses and could be tricked via DNS resolution to access internal or private IP addresses, potentially leaking sensitive internal data. Attackers could exploit this to probe internal networks or retrieve metadata from services not intended to be publicly accessible.
Technical details
The vulnerability is a Server-Side Request Forgery (SSRF) vulnerability (CWE-918) in link-preview-js that allows attackers to bypass network access controls. The root cause is insufficient validation of IPv6 loopback addresses in the URL validation regex, and improper handling of DNS resolution results. An attacker can supply a URL that resolves to an internal IP address (127.0.0.1, ::1, or private ranges) or craft IPv6 addresses designed to reach loopback interfaces. The attack requires no authentication and is network-reachable. A successful exploit allows an attacker to fetch content from internal services, potentially exposing sensitive data or metadata. The patch in version 4.0.1 tightens the IPv6 validation regex and blocks certain DNS suffixes (.internal, .local, .nip.io, .sslip.io), but the maintainers acknowledge this is incomplete protection. Users are strongly advised to use the resolveDNSHost option to perform DNS resolution validation before fetching content.
Affected products
- OP-Engineering link-preview-js <= 4.0.0
Timeline
- 2026-04-25: disclosed
- 2026-04-25: patched: Version 4.0.1 released
- 2026-05-05: advisory: GHSA-4gp8-rjrq-ch6q published
References
- https://github.com/OP-Engineering/link-preview-js/security/advisories/GHSA-4gp8-rjrq-ch6q
- https://github.com/OP-Engineering/link-preview-js/pull/179
- https://github.com/OP-Engineering/link-preview-js/commit/4396d48909fab37553c0e93e26447fe218363ede
- https://github.com/OP-Engineering/link-preview-js
- https://github.com/OP-Engineering/link-preview-js/releases/tag/4.0.1