4 lines
811 B
Plaintext
4 lines
811 B
Plaintext
Applications that allow execution of operating system commands from user-controlled data should control the command to execute, otherwise an attacker can inject arbitrary commands that will compromise the underlying operating system.
|
|
|
|
The mitigation strategy can be based on a list of authorized and safe commands to execute and when a shell is spawned to sanitize shell meta-characters. Keep in mind that when a single argument to the command is user-controlled and shell-metachars are sanitized, it can still lead to vulnerabilities if the attacker can inject a dangerous option supported by the command, such as `-exec` available with https://linux.die.net/man/1/find[find], in that case, mark end of option processing on the command line using `--` (double-dash) or restrict options to only trusted values.
|