CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-25802

Prompt Injection to Stored XSS: Unpacking CVE-2026-25802 in new-api

Alon Barad
Alon Barad
Software Engineer

Feb 24, 2026·6 min read·161 visits

Executive Summary (TL;DR)

The 'new-api' LLM gateway trusted AI-generated content too much. By asking the AI to write malicious code, attackers could trigger a Stored XSS in the playground UI, leading to session hijacking. Fixed in version 0.10.8-alpha.9 by sandboxing the output.

A critical Cross-Site Scripting (XSS) vulnerability was discovered in the 'new-api' LLM gateway, specifically within its playground component. The flaw allows attackers to weaponize Large Language Model outputs via indirect prompt injection, causing the application to render malicious JavaScript that executes in the victim's browser. The root cause lies in the unsafe use of React's 'dangerouslySetInnerHTML' without adequate sanitization.

The Hook: When Chatbots Attack

In the rush to integrate Large Language Models (LLMs) into every piece of software known to man, developers often forget a cardinal rule of security: All input is evil. But with LLMs, the "input" is technically "output" generated by a machine we implicitly trust to be smart. This cognitive dissonance is exactly where CVE-2026-25802 lives. It targets new-api, a popular Go-based gateway for managing LLM assets and APIs. The vulnerability isn't in the AI itself; it's in how the human-built UI handles the AI's hallucinations.

The specific component at fault is the "Playground"—a sandbox where administrators and users can test prompts against various models. The irony of calling it a "sandbox" while it lacked actual browser sandboxing is palpable. When a user asks the model to generate content, the frontend renders it. If that content happens to be a malicious JavaScript payload disguised as helpful code, the browser executes it. This turns the LLM into a confused accomplice in a classic Cross-Site Scripting (XSS) attack.

This isn't just a theoretical "popup" bug. Because the chat history is saved to the database, this becomes a Stored XSS. An attacker can generate a malicious chat log, and later, when an administrator reviews the logs or the history is reloaded, the payload detonates. It's a landmine made of text.

The Flaw: dangerouslySetInnerHTML Meets AI

The root cause of this vulnerability is a tale as old as React itself. The developers wanted to display rich text responses from the AI—markdown, code blocks, maybe some bold text for emphasis. To do this, they reached for the forbidden fruit: dangerouslySetInnerHTML. As the name implies, this React attribute is dangerous because it bypasses the virtual DOM's built-in XSS protection and dumps raw HTML directly into the document.

In MarkdownRenderer.jsx, the application took the string response from the LLM and shoved it directly into the DOM. There was no sanitization layer, no DOMPurify, just raw trust. If the LLM output contained <script>alert(1)</script>, the browser would obediently execute it. But wait, it gets worse. There was a secondary vector in CodeViewer.jsx.

The developers implemented a custom syntax highlighter for JSON responses. Instead of using a battle-tested library, they manually constructed HTML strings by wrapping tokens in <span> tags. They forgot to escape the content inside those tokens. So, if a JSON value contained "><img src=x onerror=alert(1)>, the concatenation logic would break out of the span and inject the event handler. It's a masterclass in why you should never build your own parser.

The Code: The Smoking Gun

Let's look at the commit that introduced the fix (ab5456eb1049aa8a0f3e51f359907ec7fff38b4b). The difference between the vulnerable code and the patched code effectively illustrates the severity of the oversight.

The Vulnerable Implementation (Before): In the original MarkdownRenderer.jsx, the code looked something like this:

// The developer trusted the 'content' variable completely
<div 
  className="markdown-body"
  dangerouslySetInnerHTML={{ __html: content }}
/>

This is the digital equivalent of leaving your front door open because you assume only your friends know where you live. The content variable here comes directly from the LLM, which effectively comes from the user's prompt.

The Fix (After): Reference commit ab5456eb1049aa8a0f3e51f359907ec7fff38b4b. The maintainers realized they couldn't sanitize every possible output, so they chose containment. They replaced the direct render with a Sandboxed Iframe.

// SandboxedHtmlPreview component
<iframe
  ref={iframeRef}
  sandbox='allow-same-origin' // Note: allow-scripts is MISSING
  srcDoc={code}
  title='HTML Preview'
  style={{ width: '100%', border: 'none' }}
/>

