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.

9394 vulnerabilities reference this CWE, most recent first.

GHSA-63CW-57P8-FM3P

Vulnerability from github – Published: 2026-01-27 20:10 – Updated: 2026-01-29 03:42
VLAI
Summary
PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files
Details

Summary

A vulnerability in PyTorch's weights_only unpickler allows an attacker to craft a malicious checkpoint file (.pth) that, when loaded with torch.load(..., weights_only=True), can corrupt memory and potentially lead to arbitrary code execution.

Vulnerability Details

The weights_only=True unpickler failed to properly validate pickle opcodes and storage metadata, allowing:

  1. Heap memory corruption via SETITEM/SETITEMS opcodes applied to non-dictionary types
  2. Storage size mismatch between declared element count and actual data in the archive

Impact

An attacker who can convince a user to load a malicious checkpoint file may achieve arbitrary code execution in the context of the victim's process.

Credit

Ji'an Zhou

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "pytorch"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.10.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-24747"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-502",
      "CWE-94"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-01-27T20:10:54Z",
    "nvd_published_at": "2026-01-27T22:15:56Z",
    "severity": "HIGH"
  },
  "details": "### Summary\n\nA vulnerability in PyTorch\u0027s `weights_only` unpickler allows an attacker to craft a malicious checkpoint file (`.pth`) that, when loaded with `torch.load(..., weights_only=True)`, can corrupt memory and potentially lead to arbitrary code execution.\n\n### Vulnerability Details\n\nThe `weights_only=True` unpickler failed to properly validate pickle opcodes and storage metadata, allowing:\n\n1. **Heap memory corruption** via `SETITEM`/`SETITEMS` opcodes applied to non-dictionary types\n2. **Storage size mismatch** between declared element count and actual data in the archive\n\n### Impact\n\nAn attacker who can convince a user to load a malicious checkpoint file may achieve arbitrary code execution in the context of the victim\u0027s process.\n\n\n# Credit\nJi\u0027an Zhou",
  "id": "GHSA-63cw-57p8-fm3p",
  "modified": "2026-01-29T03:42:52Z",
  "published": "2026-01-27T20:10:54Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/pytorch/pytorch/security/advisories/GHSA-63cw-57p8-fm3p"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-24747"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pytorch/pytorch/issues/163105"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/pytorch/pytorch"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pytorch/pytorch/163122/commit/954dc5183ee9205cbe79876ad05dd2d9ae752139"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pytorch/pytorch/releases/tag/v2.10.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files"
}

GHSA-63HM-3QVH-MG6X

Vulnerability from github – Published: 2022-04-30 18:22 – Updated: 2022-04-30 18:22
VLAI
Details

