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.

8376 vulnerabilities reference this CWE, most recent first.

GHSA-4FWJ-V7F6-PQ59

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

Multiple eval injection vulnerabilities in the com_search component in Joomla! 1.5 beta before RC1 (aka Mapya) allow remote attackers to execute arbitrary PHP code via PHP sequences in the searchword parameter, related to default_results.php in (1) components/com_search/views/search/tmpl/ and (2) templates/beez/html/com_search/search/.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-4187"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-08-08T01:17:00Z",
    "severity": "HIGH"
  },
  "details": "Multiple eval injection vulnerabilities in the com_search component in Joomla! 1.5 beta before RC1 (aka Mapya) allow remote attackers to execute arbitrary PHP code via PHP sequences in the searchword parameter, related to default_results.php in (1) components/com_search/views/search/tmpl/ and (2) templates/beez/html/com_search/search/.",
  "id": "GHSA-4fwj-v7f6-pq59",
  "modified": "2022-05-01T18:21:10Z",
  "published": "2022-05-01T18:21:10Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-4187"
    },
    {
      "type": "WEB",
      "url": "http://joomlacode.org/gf/project/joomla/scmsvn/?action=browse\u0026path=%2Fdevelopment%2Ftrunk%2Fcomponents%2Fcom_search%2Fviews%2Fsearch%2Fview.php\u0026r1=7455\u0026r2=7456"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/41260"
    },
    {
      "type": "WEB",
      "url": "http://securityreason.com/securityalert/2969"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/474417/100/100/threaded"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4G2F-Q935-7PPV

Vulnerability from github – Published: 2022-05-01 07:30 – Updated: 2025-04-09 03:32
VLAI
Details

PHP remote file inclusion vulnerability in end.php in ask_rave 0.9 PR, and other versions before 0.9b, allows remote attackers to execute arbitrary PHP code via a URL in the footfile parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-5621"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-10-31T20:07:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in end.php in ask_rave 0.9 PR, and other versions before 0.9b, allows remote attackers to execute arbitrary PHP code via a URL in the footfile parameter.",
  "id": "GHSA-4g2f-q935-7ppv",
  "modified": "2025-04-09T03:32:55Z",
  "published": "2022-05-01T07:30:08Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-5621"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/29825"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/2654"
    },
    {
      "type": "WEB",
      "url": "http://rave.jk-digital.com/blog/2006/12/08/ask_rave-09b-released"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/20758"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/4211"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4G2X-VQ5P-5VJ6

Vulnerability from github – Published: 2024-03-01 20:09 – Updated: 2024-08-15 17:02
VLAI
Summary
Budibase affected by VM2 Constructor Escape Vulnerability
Details

Impact

Previously, budibase used a library called vm2 for code execution inside the Budibase builder and apps, such as the UI below for configuring bindings in the design section.

Screenshot 2024-03-01 at 13 50 16

Due to a vulnerability in vm2, any environment that executed the code server side (automations and column formulas) was susceptible to this vulnerability, allowing users to escape the sandbox provided by vm2, and to expose server side variables such as process.env. It's recommended by the authors of vm2 themselves that you should move to another solution for remote JS execution due to this vulnerability.

Patches

We moved our entire JS sandbox infrastructure over to isolated-vm, a much more secure and recommended library for remote code execution in 2.20.0. This also comes with a performance benefit in the way we cache and execute your JS server side. The budibase cloud platform has been patched already and is not running vm2, but self host users will need to manage the updates by themselves.

If you are a self hosted user, you can take the following steps to reproduce the exploit and to verify if your installation is currently affected.

Create a new formula column on one of your tables in the data section with the following configuration. Screenshot 2024-03-01 at 14 04 28

Add the following JS function to the formula and save. Screenshot 2024-03-01 at 14 05 19

If your installation is vulnerable, when the formula evaluates you will be able to see the printed process.env in your new formula field. If not, your installation is not affected.

Workarounds

There is no workaround at this time for any budibase app that uses JS. You must fully migrate post version 2.20.0 to patch the vulnerability.

References

  • https://github.com/advisories/GHSA-cchq-frgv-rjh5
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@budibase/server"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.20.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2024-03-01T20:09:00Z",
    "nvd_published_at": null,
    "severity": "CRITICAL"
  },
  "details": "### Impact\nPreviously, budibase used a library called `vm2` for code execution inside the Budibase builder and apps, such as the UI below for configuring bindings in the design section.\n\n![Screenshot 2024-03-01 at 13 50 16](https://github.com/Budibase/budibase/assets/11256663/5f049b64-cd99-48fd-a184-644cd312c82e)\n\nDue to a [vulnerability in vm2](https://github.com/advisories/GHSA-cchq-frgv-rjh5), any environment that executed the code server side (automations and column formulas) was susceptible to this vulnerability, allowing users to escape the sandbox provided by `vm2`, and to expose server side variables such as `process.env`. It\u0027s recommended by the authors of `vm2` themselves that you should move to another solution for remote JS execution due to this vulnerability.\n\n### Patches\nWe moved our entire JS sandbox infrastructure over to `isolated-vm`, a much more secure and recommended library for remote code execution in 2.20.0. This also comes with a performance benefit in the way we cache and execute your JS server side. The budibase cloud platform has been patched already and is not running `vm2`, but self host users will need to manage the updates by themselves.\n\nIf you are a self hosted user, you can take the following steps to reproduce the exploit and to verify if your installation is currently affected.\n\nCreate a new formula column on one of your tables in the data section with the following configuration.\n![Screenshot 2024-03-01 at 14 04 28](https://github.com/Budibase/budibase/assets/11256663/0f8bc19b-9e44-4e95-ab4e-6ef6278eea34)\n\nAdd the following JS function to the formula and save.\n![Screenshot 2024-03-01 at 14 05 19](https://github.com/Budibase/budibase/assets/11256663/1d0c9705-1a88-49b0-93e0-f385a04b5c25)\n\nIf your installation is vulnerable, when the formula evaluates you will be able to see the printed `process.env` in your new formula field. If not, your installation is not affected.\n\n### Workarounds\nThere is no workaround at this time for any budibase app that uses JS. You must fully migrate post version 2.20.0 to patch the vulnerability.\n\n### References\n- https://github.com/advisories/GHSA-cchq-frgv-rjh5\n",
  "id": "GHSA-4g2x-vq5p-5vj6",
  "modified": "2024-08-15T17:02:27Z",
  "published": "2024-03-01T20:09:00Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/Budibase/budibase/security/advisories/GHSA-4g2x-vq5p-5vj6"
    },
    {
      "type": "WEB",
      "url": "https://github.com/patriksimek/vm2/security/advisories/GHSA-cchq-frgv-rjh5"
    },
    {
      "type": "WEB",
      "url": "https://github.com/Budibase/budibase/commit/601c02a4acc695b1cc602bf611f0ae66d6e5868f"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/Budibase/budibase"
    }
  ],
  "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": "Budibase affected by VM2 Constructor Escape Vulnerability"
}

