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.

8342 vulnerabilities reference this CWE, most recent first.

GHSA-CMPJ-5W72-JQ28

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

Sun Java Web Start and Java Plug-in for JDK and JRE 6 Update 10 and earlier; JDK and JRE 5.0 Update 16 and earlier; and SDK and JRE 1.4.2_18 and earlier allow remote attackers to execute arbitrary code via a crafted jnlp file that modifies the (1) java.home, (2) java.ext.dirs, or (3) user.home System Properties, aka "Java Web Start File Inclusion" and CR 6694892.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-2086"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-12-05T02:30:00Z",
    "severity": "HIGH"
  },
  "details": "Sun Java Web Start and Java Plug-in for JDK and JRE 6 Update 10 and earlier; JDK and JRE 5.0 Update 16 and earlier; and SDK and JRE 1.4.2_18 and earlier allow remote attackers to execute arbitrary code via a crafted jnlp file that modifies the (1) java.home, (2) java.ext.dirs, or (3) user.home System Properties, aka \"Java Web Start File Inclusion\" and CR 6694892.",
  "id": "GHSA-cmpj-5w72-jq28",
  "modified": "2022-05-01T23:46:35Z",
  "published": "2022-05-01T23:46:35Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-2086"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A5601"
    },
    {
      "type": "WEB",
      "url": "http://lists.apple.com/archives/security-announce/2009/Feb/msg00003.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2009-01/msg00009.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2009-04/msg00004.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2009-05/msg00000.html"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=123678756409861\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=126583436323697\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/50510"
    },
    {
      "type": "WEB",
      "url": "http://rhn.redhat.com/errata/RHSA-2008-1025.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/32991"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/33015"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/33528"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/33710"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/34233"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/34605"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/34889"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/35065"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/37386"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/38539"
    },
    {
      "type": "WEB",
      "url": "http://security.gentoo.org/glsa/glsa-200911-02.xml"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/4693"
    },
    {
      "type": "WEB",
      "url": "http://sunsolve.sun.com/search/document.do?assetkey=1-26-244988-1"
    },
    {
      "type": "WEB",
      "url": "http://support.avaya.com/elmodocs2/security/ASA-2008-486.htm"
    },
    {
      "type": "WEB",
      "url": "http://support.avaya.com/elmodocs2/security/ASA-2009-012.htm"
    },
    {
      "type": "WEB",
      "url": "http://support.nortel.com/go/main.jsp?cscat=BLTNDETAIL\u0026DocumentOID=829914\u0026poid="
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2008-1018.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2009-0015.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2009-0016.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2009-0445.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/498907/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/32620"
    },
    {
      "type": "WEB",
      "url": "http://www.securitytracker.com/id?1021318"
    },
    {
      "type": "WEB",
      "url": "http://www.us-cert.gov/cas/techalerts/TA08-340A.html"
    },
    {
      "type": "WEB",
      "url": "http://www.vsecurity.com/bulletins/advisories/2008/JWS-props.txt"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2009/0424"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2009/0672"
    },
    {
      "type": "WEB",
      "url": "http://www116.nortel.com/pub/repository/CLARIFY/DOCUMENT/2009/03/024431-01.pdf"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CMQ2-RRCP-64GF

Vulnerability from github – Published: 2022-05-24 16:57 – Updated: 2022-05-24 16:57
VLAI
Details

The KSLABS KSWEB (aka ru.kslabs.ksweb) application 3.93 for Android allows authenticated remote code execution via a POST request to the AJAX handler with the configFile parameter set to the arbitrary file to be written to (and the config_text parameter set to the content of the file to be created). This can be a PHP file that is written to in the public web directory and subsequently executed. The attacker must have network connectivity to the PHP server that is running on the Android device.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2019-15766"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2019-10-03T21:15:00Z",
    "severity": "HIGH"
  },
  "details": "The KSLABS KSWEB (aka ru.kslabs.ksweb) application 3.93 for Android allows authenticated remote code execution via a POST request to the AJAX handler with the configFile parameter set to the arbitrary file to be written to (and the config_text parameter set to the content of the file to be created). This can be a PHP file that is written to in the public web directory and subsequently executed. The attacker must have network connectivity to the PHP server that is running on the Android device.",
  "id": "GHSA-cmq2-rrcp-64gf",
  "modified": "2022-05-24T16:57:49Z",
  "published": "2022-05-24T16:57:49Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-15766"
    },
    {
      "type": "WEB",
      "url": "https://play.google.com/store/apps/details?id=ru.kslabs.ksweb\u0026gl=GB"
    },
    {
      "type": "WEB",
      "url": "https://rastating.github.io/ksweb-android-remote-code-execution"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CMQP-JVJ8-33WX

Vulnerability from github – Published: 2026-07-18 21:30 – Updated: 2026-07-18 21:30
VLAI
Details

A vulnerability has been found in CartoDB carto-api-client 0.5.29. This impacts the function addFilter of the file src/filters.ts. Such manipulation of the argument column leads to improperly controlled modification of object prototype attributes. The attack can be executed remotely. The project was informed of the problem early through an issue report but has not responded yet.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-16151"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-07-18T20:17:30Z",
    "severity": "MODERATE"
  },
  "details": "A vulnerability has been found in CartoDB carto-api-client 0.5.29. This impacts the function addFilter of the file src/filters.ts. Such manipulation of the argument column leads to improperly controlled modification of object prototype attributes. The attack can be executed remotely. The project was informed of the problem early through an issue report but has not responded yet.",
  "id": "GHSA-cmqp-jvj8-33wx",
  "modified": "2026-07-18T21:30:23Z",
  "published": "2026-07-18T21:30:23Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-16151"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CartoDB/carto-api-client/issues/299"
    },
    {
      "type": "WEB",
      "url": "https://github.com/CartoDB/carto-api-client"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/cve/CVE-2026-16151"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/submit/857043"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/vuln/379917"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/vuln/379917/cti"
    }
  ],
  "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-CMVJ-3PJ4-HRR7

