Actively Exploited · CISA KEV · 2026

CVE-2026-45312 & CVE-2026-28797: RAGFlow SSTI to RCE

Two critical Jinja2 template-injection flaws turned ordinary AI workflow configuration in RAGFlow into a path to full server compromise — and unlike most CVEs that stay theoretical, these are confirmed under active attack. Here's the complete technical picture.

9 min read
In This Analysis
1. Quick Answer 2. Now on CISA's Exploited-Vulnerabilities List 3. CVE-2026-45312: The Prompt Generator Flaw 4. CVE-2026-28797: The Agent Workflow Flaw 5. Why "Requires Authentication" Doesn't Mean Safe 6. The Fix, and Its Limits 7. Security Checklist 8. FAQ

1. Quick Answer

RAGFlow SSTI is a Server-Side Template Injection vulnerability in which attacker-controlled template syntax is processed by an unsandboxed Jinja2 template engine on the RAGFlow server — turning what looks like ordinary prompt or agent configuration into executable code. RAGFlow is a widely used open-source Retrieval-Augmented Generation engine that connects LLMs to enterprise documents, tools, and external systems.

Two distinct CVEs share this root cause, in two different components:

CVEComponentSeverityAffected versions
CVE-2026-45312Prompt GeneratorCVSS 3.1: 9.9 Critical0.24.0 and earlier
CVE-2026-28797Agent workflow (StringTransform, Message)CVSS 4.0: 8.7 High / CVSS 3.1: 8.8 High0.24.0 and earlier

Neither requires administrator access. Both let an ordinary authenticated user reach arbitrary operating-system command execution on the RAGFlow server.

2. Now on CISA's Exploited-Vulnerabilities List

This is no longer a theoretical risk. Both CVE-2026-45312 and CVE-2026-28797 have been added to CISA's Known Exploited Vulnerabilities (KEV) catalog. Microsoft has documented real campaigns against exposed RAGFlow instances using these exact flaws — attackers establishing persistent access and harvesting LLM provider API keys and related metadata. Per the coordinated advisory, telemetry showed consistent objectives across cases: credential collection, durable access mechanisms, and resource monetization, even where the specific execution path differed by product. Federal agencies were directed to patch under Binding Operational Directive 26-04.

That detail changes the calculus for anyone running RAGFlow. A CVSS score alone tells you how bad a flaw could be. A KEV listing tells you it's already being used.

3. CVE-2026-45312: The Prompt Generator Flaw

CVE-2026-45312 CVSS 9.9 · CRITICAL

The vulnerable code lives in rag/prompts/generator.py, specifically the citation_prompt() function. RAGFlow constructs an ordinary, unsandboxed jinja2.Environment and renders user-controlled prompt configuration through it. A field that looks like prompt configuration is, to the server, executable template logic.

Per the vendor's own advisory, exploitation needs nothing beyond a normal account: any user can register, create a Canvas workflow with a simple component chain, and trigger the injection — no API keys, sandbox service, or embedding model required. That's the attack chain, end to end: register → build a workflow → submit a crafted citation field → the server evaluates it as a template → arbitrary OS command execution.

The published CVSS vector — AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H — reads as network-reachable, low complexity, low privileges required, no user interaction, and high impact across confidentiality, integrity, and availability, with a changed security scope. In plain terms: a low-privileged account is one workflow away from a potential path to full server compromise.

4. CVE-2026-28797: The Agent Workflow Flaw

CVE-2026-28797 CVSS 8.7 / 8.8 · HIGH

Same underlying mistake, different surface: RAGFlow's Agent workflow StringTransform and Message components (agent/component/string_transform.py, agent/component/message.py) pass user-supplied content directly to jinja2.Template() with no sandboxing. Any authenticated user able to submit or edit an agent template can craft input that escapes the template context and executes system commands.

What makes this pairing significant rather than redundant is where it sits: this one lives in the agent layer, not just prompt configuration. A modern AI agent doesn't just generate text — it can call tools, transform data, retrieve documents, and take real actions. A template-injection flaw reachable through that layer means the same class of bug now threatens the components actually driving autonomous behavior, not just what the model says.

5. Why "Requires Authentication" Doesn't Mean Safe

Both advisories describe exploitation by an ordinary authenticated user — not an administrator. That distinction matters more in AI platforms than in traditional web applications, because modern AI tools routinely give regular users real application-level power: creating agents, configuring prompts, defining workflows, connecting tools. A "low-privilege" account in a RAG platform can often do far more than a low-privilege account in a conventional CRUD app.

The real security question isn't "does this require authentication." It's "what can this authenticated identity actually control?" For a multi-tenant RAG deployment, that's the difference between a contained account compromise and a path to the entire server.

6. The Fix, and Its Limits

The remediation both advisories point to is Jinja2's own SandboxedEnvironment in place of the standard, unrestricted one. RAGFlow's current generator.py does now import and use it — a real, verifiable sign the vulnerable pattern has been addressed in that specific file.

Two caveats worth taking seriously. First, the original advisories list no specific patched version, and RAGFlow has shipped many releases since (the project's latest, v0.27.2, went out September 10, 2026) — a version-number upgrade alone isn't proof of remediation; verify the actual deployed code and current advisories. Second, sandboxing a template engine is necessary but not sufficient on its own. A resilient posture pairs it with strict input validation, least-privilege workflow permissions, runtime isolation, restricted network egress, secrets kept out of application configuration, and monitoring for anomalous child processes — not a single control carrying the whole defense.

Is Your RAG Pipeline's Attack Surface Actually Mapped?

Run a free assessment across prompt injection, agentic tool abuse, and the workflow/template layers this analysis covers — mapped to MITRE ATLAS and OWASP LLM Top 10.

Run Free Assessment →

7. Security Checklist

For teams operating RAGFlow, or any platform where users can configure templates, prompts, or agent workflows:

Application

Identity & Runtime

Detection & Response

8. FAQ

What is CVE-2026-45312?
A critical (CVSS 9.9) server-side template injection vulnerability in RAGFlow's Prompt Generator (rag/prompts/generator.py). RAGFlow versions 0.24.0 and earlier are affected. Any authenticated user can register, create a Canvas workflow, and trigger unsandboxed Jinja2 rendering to execute arbitrary OS commands on the server — no API keys, sandbox service, or embedding model required.
What is CVE-2026-28797?
A related SSTI vulnerability (CVSS 4.0: 8.7 High, CVSS 3.1: 8.8 High) in RAGFlow's Agent workflow, specifically the StringTransform and Message components. Same root cause as CVE-2026-45312 — unsandboxed jinja2.Template rendering of user-supplied content — reached through the agent layer instead of the prompt generator.
Are these vulnerabilities being actively exploited?
Yes. Both CVEs were added to CISA's Known Exploited Vulnerabilities (KEV) catalog after Microsoft documented active campaigns against exposed RAGFlow instances using these exact flaws to establish persistence and steal LLM provider API keys and related metadata.
Does exploitation require administrator access?
No. Both advisories describe exploitation by an ordinary authenticated user — not an administrator. That is a large part of why the CVSS scores are so high: no privilege escalation is needed first.
Is Jinja2 itself the vulnerability?
No. Jinja2 is a legitimate, widely used template engine. The vulnerability is architectural: RAGFlow's affected components rendered user-controlled content with the standard, unsandboxed Jinja2 environment instead of Jinja2's own SandboxedEnvironment, which is the documented fix.