PHP remote file inclusion vulnerability in News Evolution 2.0 allows remote attackers to execute arbitrary PHP commands via the neurl parameter to (1) backend.php, (2) screen.php, or (3) admin/modules/comment.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2002-2249"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2002-12-31T05:00:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in News Evolution 2.0 allows remote attackers to execute arbitrary PHP commands via the neurl parameter to (1) backend.php, (2) screen.php, or (3) admin/modules/comment.php.",
  "id": "GHSA-63hm-3qvh-mg6x",
  "modified": "2022-04-30T18:22:48Z",
  "published": "2022-04-30T18:22:48Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2002-2249"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/10709"
    },
    {
      "type": "WEB",
      "url": "http://marc.info/?l=bugtraq\u0026m=103835200230127\u0026w=2"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/6260"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-63M6-8FWH-9FHM

Vulnerability from github – Published: 2022-05-13 01:17 – Updated: 2025-04-11 04:16
VLAI
Details

Eval injection vulnerability in ajax.php in openSIS 4.5 through 5.2 allows remote attackers to execute arbitrary PHP code via the modname parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-1349"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-12-09T16:36:00Z",
    "severity": "HIGH"
  },
  "details": "Eval injection vulnerability in ajax.php in openSIS 4.5 through 5.2 allows remote attackers to execute arbitrary PHP code via the modname parameter.",
  "id": "GHSA-63m6-8fwh-9fhm",
  "modified": "2025-04-11T04:16:45Z",
  "published": "2022-05-13T01:17:42Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-1349"
    },
    {
      "type": "WEB",
      "url": "http://karmainsecurity.com/KIS-2013-10"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55913"
    },
    {
      "type": "WEB",
      "url": "http://sourceforge.net/p/opensis-ce/bugs/59"
    },
    {
      "type": "WEB",
      "url": "http://sourceforge.net/p/opensis-ce/code/1009"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-63MW-CXCJ-9X5W

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

PHP remote file inclusion vulnerability in Webspotblogging 3.0.1 allows remote attackers to execute arbitrary PHP code via a URL in the path parameter to (1) inc/logincheck.inc.php, (2) inc/adminheader.inc.php, (3) inc/global.php, or (4) inc/mainheader.inc.php. NOTE: some of these vectors were also reported for 3.0 in a separate disclosure.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2006-2860"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2006-06-06T20:06:00Z",
    "severity": "MODERATE"
  },
  "details": "PHP remote file inclusion vulnerability in Webspotblogging 3.0.1 allows remote attackers to execute arbitrary PHP code via a URL in the path parameter to (1) inc/logincheck.inc.php, (2) inc/adminheader.inc.php, (3) inc/global.php, or (4) inc/mainheader.inc.php.  NOTE: some of these vectors were also reported for 3.0 in a separate disclosure.",
  "id": "GHSA-63mw-cxcj-9x5w",
  "modified": "2025-04-03T04:34:03Z",
  "published": "2022-05-01T07:03:17Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2006-2860"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/26910"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/1871"
    },
    {
      "type": "WEB",
      "url": "http://arfis.wordpress.com/2007/09/14/rfi-02-webspotblogging"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/20439"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/25992"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/25993"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/25994"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/25995"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/447001/100/0/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/archive/1/447576/100/200/threaded"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/18260"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2006/2127"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-63MX-9CW2-M4WM

Vulnerability from github – Published: 2025-08-13 18:31 – Updated: 2025-08-13 18:31
VLAI
Details

NVIDIA Megatron-LM for all platforms contains a vulnerability in the megatron/training/ arguments.py component where an attacker could cause a code injection issue by providing a malicious input. A successful exploit of this vulnerability may lead to code execution, escalation of privileges, information disclosure, and data tampering.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-23306"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-08-13T18:15:30Z",
    "severity": "HIGH"
  },
  "details": "NVIDIA Megatron-LM for all platforms contains a vulnerability in the megatron/training/\narguments.py component where an attacker could cause a code injection issue by providing a malicious input. A successful exploit of this vulnerability may lead to code execution, escalation of privileges, information disclosure, and data tampering.",
  "id": "GHSA-63mx-9cw2-m4wm",
  "modified": "2025-08-13T18:31:25Z",
  "published": "2025-08-13T18:31:25Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-23306"
    },
    {
      "type": "WEB",
      "url": "https://nvidia.custhelp.com/app/answers/detail/a_id/5685"
    },
    {
      "type": "WEB",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-23306"
    }
  ],
  "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-63PV-4Q6J-7PXP

Vulnerability from github – Published: 2022-05-02 03:44 – Updated: 2022-05-02 03:44
VLAI
Details

PHP remote file inclusion vulnerability in printnews.php3 in SZNews 2.7 allows remote attackers to execute arbitrary PHP code via a URL in the id parameter.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2009-3362"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2009-09-24T16:30:00Z",
    "severity": "HIGH"
  },
  "details": "PHP remote file inclusion vulnerability in printnews.php3 in SZNews 2.7 allows remote attackers to execute arbitrary PHP code via a URL in the id parameter.",
  "id": "GHSA-63pv-4q6j-7pxp",
  "modified": "2022-05-02T03:44:21Z",
  "published": "2022-05-02T03:44:21Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2009-3362"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/57986"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.org/0909-exploits/sznews-rfi.txt"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/36699"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-63PW-526X-MRR6

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