Vulnerability from github – Published: 2025-05-21 18:33 – Updated: 2025-05-21 21:31
VLAI
Details

An issue in Valvesoftware Steam Client Steam Client 1738026274 allows attackers to escalate privileges via a crafted executable or DLL.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-27998"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-05-21T16:15:31Z",
    "severity": "HIGH"
  },
  "details": "An issue in Valvesoftware Steam Client Steam Client 1738026274 allows attackers to escalate privileges via a crafted executable or DLL.",
  "id": "GHSA-cmvj-3pj4-hrr7",
  "modified": "2025-05-21T21:31:38Z",
  "published": "2025-05-21T18:33:30Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-27998"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/sornram9254/e8d10efcf246cc50ff3d4f837b261616"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CMX3-WHXW-V8MP

Vulnerability from github – Published: 2024-02-02 12:30 – Updated: 2025-06-17 18:31
VLAI
Details

An issue in Blurams Lumi Security Camera (A31C) v23.0406.435.4120 allows attackers to execute arbitrary code.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-50488"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-02-02T10:15:08Z",
    "severity": "CRITICAL"
  },
  "details": "An issue in Blurams Lumi Security Camera (A31C) v23.0406.435.4120 allows attackers to execute arbitrary code.",
  "id": "GHSA-cmx3-whxw-v8mp",
  "modified": "2025-06-17T18:31:32Z",
  "published": "2024-02-02T12:30:30Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-50488"
    },
    {
      "type": "WEB",
      "url": "https://github.com/roman-mueller/PoC/tree/master/CVE-2023-50488"
    },
    {
      "type": "WEB",
      "url": "https://infosec.rm-it.de/2024/02/01/blurams-lumi-security-camera-analysis"
    }
  ],
  "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-CP2P-6XH4-JMCP

Vulnerability from github – Published: 2023-01-02 18:30 – Updated: 2023-10-20 22:38
VLAI
Summary
nterchange Code Injection vulnerability
Details

