Skills101
← All practice quizzes

Quiz: Command Injection and Path Traversal

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Two classic server-side attacks: injecting shell commands through a form field, and reading any file on the server with ../ in a file name. See exactly how each works and the safe patterns that stop them, with runnable Python.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What makes subprocess.run("ping -c 1 " + host, shell=True) dangerous?

  2. Question 2

    Which call is the safe way to run ping with a user-supplied host in Python?

  3. Question 3

    What does this print?

    cmd = ["ping", "-c", "1", "1.1.1.1 && whoami"]
    print(len(cmd), cmd[-1])
    
  4. Question 4

    Why is an allowlist better than a blocklist for validating input?

  5. Question 5

    In a file path, what does .. mean?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →