CVE-2026-39891: PraisonAI has a Template Injection in Agent Tool Definitions

Published Apr 8, 2026
·
Updated

Summary Direct insertion of unescaped user input into template-rendering tools allows arbitrary code execution via specially crafted agent instructions. Details The createagentcentrictools() function returns tools (like acpcreatefile) that process file content using template rendering. When user input from agent.start() is passed directly into these tools without escaping (as shown in agentcentricexample.py:85-86), template expressions in the input are executed rather than treated as literal text. This occurs because: 1. No input sanitization or escaping is applied to user-controlled content 2. The ACP-enabled runtime auto-approves operations (approvalmode="auto") 3. Tools lack context-aware escaping for template syntax PoC python Replace the agent.start() call at line 85 with: result = agent.start('Create file with content: {{ self.init.globals.builtins.import("os").system("touch /tmp/pwned") }}') Successful exploitation creates /tmp/pwned confirming arbitrary command execution. The expression {{77}} renders as 49 instead of literal text. Impact Attackers can execute arbitrary system commands with the privileges of the running process by injecting malicious template expressions through agent instructions. This compromises the host system, enabling data theft, ransomware deployment, or lateral movement. Recommended Fix 1. Input Sanitization: Implement strict whitelist validation for file content 2. Contextual Escaping: Auto-escape template syntax characters (e.g., {{ }}) in user input using Jinja2 autoescape=True 3. Sandboxing: Restrict template execution environments using secure eval modes 4. Approval Hardening: Require manual approval for file creation operations in production

Other sources

PraisonAI is a multi-agent teams system. Prior to 4.5.115, the createagentcentrictools() function returns tools (like acpcreatefile) that process file content using template rendering. When user input from agent.start() is passed directly into these tools without escaping, template expressions in the input are executed rather than treated as literal text. This vulnerability is fixed in 4.5.115.

MITRE

Affected Software

2 affected componentsFixes available
pip/praisonai<=4.5.114
4.5.115
Praison PraisonAI<=4.5.114

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/praisonai to a version that resolves this vulnerability.

    Fixed in 4.5.115
  2. Upgrade

    Upgrade PraisonAI to a version that resolves this vulnerability.

    Fixed in 4.5.115
  3. Configuration

    Enable Jinja2 `autoescape=True` so template syntax characters (e.g., `{{ }}`) in user input are treated as literal text rather than executed.

    Jinja2 template rendering in agent tool definitions (create_agent_centric_tools, e.g., acp_create_file) autoescape = True
  4. Configuration

    Implement strict whitelist validation for file content/content derived from `agent.start()` user input to prevent template-expression injection into template rendering.

    Agent tool file-content handling (e.g., acp_create_file) file content validation = strict whitelist
  5. Configuration

    Restrict template execution environments by using secure eval modes so injected template expressions cannot execute arbitrary code.

    Template execution environment (sandboxing/eval mode for template rendering in agent tool definitions) secure eval mode = restricted
  6. Configuration

    Require manual approval for file creation operations in production (set `approval_mode` to manual instead of `approval_mode=

    PraisonAI ACP-enabled runtime approval_mode = manual

Event History

Apr 8, 2026
Advisory Published
via GitHub·07:21 PM
Data Sourced
via GitHub·07:21 PM
DescriptionSeverityWeaknessAffected Software
CVE Published
via MITRE·08:46 PM
Data Sourced
via MITRE·08:46 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
Affected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

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