312-50 ยท Web servers and web applications
Injection, parameter tampering and logic flaws
Command injection, XXE, file inclusion (LFI/RFI), file upload flaws, parameter tampering, business logic flaws, input validation.
Key points
- Injection: untrusted input run as code or commands (OS command injection, XXE via XML parsers).
- LFI/RFI: loads unintended files. Unrestricted upload: executable content on the server.
- Parameter tampering: price or role values the server wrongly trusts.
- Business logic flaws: skipping steps, replaying coupons.
- Defenses: server-side allow-lists, parameterized APIs, external XML entities off, safe uploads, server re-checks prices and state.
Practice questions
What is the main cause of OS command injection?
- User input concatenated into a system command
- Missing HTTPS
- A cookie without the Secure flag
- An outdated browser
Show answer
Answer: A. User input concatenated into a system command
User input is concatenated into a shell command, so metacharacters change what is executed. Weak TLS or cookie flags are unrelated.
Which measures make file upload safer?
- Allow-listing permitted file types and checking content
- Storing uploads outside the web root without execute permission
- Trusting the extension sent by the client
- Saving uploads in the script directory
- Keeping the original uploaded filename for execution
Show answer
Answer: A. Allow-listing permitted file types and checking content, B. Storing uploads outside the web root without execute permission
Allow-listing types and storing files outside the web root without execute permission prevents uploaded content from running. Trusting the filename extension alone or serving from the code directory is unsafe.
True or false: validating input only in JavaScript in the browser is sufficient protection against tampering.
Show answer
Answer: False
False. Client-side checks are trivially bypassed with a proxy or curl; validation must be enforced on the server.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
