CVE-2026-40158: CWE-94: Improper Control of Generation of Code ('Code Injection') in MervinPraison PraisonAI
PraisonAI is a multi-agent teams system. Prior to 4.5.128, PraisonAI's AST-based Python sandbox can be bypassed using type.__getattribute__ trampoline, allowing arbitrary code execution when running untrusted agent code. 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. The string '__subclasses__' is an ast.Constant, not an ast.Attribute, so it is never checked against the blocked list. This vulnerability is fixed in 4.5.128.
AI Analysis
Technical Summary
PraisonAI versions before 4.5.128 use an AST-based Python sandbox to restrict untrusted agent code by filtering dangerous attributes such as __subclasses__, __globals__, and __bases__. However, the filtering only inspects ast.Attribute nodes and does not check ast.Constant nodes, allowing bypass via dynamic attribute resolution through type.__getattribute__. This enables arbitrary code execution within the sandbox environment. The vulnerability is identified as CWE-94 (Improper Control of Generation of Code) and CWE-693 (Protection Mechanism Failure). The vulnerability is fixed in version 4.5.128, but no explicit vendor advisory or patch link is provided in the data.
Potential Impact
Successful exploitation allows an attacker running untrusted agent code to bypass sandbox restrictions and execute arbitrary code. This leads to complete compromise of the system's confidentiality, integrity, and availability. The CVSS v3.1 score is 8.6 (high), reflecting local attack vector with low complexity, no privileges required, user interaction needed, and scope changed with high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
The vulnerability is fixed in PraisonAI version 4.5.128. Users should upgrade to this version or later to remediate the issue. Since no official patch advisory is provided, users should verify with the vendor for confirmation and further guidance. Until patched, avoid running untrusted agent code or apply additional sandboxing controls if possible.
CVE-2026-40158: CWE-94: Improper Control of Generation of Code ('Code Injection') in MervinPraison PraisonAI
Description
PraisonAI is a multi-agent teams system. Prior to 4.5.128, PraisonAI's AST-based Python sandbox can be bypassed using type.__getattribute__ trampoline, allowing arbitrary code execution when running untrusted agent code. 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. The string '__subclasses__' is an ast.Constant, not an ast.Attribute, so it is never checked against the blocked list. This vulnerability is fixed in 4.5.128.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
PraisonAI versions before 4.5.128 use an AST-based Python sandbox to restrict untrusted agent code by filtering dangerous attributes such as __subclasses__, __globals__, and __bases__. However, the filtering only inspects ast.Attribute nodes and does not check ast.Constant nodes, allowing bypass via dynamic attribute resolution through type.__getattribute__. This enables arbitrary code execution within the sandbox environment. The vulnerability is identified as CWE-94 (Improper Control of Generation of Code) and CWE-693 (Protection Mechanism Failure). The vulnerability is fixed in version 4.5.128, but no explicit vendor advisory or patch link is provided in the data.
Potential Impact
Successful exploitation allows an attacker running untrusted agent code to bypass sandbox restrictions and execute arbitrary code. This leads to complete compromise of the system's confidentiality, integrity, and availability. The CVSS v3.1 score is 8.6 (high), reflecting local attack vector with low complexity, no privileges required, user interaction needed, and scope changed with high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
The vulnerability is fixed in PraisonAI version 4.5.128. Users should upgrade to this version or later to remediate the issue. Since no official patch advisory is provided, users should verify with the vendor for confirmation and further guidance. Until patched, avoid running untrusted agent code or apply additional sandboxing controls if possible.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-09T19:31:56.014Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69d9d9721cc7ad14da3f863d
Added to database: 4/11/2026, 5:17:38 AM
Last enriched: 4/11/2026, 5:18:24 AM
Last updated: 4/11/2026, 2:02:18 PM
Views: 7
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.