{"id":"CVE-2026-40158","published":"2026-04-10T16:49:24Z","modified":"2026-04-10T18:31:12Z","title":"PraisonAI has Improper Control of Generation of Code ('Code Injection') and Protection Mechanism Failure in praisonai","vendor":"MervinPraison","product":"PraisonAI","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.6,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00234,"percentile":0.08597,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"},{"id":"CWE-693","name":"Protection Mechanism Failure"}],"references":[{"url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7","tags":["x_refsource_CONFIRM"]}],"priority":{"score":7.7,"factors":[{"name":"EPSS percentile","points":1.72},{"name":"CVSS severity","points":6.02}]},"vendorSlug":"mervinpraison","affectedVersions":[{"vendor":"MervinPraison","product":"PraisonAI","versions":["< 4.5.128"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2026-04-10T18:31:02.529674Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"PraisonAI","vulnerableRanges":["<4.5.128"],"patched":["4.5.128"],"from":["GHSA-3c4r-6p77-xwr7","PYSEC-2026-2898"],"provenance":"source"}],"summary":{"text":"PraisonAI, a multi-agent teams system, contains a flaw in the AST-based Python sandbox of its python_tools.py component (the _execute_code_direct function), where the code filter only checks attribute nodes and can be bypassed by resolving blocked attributes dynamically through type.__getattribute__. An attacker who can get untrusted agent code executed, and whose execution requires a user to interact with the system, can run arbitrary code, with high impact to confidentiality, integrity and availability, because the sandbox fails to enforce its restrictions.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:04:52Z"},"euvd":{"id":"EUVD-2026-21510","exploited":false,"provenance":"source"}}