← Quiz: Command Injection and Path Traversal: all 10 questions
Quiz: Command Injection and Path Traversal · Question 1 of 10
What makes subprocess.run("ping -c 1 " + host, shell=True) dangerous?
What makes subprocess.run("ping -c 1 " + host, shell=True) dangerous?
- A.ping is a slow program
- B.The shell interprets characters like ; and $( ) in host, so an attacker can add commands
- C.subprocess cannot run ping
- D.It only works on Linux
Answer & explanation
Correct answer: The shell interprets characters like ; and $( ) in host, so an attacker can add commands
With shell=True the whole string is parsed by a shell, including any extra commands in host.
Can you get the rest right without peeking?
Take the timed Quiz: Command Injection and Path Traversal quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →