PatchSiren

PatchSiren cyber security CVE debrief

CVE-2026-40158 MervinPraison CVE debrief

CVE-2026-40158 is a high-severity vulnerability in PraisonAI's AST-based Python sandbox, allowing arbitrary code execution when running untrusted agent code. The vulnerability exists due to incomplete enforcement of security restrictions, specifically bypassing the filter designed to block dangerous Python attributes. This issue arises from the sandbox's failure to account for dynamic attribute resolution via built-in methods such as type.getattribute, resulting in incomplete enforcement of security restrictions. The filter only checks ast.Attribute nodes, allowing a bypass. The string '__subclasses__' is an ast.Constant, not an ast.Attribute, so it is never checked against the

Vendor
MervinPraison
Product
PraisonAI
CVSS
HIGH 8.6
CISA KEV
Not listed in stored evidence
Original CVE published
2026-04-10
Original CVE updated
2026-10-26
Advisory published
2026-04-10
Advisory updated
2026-10-26

Who should care

Defenders responsible for systems using PraisonAI, especially those running versions prior to 4.5.128, should assess exposure and potential impact. This vulnerability allows arbitrary code execution when running untrusted agent code, making it a high-severity issue.

Why it matters

CVE-2026-40158 is a high-severity vulnerability in PraisonAI's AST-based Python sandbox, allowing arbitrary code execution when running untrusted agent code. Defenders should prioritize verifying exposure and assessing the impact on their systems, especially those using PraisonAI versions prior to 4.5.128.

  • Arbitrary code execution when running untrusted agent code
  • Incomplete enforcement of security restrictions in the AST-based Python sandbox
  • Bypass of filter designed to block dangerous Python attributes

Technical summary

The _execute_code_direct function in praisonaiagents/tools/python_tools.py uses AST filtering to block dangerous Python attributes like __subclasses__, __globals__, and __bases__. However, the filter only checks ast.Attribute nodes, allowing a bypass. The sandbox relies on AST-based filtering of attribute access but fails to account for dynamic attribute resolution via built-in methods such as type.getattribute, resulting in incomplete enforcement of security restrictions.

Defensive priority

Defenders should prioritize verifying exposure and assessing the impact of this vulnerability on their systems, especially those using PraisonAI versions prior to 4.5.128.

Recommended defensive actions

  • Verify PraisonAI version and check if it's prior to 4.5.128
  • Assess exposure and potential impact on systems using PraisonAI
  • Apply patch or upgrade to PraisonAI version 4.5.128 or later
  • Monitor systems for suspicious activity
  • Review compensating controls for exposed systems while remediation is scheduled and verified
  • Check relevant monitoring, detection, and logs for exposed assets that need extra review
  • Track exceptions, retest remediated assets, and close the item only after evidence is documented

Evidence notes

The vulnerability is caused by the sandbox's failure to account for dynamic attribute resolution via built-in methods such as type.getattribute. The filter only checks ast.Attribute nodes, allowing a bypass. The string '__subclasses__' is an ast.Constant, not an ast.Attribute, so it is never checked against the blocked list.

Sources and references

Verified primary and authoritative sources

  • CVE-2026-40158 CVE Program record

    Publisher, destination, and source semantics verified

    URL: https://www.cve.org/CVERecord?id=CVE-2026-40158

    CVE Program - Official CVE Program record with source-provided CVE metadata.

  • CVE-2026-40158 NVD vulnerability detail

    Publisher, destination, and source semantics verified

    URL: https://nvd.nist.gov/vuln/detail/CVE-2026-40158

    NIST National Vulnerability Database - Official NIST NVD detail page and source-specific vulnerability assessment.

Supplemental references

  • Source reference

    Unverified legacy reference

    URL: https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7

    [email protected] - Exploit, Vendor Advisory

Methodology and review provenance

AI-assisted synthesis based on stored public vulnerability evidence. System validation, approval state, and publication status do not by themselves establish human review of this revision. PatchSiren helps prioritize defensive review and does not prove exposure or remediation on any system.