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.

8271 vulnerabilities reference this CWE, most recent first.

GHSA-GWR9-QFPW-3H2X

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

The Server Side Includes (SSI) implementation in the File Upload BBS component in ULTRAPOP.JP i-HTTPD allows remote attackers to execute arbitrary commands by uploading files containing commands in SSI directives.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2014-7260"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2014-12-12T00:59:00Z",
    "severity": "HIGH"
  },
  "details": "The Server Side Includes (SSI) implementation in the File Upload BBS component in ULTRAPOP.JP i-HTTPD allows remote attackers to execute arbitrary commands by uploading files containing commands in SSI directives.",
  "id": "GHSA-gwr9-qfpw-3h2x",
  "modified": "2022-05-17T04:19:55Z",
  "published": "2022-05-17T04:19:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2014-7260"
    },
    {
      "type": "WEB",
      "url": "http://jvn.jp/en/jp/JVN16406395/360573/index.html"
    },
    {
      "type": "WEB",
      "url": "http://jvn.jp/en/jp/JVN16406395/index.html"
    },
    {
      "type": "WEB",
      "url": "http://jvndb.jvn.jp/jvndb/JVNDB-2014-000143"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-GWRJ-88FP-5M36

Vulnerability from github – Published: 2021-07-02 18:36 – Updated: 2023-01-24 15:09
VLAI
Summary
Code injection in Narou
Details

Narou (aka Narou.rb) before 3.8.0 allows Ruby Code Injection via the title name or author name of a novel.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "narou"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.8.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2021-35514"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2021-06-30T17:42:19Z",
    "nvd_published_at": "2021-06-28T12:15:00Z",
    "severity": "HIGH"
  },
  "details": "Narou (aka Narou.rb) before 3.8.0 allows Ruby Code Injection via the title name or author name of a novel.",
  "id": "GHSA-gwrj-88fp-5m36",
  "modified": "2023-01-24T15:09:14Z",
  "published": "2021-07-02T18:36:01Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-35514"
    },
    {
      "type": "WEB",
      "url": "https://github.com/whiteleaf7/narou/commit/d07720e855293182563b749431dfbf6c2d1cdb42"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/whiteleaf7/narou"
    },
    {
      "type": "WEB",
      "url": "https://github.com/whiteleaf7/narou/blob/develop/ChangeLog.md#380-20210627"
    },
    {
      "type": "WEB",
      "url": "https://vuln.ryotak.me/advisories/51"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Code injection in Narou"
}

GHSA-GWVQ-C7XM-5VCR

Vulnerability from github – Published: 2022-05-01 06:39 – Updated: 2022-05-01 06:39
VLAI
Details

Unspecified vulnerability in Safari, LaunchServices, and/or CoreTypes in Apple Mac OS X 10.4 up to 10.4.5 allows attackers to trick a user into opening an application that appears to be a safe file type. NOTE: due to the lack of specific information in the vendor advisory, it is not clear how CVE-2006-0397, CVE-2006-0398, and CVE-2006-0399 are different.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-0399"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-03-14T11:02:00Z",
    "severity": "HIGH"
  },
  "details": "Unspecified vulnerability in Safari, LaunchServices, and/or CoreTypes in Apple Mac OS X 10.4 up to 10.4.5 allows attackers to trick a user into opening an application that appears to be a safe file type. NOTE: due to the lack of specific information in the vendor advisory, it is not clear how CVE-2006-0397, CVE-2006-0398, and CVE-2006-0399 are different.",
  "id": "GHSA-gwvq-c7xm-5vcr",
  "modified": "2022-05-01T06:39:32Z",
  "published": "2022-05-01T06:39:32Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-0399"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/25269"
    },
    {
      "type": "WEB",
      "url": "http://docs.info.apple.com/article.html?artnum=303453"
    },
    {
      "type": "WEB",
      "url": "http://lists.apple.com/archives/security-announce/2006/Mar/msg00001.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/19129"
    },
    {
      "type": "WEB",
      "url": "http://securitytracker.com/id?1015760"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/23871"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/0949"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-GX2G-VF96-QJWV

Vulnerability from github – Published: 2024-03-21 03:36 – Updated: 2024-03-21 03:36
VLAI
Details

A vulnerability, which was classified as critical, was found in ZhiCms 4.0. Affected is the function index of the file app/manage/controller/setcontroller.php. The manipulation of the argument sitename leads to code injection. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used. VDB-255270 is the identifier assigned to this vulnerability.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-2016"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-03-21T02:52:26Z",
    "severity": "MODERATE"
  },
  "details": "A vulnerability, which was classified as critical, was found in ZhiCms 4.0. Affected is the function index of the file app/manage/controller/setcontroller.php. The manipulation of the argument sitename leads to code injection. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used. VDB-255270 is the identifier assigned to this vulnerability.",
  "id": "GHSA-gx2g-vf96-qjwv",
  "modified": "2024-03-21T03:36:47Z",
  "published": "2024-03-21T03:36:47Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-2016"
    },
    {
      "type": "WEB",
      "url": "https://gist.github.com/L1nyz-tel/e3ee6f3401a9d1c580be1a9b4a8afab5"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?ctiid.255270"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?id.255270"
    }
  ],
  "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"
    }
  ]
}

