Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-8251 Overview
CVE-2024-8251 is a Prisma injection vulnerability in mintplex-labs/anything-llm prior to version 1.2.2. The flaw exists in the /embed/:embedId/stream-chat API endpoint, which passes user-supplied JSON directly into a Prisma where clause. An attacker can submit a crafted object such as {"sessionId":{"not":"a"}} to coerce Prisma into returning every row in the embedded chat table. The result is unauthorized access to all user queries submitted through embedded chat sessions. The weakness is tracked under CWE-89 as an injection class issue affecting ORM query construction.
Critical Impact
Unauthenticated network attackers can enumerate every embedded chat message stored by vulnerable AnythingLLM deployments, exposing potentially sensitive user prompts and conversation history.
Affected Products
- mintplex-labs anything-llm versions prior to 1.2.2
- Deployments exposing the /embed/:embedId/stream-chat endpoint
- Self-hosted AnythingLLM instances using the embedded chat widget
Discovery Timeline
- 2025-03-20 - CVE-2024-8251 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-8251
Vulnerability Analysis
The /embed/:embedId/stream-chat endpoint in AnythingLLM accepts a sessionId field from the request body and forwards it unchanged into a Prisma where clause. Prisma treats nested JSON objects as query operators, so a client-supplied object like {"not":"a"} is interpreted as a filter expression rather than a scalar comparison. The query no longer filters by a specific session and instead matches every row that is not equal to the string "a". Because the endpoint is reachable without authentication by design (embeds are public), any remote caller who knows an embedId can retrieve the complete chat history for that embed. The vulnerability maps to CWE-89, extended to ORM query injection where structured input bypasses intended filter semantics.
Root Cause
The root cause is missing type validation on the sessionId parameter before it enters Prisma. The server trusted that sessionId would be a string and passed the raw value into the ORM. Prisma's rich query DSL means any object value becomes an operator tree, converting a session lookup into an arbitrary filter.
Attack Vector
An attacker sends an HTTP POST request to /embed/:embedId/stream-chat with a JSON body that replaces the scalar sessionId with a Prisma operator object. Operators such as not, gt, or contains cause the backend to return rows outside the attacker's own session, disclosing other users' prompts and responses.
// Patch from server/models/embedChats.js — coerces sessionId to a string
// before it reaches Prisma, defeating operator-object injection.
embed_id: Number(embedId),
response: JSON.stringify(response),
connection_information: JSON.stringify(connection_information),
- session_id: sessionId,
+ session_id: String(sessionId),
},
});
return { chat, message: null };
// Source: https://github.com/mintplex-labs/anything-llm/commit/334fd9cdd02ad4aa6a3c9bdfc95e7764651c13f4
// Patch from server/utils/middleware/embedMiddleware.js — adds the uuid
// validate helper so sessionId can be verified as a well-formed UUID.
-const { v4: uuidv4 } = require("uuid");
+const { v4: uuidv4, validate } = require("uuid");
const { VALID_CHAT_MODE } = require("../chats/stream");
const { EmbedChats } = require("../../models/embedChats");
const { EmbedConfig } = require("../../models/embedConfig");
// Source: https://github.com/mintplex-labs/anything-llm/commit/334fd9cdd02ad4aa6a3c9bdfc95e7764651c13f4
Detection Methods for CVE-2024-8251
Indicators of Compromise
- POST requests to /embed/:embedId/stream-chat whose JSON body contains a sessionId field with a nested object instead of a string.
- Request bodies containing Prisma operator keys such as not, gt, lt, contains, or in under sessionId.
- Unusually large response payloads from the embed stream-chat endpoint, suggesting bulk record disclosure.
- Access patterns from a single source iterating through multiple embedId values.
Detection Strategies
- Inspect application logs for /embed/*/stream-chat requests where the parsed sessionId is not a string or valid UUID.
- Deploy a WAF rule that rejects request bodies containing JSON objects as the value of sessionId.
- Alert on repeated requests to the embed endpoint lacking a stable sessionId across calls.
Monitoring Recommendations
- Capture full request bodies for the AnythingLLM embed API in centralized logging to retain forensic evidence.
- Track response size distribution for the stream-chat endpoint and alert on statistical outliers.
- Review audit logs for mass retrieval of embed chat records outside normal application flows.
How to Mitigate CVE-2024-8251
Immediate Actions Required
- Upgrade mintplex-labs/anything-llm to version 1.2.2 or later without delay.
- Restrict public exposure of embed endpoints to trusted origins where feasible.
- Rotate or disable any embedId values that may have been queried by untrusted clients.
- Audit historical access logs for crafted sessionId payloads and treat matches as data exposure incidents.
Patch Information
The fix is delivered in commit 334fd9c. It coerces sessionId with String(sessionId) before passing it to Prisma and imports the validate helper from the uuid package to pre-validate the identifier format in embedMiddleware.js. See the Huntr bounty report for the original disclosure.
Workarounds
- Place a reverse proxy or WAF in front of AnythingLLM to reject requests whose sessionId is not a string.
- Disable embedded chat (/embed/*) routes until the upgrade can be applied if public exposure is not required.
- Apply input validation at an API gateway to enforce a UUID schema on the sessionId field.
# Example nginx snippet to drop requests where sessionId is a JSON object
location ~ ^/embed/[^/]+/stream-chat$ {
if ($request_body ~* "\"sessionId\"\s*:\s*\{") {
return 400;
}
proxy_pass http://anythingllm_upstream;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

