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.

8378 vulnerabilities reference this CWE, most recent first.

GHSA-578C-38FG-WF3M

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

The getdirective function in mathtex.cgi in mathTeX, when downloaded before 20090713, allows remote attackers to execute arbitrary commands via shell metacharacters in the dpi tag.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2009-1383"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2009-07-14T20:30:00Z",
    "severity": "HIGH"
  },
  "details": "The getdirective function in mathtex.cgi in mathTeX, when downloaded before 20090713, allows remote attackers to execute arbitrary commands via shell metacharacters in the dpi tag.",
  "id": "GHSA-578c-38fg-wf3m",
  "modified": "2022-05-02T03:24:33Z",
  "published": "2022-05-02T03:24:33Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2009-1383"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/51795"
    },
    {
      "type": "WEB",
      "url": "http://groups.google.com/group/comp.text.tex/browse_thread/thread/5d56d3d744351578"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/35816"
    },
    {
      "type": "WEB",
      "url": "http://www.ocert.org/advisories/ocert-2009-010.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/504919/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2009/1875"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-57CM-P9Q8-QFQP

Vulnerability from github – Published: 2024-12-19 18:31 – Updated: 2024-12-19 18:31
VLAI
Details

A vulnerability was found in PbootCMS up to 3.2.3. It has been classified as critical. This affects an unknown part of the file apps/home/controller/IndexController.php. The manipulation of the argument tag leads to code injection. It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 3.2.4 is able to address this issue. It is recommended to upgrade the affected component.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-12789"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-74",
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-12-19T17:15:08Z",
    "severity": "MODERATE"
  },
  "details": "A vulnerability was found in PbootCMS up to 3.2.3. It has been classified as critical. This affects an unknown part of the file apps/home/controller/IndexController.php. The manipulation of the argument tag leads to code injection. It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used. Upgrading to version 3.2.4 is able to address this issue. It is recommended to upgrade the affected component.",
  "id": "GHSA-57cm-p9q8-qfqp",
  "modified": "2024-12-19T18:31:37Z",
  "published": "2024-12-19T18:31:37Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-12789"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/J1rrY-learn/8e52bf055fd1806ada81ae1ff25dd817"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?ctiid.288969"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?id.288969"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?submit.465122"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/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-57G5-R5H9-Q5PF

Vulnerability from github – Published: 2022-05-14 01:49 – Updated: 2022-05-14 01:49
VLAI
Details

Adobe Flash Player before 11.7.700.257 and 11.8.x and 11.9.x before 11.9.900.170 on Windows and Mac OS X and before 11.2.202.332 on Linux, Adobe AIR before 3.9.0.1380, Adobe AIR SDK before 3.9.0.1380, and Adobe AIR SDK & Compiler before 3.9.0.1380 allow remote attackers to execute arbitrary code via crafted .swf content that leverages an unspecified "type confusion," as exploited in the wild in December 2013.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-5331"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-12-11T15:55:00Z",
    "severity": "HIGH"
  },
  "details": "Adobe Flash Player before 11.7.700.257 and 11.8.x and 11.9.x before 11.9.900.170 on Windows and Mac OS X and before 11.2.202.332 on Linux, Adobe AIR before 3.9.0.1380, Adobe AIR SDK before 3.9.0.1380, and Adobe AIR SDK \u0026 Compiler before 3.9.0.1380 allow remote attackers to execute arbitrary code via crafted .swf content that leverages an unspecified \"type confusion,\" as exploited in the wild in December 2013.",
  "id": "GHSA-57g5-r5h9-q5pf",
  "modified": "2022-05-14T01:49:40Z",
  "published": "2022-05-14T01:49:40Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-5331"
    },
    {
      "type": "WEB",
      "url": "http://helpx.adobe.com/security/products/flash-player/apsb13-28.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2013-12/msg00008.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-updates/2013-12/msg00075.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-updates/2013-12/msg00084.html"
    },
    {
      "type": "WEB",
      "url": "http://rhn.redhat.com/errata/RHSA-2013-1818.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-57J9-GJQ8-Q2VW

Vulnerability from github – Published: 2022-05-01 18:39 – Updated: 2022-05-01 18:39
VLAI
Details

PHP remote file inclusion vulnerability in index.php in Mp3 ToolBox 1.0 beta 5 allows remote attackers to execute arbitrary PHP code via a URL in the skin_file parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-6139"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-11-27T19:46:00Z",
    "severity": "MODERATE"
  },
  "details": "PHP remote file inclusion vulnerability in index.php in Mp3 ToolBox 1.0 beta 5 allows remote attackers to execute arbitrary PHP code via a URL in the skin_file parameter.",
  "id": "GHSA-57j9-gjq8-q2vw",
  "modified": "2022-05-01T18:39:56Z",
  "published": "2022-05-01T18:39:56Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-6139"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/38598"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4650"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/484121/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/3997"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-57JG-GJ47-Q3JW

