Security Resilience

CVE-2026-40158

Praisonai ≤ 4.5.128

Public PoC
Published
10 April 2026
Modified
26 October 2026
Patch / advisory
CVSS Score v3.1 8.6
Click a component to see what it means
Raw vectorCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
EPSS Score 0.0023 9th percentile
Risk Priority 59 floored blend · peak EPSS

CVSS and EPSS are reproduced from their sources (NVD, FIRST EPSS). EPSS, Forum of Incident Response and Security Teams (FIRST), epss.first.org. Risk Priority is our own derived reading, not an NVD score.

Summary

CVE-2026-40158 is a high-severity Code Injection (CWE-94) vulnerability in Praisonai. Its CVSS base score is 8.6 (High).

Operationally, exploitation aligns with the MITRE ATT&CK technique Exploitation for Privilege Escalation (T1068); ranked at the 9th percentile by exploit likelihood (below the median); it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.

The strongest mitigations our analysis identified map to AC-3 (Access Enforcement) and AC-4 (Information Flow Enforcement) — see the control section below for these in your framework.

Deeper analysis AI-assisted summary

Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.

CVE-2026-40158 is a sandbox bypass vulnerability in PraisonAI, a multi-agent teams system, affecting versions prior to 4.5.128. The issue resides in the AST-based Python sandbox within the _execute_code_direct function of praisonaiagents/tools/python_tools.py, which filters dangerous attributes like __subclasses__, __globals__, and __bases__. However, the filter only inspects ast.Attribute nodes and overlooks dynamic attribute resolution via built-in methods such as type.__getattribute__, treating strings like '__subclasses__' as ast.Constant nodes that evade blocking. This allows attackers to trampoline into restricted attributes, enabling arbitrary code execution when processing untrusted agent code. The vulnerability is associated with CWE-94 (Improper Control of Generation of Code) and CWE-693 (Protection Mechanism Failure) and carries a CVSS v3.1 base score of 8.6 (AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H).

Exploitation requires local access to the system running PraisonAI, low attack complexity, no privileges, and user interaction, such as convincing a user to execute untrusted agent code within the sandbox. A malicious actor can craft Python code that bypasses the AST filtering— for instance, by using type.__getattribute__ to access prohibited attributes—and achieve arbitrary code execution on the host environment. This grants high-impact confidentiality, integrity, and availability compromises, with a changed scope due to the sandbox escape.

The vulnerability was fixed in PraisonAI version 4.5.128. Additional details on the issue, including the patch and reproduction steps, are available in the GitHub security advisory at https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7. Security practitioners should upgrade to the patched version and review any deployments running untrusted code in AI agent contexts.

OWASP Top 10 for Web (2025)

EU & UK References

Vulnerability Data

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…

more

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.

CWE(s)

Related Threats

MITRE ATT&CK Enterprise Techniques

MITRE ATT&CK v20.0

T1068 Exploitation for Privilege Escalation Privilege Escalation
Adversaries may exploit software vulnerabilities in an attempt to elevate privileges.
T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
T1203 Exploitation for Client Execution Execution
Adversaries may exploit software vulnerabilities in client applications to execute code.
T1210 Exploitation of Remote Services Lateral Movement
Adversaries may exploit remote services to gain unauthorized access to internal systems once inside of a network.
T1559.003 XPC Services Execution
Adversaries can provide malicious content to an XPC service daemon for local code execution.
T1584.008 Network Devices Resource Development
Adversaries may compromise third-party network devices that can be used during targeting.
Derived from this CVE’s CWE(s) via the direct CWE→ATT&CK cross-walk.

CVEs Like This One

CVE-2026-39891Same product: Praison Praisonai
CVE-2026-44334Same product: Praison Praisonai
CVE-2026-40156Same product: Praison Praisonai
CVE-2026-39888Same product: Praison Praisonai
CVE-2026-40288Same product: Praison Praisonai
CVE-2026-44336Same product: Praison Praisonai
CVE-2026-40287Same product: Praison Praisonai
CVE-2025-3114Shared CWE-693, CWE-94
CVE-2026-21671Shared CWE-693, CWE-94
CVE-2026-21669Shared CWE-693, CWE-94

Affected Assets

praison
praisonai
≤ 4.5.128

Mitigating Controls

Control response

Prevent
Stop it (NIST 800-53)

—

Detect
Catch it (NIST detect / respond)

—

Harden
Shrink the surface (DISA STIG)

—

Validate
Prove the fix (OWASP ASVS)
  • V1.3.1

Mitigating Controls (NIST 800-53 r5)

Our mappings, made for this CVE.

AC-3 directly requires enforcement of access authorizations via the protection mechanism itself.

AC-4 mandates use of information flow enforcement mechanisms to control data movement.

SC-2 requires separation of user and system functionality as a protection mechanism.

SC-28 requires protection mechanisms for information at rest.

SC-3 requires isolation of security functions from non-security functions.

SC-7 requires boundary protection mechanisms to monitor and control external communications.

Mitigating Controls (NIST CSF 2.0)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→CSF cross-walk — links open the control.

PR.PS-06 mostly match
blocks

PR.PS-06's SDLC practices directly target injection flaws via secure coding and testing (mostly), yet as a single broad outcome it leaves many code-generation specifics unaddressed (partial).

Mitigating Controls (ISO/IEC 27001:2022 Annex A)

Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→ISO cross-walk — links open the control.

finds

A.8.29's programme of code review, static analysis, dynamic testing and penetration testing is the complete pre-production discovery set for code injection: eval/dynamic-execution sinks are visible to SAST, code review catches them, and penetration testing reaches the externally exploitable instances, with no nameable remainder.

prevents

Training technical teams in secure coding practices (per A.6.3's education and training guidance) helps developers avoid constructing code from untrusted input without neutralization, but the effect is a minority one because the clause mandates a general awareness/training practice rather than a specific secure-coding mechanism, and developers remain fallible.

blocks

A.8.20 implements network-layer protection mechanisms (firewalls, network segmentation, transit encryption, connection filtering, device hardening) that, when well implemented, block exploitation of attacks relying on missing or insufficient network protection; but CWE-693 is a Pillar weakness covering all protection mechanism failures across the product, and the vast majority—application-layer input validation, output encoding, authentication, authorization, memory protection, cryptographic storage—are outside A.8.20's scope.

blocks

A.8.21 mandates authentication, encryption, network connection controls and monitoring for network services, which blocks exploitation of the network-service-related slice of CWE-693; the remainder is bounded and nameable — protection mechanism failures in application logic, sandboxing, signing, virtualization, and other non-network-service domains are outside the clause's scope.

removes

A.8.24 mandates proper cryptographic protections and therefore removes existing CWE-693 instances where the failed or missing protection mechanism is cryptographic, but it does not remove the many non-cryptographic protection-mechanism failures covered by CWE-693, so it addresses only a minority of the class.

prevents

Banning unapproved code samples and unauthenticated web services, combined with secure-coding standards and SAST, prevents the dynamic generation or inclusion of attacker-supplied code.

Hardening callouts derived

DISA STIG baselines are authored against specific weaknesses. Where this CVE cites a broad weakness class, the mapping is not asserted at that abstraction (owner ruling, 2026-09-25: grade only at Base and below), so no rule is shown here rather than a rule shown against the wrong grain.

  • No fine-grained STIG row for CWE-693, a pillar-level weakness. Rules are authored against its narrower children: CWE-654, CWE-757.

References