A vulnerability was found in nterchange up to 4.1.0. It has been rated as critical. This issue affects the function getContent of the file app/controllers/code_caller_controller.php. The manipulation of the argument q with the input %5C%27%29;phpinfo%28%29;/* leads to code injection. The exploit has been disclosed to the public and may be used. Upgrading to version 4.1.1 is able to address this issue. The name of the patch is fba7d89176fba8fe289edd58835fe45080797d99. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217187.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "nonfiction/nterchange"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "4.1.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2015-10009"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-10-20T22:38:12Z",
    "nvd_published_at": "2023-01-02T16:15:00Z",
    "severity": "CRITICAL"
  },
  "details": "A vulnerability was found in nterchange up to 4.1.0. It has been rated as critical. This issue affects the function getContent of the file `app/controllers/code_caller_controller.php`. The manipulation of the argument q with the input %5C%27%29;phpinfo%28%29;/* leads to code injection. The exploit has been disclosed to the public and may be used. Upgrading to version 4.1.1 is able to address this issue. The name of the patch is fba7d89176fba8fe289edd58835fe45080797d99. It is recommended to upgrade the affected component. The associated identifier of this vulnerability is VDB-217187.",
  "id": "GHSA-cp2p-6xh4-jmcp",
  "modified": "2023-10-20T22:38:12Z",
  "published": "2023-01-02T18:30:27Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2015-10009"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nonfiction/nterchange_backend/commit/fba7d89176fba8fe289edd58835fe45080797d99"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nonfiction/nterchange_backend"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nonfiction/nterchange_backend/releases/tag/4.1.1"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?ctiid.217187"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?id.217187"
    }
  ],
  "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"
    }
  ],
  "summary": "nterchange Code Injection vulnerability"
}

GHSA-CP3H-563P-CMFG

Vulnerability from github – Published: 2022-05-01 23:55 – Updated: 2025-04-09 03:56
VLAI
Details

Unspecified vulnerability in the WEC Discussion Forum (wec_discussion) extension 1.6.2 and earlier for TYPO3 allows attackers to execute arbitrary code via vectors related to "certain file types."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-3043"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-07-07T18:41:00Z",
    "severity": "HIGH"
  },
  "details": "Unspecified vulnerability in the WEC Discussion Forum (wec_discussion) extension 1.6.2 and earlier for TYPO3 allows attackers to execute arbitrary code via vectors related to \"certain file types.\"",
  "id": "GHSA-cp3h-563p-cmfg",
  "modified": "2025-04-09T03:56:08Z",
  "published": "2022-05-01T23:55:58Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-3043"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/43512"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/30905"
    },
    {
      "type": "WEB",
      "url": "http://typo3.org/teams/security/security-bulletins/typo3-20080701-4"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/30026"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CP8F-5JP9-RQMH

Vulnerability from github – Published: 2022-05-13 01:14 – Updated: 2025-10-22 00:31
VLAI
Details

Kibana versions before 5.6.15 and 6.6.1 contain an arbitrary code execution flaw in the Timelion visualizer. An attacker with access to the Timelion application could send a request that will attempt to execute javascript code. This could possibly lead to an attacker executing arbitrary commands with permissions of the Kibana process on the host system.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2019-7609"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2019-03-25T19:29:00Z",
    "severity": "CRITICAL"
  },
  "details": "Kibana versions before 5.6.15 and 6.6.1 contain an arbitrary code execution flaw in the Timelion visualizer. An attacker with access to the Timelion application could send a request that will attempt to execute javascript code. This could possibly lead to an attacker executing arbitrary commands with permissions of the Kibana process on the host system.",
  "id": "GHSA-cp8f-5jp9-rqmh",
  "modified": "2025-10-22T00:31:37Z",
  "published": "2022-05-13T01:14:26Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-7609"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHBA-2019:2824"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHSA-2019:2860"
    },
    {
      "type": "WEB",
      "url": "https://discuss.elastic.co/t/elastic-stack-6-6-1-and-5-6-15-security-update/169077"
    },
    {
      "type": "WEB",
      "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2019-7609"
    },
    {
      "type": "WEB",
      "url": "https://www.elastic.co/community/security"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/174569/Kibana-Timelion-Prototype-Pollution-Remote-Code-Execution.html"
    }
  ],
  "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"
    }
  ]
}

GHSA-CP8M-FJ8Q-88FM

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

VMware vCenter Server Appliance (vCSA) 5.1 before Update 1 allows remote authenticated users to execute arbitrary programs with root privileges by leveraging Virtual Appliance Management Interface (VAMI) access.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-3079"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-05-01T12:00:00Z",
    "severity": "HIGH"
  },
  "details": "VMware vCenter Server Appliance (vCSA) 5.1 before Update 1 allows remote authenticated users to execute arbitrary programs with root privileges by leveraging Virtual Appliance Management Interface (VAMI) access.",
  "id": "GHSA-cp8m-fj8q-88fm",
  "modified": "2022-05-17T05:10:47Z",
  "published": "2022-05-17T05:10:47Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-3079"
    },
    {
      "type": "WEB",
      "url": "http://www.vmware.com/security/advisories/VMSA-2013-0006.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CP8R-2JWF-Q8JJ

Vulnerability from github – Published: 2024-04-10 15:30 – Updated: 2024-08-01 15:31
VLAI
Details

Leantime 3.0.6 is vulnerable to HTML Injection via /dashboard/show#/tickets/newTicket.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-27476"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-04-10T15:16:04Z",
    "severity": "MODERATE"
  },
  "details": "Leantime 3.0.6 is vulnerable to HTML Injection via /dashboard/show#/tickets/newTicket.",
  "id": "GHSA-cp8r-2jwf-q8jj",
  "modified": "2024-08-01T15:31:38Z",
  "published": "2024-04-10T15:30:40Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-27476"
    },
    {
      "type": "WEB",
      "url": "https://drive.proton.me/urls/X9G9MY1FAW#NLS8RkHUihLY"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Leantime/leantime/blob/264a7dbc2c9b18f574821bf27dd568a287ee8498/app/Domain/Tickets/Controllers/ShowTicket.php#L20"
    },
    {
      "type": "WEB",
      "url": "https://github.com/dead1nfluence/Leantime-POC/blob/main/README.md"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/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.