GHSA-4G74-883W-RRGV

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

Multiple PHP remote file inclusion vulnerabilities in FAQEngine 4.24.00 allow remote attackers to execute arbitrary PHP code via a URL in the path_faqe parameter to (1) attachs.php, (2) backup.php, (3) badwords.php, (4) categories.php, (5) changepw.php, (6) colorchooser.php, (7) colorwheel.php, (8) dbfiles.php, (9) diraccess.php, (10) faq.php, (11) index.php, (12) kb.php, and (13) stats.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2010-1360"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2010-04-13T18:30:00Z",
    "severity": "HIGH"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in FAQEngine 4.24.00 allow remote attackers to execute arbitrary PHP code via a URL in the path_faqe parameter to (1) attachs.php, (2) backup.php, (3) badwords.php, (4) categories.php, (5) changepw.php, (6) colorchooser.php, (7) colorwheel.php, (8) dbfiles.php, (9) diraccess.php, (10) faq.php, (11) index.php, (12) kb.php, and (13) stats.php.",
  "id": "GHSA-4g74-883w-rrgv",
  "modified": "2022-05-02T06:21:57Z",
  "published": "2022-05-02T06:21:57Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2010-1360"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/55532"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.org/1001-exploits/faqengine-rfi.txt"
    },
    {
      "type": "WEB",
      "url": "http://www.exploit-db.com/exploits/11111"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/37719"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4G99-5GW9-42HV

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

The School Management WordPress plugin before 9.9.7 contains an obfuscated backdoor injected in it's license checking code that registers a REST API handler, allowing an unauthenticated attacker to execute arbitrary PHP code on the site.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-1609"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-01-16T16:15:09Z",
    "severity": "CRITICAL"
  },
  "details": "The School Management WordPress plugin before 9.9.7 contains an obfuscated backdoor injected in it\u0027s license checking code that registers a REST API handler, allowing an unauthenticated attacker to execute arbitrary PHP code on the site.",
  "id": "GHSA-4g99-5gw9-42hv",
  "modified": "2025-06-02T18:30:26Z",
  "published": "2024-01-16T18:31:09Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-1609"
    },
    {
      "type": "WEB",
      "url": "https://wpscan.com/vulnerability/e2d546c9-85b6-47a4-b951-781b9ae5d0f2"
    }
  ],
  "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-4G9M-WRG6-29MR

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