GHSA-GX3F-HQ7P-8FXV

Vulnerability from github – Published: 2021-11-23 17:53 – Updated: 2021-11-22 19:53
VLAI
Summary
Code injection in spring-cloud-netflix-hystrix-dashboard
Details

Applications using the spring-cloud-netflix-hystrix-dashboard expose a way to execute code submitted within the request URI path during the resolution of view templates. When a request is made at /hystrix/monitor;[user-provided data], the path elements following hystrix/monitor are being evaluated as SpringEL expressions, which can lead to code execution.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 2.2.9.RELEASE"
      },
      "package": {
        "ecosystem": "Maven",
        "name": "org.springframework.cloud:spring-cloud-netflix-hystrix-dashboard"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.2.10.RELEASE"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2021-22053"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2021-11-22T19:53:38Z",
    "nvd_published_at": "2021-11-19T16:15:00Z",
    "severity": "HIGH"
  },
  "details": "Applications using the `spring-cloud-netflix-hystrix-dashboard` expose a way to execute code submitted within the request URI path during the resolution of view templates. When a request is made at `/hystrix/monitor;[user-provided data]`, the path elements following `hystrix/monitor` are being evaluated as SpringEL expressions, which can lead to code execution.",
  "id": "GHSA-gx3f-hq7p-8fxv",
  "modified": "2021-11-22T19:53:38Z",
  "published": "2021-11-23T17:53:33Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-22053"
    },
    {
      "type": "WEB",
      "url": "https://tanzu.vmware.com/security/cve-2021-22053"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Code injection in spring-cloud-netflix-hystrix-dashboard"
}

GHSA-GX3P-CXM8-8H7C

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

