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.

8285 vulnerabilities reference this CWE, most recent first.

GHSA-HGR8-G756-VMG9

Vulnerability from github – Published: 2022-05-17 00:18 – Updated: 2024-04-23 23:01
VLAI
Summary
Zeta Components Mail Arbitrary code execution via a crafted email address
Details

The send function in the ezcMailMtaTransport class in Zeta Components Mail before 1.8.2 does not properly restrict the set of characters used in the ezcMail returnPath property, which might allow remote attackers to execute arbitrary code via a crafted email address, as demonstrated by one containing "-X/path/to/wwwroot/file.php."

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "zetacomponents/mail"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.8.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2017-15806"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-04-23T23:01:34Z",
    "nvd_published_at": "2017-11-15T16:29:00Z",
    "severity": "HIGH"
  },
  "details": "The send function in the ezcMailMtaTransport class in Zeta Components Mail before 1.8.2 does not properly restrict the set of characters used in the ezcMail returnPath property, which might allow remote attackers to execute arbitrary code via a crafted email address, as demonstrated by one containing \"-X/path/to/wwwroot/file.php.\"",
  "id": "GHSA-hgr8-g756-vmg9",
  "modified": "2024-04-23T23:01:34Z",
  "published": "2022-05-17T00:18:44Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2017-15806"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zetacomponents/Mail/issues/58"
    },
    {
      "type": "WEB",
      "url": "https://github.com/FriendsOfPHP/security-advisories/blob/master/zetacomponents/mail/CVE-2017-15806.yaml"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/zetacomponents/Mail"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zetacomponents/Mail/releases/tag/1.8.2"
    },
    {
      "type": "WEB",
      "url": "https://kay-malwarebenchmark.github.io/blog/cve-2017-15806-critical-rce-vulnerability"
    },
    {
      "type": "WEB",
      "url": "https://kay-malwarebenchmark.github.io/blog/cve-2017-15806-yuan-cheng-dai-ma-zhi-xing-lou-dong"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/43155"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/101866"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Zeta Components Mail Arbitrary code execution via a crafted email address"
}

GHSA-HGRC-R3FF-WXFQ

Vulnerability from github – Published: 2024-01-24 00:30 – Updated: 2025-11-03 21:30
VLAI
Details

An issue was discovered in badaix Snapcast version 0.27.0, allows remote attackers to execute arbitrary code and gain sensitive information via crafted request in JSON-RPC-API.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-36177"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-01-23T22:15:16Z",
    "severity": "CRITICAL"
  },
  "details": "An issue was discovered in badaix Snapcast version 0.27.0, allows remote attackers to execute arbitrary code and gain sensitive information via crafted request in JSON-RPC-API.",
  "id": "GHSA-hgrc-r3ff-wxfq",
  "modified": "2025-11-03T21:30:59Z",
  "published": "2024-01-24T00:30:32Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-36177"
    },
    {
      "type": "WEB",
      "url": "https://lists.debian.org/debian-lts-announce/2025/07/msg00015.html"
    },
    {
      "type": "WEB",
      "url": "https://oxnan.com/posts/Snapcast_jsonrpc_rce"
    },
    {
      "type": "WEB",
      "url": "http://snapcast.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"
    }
  ]
}

GHSA-HGV6-5HXF-XV66

Vulnerability from github – Published: 2024-01-11 00:30 – Updated: 2024-01-18 15:30
VLAI
Details

This issue was addressed by forcing hardened runtime on the affected binaries at the system level. This issue is fixed in macOS Monterey 12.6.6, macOS Big Sur 11.7.7, macOS Ventura 13.4. An app may be able to inject code into sensitive binaries bundled with Xcode.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-32383"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-01-10T22:15:47Z",
    "severity": "HIGH"
  },
  "details": "This issue was addressed by forcing hardened runtime on the affected binaries at the system level. This issue is fixed in macOS Monterey 12.6.6, macOS Big Sur 11.7.7, macOS Ventura 13.4. An app may be able to inject code into sensitive binaries bundled with Xcode.",
  "id": "GHSA-hgv6-5hxf-xv66",
  "modified": "2024-01-18T15:30:35Z",
  "published": "2024-01-11T00:30:24Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-32383"
    },
    {
      "type": "WEB",
      "url": "https://support.apple.com/en-us/HT213758"
    },
    {
      "type": "WEB",
      "url": "https://support.apple.com/en-us/HT213759"
    },
    {
      "type": "WEB",
      "url": "https://support.apple.com/en-us/HT213760"
    }
  ],
  "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-HH2X-4QPH-X5HF

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

