← Quiz: Command Injection and Path Traversal: all 10 questions
Quiz: Command Injection and Path Traversal · Question 8 of 10
What happens with posixpath.join("/srv/app/invoices", "/etc/passwd")?
What happens with posixpath.join("/srv/app/invoices", "/etc/passwd")?
- A.It raises an error
- B.It gives /srv/app/invoices/etc/passwd
- C.It gives /etc/passwd, because an absolute second part replaces the base
- D.It gives /srv/app/invoices
Answer & explanation
Correct answer: It gives /etc/passwd, because an absolute second part replaces the base
This is why the safe check looks at the final path, not just the user's text.
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 →