The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval").
N/A
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
CVE: CVE-2024-4181
Framework for LLM applications allows eval injection via a crafted response from a hosting provider.
CVE: CVE-2022-2054
Python compiler uses eval() to execute malicious strings as Python code.
CVE: CVE-2021-22204 — KEV
Chain: regex in EXIF processor code does not correctly determine where a string ends (CWE-625), enabling eval injection (CWE-95), as exploited in the wild per CISA KEV.
CVE: CVE-2021-22205 — KEV
Chain: backslash followed by a newline can bypass a validation step (CWE-20), leading to eval injection (CWE-95), as exploited in the wild per CISA KEV.
CVE: CVE-2008-5071
Eval injection in PHP program.
CVE: CVE-2002-1750
Eval injection in Perl program.
CVE: CVE-2008-5305
Eval injection in Perl program using an ID that should only contain hyphens and numbers.
CVE: CVE-2002-1752
Direct code injection into Perl eval function.
CVE: CVE-2002-1753
Eval injection in Perl program.
CVE: CVE-2005-1527
Direct code injection into Perl eval function.
CVE: CVE-2005-2837
Direct code injection into Perl eval function.
CVE: CVE-2005-1921
MFV. code injection into PHP eval statement using nested constructs that should not be nested.
CVE: CVE-2005-2498
MFV. code injection into PHP eval statement using nested constructs that should not be nested.
CVE: CVE-2005-3302
Code injection into Python eval statement from a field in a formatted file.
CVE: CVE-2007-1253
Eval injection in Python program.
CVE: CVE-2001-1471
chain: Resultant eval injection. An invalid value prevents initialization of variables, which can be modified by attacker and later injected into PHP eval statement.
CVE: CVE-2007-2713
Chain: Execution after redirect triggers eval injection.
Phase | Note |
---|---|
Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
Implementation | This weakness is prevalent in handler/dispatch procedures that might want to invoke a large number of functions, or set a large number of variables. |
Intro: edit-config.pl: This CGI script is used to modify settings in a configuration file.
Body: The script intends to take the 'action' parameter and invoke one of a variety of functions based on the value of that parameter - config_file_add_key(), config_file_set_key(), or config_file_delete_key(). It could set up a conditional to invoke each function separately, but eval() is a powerful way of doing the same thing in fewer lines of code, especially when a large number of functions or variables are involved. Unfortunately, in this case, the attacker can provide other values in the action parameter, such as:
use CGI qw(:standard); sub config_file_add_key { my ($fname, $key, $arg) = @_; # code to add a field/key to a file goes here } sub config_file_set_key { my ($fname, $key, $arg) = @_; # code to set key to a particular file goes here } sub config_file_delete_key { my ($fname, $key, $arg) = @_; # code to delete key from a particular file goes here } sub handleConfigAction { my ($fname, $action) = @_; my $key = param('key'); my $val = param('val'); # this is super-efficient code, especially if you have to invoke # any one of dozens of different functions! my $code = "config_file_$action_key(\$fname, \$key, \$val);"; eval($code); } $configfile = "/home/cwe/config.txt"; print header; if (defined(param('action'))) { handleConfigAction($configfile, param('action')); } else { print "No action specified!\n"; }
Intro: This simple script asks a user to supply a list of numbers as input and adds them together.
Body: The eval() function can take the user-supplied list and convert it into a Python list object, therefore allowing the programmer to use list comprehension methods to work with the data. However, if code is supplied to the eval() function, it will execute that code. For example, a malicious user could supply the following string:
def main(): sum = 0 numbers = eval(input("Enter a space-separated list of numbers: ")) for num in numbers: sum = sum + num print(f"Sum of {numbers} = {sum}") main()