The Oracle Siebel Option Pack for IE ActiveX control does not properly initialize memory that is used by the NewBusObj method, which allows remote attackers to execute arbitrary code via a crafted HTML document.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2009-3737"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2010-08-17T20:00:00Z",
    "severity": "HIGH"
  },
  "details": "The Oracle Siebel Option Pack for IE ActiveX control does not properly initialize memory that is used by the NewBusObj method, which allows remote attackers to execute arbitrary code via a crafted HTML document.",
  "id": "GHSA-hh2x-4qph-x5hf",
  "modified": "2022-05-02T03:48:07Z",
  "published": "2022-05-02T03:48:07Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2009-3737"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/40804"
    },
    {
      "type": "WEB",
      "url": "http://www.kb.cert.org/vuls/id/174089"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/66926"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2010/2028"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HH2X-7MF9-78FR

Vulnerability from github – Published: 2022-05-17 03:20 – Updated: 2023-01-27 00:53
VLAI
Summary
Sup Code Injection vulnerability
Details

lib/sup/message_chunks.rb in Sup before 0.13.2.1 and 0.14.x before 0.14.1.1 allows remote attackers to execute arbitrary commands via shell metacharacters in the content_type of an email attachment.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "sup"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.13.2.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "sup"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.14.0"
            },
            {
              "fixed": "0.14.1.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2013-4479"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-01-27T00:53:07Z",
    "nvd_published_at": "2013-12-07T20:55:00Z",
    "severity": "MODERATE"
  },
  "details": "`lib/sup/message_chunks.rb` in Sup before 0.13.2.1 and 0.14.x before 0.14.1.1 allows remote attackers to execute arbitrary commands via shell metacharacters in the content_type of an email attachment.",
  "id": "GHSA-hh2x-7mf9-78fr",
  "modified": "2023-01-27T00:53:07Z",
  "published": "2022-05-17T03:20:59Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-4479"
    },
    {
      "type": "WEB",
      "url": "https://github.com/sup-heliotrope/sup/commit/ca0302e0c716682d2de22e9136400c704cc93e42"
    },
    {
      "type": "WEB",
      "url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sup/CVE-2013-4479.yml"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/sup-heliotrope/sup"
    },
    {
      "type": "WEB",
      "url": "https://web.archive.org/web/20140524005344/http://rubyforge.org/pipermail/sup-talk/2013-October/004996.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.fedoraproject.org/pipermail/package-announce/2015-September/165917.html"
    },
    {
      "type": "WEB",
      "url": "http://rubyforge.org/pipermail/sup-talk/2013-October/004996.html"
    },
    {
      "type": "WEB",
      "url": "http://seclists.org/fulldisclosure/2013/Oct/272"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55294"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55400"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2012/dsa-2805"
    },
    {
      "type": "WEB",
      "url": "http://www.openwall.com/lists/oss-security/2013/10/30/2"
    },
    {
      "type": "WEB",
      "url": "http://www.phenoelit.org/stuff/whatsup.txt"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [],
  "summary": "Sup Code Injection vulnerability"
}

GHSA-HH4J-QWC4-7XF5

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

Multiple PHP remote file inclusion vulnerabilities in DataFeedFile (DFF) PHP Framework API allow remote attackers to execute arbitrary PHP code via a URL in the DFF_config[dir_include] parameter to (1) DFF_affiliate_client_API.php, (2) DFF_featured_prdt.func.php, (3) DFF_mer.func.php, (4) DFF_mer_prdt.func.php, (5) DFF_paging.func.php, (6) DFF_rss.func.php, and (7) DFF_sku.func.php in include/.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-4502"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-10-09T00:00:00Z",
    "severity": "HIGH"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in DataFeedFile (DFF) PHP Framework API allow remote attackers to execute arbitrary PHP code via a URL in the DFF_config[dir_include] parameter to (1) DFF_affiliate_client_API.php, (2) DFF_featured_prdt.func.php, (3) DFF_mer.func.php, (4) DFF_mer_prdt.func.php, (5) DFF_paging.func.php, (6) DFF_rss.func.php, and (7) DFF_sku.func.php in include/.",
  "id": "GHSA-hh4j-qwc4-7xf5",
  "modified": "2022-05-02T00:10:40Z",
  "published": "2022-05-02T00:10:40Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-4502"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/45764"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/6700"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/32166"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/4370"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/31644"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HHC2-FFW9-RJR6

Vulnerability from github – Published: 2022-05-17 01:04 – Updated: 2025-04-11 03:38
VLAI
Details

