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-F3XC-CHGR-4VVJ

Vulnerability from github – Published: 2022-07-29 00:00 – Updated: 2022-08-04 00:00
VLAI
Details

In JetBrains IntelliJ IDEA before 2022.2 local code execution via a Vagrant executable was possible

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-37009"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-07-28T11:15:00Z",
    "severity": "HIGH"
  },
  "details": "In JetBrains IntelliJ IDEA before 2022.2 local code execution via a Vagrant executable was possible",
  "id": "GHSA-f3xc-chgr-4vvj",
  "modified": "2022-08-04T00:00:15Z",
  "published": "2022-07-29T00:00:48Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-37009"
    },
    {
      "type": "WEB",
      "url": "https://www.jetbrains.com/privacy-security/issues-fixed"
    }
  ],
  "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-F3XF-X8W4-HFX8

Vulnerability from github – Published: 2026-07-02 12:31 – Updated: 2026-07-02 12:31
VLAI
Details

Unauthenticated Remote Code Execution (RCE) in Blocksy Companion Pro <= 2.1.46 versions.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-57624"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-07-02T12:17:37Z",
    "severity": "CRITICAL"
  },
  "details": "Unauthenticated Remote Code Execution (RCE) in Blocksy Companion Pro \u003c= 2.1.46 versions.",
  "id": "GHSA-f3xf-x8w4-hfx8",
  "modified": "2026-07-02T12:31:01Z",
  "published": "2026-07-02T12:31:01Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-57624"
    },
    {
      "type": "WEB",
      "url": "https://patchstack.com/database/wordpress/plugin/blocksy-companion-pro/vulnerability/wordpress-blocksy-companion-pro-plugin-2-1-46-remote-code-execution-rce-vulnerability?_s_id=cve"
    }
  ],
  "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-F425-PFVH-X64X

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

PHP remote file inclusion vulnerability in install/config.php in Picturesolution 2.1 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the path parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-5313"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-10-09T21:17:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in install/config.php in Picturesolution 2.1 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the path parameter.",
  "id": "GHSA-f425-pfvh-x64x",
  "modified": "2022-05-01T18:32:15Z",
  "published": "2022-05-01T18:32:15Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5313"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/37006"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4492"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/38643"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/25961"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/3431"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-F456-RF33-4626

Vulnerability from github – Published: 2026-01-22 18:09 – Updated: 2026-02-27 22:18
VLAI
Summary
Orval Mock Generation Code Injection via const
Details

I am reporting a code injection vulnerability in Orval’s mock generation pipeline affecting @orval/mock in both the 7.x and 8.x series. This issue is related in impact to the previously reported enum x-enumDescriptions (https://github.com/advisories/GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core.

The vulnerability allows untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. I have confirmed that this occurs on orval@7.19.0 and orval@8.0.2 with mock: true, and that the generated mocks contain executable payloads such as require('child_process').execSync('id') in the output TypeScript.

openapi: 3.1.0
info:
  title: Mock Const Injection PoC
  version: 1.0.0
paths:
  /test:
    get:
      operationId: getTests
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tests'
components:
  schemas:
    Tests:
      type: object
      properties:
        EvilString:
          type: string
          const: "'); require('child_process').execSync('id'); //"
        EvilNumber:
          type: number
          const: "0); require('child_process').execSync('id'); //"
        SafeEnum:
          type: string
          enum: ["test"]

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@orval/mock"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "7.20.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "npm",
        "name": "@orval/mock"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "8.0.0-rc.0"
            },
            {
              "fixed": "8.0.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-24132"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-77",
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-01-22T18:09:13Z",
    "nvd_published_at": "2026-01-23T00:15:52Z",
    "severity": "HIGH"
  },
  "details": "I am reporting a code injection vulnerability in Orval\u2019s mock generation pipeline affecting @orval/mock in both the 7.x and 8.x series. This issue is related in impact to the previously reported enum x-enumDescriptions (https://github.com/advisories/GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core.\n\nThe vulnerability allows untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. I have confirmed that this occurs on orval@7.19.0 and orval@8.0.2 with mock: true, and that the generated mocks contain executable payloads such as require(\u0027child_process\u0027).execSync(\u0027id\u0027) in the output TypeScript.\n\n```yaml\nopenapi: 3.1.0\ninfo:\n  title: Mock Const Injection PoC\n  version: 1.0.0\npaths:\n  /test:\n    get:\n      operationId: getTests\n      responses:\n        \u0027200\u0027:\n          description: OK\n          content:\n            application/json:\n              schema:\n                $ref: \u0027#/components/schemas/Tests\u0027\ncomponents:\n  schemas:\n    Tests:\n      type: object\n      properties:\n        EvilString:\n          type: string\n          const: \"\u0027); require(\u0027child_process\u0027).execSync(\u0027id\u0027); //\"\n        EvilNumber:\n          type: number\n          const: \"0); require(\u0027child_process\u0027).execSync(\u0027id\u0027); //\"\n        SafeEnum:\n          type: string\n          enum: [\"test\"]\n\n```",
  "id": "GHSA-f456-rf33-4626",
  "modified": "2026-02-27T22:18:34Z",
  "published": "2026-01-22T18:09:13Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/security/advisories/GHSA-f456-rf33-4626"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-24132"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/pull/2828"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/pull/2829"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/pull/2830"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/commit/44ca8c1f5f930a3e4cefb6b79b38bcde7f8532a5"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/commit/6d8ece07ccb80693ad43edabccb3957aceadcd06"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/commit/9b211cddc9f009f8a671e4ac5c6cb72cd8646b62"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/orval-labs/orval"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/releases/tag/v7.20.0"
    },
    {
      "type": "WEB",
      "url": "https://github.com/orval-labs/orval/releases/tag/v8.0.3"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Orval Mock Generation Code Injection via const"
}

