# CVE-2026-45312: infiniflow RAGFlow Jinja2 template injection in prompt generator

Source: https://junglewise.ai/threats/cve-2026-45312-infiniflow-ragflow-jinja2-template-injection-in-prompt-generator  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-29. Updated: 2026-05-29  
License: CC BY 4.0 with a link back

CVE-2026-45312 · Severity: critical · CVSS 9.9 · Published 2026-05-29

RAGFlow is an open-source engine used to build AI applications that connect large language models to private data. A security flaw in the system's prompt generator allows any registered user to execute malicious commands on the underlying server. This could lead to a complete system takeover, unauthorized access to sensitive data, or disruption of AI services.

Technologies: [InfiniFlow RAGFlow](https://junglewise.ai/threats/technologies/ragflow). Vendors: [InfiniFlow](https://junglewise.ai/threats/vendors/infiniflow).

## Quick answers

**Is CVE-2026-45312 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-45312 being exploited in the wild.

**How severe is CVE-2026-45312?** Critical severity, with a CVSS score of 9.9, published 29 May 2026.

**Which products and versions are affected?** InfiniFlow RAGFlow <= 0.24.0.

**Is there a fix for CVE-2026-45312?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2026-45312 attacked?** It is attacked over the network, in a network appliance.

**Am I affected by CVE-2026-45312?** Check whether you run InfiniFlow RAGFlow at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A Server-Side Template Injection (SSTI) exists in the citation_prompt() function within rag/prompts/generator.py. The application uses an unsandboxed Jinja2 environment to render user-controlled input extracted from <CITATION_GUIDELINES> XML tags in the LLM component's system prompt. An authenticated attacker can trigger this by creating a Canvas workflow using a DuckDuckGo and LLM component chain. Because the DuckDuckGo component populates retrieval chunks without requiring API keys or embedding models, the vulnerable rendering path is easily reached. Successful exploitation allows for arbitrary remote code execution (RCE) with the privileges of the server process.

## Affected products

- infiniflow RAGFlow <= 0.24.0

## Timeline

- 2026-05-09: advisory: Original GitHub security advisory published
- 2026-05-29: disclosed: CVE-2026-45312 published to NVD

## References

- [https://github.com/infiniflow/ragflow/security/advisories/GHSA-wpg4-h5g2-jxm6](https://github.com/infiniflow/ragflow/security/advisories/GHSA-wpg4-h5g2-jxm6)

## Related threats

- [RAGFlow server-side request forgery in LLM API key endpoint](https://junglewise.ai/threats/cve-2026-49951-ragflow-before-0-27-0-contains-a-server-side-request-forgery)
- [InfiniFlow RAGFlow server-side request forgery in Seafile Connector](https://junglewise.ai/threats/cve-2026-121927-a-vulnerability-has-been-found-in-infiniflow-ragflow-up-to-0-27)
- [InfiniFlow RAGFlow authorization bypass in Text To SQL Retrieval](https://junglewise.ai/threats/cve-2026-121585-a-security-flaw-has-been-discovered-in-infiniflow-ragflow-up-to)
- [RAGFlow authorization bypass in OpenAI-compatible agent completion](https://junglewise.ai/threats/cve-2026-119337-ragflow-is-an-open-source-rag-retrieval-augmented-generation)
- [RAGFlow improper access control in get_dataset API endpoint](https://junglewise.ai/threats/cve-2026-51897-ragflow-0-24-0-contains-improper-access-control-in-get-dataset)
