Study. uk . com
  1. Home
  2. All questions
  3. Question 470

CompTIA Security+ study material · question 470 of 611

An application passes user input into a shell command. What is the most reliable fix?

  1. Run the command as a lower-privileged user
  2. Escape shell metacharacters in the input
  3. Restrict input length
  4. Avoid the shell entirely and invoke the program with an argument list
Show the answer

Answer: D. Avoid the shell entirely and invoke the program with an argument list

Escaping is fragile across shells; removing the interpreter removes the injection surface. Lower privilege only limits impact.

Source: OWASP Input Validation Cheat Sheet (OWASP) — OWASP Input Validation Cheat Sheet › Validation

Challenge yourself on this topic → Study as cards