Common Weakness Enumeration

CWE-94

Allowed-with-Review

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

9498 vulnerabilities reference this CWE, most recent first.

GHSA-7MC2-WWMP-GCXH

Vulnerability from github – Published: 2022-12-15 21:30 – Updated: 2022-12-21 21:30
VLAI
Details

An issue was discovered in /Upload/admin/admin_notify.php in Seacms 11.4 allows attackers to execute arbitrary php code via the notify1 parameter when the action parameter equals set.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2021-39426"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-12-15T19:15:00Z",
    "severity": "CRITICAL"
  },
  "details": "An issue was discovered in /Upload/admin/admin_notify.php in Seacms 11.4 allows attackers to execute arbitrary php code via the notify1 parameter when the action parameter equals set.",
  "id": "GHSA-7mc2-wwmp-gcxh",
  "modified": "2022-12-21T21:30:15Z",
  "published": "2022-12-15T21:30:29Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-39426"
    },
    {
      "type": "WEB",
      "url": "https://github.com/seacms-com/seacms/issues/21"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-7MCQ-5QP3-W599

Vulnerability from github – Published: 2023-11-30 00:30 – Updated: 2023-12-05 03:30
VLAI
Details

Remote code execution

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-42541"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2023-11-29T22:15:07Z",
    "severity": "CRITICAL"
  },
  "details": "Remote code execution",
  "id": "GHSA-7mcq-5qp3-w599",
  "modified": "2023-12-05T03:30:21Z",
  "published": "2023-11-30T00:30:18Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-42541"
    },
    {
      "type": "WEB",
      "url": "https://source.android.com/docs/security/bulletin/chromecast/2023-07-01"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-7MCW-6R84-FRFH

Vulnerability from github – Published: 2022-05-02 06:10 – Updated: 2022-05-02 06:10
VLAI
Details

Adobe Reader and Acrobat 9.x before 9.3.2, and 8.x before 8.2.2 on Windows and Mac OS X, allow attackers to execute arbitrary code via unspecified vectors, related to a "prefix protocol handler vulnerability."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2010-0191"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2010-04-14T16:00:00Z",
    "severity": "HIGH"
  },
  "details": "Adobe Reader and Acrobat 9.x before 9.3.2, and 8.x before 8.2.2 on Windows and Mac OS X, allow attackers to execute arbitrary code via unspecified vectors, related to a \"prefix protocol handler vulnerability.\"",
  "id": "GHSA-7mcw-6r84-frfh",
  "modified": "2022-05-02T06:10:51Z",
  "published": "2022-05-02T06:10:51Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2010-0191"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A6729"
    },
    {
      "type": "WEB",
      "url": "http://www.adobe.com/support/security/bulletins/apsb10-09.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/39329"
    },
    {
      "type": "WEB",
      "url": "http://www.us-cert.gov/cas/techalerts/TA10-103C.html"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2010/0873"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-7MG9-54M6-QH35

Vulnerability from github – Published: 2025-07-17 21:32 – Updated: 2025-07-17 21:32
VLAI
Details

A code injection vulnerability has been discovered in the Robot Operating System (ROS) 'rostopic' command-line tool, affecting ROS distributions Noetic Ninjemys and earlier. The vulnerability lies in the 'echo' verb, which allows a user to introspect a ROS topic and accepts a user-provided Python expression via the --filter option. This input is passed directly to the eval() function without sanitization, allowing a local user to craft and execute arbitrary code.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-41921"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-07-17T20:15:27Z",
    "severity": "HIGH"
  },
  "details": "A code injection vulnerability has been discovered in the Robot Operating System (ROS) \u0027rostopic\u0027 command-line tool, affecting ROS distributions Noetic Ninjemys and earlier. The vulnerability lies in the \u0027echo\u0027 verb, which allows a user to introspect a ROS topic and accepts a user-provided Python expression via the --filter option. This input is passed directly to the eval() function without sanitization, allowing a local user to craft and execute arbitrary code.",
  "id": "GHSA-7mg9-54m6-qh35",
  "modified": "2025-07-17T21:32:15Z",
  "published": "2025-07-17T21:32:15Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-41921"
    },
    {
      "type": "WEB",
      "url": "https://www.ros.org/blog/noetic-eol"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-7MHX-7529-P5JC

Vulnerability from github – Published: 2022-05-14 02:33 – Updated: 2025-10-22 03:30
VLAI
Details

GDI+ in Microsoft Windows Vista SP2 and Server 2008 SP2; Office 2003 SP3, 2007 SP3, and 2010 SP1 and SP2; Office Compatibility Pack SP3; and Lync 2010, 2010 Attendee, 2013, and Basic 2013 allows remote attackers to execute arbitrary code via a crafted TIFF image, as demonstrated by an image in a Word document, and exploited in the wild in October and November 2013.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-3906"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-11-06T15:55:00Z",
    "severity": "HIGH"
  },
  "details": "GDI+ in Microsoft Windows Vista SP2 and Server 2008 SP2; Office 2003 SP3, 2007 SP3, and 2010 SP1 and SP2; Office Compatibility Pack SP3; and Lync 2010, 2010 Attendee, 2013, and Basic 2013 allows remote attackers to execute arbitrary code via a crafted TIFF image, as demonstrated by an image in a Word document, and exploited in the wild in October and November 2013.",
  "id": "GHSA-7mhx-7529-p5jc",
  "modified": "2025-10-22T03:30:35Z",
  "published": "2022-05-14T02:33:20Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-3906"
    },
    {
      "type": "WEB",
      "url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2013/ms13-096"
    },
    {
      "type": "WEB",
      "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2013-3906"
    },
    {
      "type": "WEB",
      "url": "http://blogs.mcafee.com/mcafee-labs/mcafee-labs-detects-zero-day-exploit-targeting-microsoft-office-2"
    },
    {
      "type": "WEB",
      "url": "http://blogs.technet.com/b/srd/archive/2013/11/05/cve-2013-3906-a-graphics-vulnerability-exploited-through-word-documents.aspx"
    },
    {
      "type": "WEB",
      "url": "http://technet.microsoft.com/security/advisory/2896666"
    },
    {
      "type": "WEB",
      "url": "http://www.exploit-db.com/exploits/30011"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-7MJJ-9265-43WM

Vulnerability from github – Published: 2022-05-01 02:03 – Updated: 2022-05-01 02:03
VLAI
Details

Eval injection vulnerability in PEAR XML_RPC 1.3.0 and earlier (aka XML-RPC or xmlrpc) and PHPXMLRPC (aka XML-RPC For PHP or php-xmlrpc) 1.1 and earlier, as used in products such as (1) WordPress, (2) Serendipity, (3) Drupal, (4) egroupware, (5) MailWatch, (6) TikiWiki, (7) phpWebSite, (8) Ampache, and others, allows remote attackers to execute arbitrary PHP code via an XML file, which is not properly sanitized before being used in an eval statement.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2005-1921"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2005-07-05T04:00:00Z",
    "severity": "HIGH"
  },
  "details": "Eval injection vulnerability in PEAR XML_RPC 1.3.0 and earlier (aka XML-RPC or xmlrpc) and PHPXMLRPC (aka XML-RPC For PHP or php-xmlrpc) 1.1 and earlier, as used in products such as (1) WordPress, (2) Serendipity, (3) Drupal, (4) egroupware, (5) MailWatch, (6) TikiWiki, (7) phpWebSite, (8) Ampache, and others, allows remote attackers to execute arbitrary PHP code via an XML file, which is not properly sanitized before being used in an eval statement.",
  "id": "GHSA-7mjj-9265-43wm",
  "modified": "2022-05-01T02:03:16Z",
  "published": "2022-05-01T02:03:16Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2005-1921"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A11294"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A350"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=112008638320145\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=112015336720867\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=112605112027335\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://pear.php.net/package/XML_RPC/download/1.3.1"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15810"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15852"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15855"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15861"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15872"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15883"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15884"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15895"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15903"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15904"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15916"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15917"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15922"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15944"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15947"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/15957"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/16001"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/16339"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/16693"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/17440"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/17674"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/18003"
    },
    {
      "type": "WEB",
      "url": "http://security.gentoo.org/glsa/glsa-200507-01.xml"
    },
    {
      "type": "WEB",
      "url": "http://security.gentoo.org/glsa/glsa-200507-06.xml"
    },
    {
      "type": "WEB",
      "url": "http://security.gentoo.org/glsa/glsa-200507-07.xml"
    },
    {
      "type": "WEB",
      "url": "http://securitytracker.com/id?1015336"
    },
    {
      "type": "WEB",
      "url": "http://sourceforge.net/project/showfiles.php?group_id=87163"
    },
    {
      "type": "WEB",
      "url": "http://sourceforge.net/project/shownotes.php?release_id=338803"
    },
    {
      "type": "WEB",
      "url": "http://www.ampache.org/announce/3_3_1_2.php"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2005/dsa-745"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2005/dsa-746"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2005/dsa-747"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2005/dsa-789"
    },
    {
      "type": "WEB",
      "url": "http://www.drupal.org/security/drupal-sa-2005-003/advisory.txt"
    },
    {
      "type": "WEB",
      "url": "http://www.gulftech.org/?node=research\u0026article_id=00087-07012005"
    },
    {
      "type": "WEB",
      "url": "http://www.hardened-php.net/advisory-022005.php"
    },
    {
      "type": "WEB",
      "url": "http://www.mandriva.com/security/advisories?name=MDKSA-2005:109"
    },
    {
      "type": "WEB",
      "url": "http://www.novell.com/linux/security/advisories/2005_18_sr.html"
    },
    {
      "type": "WEB",
      "url": "http://www.novell.com/linux/security/advisories/2005_41_php_pear.html"
    },
    {
      "type": "WEB",
      "url": "http://www.novell.com/linux/security/advisories/2005_49_php.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2005-564.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/419064/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/14088"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2005/2827"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-7MJM-M5WM-MFGG

Vulnerability from github – Published: 2026-08-22 15:31 – Updated: 2026-08-22 15:31
VLAI
Details

Joomla Extension - fabrikar.com - Remote code execution via image element in Fabrik < 4.7.3 - ???.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-76605"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-08-22T15:16:22Z",
    "severity": "CRITICAL"
  },
  "details": "Joomla Extension - fabrikar.com - Remote code execution via image element in Fabrik \u003c 4.7.3 - ???.",
  "id": "GHSA-7mjm-m5wm-mfgg",
  "modified": "2026-08-22T15:31:05Z",
  "published": "2026-08-22T15:31:05Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-76605"
    },
    {
      "type": "WEB",
      "url": "https://www.fabrikar.com"
    }
  ],
  "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:H/SI:H/SA:H/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-7MM3-VMXH-8QQX