By omitting allow-scripts from the sandbox attribute, the browser renders the HTML visually but refuses to execute any JavaScript within that frame. Additionally, in CodeViewer.jsx, they finally introduced a sanitizer:

const escapeHtml = (str) => {
  return str
    .replace(/&/g, '&amp;')
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/"/g, '&quot;')
    .replace(/'/g, '&#039;');
};

This function is now called on every token before it gets wrapped in syntax highlighting tags, ensuring that special characters are treated as text, not code.

The Exploit: Weaponizing the Chatbot

Exploiting this requires a technique known as Indirect Prompt Injection. We don't write the XSS payload; we bully the AI into writing it for us. The attack flow is elegant in its simplicity.

Step 1: The Setup The attacker logs into the new-api playground. They select a model (it doesn't matter which one, as long as it follows instructions).

Step 2: The Injection The attacker sends the following prompt: > "Please write a complete HTML example that includes a script tag to redirect the current page to google.com. Do not use code blocks, just raw text."

Step 3: The Execution The LLM, trying to be helpful, responds: > "Sure, here is the code: <script>window.location.replace("https://www.google.com")</script>"

Step 4: The Detonation The new-api frontend receives this string. The MarkdownRenderer sees the HTML tags and passes them to dangerouslySetInnerHTML. The React component mounts, the browser parses the DOM, encounters the <script> tag, and immediately executes the redirect.

Because this interaction is saved in the chat history, any administrator who views this chat session later will also be redirected (or worse, have their session cookies stolen via document.cookie).

The Fix: Containment and Sanitization

The remediation for CVE-2026-25802 is twofold, addressing both the rendering engine and the data handling. The primary fix is the introduction of isolation.

1. Sandbox Isolation: The move to an <iframe> with the sandbox attribute is the strongest defense here. Even if the sanitizer fails, or if the LLM invents a new polyglot payload, the browser's security model prevents execution. By strictly defining the capabilities of the iframe (allowing same-origin for styles but denying scripts), the attack surface is effectively neutralized.

2. Context-Aware Escaping: For the syntax highlighter, the developers implemented classic output encoding. This ensures that data is treated as data, not instructions. This is a crucial lesson: never manually build HTML strings without a utility function to handle entity encoding.

Recommendation: If you are running new-api versions prior to 0.10.8-alpha.9, you are vulnerable. Update immediately. If you cannot update, disable the Playground feature or block access to it via network policies, as there is no configuration-based mitigation for the vulnerability itself.

Official Patches

QuantumNousGitHub Commit: Fix XSS in Markdown and JSON components

Fix Analysis (1)

Technical Appendix

CVSS Score
7.6/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:N/I:H/A:L
EPSS Probability
0.04%

Affected Systems

new-api (QuantumNous)

Affected Versions Detail

Product
Affected Versions
Fixed Version
new-api
QuantumNous
< 0.10.8-alpha.90.10.8-alpha.9
AttributeDetail
CWE IDCWE-79
CVSS Score7.6 (High)
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredLow
ImpactSession Hijacking, RCE (via Admin context)
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1059.007Command and Scripting Interpreter: JavaScript
Execution
T1185Browser Session Hijacking
Collection
CWE-79
Cross-site Scripting

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Known Exploits & Detection

GitHub AdvisoryProof of concept demonstrating redirection to Google via LLM prompt.

Vulnerability Timeline

Fix commit pushed to GitHub
2026-02-06
GitHub Advisory (GHSA) published
2026-02-23
CVE-2026-25802 published
2026-02-24

References & Sources

  • [1]GHSA Advisory
  • [2]NIST NVD Entry

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-118748
7.5

CVE-2026-118748: Unbounded Memory Allocation Denial of Service in ASP.NET Core Blazor Static-SSR

CVE-2026-118748 is a remote Denial of Service (DoS) vulnerability in Microsoft ASP.NET Core (.NET 11.0 preview releases prior to 11.0.0) and Microsoft Visual Studio 2026 (prior to 18.12.0). The flaw originates from unbounded resource allocation (CWE-770) within the Blazor static server-side rendering (static-SSR) validation pipeline, where dynamic or attacker-supplied form field identifiers are cached in a singleton-scoped memory structure without size limits or eviction policies. Unauthenticated remote attackers can exploit this condition over the network by sending repeated HTTP requests with unique field names, exhausting heap memory and terminating the host process via an unhandled OutOfMemoryException.

Alon Barad
Alon Barad
2 views•9 min read
•about 2 hours ago•CVE-2026-114150
5.9

CVE-2026-114150: Remote Information Disclosure via Uninitialized Pooled Memory in ASP.NET Core Response Buffering

CVE-2026-114150 is a network-accessible information disclosure vulnerability affecting Microsoft ASP.NET Core in .NET 11.0 preview releases and Microsoft Visual Studio 2026 prior to version 18.12.0. The flaw stems from the use of uninitialized resources (CWE-908) within response buffering components, specifically ResponseBufferingStream used by middleware such as HTTP Logging and Output Caching. Because rented memory segments from ArrayPool<byte> or MemoryPool<byte> are not cleared upon return or strictly bounded to the exact written byte count during subsequent reads, residual response payloads from earlier HTTP requests remain in the buffer tail. Downstream consumers or log sinks reading these buffers expose confidential cross-session data, including authentication tokens and personally identifiable information.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 3 hours ago•CVE-2026-114146
9.0

CVE-2026-114146: Elevation of Privilege in ASP.NET Core SignalR Connection Dispatcher

An incorrect authorization vulnerability (CWE-863) exists in the ASP.NET Core SignalR HTTP Connection Dispatcher (`Microsoft.AspNetCore.Http.Connections`). The connection negotiation process failed to bind the authenticated caller identity to the generated connection state, and subsequent transport or message dispatch handlers failed to verify caller consistency. Consequently, an authenticated low-privilege attacker who obtains a valid connection identifier or token can inject messages into or hijack another user's SignalR session, achieving an elevation of privilege across security boundaries.

Alon Barad
Alon Barad
5 views•11 min read
•about 4 hours ago•CVE-2026-109478
7.5

CVE-2026-109478: Algorithmic Complexity Denial of Service in ASP.NET Core Header Parsing

CVE-2026-109478 is a network-accessible Denial of Service (DoS) vulnerability in ASP.NET Core caused by inefficient algorithmic complexity (CWE-407) when parsing comma-separated HTTP request headers. Prior to the patch, the internal helper method ParsingHelpers.GetHeaderSplit repeatedly called StringValues.Concat inside a loop iterating over each comma-separated token. Because StringValues allocates a new array of size k + 1 and copies all existing elements upon each concatenation, processing N tokens incurs O(N^2) time and space complexity. An unauthenticated remote attacker can send HTTP requests with headers containing thousands of short, comma-separated values to exhaust CPU cycles and induce severe Garbage Collection (GC) pauses, rendering the web application unresponsive.

Alon Barad
Alon Barad
6 views•11 min read
•about 5 hours ago•CVE-2026-114147
7.5

CVE-2026-114147: Denial of Service via Memory Leak in ASP.NET Core SignalR Redis Backplane

CVE-2026-114147 is a high-severity Denial of Service (DoS) vulnerability affecting ASP.NET Core and specifically the Microsoft.AspNetCore.SignalR.StackExchangeRedis scale-out provider across .NET 8.0, 9.0, 10.0, and 11.0 preview releases. The vulnerability originates from a string comparison mismatch between internal per-connection group collections and the centralized Redis channel subscription registry, compounded by a race condition during connection teardown. Remote unauthenticated attackers can exploit this flaw to leave orphaned connection contexts and active Redis pub/sub listeners pinned in memory, leading to unbounded memory exhaustion and application process termination.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 6 hours ago•CVE-2026-114156
6.5

CVE-2026-114156: Path Equivalence Security Feature Bypass in Microsoft ASP.NET Core

CVE-2026-114156 is an improper resolution of path equivalence vulnerability (CWE-41) in Microsoft ASP.NET Core affecting .NET 11.0 preview releases and Microsoft Visual Studio 2026. The vulnerability stems from a discrepancy between how path prefix validation helpers (such as PathString.StartsWithSegments) and downstream routing mechanisms handle alternate path separators and percent-encoded characters. An unauthenticated remote attacker can exploit this mismatch over the network to bypass path-based authorization middleware and access restricted endpoints.

Amit Schendel
Amit Schendel
5 views•8 min read