{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2026-40158","id":"CVE-2026-40158","title":"PraisonAI has Improper Control of Generation of Code ('Code Injection') and Protection Mechanism Failure in 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__.","descriptionLong":"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.","published":"2026-04-10T16:49:24.753Z","updated":"2026-10-28T02:30:41.595630601Z","reserved":"2026-04-09T19:31:56.014Z","status":"Analyzed","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":8.6,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub_M"},"metrics":[{"version":"3.1","score":8.6,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub_M"},{"version":"3.1","score":8.6,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"github.com"},{"version":"3.1","score":7.8,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","rating":"high","source":"NVD"},{"version":"3.1","score":8.6,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"OSV"},{"version":"3.1","score":8.6,"vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","rating":"high","source":"GitHub"}],"rating":"high","products":["MervinPraison PraisonAI"],"affectedProducts":[{"vendor":"MervinPraison","product":"PraisonAI","defaultStatus":null,"versions":[{"version":"< 4.5.128","status":"affected"}],"platforms":[]}],"packages":[{"ecosystem":"PyPI","name":"praisonai","purl":"pkg:pypi/praisonai","ranges":["<4.5.128"],"fixed":["4.5.128"],"advisory":"GHSA-3c4r-6p77-xwr7"}],"cwes":["CWE-94","CWE-693"],"aliases":["GHSA-3c4r-6p77-xwr7","PYSEC-2026-2898"],"references":[{"url":"https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7","tags":["x_refsource_CONFIRM","Exploit","Vendor Advisory","advisory","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40158.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40158","tags":["advisory"]},{"url":"https://github.com/MervinPraison/PraisonAI","tags":["package"]},{"url":"https://github.com/MervinPraison/PraisonAI/releases/tag/v4.5.128","tags":["web"]},{"url":"https://pypi.org/project/praisonai","tags":["package"]},{"url":"https://github.com/advisories/GHSA-3c4r-6p77-xwr7","tags":["advisory"]}],"patchReferenced":false,"fixAvailable":true,"exploitReferenced":true,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total"},"epss":0.00244,"epssPercentile":0.15825,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-40158","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40158","ok":true,"note":"Analyzed"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2026-40158","ok":true,"note":"1 package"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-3c4r-6p77-xwr7","ok":true,"note":"GHSA-3c4r-6p77-xwr7"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-40158","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}