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