Skip to content

Eval Injection

Description

The application calls the `eval` function with non-literal data, allowing an adversary to compromise the system by executing arbitrary Python code.

Examples

Insecure Code

python
eval(user_supplied_data)

Secure Code

python
user_object = json.loads(user_supplied_data)

Remediation

Remove calls to `eval` and consider alternative methods for executing business logic, such as using `json.loads` for converting strings into objects.

Rule Details

FieldValue
IDCODE-0144
CategoryInjection
SeverityHIGH
CWECWE-95
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagseval, injection
OWASPA1:2017-Injection, A03:2021-Injection