taocms through 2014-05-24 allows eval injection by placing PHP code in the install.php db_name parameter and then making a config.php request.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2019-7720"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2019-02-11T04:29:00Z",
    "severity": "CRITICAL"
  },
  "details": "taocms through 2014-05-24 allows eval injection by placing PHP code in the install.php db_name parameter and then making a config.php request.",
  "id": "GHSA-63pw-526x-mrr6",
  "modified": "2022-05-14T01:34:21Z",
  "published": "2022-05-14T01:34:20Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-7720"
    },
    {
      "type": "WEB",
      "url": "https://github.com/taogogo/taocms/issues/1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-63QF-CWCV-FF3R

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

CRLF injection vulnerability in the header function in (1) CGI.pm before 3.50 and (2) Simple.pm in CGI::Simple 1.112 and earlier allows remote attackers to inject arbitrary HTTP headers and conduct HTTP response splitting attacks via vectors related to non-whitespace characters preceded by newline characters, a different vulnerability than CVE-2010-2761 and CVE-2010-3172.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2010-4410"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2010-12-06T20:13:00Z",
    "severity": "MODERATE"
  },
  "details": "CRLF injection vulnerability in the header function in (1) CGI.pm before 3.50 and (2) Simple.pm in CGI::Simple 1.112 and earlier allows remote attackers to inject arbitrary HTTP headers and conduct HTTP response splitting attacks via vectors related to non-whitespace characters preceded by newline characters, a different vulnerability than CVE-2010-2761 and CVE-2010-3172.",
  "id": "GHSA-63qf-cwcv-ff3r",
  "modified": "2022-05-17T03:23:45Z",
  "published": "2022-05-17T03:23:45Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2010-4410"
    },
    {
      "type": "WEB",
      "url": "https://bugzilla.redhat.com/show_bug.cgi?id=658970"
    },
    {
      "type": "WEB",
      "url": "http://cpansearch.perl.org/src/LDS/CGI.pm-3.50/Changes"
    },
    {
      "type": "WEB",
      "url": "http://kb.juniper.net/InfoCenter/index?page=content\u0026id=JSA10705"
    },
    {
      "type": "WEB",
      "url": "http://kb.juniper.net/InfoCenter/index?page=content\u0026id=JSA10735"
    },
    {
      "type": "WEB",
      "url": "http://lists.fedoraproject.org/pipermail/package-announce/2011-January/053576.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.fedoraproject.org/pipermail/package-announce/2011-January/053591.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2011-01/msg00006.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-security-announce/2011-04/msg00000.html"
    },
    {
      "type": "WEB",
      "url": "http://openwall.com/lists/oss-security/2010/12/01/1"
    },
    {
      "type": "WEB",
      "url": "http://openwall.com/lists/oss-security/2010/12/01/2"
    },
    {
      "type": "WEB",
      "url": "http://openwall.com/lists/oss-security/2010/12/01/3"
    },
    {
      "type": "WEB",
      "url": "http://perl5.git.perl.org/perl.git/blobdiff/a0b94c2432b1d8c20653453a0f6970cb10f59aec..84601d63a7e34958da47dad1e61e27cb3bd467d1:/cpan/CGI/lib/CGI.pm"
    },
    {
      "type": "WEB",
      "url": "http://perl5.git.perl.org/perl.git/commit/84601d63a7e34958da47dad1e61e27cb3bd467d1"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/43068"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/43147"
    },
    {
      "type": "WEB",
      "url": "http://www.mandriva.com/security/advisories?name=MDVSA-2010:237"
    },
    {
      "type": "WEB",
      "url": "http://www.mandriva.com/security/advisories?name=MDVSA-2010:252"
    },
    {
      "type": "WEB",
      "url": "http://www.nntp.perl.org/group/perl.perl5.changes/2010/11/msg28043.html"
    },
    {
      "type": "WEB",
      "url": "http://www.redhat.com/support/errata/RHSA-2011-1797.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/44199"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/45145"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2010/3230"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2011/0212"
    },
    {
      "type": "WEB",
      "url": "http://www.vupen.com/english/advisories/2011/0249"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-63QF-FRRC-RVQP

Vulnerability from github – Published: 2025-11-20 18:31 – Updated: 2025-11-20 21:30
VLAI
Details

Lite XL versions 2.1.8 and prior automatically execute the .lite_project.lua file when opening a project directory, without prompting the user for confirmation. The .lite_project.lua file is intended for project-specific configuration but can contain executable Lua logic. This behavior could allow execution of untrusted Lua code if a user opens a malicious project, potentially leading to arbitrary code execution with the privileges of the Lite XL process.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-12120"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-11-20T17:15:48Z",
    "severity": "HIGH"
  },
  "details": "Lite XL versions 2.1.8 and prior automatically execute the .lite_project.lua file when opening a project directory, without prompting the user for confirmation. The .lite_project.lua file is intended for project-specific configuration but can contain executable Lua logic. This behavior could allow execution of untrusted Lua code if a user opens a malicious project, potentially leading to arbitrary code execution with the privileges of the Lite XL process.",
  "id": "GHSA-63qf-frrc-rvqp",
  "modified": "2025-11-20T21:30:32Z",
  "published": "2025-11-20T18:31:01Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-12120"
    },
    {
      "type": "WEB",
      "url": "https://github.com/lite-xl/lite-xl/pull/2164"
    },
    {
      "type": "WEB",
      "url": "https://kb.cert.org/vuls/id/579478"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-63RF-CWPF-VW2P

Vulnerability from github – Published: 2022-05-14 00:56 – Updated: 2022-05-14 00:56
VLAI
Details

The dashboard report in Puppet Enterprise before 3.0.1 allows attackers to execute arbitrary YAML code via a crafted report-specific type.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-4957"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-94"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-10-25T23:55:00Z",
    "severity": "MODERATE"
  },
  "details": "The dashboard report in Puppet Enterprise before 3.0.1 allows attackers to execute arbitrary YAML code via a crafted report-specific type.",
  "id": "GHSA-63rf-cwpf-vw2p",
  "modified": "2022-05-14T00:56:49Z",
  "published": "2022-05-14T00:56:49Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-4957"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/88089"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/98639"
    },
    {
      "type": "WEB",
      "url": "http://puppetlabs.com/security/cve/cve-2013-4957"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/55362"
    }
  ],
  "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.