# CVE-2026-40158: PraisonAI has Improper Control of Generation of Code ('Code Injection') and Protection Mechanism Failure in praisonai

- Severity: High 8.6 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.24%, higher than 9% of CVEs (2026-11-30)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-04-10T16:49:24.753Z
- Modified: 2026-10-26T21:10:00.170Z
- Also known as: GHSA-3c4r-6p77-xwr7, PYSEC-2026-2898
- Weaknesses: CWE-94, CWE-693
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- MervinPraison PraisonAI: < 4.5.128
- praisonai (PyPI): before 4.5.128
- praison praisonai: before 4.5.128

## Every score

- GitHub_M: CVSS:3.1 8.6 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.6 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: CVSS:3.1 8.6 High `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`

## References

- <https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7> (exploit, vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-40158> (advisory)
- <https://github.com/MervinPraison/PraisonAI> (package)
- <https://github.com/MervinPraison/PraisonAI/releases/tag/v4.5.128> (web)
- <https://pypi.org/project/praisonai> (package)
- <https://github.com/advisories/GHSA-3c4r-6p77-xwr7> (advisory)

## Sources

- CVE List: [CVE-2026-40158](https://www.cve.org/CVERecord?id=CVE-2026-40158), CVE Terms of Use, modified 2026-04-10
- GitHub Advisory Database: [GHSA-3c4r-6p77-xwr7](https://github.com/advisories/GHSA-3c4r-6p77-xwr7), CC-BY-4.0, modified 2026-07-13
- NVD: [CVE-2026-40158](https://nvd.nist.gov/vuln/detail/CVE-2026-40158), Public domain, modified 2026-10-26
- PyPA Advisory Database: [PYSEC-2026-2898](https://osv.dev/vulnerability/PYSEC-2026-2898), CC-BY-4.0, modified 2026-07-13

---

Page: https://cve.day/CVE-2026-40158 · Whole record: https://cve.day/CVE-2026-40158.json · Rebuilt by cve.day 2026-11-25T22:59:18.529Z
