OS command injection is a critical vulnerability that can lead to a full system compromise as it may allow an adversary to pass in arbitrary commands or arguments to be executed.
1$username = $_COOKIE['username'];
2// Noncompliant: Incorporating variable into command strings
3exec("wto -n \"$username\" -g", $ret);
1$fullpath = $_POST['fullpath'];
2// Compliant: escapeshellarg() is used to prevent command injection
3$filesize = trim(shell_exec('stat -c %s ' . escapeshellarg($fullpath)));