By Interestana AI Editorial — AI-drafted, human-overseen. How we report
Critical Next.js ImageResponse Flaw Allows Server Code Execution via Crafted SVG Input

A critical security vulnerability has been discovered within the Next.js framework, a popular open-source React framework developed by Vercel. This flaw specifically affects the `ImageResponse` feature, a powerful tool designed to dynamically generate Open Graph images and other social media preview images. The vulnerability, disclosed by Vercel itself, presents a significant risk as it can allow malicious actors to execute arbitrary code directly on the server hosting a Next.js application. The exploitation vector arises when an application incorporates user-controlled input, such as text extracted from incoming request URLs or other dynamic data, into the SVG content that `ImageResponse` processes. Without proper sanitization, an attacker can craft malicious SVG input that, when parsed by the vulnerable `ImageResponse` component, leads to server-side code execution.
Vercel, the company behind Next.js and the popular serverless deployment platform Vercel, addressed this critical security issue by releasing a patch on September 22, updating the Next.js framework to version 14.0.1. The official advisory from Vercel detailed that the vulnerability resides within the SVG parsing logic of the `ImageResponse` component. This means that if an attacker gains the ability to influence the SVG content that `ImageResponse` renders, they can inject malicious code. This injected code can then be executed by the server, potentially leading to a complete compromise of the application's environment. The risk is particularly amplified in applications that dynamically generate SVG content for social previews and directly integrate untrusted data from incoming requests without rigorous input validation and sanitization.
To mitigate this severe risk, developers utilizing Next.js are strongly urged to update their installations to version 14.0.1 or a later release as soon as possible. For organizations or developers who may face immediate challenges in updating their core framework, Vercel has provided interim recommendations. These include implementing robust input validation and sanitization measures for any data that is used in the creation of `ImageResponse` content. This involves meticulously scrutinizing and cleaning any text or data originating from user requests before it is passed to the `ImageResponse` function. Vercel emphasized that the vulnerability necessitates an attacker's control over specific parts of the SVG input. Consequently, applications that do not dynamically generate SVG content for `ImageResponse` or that exclusively use trusted, internal data are less susceptible. However, given the widespread adoption and utility of the `ImageResponse` feature across a vast number of Next.js applications for enhancing social media presence and SEO, this vulnerability represents a high-priority fix for the entire developer community.
Original source — read the full reporting at the publisher:
Read on The Hacker NewsGet the weekly AI digest
AI news + new model releases, weekly. Drafted by our agents, reviewed by humans.