Skip to content

Code Injection via Backticks

Description

The use of backticks may lead to command injection vulnerabilities, allowing an attacker to execute arbitrary system commands.

Examples

Insecure Code

php
`echo $input;`;

Secure Code

php
$output = shell_exec('echo '. escapeshellarg($input));

Remediation

Use a safer alternative, such as the exec or system functions with proper input validation and sanitization, or consider using a PHP library that provides a safer way to execute system commands.

Rule Details

FieldValue
IDCODE-0746
CategoryInjection
SeverityCRITICAL
CWECWE-94
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagscommand injection, code injection
OWASPA1:2017-Injection, A03:2021-Injection

References