Vulnerability from github – Published: 2022-05-01 07:43 – Updated: 2022-05-01 07:43
VLAI
Details

Multiple PHP remote file inclusion vulnerabilities in phpBlueDragon 2.9.1 allow remote attackers to execute arbitrary PHP code via a URL in the vsDragonRootPath parameter to (1) team_admin.php, (2) rss_admin.php, (3) manual_admin.php, and (4) forum_admin.php in includes/root_modules/, a different set of vectors than CVE-2006-3076.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-6958"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-01-29T16:28:00Z",
    "severity": "HIGH"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in phpBlueDragon 2.9.1 allow remote attackers to execute arbitrary PHP code via a URL in the vsDragonRootPath parameter to (1) team_admin.php, (2) rss_admin.php, (3) manual_admin.php, and (4) forum_admin.php in includes/root_modules/, a different set of vectors than CVE-2006-3076.",
  "id": "GHSA-57jg-gj47-q3jw",
  "modified": "2022-05-01T07:43:13Z",
  "published": "2022-05-01T07:43:13Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-6958"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/27152"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.org/0606-exploits/phpbluedragon-2.txt"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/2193"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/27676"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/27677"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/27678"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/27679"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/438238/100/100/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/18609"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-57M2-MPC7-GWGX

Vulnerability from github – Published: 2023-09-15 03:30 – Updated: 2023-09-20 22:21
VLAI
Summary
LibreNMS Code Injection vulnerability
Details

Code Injection in GitHub repository librenms/librenms prior to 23.9.0.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "librenms/librenms"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "23.9.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-4977"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-09-15T19:29:52Z",
    "nvd_published_at": "2023-09-15T01:15:08Z",
    "severity": "MODERATE"
  },
  "details": " Code Injection in GitHub repository librenms/librenms prior to 23.9.0.",
  "id": "GHSA-57m2-mpc7-gwgx",
  "modified": "2023-09-20T22:21:45Z",
  "published": "2023-09-15T03:30:19Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-4977"
    },
    {
      "type": "WEB",
      "url": "https://github.com/librenms/librenms/commit/1194934d31c795a3f6877a96ffaa34b1f475bdd0"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/librenms/librenms"
    },
    {
      "type": "WEB",
      "url": "https://huntr.dev/bounties/3db8a1a4-ca2d-45df-be18-a959ebf82fbc"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "LibreNMS Code Injection vulnerability"
}

GHSA-5827-P7QC-6VF6

Vulnerability from github – Published: 2024-08-29 21:31 – Updated: 2024-08-30 18:30
VLAI
Details

RPi-Jukebox-RFID v2.7.0 was discovered to contain a remote code execution (RCE) vulnerability via htdocs\trackEdit.php

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-41364"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-08-29T20:15:09Z",
    "severity": "CRITICAL"
  },
  "details": "RPi-Jukebox-RFID v2.7.0 was discovered to contain a remote code execution (RCE) vulnerability via htdocs\\trackEdit.php",
  "id": "GHSA-5827-p7qc-6vf6",
  "modified": "2024-08-30T18:30:39Z",
  "published": "2024-08-29T21:31:03Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-41364"
    },
    {
      "type": "WEB",
      "url": "https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/2400"
    }
  ],
  "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-583W-WJG4-5W8F

Vulnerability from github – Published: 2022-05-01 18:25 – Updated: 2022-05-01 18:25
VLAI
Details