Microsoft Excel 2007 SP3, Excel 2010 SP2, and Office Compatibility Pack allow remote attackers to execute arbitrary code via a crafted Office document, aka "Global Free Remote Code Execution in Excel Vulnerability."

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2014-6360"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2014-12-11T00:59:00Z",
    "severity": "HIGH"
  },
  "details": "Microsoft Excel 2007 SP3, Excel 2010 SP2, and Office Compatibility Pack allow remote attackers to execute arbitrary code via a crafted Office document, aka \"Global Free Remote Code Execution in Excel Vulnerability.\"",
  "id": "GHSA-gx3p-cxm8-8h7c",
  "modified": "2022-05-14T02:30:13Z",
  "published": "2022-05-14T02:30:13Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2014-6360"
    },
    {
      "type": "WEB",
      "url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2014/ms14-083"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-GX5G-RJJV-754Q

Vulnerability from github – Published: 2024-05-07 18:30 – Updated: 2024-05-07 18:30
VLAI
Details

A medium severity vulnerability has been identified in the update mechanism of the Phish Alert Button for Outlook, which could allow an attacker to remotely execute arbitrary code on the host machine. The vulnerability arises from the application's failure to securely verify the authenticity and integrity of the update server.

The application periodically checks for updates by querying a specific URL. However, this process does not enforce strict SSL/TLS verification, nor does it validate the digital signature of the received update files. An attacker with the capability to perform DNS spoofing can exploit this weakness. By manipulating DNS responses, the attacker can redirect the application's update requests to a malicious server under their control.

Once the application queries the spoofed update URL, the malicious server can respond with a crafted update package. Since the application fails to properly verify the authenticity of the update file, it will accept and execute the package, leading to arbitrary code execution on the host machine.

Impact: Successful exploitation of this vulnerability allows an attacker to execute code with elevated privileges, potentially leading to data theft, installation of further malware, or other malicious activities on the host system.

Affected Products: Phish Alert Button (PAB) for Outlook versions 1.10.0-1.10.11 Second Chance Client versions 2.0.0-2.0.9 PIQ Client versions 1.0.0-1.0.15

Remediation: Automated updates will be pushed to address this issue. Users of affected versions should verify the latest version is applied and, if not, apply the latest updates provided by KnowBe4, which addresses this vulnerability by implementing proper SSL/TLS checks of the update server. It is also recommended to ensure DNS settings are secure to prevent DNS spoofing attacks.

Workarounds: Use secure corporate networks or VPN services to secure network communications, which can help mitigate the risk of DNS spoofing.

Credits: This vulnerability was discovered by Ceri Coburn at Pen Test Partners, who reported it responsibly to the vendor.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-29209"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-05-07T17:15:08Z",
    "severity": "MODERATE"
  },
  "details": "A medium severity vulnerability has been identified in the update mechanism of the Phish Alert Button for Outlook, which could allow an attacker to remotely execute arbitrary code on the host machine. The vulnerability arises from the application\u0027s failure to securely verify the authenticity and integrity of the update server.\n\nThe application periodically checks for updates by querying a specific URL. However, this process does not enforce strict SSL/TLS verification, nor does it validate the digital signature of the received update files. An attacker with the capability to perform DNS spoofing can exploit this weakness. By manipulating DNS responses, the attacker can redirect the application\u0027s update requests to a malicious server under their control.\n\nOnce the application queries the spoofed update URL, the malicious server can respond with a crafted update package. Since the application fails to properly verify the authenticity of the update file, it will accept and execute the package, leading to arbitrary code execution on the host machine.\n\nImpact:\nSuccessful exploitation of this vulnerability allows an attacker to execute code with elevated privileges, potentially leading to data theft, installation of further malware, or other malicious activities on the host system.\n\nAffected Products:\nPhish Alert Button (PAB) for Outlook versions 1.10.0-1.10.11\nSecond Chance Client versions 2.0.0-2.0.9\nPIQ Client versions 1.0.0-1.0.15\n\nRemediation:\nAutomated updates will be pushed to address this issue. Users of affected versions should verify the latest version is applied and, if not, apply the latest updates provided by KnowBe4, which addresses this vulnerability by implementing proper SSL/TLS checks of the update server. It is also recommended to ensure DNS settings are secure to prevent DNS spoofing attacks.\n\nWorkarounds:\nUse secure corporate networks or VPN services to secure network communications, which can help mitigate the risk of DNS spoofing.\n\nCredits:\nThis vulnerability was discovered by Ceri Coburn at Pen Test Partners, who reported it responsibly to the vendor.",
  "id": "GHSA-gx5g-rjjv-754q",
  "modified": "2024-05-07T18:30:33Z",
  "published": "2024-05-07T18:30:33Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-29209"
    },
    {
      "type": "WEB",
      "url": "https://support.knowbe4.com/hc/en-us/articles/28959755127955-CVE-2024-29209"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-GX5R-PH5H-R7WR

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

CRLF injection vulnerability in autologin.jsp in Cisco CiscoWorks Common Services 4.0, as used in Cisco Prime LAN Management Solution and other products, allows remote attackers to inject arbitrary HTTP headers and conduct HTTP response splitting attacks via the URL parameter, aka Bug ID CSCtu18693.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2011-4237"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2012-05-03T10:11:00Z",
    "severity": "MODERATE"
  },
  "details": "CRLF injection vulnerability in autologin.jsp in Cisco CiscoWorks Common Services 4.0, as used in Cisco Prime LAN Management Solution and other products, allows remote attackers to inject arbitrary HTTP headers and conduct HTTP response splitting attacks via the URL parameter, aka Bug ID CSCtu18693.",
  "id": "GHSA-gx5r-ph5h-r7wr",
  "modified": "2022-05-17T05:28:56Z",
  "published": "2022-05-17T05:28:56Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2011-4237"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/49094"
    },
    {
      "type": "WEB",
      "url": "http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_lan_management_solution/4.2/release/notes/lms42rel.html"
    },
    {
      "type": "WEB",
      "url": "http://www.nessus.org/plugins/index.php?view=single\u0026id=58950"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-GX6V-67QV-RHX5

Vulnerability from github – Published: 2022-06-21 00:00 – Updated: 2022-06-29 22:09
VLAI
Summary
Code injection in Elefant CMS
Details

A vulnerability was found in Elefant CMS 1.3.12-RC. It has been declared as critical. Affected by this vulnerability is an unknown functionality of the file /designer/add/layout. The manipulation leads to code injection. The attack can be launched remotely. Upgrading to version 1.3.13 is able to address this issue. It is recommended to upgrade the affected component.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "elefant/cms"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.3.13"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2017-20064"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-06-29T22:09:12Z",
    "nvd_published_at": "2022-06-20T05:15:00Z",
    "severity": "HIGH"
  },
  "details": "A vulnerability was found in Elefant CMS 1.3.12-RC. It has been declared as critical. Affected by this vulnerability is an unknown functionality of the file /designer/add/layout. The manipulation leads to code injection. The attack can be launched remotely. Upgrading to version 1.3.13 is able to address this issue. It is recommended to upgrade the affected component.",
  "id": "GHSA-gx6v-67qv-rhx5",
  "modified": "2022-06-29T22:09:12Z",
  "published": "2022-06-21T00:00:48Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2017-20064"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/jbroadway/elefant"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/?id.97261"
    },
    {
      "type": "WEB",
      "url": "http://seclists.org/fulldisclosure/2017/Feb/39"
    }
  ],
  "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"
    }
  ],
  "summary": "Code injection in Elefant CMS"
}