Multiple PHP remote file inclusion vulnerabilities in the Taskhopper 1.1 component for Mambo and Joomla! allow remote attackers to execute arbitrary PHP code via a URL in the mosConfig_absolute_path parameter to (1) contact_type.php, (2) itemstatus_type.php, (3) projectstatus_type.php, (4) request_type.php, (5) responses_type.php, (6) timelog_type.php, or (7) urgency_type.php in inc/.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-2005"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-04-12T19:19:00Z",
    "severity": "MODERATE"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in the Taskhopper 1.1 component for Mambo and Joomla! allow remote attackers to execute arbitrary PHP code via a URL in the mosConfig_absolute_path parameter to (1) contact_type.php, (2) itemstatus_type.php, (3) projectstatus_type.php, (4) request_type.php, (5) responses_type.php, (6) timelog_type.php, or (7) urgency_type.php in inc/.",
  "id": "GHSA-4g9m-wrg6-29mr",
  "modified": "2022-05-01T17:59:16Z",
  "published": "2022-05-01T17:59:16Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-2005"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/33552"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/3703"
    },
    {
      "type": "WEB",
      "url": "http://attrition.org/pipermail/vim/2007-April/001504.html"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34795"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34796"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34797"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34798"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34799"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34800"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/34801"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/23408"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2007/1346"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4GC3-8HMV-3556

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

PHP remote file inclusion vulnerability in news.php in Fantastic News 2.1.3 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the CONFIG[script_path] parameter. NOTE: it was later reported that 2.1.5 is also affected.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-4285"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-08-22T17:04:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in news.php in Fantastic News 2.1.3 and earlier allows remote attackers to execute arbitrary PHP code via a URL in the CONFIG[script_path] parameter.  NOTE: it was later reported that 2.1.5 is also affected.",
  "id": "GHSA-4gc3-8hmv-3556",
  "modified": "2022-05-01T07:17:09Z",
  "published": "2022-05-01T07:17:09Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-4285"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/28469"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/2221"
    },
    {
      "type": "WEB",
      "url": "http://fscripts.com/index.php"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/21571"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/457680/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/19613"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/3336"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-4GF4-QJR3-PPXJ

Vulnerability from github – Published: 2022-01-12 00:00 – Updated: 2024-11-14 21:31
VLAI
Details

Windows Geolocation Service Remote Code Execution Vulnerability.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-21878"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-01-11T21:15:00Z",
    "severity": "HIGH"
  },
  "details": "Windows Geolocation Service Remote Code Execution Vulnerability.",
  "id": "GHSA-4gf4-qjr3-ppxj",
  "modified": "2024-11-14T21:31:47Z",
  "published": "2022-01-12T00:00:54Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-21878"
    },
    {
      "type": "WEB",
      "url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2022-21878"
    },
    {
      "type": "WEB",
      "url": "https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2022-21878"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-4GHR-47H5-V2HF

Vulnerability from github – Published: 2024-02-02 00:31 – Updated: 2024-02-15 09:30
VLAI
Details

ConnectWise ScreenConnect through 23.8.4 allows man-in-the-middle attackers to achieve remote code execution via crafted messages.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-47257"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2024-02-01T22:15:55Z",
    "severity": "HIGH"
  },
  "details": "ConnectWise ScreenConnect through 23.8.4 allows man-in-the-middle attackers to achieve remote code execution via crafted messages.",
  "id": "GHSA-4ghr-47h5-v2hf",
  "modified": "2024-02-15T09:30:35Z",
  "published": "2024-02-02T00:31:25Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-47257"
    },
    {
      "type": "WEB",
      "url": "https://web.archive.org/web/20240208140218/https://gotham-security.com/screenconnect-cve-2023-47256"
    },
    {
      "type": "WEB",
      "url": "https://www.connectwise.com/company/trust/security-bulletins/connectwise-screenconnect-23.8-security-fix"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-4GP7-FJ67-X927

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

Multiple PHP remote file inclusion vulnerabilities in Simpleboard Mambo module 1.1.0 and earlier allow remote attackers to execute arbitrary PHP code via a URL in the sbp parameter to (1) image_upload.php and (2) file_upload.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-3528"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-07-12T00:05:00Z",
    "severity": "MODERATE"
  },
  "details": "Multiple PHP remote file inclusion vulnerabilities in Simpleboard Mambo module 1.1.0 and earlier allow remote attackers to execute arbitrary PHP code via a URL in the sbp parameter to (1) image_upload.php and (2) file_upload.php.",
  "id": "GHSA-4gp7-fj67-x927",
  "modified": "2022-05-01T07:09:55Z",
  "published": "2022-05-01T07:09:55Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-3528"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/1994"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=115876919804966\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/20981"
    },
    {
      "type": "WEB",
      "url": "http://securitytracker.com/id?1016824"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/27421"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/28531"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/445716/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/18917"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/2716"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

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.