GHSA-F469-V24C-6RXV

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

Buffer overflow in the ExtractCab function in the HPISDataManagerLib.Datamgr ActiveX control in HPISDataManager.dll in HP Instant Support before 1.0.0.24 allows remote attackers to execute arbitrary code via a long first argument, a different vulnerability than CVE-2007-5605, CVE-2007-5606, and CVE-2007-5607.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-5604"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-06-04T20:32:00Z",
    "severity": "HIGH"
  },
  "details": "Buffer overflow in the ExtractCab function in the HPISDataManagerLib.Datamgr ActiveX control in HPISDataManager.dll in HP Instant Support before 1.0.0.24 allows remote attackers to execute arbitrary code via a long first argument, a different vulnerability than CVE-2007-5605, CVE-2007-5606, and CVE-2007-5607.",
  "id": "GHSA-f469-v24c-6rxv",
  "modified": "2022-05-01T18:34:57Z",
  "published": "2022-05-01T18:34:57Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5604"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/42844"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/30516"
    },
    {
      "type": "WEB",
      "url": "http://www.csis.dk/dk/forside/CSIS-RI-0003.pdf"
    },
    {
      "type": "WEB",
      "url": "http://www.kb.cert.org/vuls/id/754403"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/29526"
    },
    {
      "type": "WEB",
      "url": "http://www.securitytracker.com/id?1020165"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2008/1740/references"
    },
    {
      "type": "WEB",
      "url": "http://www12.itrc.hp.com/service/cki/docDisplay.do?docId=emr_na-c01422264"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-F49G-X9FX-87QM

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

PHP remote file inclusion vulnerability in index.php in Zen Cart 1.3.0.2 and earlier, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the autoLoadConfig[999][0][loadFile] parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-4215"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-08-17T21:04:00Z",
    "severity": "MODERATE"
  },
  "details": "PHP remote file inclusion vulnerability in index.php in Zen Cart 1.3.0.2 and earlier, when register_globals is enabled, allows remote attackers to execute arbitrary PHP code via a URL in the autoLoadConfig[999][0][loadFile] parameter.",
  "id": "GHSA-f49g-x9fx-87qm",
  "modified": "2022-05-01T07:16:36Z",
  "published": "2022-05-01T07:16:36Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-4215"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/28394"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/21484"
    },
    {
      "type": "WEB",
      "url": "http://www.gulftech.org/?node=research\u0026article_id=00109-08152006"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/28149"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/19543"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/3283"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-F4FH-29CP-VMCG

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

EnterpriseDB Advanced Server 8.2 does not properly handle certain debugging function calls that occur before a call to pldbg_create_listener, which allows remote authenticated users to cause a denial of service (daemon crash) and possibly execute arbitrary code via a SELECT statement that invokes a pldbg_ function, as demonstrated by (1) pldbg_get_stack and (2) pldbg_abort_target, which triggers use of an uninitialized pointer.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-4639"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-824",
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-08-31T23:17:00Z",
    "severity": "MODERATE"
  },
  "details": "EnterpriseDB Advanced Server 8.2 does not properly handle certain debugging function calls that occur before a call to pldbg_create_listener, which allows remote authenticated users to cause a denial of service (daemon crash) and possibly execute arbitrary code via a SELECT statement that invokes a pldbg_ function, as demonstrated by (1) pldbg_get_stack and (2) pldbg_abort_target, which triggers use of an uninitialized pointer.",
  "id": "GHSA-f4fh-29cp-vmcg",
  "modified": "2022-05-01T18:25:38Z",
  "published": "2022-05-01T18:25:38Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-4639"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/36328"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/26640"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/478057/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/25481"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/3040"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-F4J4-8X73-VJX4

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