GHSA-GX88-675C-VCWX

Vulnerability from github – Published: 2022-08-03 00:00 – Updated: 2022-08-09 00:00
VLAI
Details

Mealie1.0.0beta3 was discovered to contain a Server-Side Template Injection vulnerability, which allows attackers to execute arbitrary code via a crafted Jinja2 template.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-34625"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-08-02T16:15:00Z",
    "severity": "HIGH"
  },
  "details": "Mealie1.0.0beta3 was discovered to contain a Server-Side Template Injection vulnerability, which allows attackers to execute arbitrary code via a crafted Jinja2 template.",
  "id": "GHSA-gx88-675c-vcwx",
  "modified": "2022-08-09T00:00:21Z",
  "published": "2022-08-03T00:00:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-34625"
    },
    {
      "type": "WEB",
      "url": "https://cwe.mitre.org/data/definitions/1336.html"
    },
    {
      "type": "WEB",
      "url": "https://cwe.mitre.org/data/definitions/94.html"
    },
    {
      "type": "WEB",
      "url": "https://docs.mealie.io/changelog/v0.5.6"
    },
    {
      "type": "WEB",
      "url": "https://gainsec.com/2022/08/02/cve-2022-34625-ssti-rce-mealie"
    },
    {
      "type": "WEB",
      "url": "https://hub.docker.com/r/hkotel/mealie"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:H/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.