🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Command Injection and Path Traversal: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What makes subprocess.run("ping -c 1 " + host, shell=True) dangerous?
  2. Q2. Which call is the safe way to run ping with a user-supplied host in Python?
  3. Q3. What does this print? (code)
  4. Q4. Why is an allowlist better than a blocklist for validating input?
  5. Q5. In a file path, what does .. mean?
  6. Q6. What does this print? (code)
  7. Q7. Why is removing the text ../ from the input not a reliable fix?
  8. Q8. What happens with posixpath.join("/srv/app/invoices", "/etc/passwd")?
  9. Q9. What is the strongest design for letting students download their own offer letters?
  10. Q10. Which OWASP Top 10:2025 categories do command injection and path traversal fall under?