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.

8284 vulnerabilities reference this CWE, most recent first.

GHSA-HX3H-9MJJ-5PMG

Vulnerability from github – Published: 2026-03-16 18:32 – Updated: 2026-03-17 18:30
VLAI
Details

LibreChat RAG API, version 0.7.0, contains a log-injection vulnerability that allows attackers to forge log entries.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-4276"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-03-16T16:16:18Z",
    "severity": "HIGH"
  },
  "details": "LibreChat RAG API, version 0.7.0, contains a log-injection vulnerability that allows attackers to forge log entries.",
  "id": "GHSA-hx3h-9mjj-5pmg",
  "modified": "2026-03-17T18:30:32Z",
  "published": "2026-03-16T18:32:03Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-4276"
    },
    {
      "type": "WEB",
      "url": "https://kb.cert.org/vuls/id/624941"
    },
    {
      "type": "WEB",
      "url": "https://www.kb.cert.org/vuls/id/624941"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-HX4X-QJ2R-6G94

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

contrib/mx_glance_sdesc.php in the mx_glance 2.3.3 module for mxBB places a critical security check within a comment because of a missing comment delimiter, which allows remote attackers to conduct remote file inclusion attacks and execute arbitrary PHP code via a URL in the mx_root_path parameter. NOTE: some sources incorrectly state that phpbb_root_path is the affected parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-5178"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-10-03T14:17:00Z",
    "severity": "MODERATE"
  },
  "details": "contrib/mx_glance_sdesc.php in the mx_glance 2.3.3 module for mxBB places a critical security check within a comment because of a missing comment delimiter, which allows remote attackers to conduct remote file inclusion attacks and execute arbitrary PHP code via a URL in the mx_root_path parameter.  NOTE: some sources incorrectly state that phpbb_root_path is the affected parameter.",
  "id": "GHSA-hx4x-qj2r-6g94",
  "modified": "2022-05-01T18:30:43Z",
  "published": "2022-05-01T18:30:43Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5178"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/36867"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4470"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/37400"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/27011"
    },
    {
      "type": "WEB",
      "url": "http://www.attrition.org/pipermail/vim/2007-October/001807.html"
    },
    {
      "type": "WEB",
      "url": "http://www.attrition.org/pipermail/vim/2007-October/001808.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/25866"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/3326"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HX6H-52MP-Q9JP

Vulnerability from github – Published: 2022-05-24 16:44 – Updated: 2024-04-04 00:02
VLAI
Details

The client in Electronic Arts (EA) Origin 10.5.36 on Windows allows template injection in the title parameter of the Origin2 URI handler. This can be used to escape the underlying AngularJS sandbox and achieve remote code execution via an origin2://game/launch URL for QtApplication QDesktopServices communication.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2019-11354"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-74",
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2019-04-19T22:29:00Z",
    "severity": "HIGH"
  },
  "details": "The client in Electronic Arts (EA) Origin 10.5.36 on Windows allows template injection in the title parameter of the Origin2 URI handler. This can be used to escape the underlying AngularJS sandbox and achieve remote code execution via an origin2://game/launch URL for QtApplication QDesktopServices communication.",
  "id": "GHSA-hx6h-52mp-q9jp",
  "modified": "2024-04-04T00:02:21Z",
  "published": "2022-05-24T16:44:00Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-11354"
    },
    {
      "type": "WEB",
      "url": "https://blog.underdogsecurity.com/rce_in_origin_client"
    },
    {
      "type": "WEB",
      "url": "https://gizmodo.com/ea-origin-users-update-your-client-now-1834079604"
    },
    {
      "type": "WEB",
      "url": "https://techcrunch.com/2019/04/16/ea-origin-bug-exposed-hackers"
    },
    {
      "type": "WEB",
      "url": "https://www.golem.de/news/sicherheitsluecke-ea-origin-fuehrte-schadcode-per-link-aus-1904-140738.html"
    },
    {
      "type": "WEB",
      "url": "https://www.pcmag.com/news/367801/security-flaw-allowed-any-app-to-run-using-eas-origin-clien"
    },
    {
      "type": "WEB",
      "url": "https://www.techradar.com/news/major-security-flaw-found-in-ea-origin-gaming-client"
    },
    {
      "type": "WEB",
      "url": "https://www.thesun.co.uk/tech/8877334/sims-4-battlefield-fifa-origin-hackers"
    },
    {
      "type": "WEB",
      "url": "https://www.trustedreviews.com/news/time-update-origin-eas-game-client-security-risk-just-installed-3697942"
    },
    {
      "type": "WEB",
      "url": "https://www.vg247.com/2019/04/17/ea-origin-security-flaw-run-malicious-code-fixed"
    },
    {
      "type": "WEB",
      "url": "http://gamasutra.com/view/news/340907/A_nowfixed_Origin_vulnerability_potentially_opened_the_client_to_hackers.php"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153375/dotProject-2.1.9-SQL-Injection.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153485/EA-Origin-Template-Injection-Remote-Code-Execution.html"
    }
  ],
  "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-HX7R-89VP-X3GJ

