Details
Same primitive as #29 / #38 (ipx redirect bypass), in a different validator. The fix recommendations for #29 also apply here, with the same trade-offs.
Impact
A Nuxt application that uses nuxt-og-image (the official-recommended OG generator) and includes any user-influenced URL in an OG component is vulnerable to SSRF that returns the bytes of the internal response as part of the rendered OG image:
- Class 1 directly:
<img src="http://[::ffff:7f00:1]:PORT/path">reaches 127.0.0.1 on the OG worker. If the dev's deployment has anything bound to loopback (admin dashboards, internal HTTP-RPC, Redis HTTP UI, anything running alongside the function on the same machine in self-hosted setups), it leaks. - Class 1 cluster: the IPv6 cluster ranges trigger only on dual-stack / k8s / NAT64 networks — but those are exactly the production targets where SSRF matters most.
- Class 2 redirect: any allowed CDN with a redirect rule extends the reach to all RFC 1918 / loopback / link-local space.
nuxt-og-image is the OG-image module recommended in Nuxt's official documentation; it is shipped with Nuxt UI templates and is one of the top-2 Nuxt modules by GitHub stars. The user-facing primitive in real apps is "title/avatar comes from a request param" — exactly the same <NuxtLink to="/og?avatar=..."> pattern Nuxt docs encourage.
Suggested fix
Three non-exclusive options:
- Replace the hand-rolled IPv6 prefix list with `ipaddr.js`'s `range()` predicate (or equivalent), then either:
- explicitly deny the four cluster ranges that
ipaddr.jscurrently misses (fec0::/10,5f00::/16,3fff::/20,64:ff9b:1::/48), or - wait for the
ipaddr.jsupstream patch (see Vercel #27 — same gap, separately disclosed) and bump. - In any case, also catch
[::ffff:7f00:1]either by wideningRE_MAPPED_V4or by classifying any::ffff:address as the embedded IPv4.
- Pass `redirect: "manual"` in `$fetch` defaults and reject 3xx. (Compare
astro:assets, which already does this —await fetch(url, { redirect: "manual" })and explicit 3xx-rejection.)
- Pin the validated IP to the connection. Resolve the hostname once during validation, then pass a custom
undici.Agentwithconnect.lookupreturning the resolved IP only. This closes both the IPv6 bypass class (the resolved IP is checked again) and the redirect class (post-30x lookup is forced to the original IP). Reference:request-filtering-agenton npm.
(2) alone closes Class 2. (1) alone closes Class 1. (3) closes both with one change.