CVE-2026-45312: RAGFlow: Server-Side Template Injection in Prompt Generator leads to Remote Code Execution

Published May 29, 2026
·
Updated

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine. In 0.24.0 and earlier, a Jinja2 template injection in the prompt generator (rag/prompts/generator.py) allows any authenticated user to execute arbitrary OS commands on the server. Any normal user can register, create a Canvas workflow with a DuckDuckGo + LLM component chain, and trigger the SSTI.

Affected Software

1 affected component
RAGFlow RAGFlow<=0.24.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Do not render user-controlled Jinja2 templates in rag/prompts/generator.py. Disable rendering of templates supplied by untrusted users, or strictly sanitize/escape user-provided template content before any Jinja2 rendering to prevent server-side template injection.

    RAGFlow prompt generator (rag/prompts/generator.py) jinja2_template_rendering_for_user_inputs = disabled or sanitized
  2. Configuration

    Disable open user registration or restrict which users can register and create Canvas workflows. Limit the ability to create workflows or add DuckDuckGo + LLM component chains to trusted or administrative accounts only, so unprivileged users cannot trigger the SSTI.

    Canvas workflows / user registration workflow_creation_and_registration = restricted
  3. Compensating control

    If immediate code changes are not possible, restrict access to the Canvas workflow creation and prompt-generation endpoints (e.g., via network ACLs, WAF rules, or requiring admin approval) to trusted IPs or accounts to prevent untrusted users from exercising the vulnerable flow (DuckDuckGo + LLM component chain).

  4. Operational

    Investigate logs for signs of exploitation related to prompt rendering or Canvas workflows. If compromise is suspected, perform incident response (containment, eradication, recovery) such as removing malicious artifacts and rotating any credentials or keys that may have been exposed.

Event History

May 29, 2026
CVE Published
via MITRE·12:24 PM
Data Sourced
via MITRE·12:24 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2026-45312?

The severity of CVE-2026-45312 is critical with a CVSS score of 9.9.

2

How do I fix CVE-2026-45312?

To fix CVE-2026-45312, upgrade RAGFlow to version 0.25.0 or later where the vulnerability is addressed.

3

What are the risks associated with CVE-2026-45312?

CVE-2026-45312 poses risks including remote code execution, which allows authenticated users to execute arbitrary OS commands on the server.

4

Who is affected by CVE-2026-45312?

Any user with authenticated access to RAGFlow version 0.24.0 and earlier is affected by CVE-2026-45312.

5

What components are vulnerable in CVE-2026-45312?

The vulnerable component in CVE-2026-45312 is the prompt generator located at rag/prompts/generator.py in RAGFlow.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203