Certain getText methods in the ActionSupport controller in Apache Roller before 5.0.2 allow remote attackers to execute arbitrary OGNL expressions via the first or second parameter, as demonstrated by the pageTitle parameter in the !getPageTitle sub-URL to roller-ui/login.rol, which uses a subclass of UIAction, aka "OGNL Injection."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-4212"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-12-07T20:55:00Z",
    "severity": "MODERATE"
  },
  "details": "Certain getText methods in the ActionSupport controller in Apache Roller before 5.0.2 allow remote attackers to execute arbitrary OGNL expressions via the first or second parameter, as demonstrated by the pageTitle parameter in the !getPageTitle sub-URL to roller-ui/login.rol, which uses a subclass of UIAction, aka \"OGNL Injection.\"",
  "id": "GHSA-f4j4-8x73-vjx4",
  "modified": "2022-05-17T01:33:12Z",
  "published": "2022-05-17T01:33:12Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-4212"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/89239"
    },
    {
      "type": "WEB",
      "url": "http://rollerweblogger.org/project/entry/apache_roller_5_0_2"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55862"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55877"
    },
    {
      "type": "WEB",
      "url": "http://security.coverity.com/advisory/2013/Oct/remote-code-execution-in-apache-roller-via-ognl-injection.html"
    },
    {
      "type": "WEB",
      "url": "http://www.exploit-db.com/exploits/29859"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/100342"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-F4J7-R4Q5-QW2C

Vulnerability from github – Published: 2026-05-18 18:31 – Updated: 2026-05-29 19:15
VLAI
Summary
ChromaDB Python project has a pre-authentication code injection vulnerability
Details

A pre-authentication, code injection vulnerability in version 1.0.0 or later of the ChromaDB Python project allows an unauthenticated attacker to run arbitrary code on the server by sending a malicious model repository and trust_remote_code set to true in the /api/v2/tenants/{tenant}/databases/{db}/collections endpoint.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "chromadb"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.0.0"
            },
            {
              "last_affected": "1.5.9"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-45829"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-29T19:15:04Z",
    "nvd_published_at": "2026-05-18T17:16:34Z",
    "severity": "CRITICAL"
  },
  "details": "A pre-authentication, code injection vulnerability in version 1.0.0 or later of the ChromaDB Python project allows an unauthenticated attacker to run arbitrary code on the server by sending a malicious model repository and trust_remote_code set to true in the\u00a0/api/v2/tenants/{tenant}/databases/{db}/collections endpoint.",
  "id": "GHSA-f4j7-r4q5-qw2c",
  "modified": "2026-05-29T19:15:04Z",
  "published": "2026-05-18T18:31:30Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-45829"
    },
    {
      "type": "WEB",
      "url": "https://github.com/chroma-core/chroma/issues/6717"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/chroma-core/chroma"
    },
    {
      "type": "WEB",
      "url": "https://www.hiddenlayer.com/research/chromatoast-served-pre-auth"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P",
      "type": "CVSS_V4"
    }
  ],
  "summary": "ChromaDB Python project has a pre-authentication code injection vulnerability"
}

GHSA-F4PW-2P4P-GVHF

Vulnerability from github – Published: 2022-05-24 19:17 – Updated: 2022-07-11 00:00
VLAI
Details

Myucms v2.2.1 contains a remote code execution (RCE) vulnerability in the component \controller\Config.php, which can be exploited via the add() method.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2020-21650"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2021-10-06T22:15:00Z",
    "severity": "HIGH"
  },
  "details": "Myucms v2.2.1 contains a remote code execution (RCE) vulnerability in the component \\controller\\Config.php, which can be exploited via the add() method.",
  "id": "GHSA-f4pw-2p4p-gvhf",
  "modified": "2022-07-11T00:00:20Z",
  "published": "2022-05-24T19:17:00Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2020-21650"
    },
    {
      "type": "WEB",
      "url": "https://github.com/lolipop1234/XXD/issues/6"
    },
    {
      "type": "WEB",
      "url": "https://cwe.mitre.org/data/definitions/96.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/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.