Vulnerability from github – Published: 2025-06-03 18:30 – Updated: 2025-06-18 15:30
VLAI
Details

In Audiocodes Mediapack MP-11x through 6.60A.369.002, a crafted POST request request may result in an unauthenticated remote user's ability to execute unauthorized code.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-32106"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-06-03T17:15:21Z",
    "severity": "CRITICAL"
  },
  "details": "In Audiocodes Mediapack MP-11x through 6.60A.369.002, a crafted POST request request may result in an unauthenticated remote user\u0027s ability to execute unauthorized code.",
  "id": "GHSA-hx7r-89vp-x3gj",
  "modified": "2025-06-18T15:30:40Z",
  "published": "2025-06-03T18:30:41Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-32106"
    },
    {
      "type": "WEB",
      "url": "https://Audiocodes.com"
    },
    {
      "type": "WEB",
      "url": "https://github.com/austin2111/papers/blob/main/CVE-2025-32105_CVE-2025-32106_Technical_Report.pdf"
    },
    {
      "type": "WEB",
      "url": "https://github.com/austin2111/papers/blob/main/Software_Vulnerabilities_in_Telecommunications_Hardware.pdf"
    }
  ],
  "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-HX9V-GJ26-R65Q

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

Hoosk v1.7.0 allows PHP code execution via a SiteUrl that is provided during installation and mishandled in config.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2018-16771"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2018-09-10T04:29:00Z",
    "severity": "CRITICAL"
  },
  "details": "Hoosk v1.7.0 allows PHP code execution via a SiteUrl that is provided during installation and mishandled in config.php.",
  "id": "GHSA-hx9v-gj26-r65q",
  "modified": "2022-05-14T02:58:24Z",
  "published": "2022-05-14T02:58:24Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2018-16771"
    },
    {
      "type": "WEB",
      "url": "https://github.com/havok89/Hoosk/issues/46"
    }
  ],
  "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"
    }
  ]
}

GHSA-HXF3-VGPM-FV9P

Vulnerability from github – Published: 2024-10-28 00:30 – Updated: 2025-02-03 13:28
VLAI
Summary
CycloneDX cdxgen may execute code contained within build-related files
Details

CycloneDX cdxgen prior to 11.1.7, when run against an untrusted codebase, may execute code contained within build-related files such as build.gradle.kts, a similar issue to CVE-2022-24441. cdxgen is used by, for example, OWASP dep-scan. NOTE: this has been characterized as a design limitation, rather than an implementation mistake.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@cyclonedx/cdxgen"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "11.1.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2024-50611"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-10-28T15:05:26Z",
    "nvd_published_at": "2024-10-27T22:15:03Z",
    "severity": "MODERATE"
  },
  "details": "CycloneDX cdxgen prior to 11.1.7, when run against an untrusted codebase, may execute code contained within build-related files such as build.gradle.kts, a similar issue to CVE-2022-24441. cdxgen is used by, for example, OWASP dep-scan. NOTE: this has been characterized as a design limitation, rather than an implementation mistake.",
  "id": "GHSA-hxf3-vgpm-fv9p",
  "modified": "2025-02-03T13:28:09Z",
  "published": "2024-10-28T00:30:48Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-50611"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CycloneDX/cdxgen/issues/1328"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CycloneDX/cdxgen/pull/1614"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/CycloneDX/cdxgen"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CycloneDX/cdxgen/releases"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CycloneDX/cdxgen/releases/tag/v11.1.7"
    },
    {
      "type": "WEB",
      "url": "https://owasp.org/www-project-dep-scan"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P",
      "type": "CVSS_V4"
    }
  ],
  "summary": "CycloneDX cdxgen may execute code contained within build-related files"
}

GHSA-HXJ5-CCFQ-HVJX

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