Vulnerability from github – Published: 2022-05-17 05:29 – Updated: 2022-05-17 05:29
VLAI
Details

PHP remote file inclusion vulnerability in libs/adodb/adodb.inc.php in PHP Free Photo Gallery script allows remote attackers to execute arbitrary PHP code via a URL in the path parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2010-4948"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2011-10-09T10:55:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in libs/adodb/adodb.inc.php in PHP Free Photo Gallery script allows remote attackers to execute arbitrary PHP code via a URL in the path parameter.",
  "id": "GHSA-7mm3-vmxh-8qqx",
  "modified": "2022-05-17T05:29:55Z",
  "published": "2022-05-17T05:29:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2010-4948"
    },
    {
      "type": "WEB",
      "url": "http://www.exploit-db.com/exploits/14438"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-7MM8-FMCF-MVW9

Vulnerability from github – Published: 2022-05-14 02:39 – Updated: 2022-05-14 02:39
VLAI
Details

The Proxim Wireless Tsunami MP.11 2411 with firmware 3.0.3 has public as its default SNMP read/write community, which makes it easier for remote attackers to obtain sensitive information or modify SNMP variables.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-5866"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2009-01-07T20:30:00Z",
    "severity": "HIGH"
  },
  "details": "The Proxim Wireless Tsunami MP.11 2411 with firmware 3.0.3 has public as its default SNMP read/write community, which makes it easier for remote attackers to obtain sensitive information or modify SNMP variables.",
  "id": "GHSA-7mm8-fmcf-mvw9",
  "modified": "2022-05-14T02:39:18Z",
  "published": "2022-05-14T02:39:18Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-5866"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/4884"
    },
    {
      "type": "WEB",
      "url": "http://www.procheckup.com/vulnerability_manager/vulnerabilities/pr08-24"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/497182/100/0/threaded"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-7MP2-F3VH-J4W4

Vulnerability from github – Published: 2022-05-14 03:11 – Updated: 2022-05-14 03:11
VLAI
Details

The previous version of Puppet Enterprise 2018.1 is vulnerable to unsafe code execution when upgrading pe-razor-server. Affected releases are Puppet Enterprise: 2018.1.x versions prior to 2018.1.1 and razor-server and pe-razor-server prior to 1.9.0.0.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2018-6512"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2018-06-11T20:29:00Z",
    "severity": "CRITICAL"
  },
  "details": "The previous version of Puppet Enterprise 2018.1 is vulnerable to unsafe code execution when upgrading pe-razor-server. Affected releases are Puppet Enterprise: 2018.1.x versions prior to 2018.1.1 and razor-server and pe-razor-server prior to 1.9.0.0.",
  "id": "GHSA-7mp2-f3vh-j4w4",
  "modified": "2022-05-14T03:11:18Z",
  "published": "2022-05-14T03:11:18Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2018-6512"
    },
    {
      "type": "WEB",
      "url": "https://puppet.com/security/cve/CVE-2018-6512"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

Mitigation
Architecture and Design

Strategy: Refactoring

Refactor your program so that you do not have to dynamically generate code.

Mitigation
Architecture and Design
  • 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
Implementation

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
Testing

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
Operation

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
Operation

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
Implementation

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.