HSQLDB before 1.8.0.9, as used in OpenOffice.org (OOo) 2 before 2.3.1, allows user-assisted remote attackers to execute arbitrary Java code via crafted database documents, related to "exposing static java methods."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-4575"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-12-06T02:46:00Z",
    "severity": "HIGH"
  },
  "details": "HSQLDB before 1.8.0.9, as used in OpenOffice.org (OOo) 2 before 2.3.1, allows user-assisted remote attackers to execute arbitrary Java code via crafted database documents, related to \"exposing static java methods.\"",
  "id": "GHSA-583w-wjg4-5w8f",
  "modified": "2022-05-01T18:25:08Z",
  "published": "2022-05-01T18:25:08Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-4575"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/38882"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A10153"
    },
    {
      "type": "WEB",
      "url": "https://www.redhat.com/archives/fedora-package-announce/2008-January/msg00678.html"
    },
    {
      "type": "WEB",
      "url": "https://www.redhat.com/archives/fedora-package-announce/2008-January/msg00753.html"
    },
    {
      "type": "WEB",
      "url": "http://bugs.gentoo.org/show_bug.cgi?id=200771"
    },
    {
      "type": "WEB",
      "url": "http://bugs.gentoo.org/show_bug.cgi?id=201799"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2007-12/msg00005.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27914"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27916"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27928"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27931"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27972"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/28018"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/28039"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/28286"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/28585"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/30100"
    },
    {
      "type": "WEB",
      "url": "http://sunsolve.sun.com/search/document.do?assetkey=1-26-103141-1"
    },
    {
      "type": "WEB",
      "url": "http://sunsolve.sun.com/search/document.do?assetkey=1-66-200637-1"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2007/dsa-1419"
    },
    {
      "type": "WEB",
      "url": "http://www.gentoo.org/security/en/glsa/glsa-200712-25.xml"
    },
    {
      "type": "WEB",
      "url": "http://www.mandriva.com/security/advisories?name=MDVSA-2008:095"
    },
    {
      "type": "WEB",
      "url": "http://www.openoffice.org/security/cves/CVE-2007-4575.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/archives/fedora-package-announce/2007-December/msg00134.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/archives/fedora-package-announce/2007-December/msg00155.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/archives/fedora-package-announce/2007-December/msg00281.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2007-1048.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2007-1090.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2008-0151.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2008-0158.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2008-0213.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/26703"
    },
    {
      "type": "WEB",
      "url": "http://www.securitytracker.com/id?1019041"
    },
    {
      "type": "WEB",
      "url": "http://www.ubuntu.com/usn/usn-609-1"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/4092"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/4146"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-5859-4V8Q-R354

Vulnerability from github – Published: 2026-02-26 18:31 – Updated: 2026-02-26 21:31
VLAI
Details

An issue in fastCMS before v.0.1.6 allows a local attacker to execute arbitrary code via the PluginController.java component

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-26682"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-02-26T18:23:07Z",
    "severity": "HIGH"
  },
  "details": "An issue in fastCMS before v.0.1.6 allows a local attacker to execute arbitrary code via the PluginController.java component",
  "id": "GHSA-5859-4v8q-r354",
  "modified": "2026-02-26T21:31:30Z",
  "published": "2026-02-26T18:31:41Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-26682"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/sorzs/e3913b814e2e5548aa66de6c25b0510a"
    },
    {
      "type": "WEB",
      "url": "https://github.com/sorzs/test/tree/main/fastcms-rce"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-585M-WRG3-HRV2

Vulnerability from github – Published: 2025-07-17 18:31 – Updated: 2025-07-24 21:30
VLAI
Details

Island Lake WebBatch before 2025C allows Remote Code Execution via a crafted URL.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-53867"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-07-17T16:15:35Z",
    "severity": "CRITICAL"
  },
  "details": "Island Lake WebBatch before 2025C allows Remote Code Execution via a crafted URL.",
  "id": "GHSA-585m-wrg3-hrv2",
  "modified": "2025-07-24T21:30:38Z",
  "published": "2025-07-17T18:31:14Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-53867"
    },
    {
      "type": "WEB",
      "url": "https://forum.winbatch.com/index.php?topic=3253.0#new"
    },
    {
      "type": "WEB",
      "url": "https://www.winbatch.com/winbatchversions.html#WB2025C"
    },
    {
      "type": "WEB",
      "url": "http://www.webbatch.com"
    }
  ],
  "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"
    }
  ]
}

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.