The normalizeDocument function in Mozilla Firefox before 3.5.12 and 3.6.x before 3.6.9, Thunderbird before 3.0.7 and 3.1.x before 3.1.3, and SeaMonkey before 2.0.7 does not properly handle the removal of DOM nodes during normalization, which might allow remote attackers to execute arbitrary code via vectors involving access to a deleted object.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2010-2766"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2010-09-09T19:00:00Z",
    "severity": "HIGH"
  },
  "details": "The normalizeDocument function in Mozilla Firefox before 3.5.12 and 3.6.x before 3.6.9, Thunderbird before 3.0.7 and 3.1.x before 3.1.3, and SeaMonkey before 2.0.7 does not properly handle the removal of DOM nodes during normalization, which might allow remote attackers to execute arbitrary code via vectors involving access to a deleted object.",
  "id": "GHSA-hhc2-ffw9-rjr6",
  "modified": "2025-04-11T03:38:50Z",
  "published": "2022-05-17T01:04:51Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2010-2766"
    },
    {
      "type": "WEB",
      "url": "https://bugzilla.mozilla.org/show_bug.cgi?id=580445"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A11778"
    },
    {
      "type": "WEB",
      "url": "http://blogs.sun.com/security/entry/multiple_vulnerabilities_in_mozilla_firefox"
    },
    {
      "type": "WEB",
      "url": "http://lists.fedoraproject.org/pipermail/package-announce/2010-September/047282.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2010-10/msg00002.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/42867"
    },
    {
      "type": "WEB",
      "url": "http://support.avaya.com/css/P8/documents/100112690"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2010/dsa-2106"
    },
    {
      "type": "WEB",
      "url": "http://www.mandriva.com/security/advisories?name=MDVSA-2010:173"
    },
    {
      "type": "WEB",
      "url": "http://www.mozilla.org/security/announce/2010/mfsa2010-57.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/43100"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2010/2323"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2011/0061"
    },
    {
      "type": "WEB",
      "url": "http://www.zerodayinitiative.com/advisories/ZDI-10-176"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HHGM-J3W3-6P82

Vulnerability from github – Published: 2022-05-01 23:54 – Updated: 2022-05-01 23:54
VLAI
Details

PHP remote file inclusion vulnerability in src/browser/resource/categories/resource_categories_view.php in Open Digital Assets Repository System (ODARS) 1.0.2, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the CLASSES_ROOT parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-2885"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-06-27T18:41:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in src/browser/resource/categories/resource_categories_view.php in Open Digital Assets Repository System (ODARS) 1.0.2, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the CLASSES_ROOT parameter.",
  "id": "GHSA-hhgm-j3w3-6p82",
  "modified": "2022-05-01T23:54:30Z",
  "published": "2022-05-01T23:54:30Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-2885"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/43285"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/5906"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/30784"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/29881"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-HHM9-WQQX-P8HF

Vulnerability from github – Published: 2025-05-08 06:30 – Updated: 2025-05-08 06:30
VLAI
Details

The Wolmart | Multi-Vendor Marketplace WooCommerce Theme theme for WordPress is vulnerable to arbitrary shortcode execution in all versions up to, and including, 1.8.11. This is due to the software allowing users to execute an action that does not properly validate a value before running do_shortcode. This makes it possible for unauthenticated attackers to execute arbitrary shortcodes.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-13793"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-05-08T05:15:50Z",
    "severity": "HIGH"
  },
  "details": "The Wolmart | Multi-Vendor Marketplace WooCommerce Theme theme for WordPress is vulnerable to arbitrary shortcode execution in all versions up to, and including, 1.8.11. This is due to the software allowing users to execute an action that does not properly validate a value before running do_shortcode. This makes it possible for unauthenticated attackers to execute arbitrary shortcodes.",
  "id": "GHSA-hhm9-wqqx-p8hf",
  "modified": "2025-05-08T06:30:33Z",
  "published": "2025-05-08T06:30:33Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-13793"
    },
    {
      "type": "WEB",
      "url": "https://themeforest.net/item/wolmart-multivendor-marketplace-woocommerce-theme/32947681#item-description__changelog"
    },
    {
      "type": "WEB",
      "url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/6eb57c97-f560-42d1-87bd-b19c60700956?source=cve"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-HHR2-6RP6-2V7M

Vulnerability from github – Published: 2026-04-22 21:31 – Updated: 2026-04-22 21:31
VLAI
Details

The Avada (Fusion) Builder plugin for WordPress is vulnerable to Arbitrary WordPress Action Execution in all versions up to, and including, 3.15.1. This is due to the plugin's output_action_hook() function accepting user-controlled input to trigger any registered WordPress action hook without proper authorization checks. This makes it possible for authenticated attackers, with Subscriber-level access and above, to execute arbitrary WordPress action hooks via the Dynamic Data feature, potentially leading to privilege escalation, file inclusion, denial of service, or other security impacts depending on which action hooks are available in the WordPress installation.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-1509"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-04-15T04:17:33Z",
    "severity": "MODERATE"
  },
  "details": "The Avada (Fusion) Builder plugin for WordPress is vulnerable to Arbitrary WordPress Action Execution in all versions up to, and including, 3.15.1. This is due to the plugin\u0027s `output_action_hook()` function accepting user-controlled input to trigger any registered WordPress action hook without proper authorization checks. This makes it possible for authenticated attackers, with Subscriber-level access and above, to execute arbitrary WordPress action hooks via the Dynamic Data feature, potentially leading to privilege escalation, file inclusion, denial of service, or other security impacts depending on which action hooks are available in the WordPress installation.",
  "id": "GHSA-hhr2-6rp6-2v7m",
  "modified": "2026-04-22T21:31:44Z",
  "published": "2026-04-22T21:31:43Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-1509"
    },
    {
      "type": "WEB",
      "url": "https://avada.com/documentation/avada-changelog"
    },
    {
      "type": "WEB",
      "url": "https://themeforest.net/item/avada-responsive-multipurpose-theme/2833226"
    },
    {
      "type": "WEB",
      "url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/fdc57b06-bae9-49a3-84dd-f593705330e9?source=cve"
    }
  ],
  "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"
    }
  ]
}

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.