Apache httpd 2.0.59 and 2.2.4, with the Prefork MPM module, allows local users to cause a denial of service via certain code sequences executed in a worker process that (1) stop request processing by killing all worker processes and preventing creation of replacements or (2) hang the system by forcing the master process to fork an arbitrarily large number of worker processes. NOTE: This might be an inherent design limitation of Apache with respect to worker processes in hosted environments.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-3303"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-06-20T22:30:00Z",
    "severity": "MODERATE"
  },
  "details": "Apache httpd 2.0.59 and 2.2.4, with the Prefork MPM module, allows local users to cause a denial of service via certain code sequences executed in a worker process that (1) stop request processing by killing all worker processes and preventing creation of replacements or (2) hang the system by forcing the master process to fork an arbitrarily large number of worker processes.  NOTE: This might be an inherent design limitation of Apache with respect to worker processes in hosted environments.",
  "id": "GHSA-hxj5-ccfq-hvjx",
  "modified": "2022-05-01T18:12:23Z",
  "published": "2022-05-01T18:12:23Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-3303"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/37050"
    },
    {
      "type": "WEB",
      "url": "http://security.psnc.pl/files/apache_report.pdf"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/2814"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/469899/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/471832/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/24215"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HXM6-CC9V-9F63

Vulnerability from github – Published: 2025-05-09 18:30 – Updated: 2025-05-10 03:30
VLAI
Details

Arbitrary File Upload in user_payment_update.php in SourceCodester Client Database Management System 1.0 allows unauthenticated users to upload arbitrary files via the uploaded_file_cancelled field. Due to the absence of proper file extension checks, MIME type validation, and authentication, attackers can upload executable PHP files to a web-accessible directory (/files/). This allows them to execute arbitrary commands remotely by accessing the uploaded script, resulting in full Remote Code Execution (RCE) without authentication.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-46191"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-05-09T17:15:51Z",
    "severity": "CRITICAL"
  },
  "details": "Arbitrary File Upload in user_payment_update.php in SourceCodester Client Database Management System 1.0 allows unauthenticated users to upload arbitrary files via the uploaded_file_cancelled field. Due to the absence of proper file extension checks, MIME type validation, and authentication, attackers can upload executable PHP files to a web-accessible directory (/files/). This allows them to execute arbitrary commands remotely by accessing the uploaded script, resulting in full Remote Code Execution (RCE) without authentication.",
  "id": "GHSA-hxm6-cc9v-9f63",
  "modified": "2025-05-10T03:30:22Z",
  "published": "2025-05-09T18:30:39Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-46191"
    },
    {
      "type": "WEB",
      "url": "https://github.com/x6vrn/mitre/blob/main/CVE-2025-46191.md"
    },
    {
      "type": "WEB",
      "url": "https://portswigger.net/web-security/file-upload"
    }
  ],
  "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-HXMH-2XC4-C894

Vulnerability from github – Published: 2026-05-26 13:30 – Updated: 2026-06-30 17:50
VLAI
Summary
Dolibarr ERP CRM contains a remote code evaluation vulnerability
Details

Dolibarr ERP CRM 7.0.3 contains a remote code evaluation vulnerability that allows unauthenticated attackers to execute arbitrary code by injecting PHP code through the db_name parameter. Attackers can send a POST request to install/step1.php with malicious PHP code in the db_name parameter, then execute commands via the check.php endpoint using the cmd GET parameter.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 7.0.3"
      },
      "package": {
        "ecosystem": "Packagist",
        "name": "dolibarr/dolibarr"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "7.0.0"
            },
            {
              "fixed": "7.0.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "dolibarr/dolibarr"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "6.0.8"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2018-25357"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-06-30T17:50:52Z",
    "nvd_published_at": "2026-05-23T19:16:56Z",
    "severity": "CRITICAL"
  },
  "details": "Dolibarr ERP CRM 7.0.3 contains a remote code evaluation vulnerability that allows unauthenticated attackers to execute arbitrary code by injecting PHP code through the db_name parameter. Attackers can send a POST request to install/step1.php with malicious PHP code in the db_name parameter, then execute commands via the check.php endpoint using the cmd GET parameter.",
  "id": "GHSA-hxmh-2xc4-c894",
  "modified": "2026-06-30T17:50:52Z",
  "published": "2026-05-26T13:30:27Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2018-25357"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Dolibarr/dolibarr/issues/9032"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Dolibarr/dolibarr/commit/41709f07d0aef384723164877395ed081b44b810"
    },
    {
      "type": "WEB",
      "url": "https://dolibarr.org"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/Dolibarr/dolibarr"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/44964"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/dolibarr-erp-crm-remote-code-evaluation-via-install-step1-php"
    }
  ],
  "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"
    },
    {
      "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Dolibarr ERP CRM contains a remote code evaluation vulnerability"
}

GHSA-HXP2-X3CH-HV5V

Vulnerability from github – Published: 2025-08-22 21:31 – Updated: 2025-08-22 21:31
VLAI
Details

Voltronic Power ViewPower through 1.04-24215, ViewPower Pro through 2.0-22165, and PowerShield Netguard before 1.04-23292 allows a remote attacker to run arbitrary code via an unspecified web interface related to detection of a managed UPS shutting down. An unauthenticated attacker can use this to run arbitrary code immediately regardless of any managed UPS state or presence.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-31491"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-08-22T20:15:31Z",
    "severity": "CRITICAL"
  },
  "details": "Voltronic Power ViewPower through 1.04-24215, ViewPower Pro through 2.0-22165, and PowerShield Netguard before 1.04-23292 allows a remote attacker to run arbitrary code via an unspecified web interface related to detection of a managed UPS shutting down. An unauthenticated attacker can use this to run arbitrary code immediately regardless of any managed UPS state or presence.",
  "id": "GHSA-hxp2-x3ch-hv5v",
  "modified": "2025-08-22T21:31:16Z",
  "published": "2025-08-22T21:31:16Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-31491"
    },
    {
      "type": "WEB",
      "url": "https://www.cisa.gov/news-events/ics-advisories/icsa-25-182-05"
    },
    {
      "type": "WEB",
      "url": "https://www.ready2disclose.com/vpow-31491-43110"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/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.