Certified Ethical Hacker Web Application Security 1 — Questions and Answers
Question 1: What is SQL injection and how is it typically exploited?
- Inserting malicious SQL code into application input fields to manipulate the database (Correct answer)
- Injecting JavaScript into web pages
- Overflowing a buffer with SQL commands
- Modifying SQL Server configuration files
Correct answer: Inserting malicious SQL code into application input fields to manipulate the database
SQL injection exploits applications that incorporate user input into SQL queries without proper sanitization, allowing attackers to read, modify, or delete database data, bypass authentication, or execute OS commands.
Question 2: What is Cross-Site Scripting (XSS) and what are its types?
- Injecting malicious scripts into web pages viewed by other users; types include stored, reflected, and DOM-based (Correct answer)
- A method for cross-referencing websites
- A technique for copying scripts between servers
- A browser extension for scripting
Correct answer: Injecting malicious scripts into web pages viewed by other users; types include stored, reflected, and DOM-based
XSS allows attackers to inject client-side scripts into web pages. Stored XSS persists in the database, reflected XSS bounces off the server in responses, and DOM-based XSS manipulates the page's DOM directly.
Question 3: What is CSRF (Cross-Site Request Forgery)?
- Forcing an authenticated user's browser to send unauthorized requests to a web application (Correct answer)
- Creating fake websites that look real
- Forging digital certificates for HTTPS
- Stealing cookies through JavaScript
Correct answer: Forcing an authenticated user's browser to send unauthorized requests to a web application
CSRF tricks a victim's browser into making unwanted requests to a web application where they're authenticated, exploiting the trust that a site has in the user's browser to perform actions without the user's knowledge.
Question 4: What is the OWASP Top 10?
- A regularly updated list of the ten most critical web application security risks (Correct answer)
- The top 10 web development frameworks
- The 10 most popular websites
- The top 10 antivirus products
Correct answer: A regularly updated list of the ten most critical web application security risks
The OWASP Top 10 is a standard awareness document identifying the most critical web application security risks, updated periodically, serving as a benchmark for web security best practices worldwide.
Question 5: What is session hijacking and how can it be prevented?
- Stealing or predicting a valid session token to gain unauthorized access; prevented with HTTPS, secure cookies, and token rotation (Correct answer)
- Hijacking a user's keyboard during a session
- Taking control of a web server's CPU
- Blocking users from logging into their accounts
Correct answer: Stealing or predicting a valid session token to gain unauthorized access; prevented with HTTPS, secure cookies, and token rotation
Session hijacking involves stealing, predicting, or brute-forcing session tokens (cookies, URLs) to impersonate an authenticated user. Prevention includes HTTPS, HttpOnly/Secure cookie flags, session timeouts, and token regeneration.
Question 6: What is directory traversal (path traversal) attack?
- Manipulating file path inputs to access files outside the intended directory (Correct answer)
- Navigating through website pages normally
- Scanning all directories on a web server
- Creating new directories on the server
Correct answer: Manipulating file path inputs to access files outside the intended directory
Directory traversal uses sequences like ../ in file path parameters to escape the intended directory and access sensitive files (e.g., /etc/passwd, configuration files) on the server that should not be accessible.
What is SQL injection and how is it typically exploited?