Certified Ethical Hacker Web Application Security 2 — Questions and Answers
Question 1: An attacker injects ' OR '1'='1 into a login form and gains access. Which vulnerability is exploited?
- Cross-Site Scripting
- SQL Injection (Correct answer)
- CSRF
- Path Traversal
Correct answer: SQL Injection
The injected condition always evaluates true, bypassing authentication via SQL Injection.
Question 2: Which HTTP response header best mitigates clickjacking attacks?
- Content-Type
- X-Frame-Options (Correct answer)
- Cache-Control
- Set-Cookie
Correct answer: X-Frame-Options
X-Frame-Options controls whether a page can be framed, preventing clickjacking.
Question 3: A stored XSS payload is most dangerous because it:
- Only affects the attacker
- Executes for every user who views the data (Correct answer)
- Requires a phishing email
- Cannot steal cookies
Correct answer: Executes for every user who views the data
Stored XSS persists on the server and runs for every victim who loads the page.
Question 4: Which technique best prevents SQL injection in application code?
- Hiding error messages
- Parameterized queries (Correct answer)
- Using HTTPS
- Disabling cookies
Correct answer: Parameterized queries
Parameterized (prepared) statements separate code from data, neutralizing injection.
Question 5: An IDOR vulnerability typically allows an attacker to:
- Crash the server
- Access objects belonging to other users by changing an ID (Correct answer)
- Brute-force passwords
- Inject JavaScript
Correct answer: Access objects belonging to other users by changing an ID
Insecure Direct Object Reference lets users access unauthorized records by manipulating identifiers.
Question 6: Which tool is commonly used to intercept and modify HTTP requests during web app testing?
- Wireshark
- Burp Suite (Correct answer)
- Nmap
- John the Ripper
Correct answer: Burp Suite
Burp Suite acts as a proxy to intercept, inspect, and tamper with web traffic.
Question 7: What is the primary defense against Cross-Site Request Forgery?
- Input length limits
- Anti-CSRF tokens (Correct answer)
- Minifying JavaScript
- Disabling JavaScript
Correct answer: Anti-CSRF tokens
Unpredictable anti-CSRF tokens ensure requests originate from the legitimate application.
An attacker injects ' OR '1'='1 into a login form and gains access.
Which vulnerability is exploited?