Courseiva
' and the…","url":"https://courseiva.com/questions/ec-council/ec-ceh/during-a-web-application-penetration-test-a-tester-submits-ugc94"},{"@type":"ListItem","position":56,"name":"An attacker uses the following URL pattern to access files: http://example.com/../../etc/passwd. Which attack is being a…","url":"https://courseiva.com/questions/ec-council/ec-ceh/an-attacker-uses-the-following-url-pattern-to-access-files-a4r3c"},{"@type":"ListItem","position":57,"name":"An application allows users to upload XML files for processing. A tester uploads the following payload:

CCNA Ceh Web Injection Questions

75 of 156 questions · Page 1/3 · Ceh Web Injection topic · Answers revealed

1
MCQeasy

An attacker crafts a link that, when clicked by an authenticated user, performs an unintended action on a web application where the user is logged in, such as changing their email address. The application uses a session cookie for authentication but does not include any anti-forgery tokens in forms. Which attack is this?

A.Cross-Site Request Forgery (CSRF)
B.Cross-Site Scripting (XSS)
C.Clickjacking
D.Server-Side Request Forgery (SSRF)
AnswerA

Cross-Site Request Forgery (CSRF) is an attack where an attacker crafts a malicious web page or link that, when clicked or loaded by a victim, forces their browser to send an unauthorized request to a trusted website. This attack leverages the victim's active authenticated session with the target site, causing the site to execute actions as if the user genuinely initiated them. The victim's browser automatically includes session cookies with the forged request, making it appear legitimate to the server, often resulting in state-changing operations like password changes or fund transfers.

Why this answer

The description matches Cross-Site Request Forgery (CSRF), where a malicious link triggers actions on a site where the victim is authenticated.

2
MCQmedium

A penetration tester identifies a web page that reflects user input in the response without proper encoding. The input is submitted via a GET parameter. Which type of cross-site scripting (XSS) is MOST likely present?

A.Blind XSS
B.Reflected XSS
C.DOM-based XSS
D.Stored XSS
AnswerB

Reflected Cross-Site Scripting occurs when a malicious script, typically injected via a URL parameter or form input, is immediately returned by the web server in the HTTP response without proper sanitization. The payload is not stored on the server; instead, it is executed client-side in the victim's browser only when they click a specially crafted link. This non-persistent nature means the attack targets individual users who interact with the malicious URL directly.

Why this answer

Reflected XSS occurs when user input is immediately returned by the web server in the response without proper encoding or validation. Since the input is submitted via a GET parameter and reflected in the response, this is the classic pattern of reflected XSS.

Exam trap

CEH often tests the distinction between reflected, stored, and DOM-based XSS, and candidates may incorrectly choose DOM-based when the input is reflected by the server, confusing client-side and server-side reflection.

How to eliminate wrong answers

Option A is wrong because blind XSS is a type of stored XSS where the payload is saved and later executed in a different context, often in an admin panel, and the attacker does not see immediate results. Option C is wrong because DOM-based XSS occurs when the vulnerability is in client-side JavaScript that processes user input, not in the server-side response reflection. Option D is wrong because stored XSS involves the malicious input being persisted on the server (e.g., in a database) and then served to other users, rather than being immediately reflected.

3
Multi-Selectmedium

During a penetration test, a tester finds a web application that reflects user input in the page without sanitization. Which TWO types of XSS are potentially exploitable in this scenario?

Select 2 answers
A.DOM-based XSS
B.Blind XSS
C.Self-XSS
D.Stored (persistent) XSS
E.Reflected XSS
AnswersA, E

DOM-based Cross-Site Scripting (XSS) arises when a web application's client-side script processes user-controllable data from the Document Object Model (DOM) unsafely, without sending it back to the server. The vulnerability occurs entirely within the browser, where malicious input directly modifies the DOM environment via JavaScript, leading to script execution. This typically involves a "source" like document.URL and a "sink" like eval() or innerHTML, making it a client-side vulnerability that doesn't necessarily involve server-side reflection.

Why this answer

Reflected XSS occurs when input is immediately returned in the response. DOM-based XSS occurs when client-side scripts process input unsafely. Stored XSS requires persistence on the server, which is not indicated.

4
MCQmedium

During a penetration test, you find a web application that includes files using a parameter like /index.php?page=about. When you change the parameter to /etc/passwd, the application returns the contents of the password file. Which vulnerability is present?

A.Local File Inclusion (LFI)
B.Remote File Inclusion (RFI)
C.Command Injection
D.Directory Traversal
AnswerA

Local File Inclusion (LFI) occurs when a web application incorporates a local file into its output or execution flow based on user-supplied input without adequate validation. An attacker can manipulate parameters to point to arbitrary files on the server's filesystem, such as `/etc/passwd` or application log files. This vulnerability allows for sensitive data disclosure, and in some cases, can be escalated to remote code execution by including log files poisoned with malicious code.

Why this answer

Local File Inclusion (LFI) allows an attacker to include local files on the server through path traversal or direct inclusion.

5
Multi-Selectmedium

An attacker is attempting to perform an Insecure Direct Object Reference (IDOR) attack on a web application. Which TWO conditions are necessary for this attack to succeed?

Select 2 answers
A.The application uses indirect object references (e.g., random tokens)
B.The application exposes direct references to internal objects (e.g., user IDs in URLs)
C.The application fails to validate the user's authorization for the requested object
D.The application has a CSRF vulnerability
E.The application implements strong access controls on every object
AnswersB, C

An attacker attempting an Insecure Direct Object Reference (IDOR) attack specifically targets applications that expose direct references to internal implementation objects. For instance, if a URL directly uses sequential database IDs like "/profile?id=123", an attacker can easily modify "id=123" to "id=124" to attempt access to another user's profile. This direct exposure provides the attacker with a clear pathway to manipulate object identifiers, which is a fundamental prerequisite for exploiting IDOR vulnerabilities.

Why this answer

Option B is correct because IDOR fundamentally requires the application to expose direct references to internal objects, such as sequential user IDs, file names, or database keys in URLs or parameters, giving the attacker a manipulable identifier to tamper with. Option C is correct because even with exposed direct references, the attack only succeeds if the application fails to validate that the authenticated user is authorized to access the requested object, allowing horizontal or vertical privilege escalation. Option A is incorrect because indirect references using random or hashed tokens are actually a mitigation that makes object identifiers unpredictable and thus harder to enumerate or manipulate.

Option D is incorrect because CSRF is a separate vulnerability class that forces a victim's browser to send unintended authenticated requests; it is not a prerequisite for IDOR. Option E is incorrect because strong access controls on every object would prevent IDOR by ensuring authorization checks are enforced, directly defeating the attack rather than enabling it.

Exam trap

The trap here is that candidates pick 'indirect object references' or 'strong access controls' as necessary conditions because those sound security-relevant, when in fact they are the exact mitigations that prevent IDOR — the exam tests whether you understand the attack requires the absence of those controls.

6
MCQmedium

A penetration tester is assessing a PHP e-commerce site. The product search page builds its query by concatenating user input directly into a statement executed with mysqli_query(). When the tester submits the string ' OR '1'='1 as the search term, the application returns every product in the catalog instead of an empty result set. The tester wants to confirm the vulnerability and then extract the contents of the users table. Which action should the tester take FIRST?

A.Immediately attempt to write a web shell to disk using SELECT ... INTO OUTFILE to prove impact.
B.Use sqlmap with the --forms flag to automate the entire extraction without any further manual verification.
C.Encode the payload with URL encoding and resubmit it, because the raw quote character is being stripped by the browser.
D.Submit a boolean-based test such as ' AND '1'='2 to observe whether the result set changes predictably, confirming the input reaches the SQL statement.
AnswerD

A true/false pair of payloads cleanly distinguishes an injection from ordinary application behavior. If ' AND '1'='2 returns no products while ' AND '1'='1 returns all, the input is demonstrably altering the query predicate, which is the definitive confirmation a tester needs before escalating to data extraction.

Why this answer

The tester has observed anomalous behavior but has not yet proven the input modifies the SQL statement. A boolean-based differential test, comparing a logically true condition against a logically false one, isolates the injection from ordinary application quirks and confirms the parameter is concatenated into the query before any extraction tooling or file-writing attempts are justified.

Exam trap

The trap here is assuming that a single anomalous result, such as returning the full product catalog, definitively proves SQL injection without a controlled true/false comparison.

7
MCQeasy

An attacker discovers that a web application's login form allows unlimited login attempts. The attacker uses a list of usernames and passwords obtained from a previous breach to gain access. This attack is known as:

A.Password spraying
B.Brute force attack
C.Dictionary attack
D.Credential stuffing
AnswerD

Credential stuffing is a highly effective attack where attackers take large lists of username and password pairs, typically obtained from data breaches on one web service, and automatically attempt to use these same credentials to log into other, unrelated web applications. This attack exploits the widespread user practice of reusing the same login credentials across multiple online platforms. Success hinges on the assumption that users will recycle their compromised passwords on new targets.

Why this answer

Credential stuffing (option D) is correct because the attacker uses a list of known username/password pairs from a previous breach to automate login attempts against the web application. This attack exploits password reuse across services, not the weakness of the passwords themselves, and relies on the application's lack of rate limiting or account lockout mechanisms.

Exam trap

The trap here is that candidates confuse credential stuffing with a dictionary attack, but credential stuffing specifically uses known username-password pairs from a prior breach, not a generic wordlist of passwords.

How to eliminate wrong answers

Option A is wrong because password spraying involves trying a single common password (e.g., 'Password123') against many usernames, not using a list of known credential pairs. Option B is wrong because a brute force attack systematically tries all possible password combinations for a single username, which is computationally expensive and not based on a pre-compromised list. Option C is wrong because a dictionary attack uses a wordlist of potential passwords against a single username, but does not pair specific usernames with their previously compromised passwords.

8
MCQmedium

A web application allows users to access files using parameters like 'file=report.pdf'. A tester changes the parameter to '../../etc/passwd' and retrieves the system password file. This is an example of which attack?

A.Local file inclusion (LFI)
B.Remote file inclusion (RFI)
C.Command injection
D.Directory traversal
AnswerD

Directory traversal, also known as path traversal, is an attack that exploits insufficient security validation of user-supplied file paths. By injecting special sequences like `../` (dot-dot-slash) or its URL-encoded equivalent, an attacker can navigate outside the intended directory structure, allowing them to access or read arbitrary files and directories on the server's file system that would otherwise be restricted.

Why this answer

Directory traversal attacks exploit insufficient input validation to access files outside the intended directory by using '../' sequences.

9
Multi-Selectmedium

Which TWO of the following are effective defenses against CSRF attacks? (Choose 2.)

Select 2 answers
A.Setting the Secure flag on cookies
B.Using input validation to block special characters
C.Using anti-CSRF tokens that are validated on the server
D.Implementing SameSite cookie attribute (Lax or Strict)
E.Enabling the HttpOnly flag on session cookies
AnswersC, D

Anti-CSRF tokens are unique, unpredictable, and secret values generated by the server and embedded into forms or request headers. When a user submits a form or makes an AJAX request, the browser sends this token along with the request. The server then validates this token against the one stored in the user's session. If the tokens do not match, the request is rejected, effectively ensuring that the request originated from the legitimate application and not from a malicious third-party site.

Why this answer

CSRF tokens and SameSite cookies both prevent cross-site request forgery. Double Submit Cookie is also a method but not listed. Custom headers are not a standard defense; the primary ones are CSRF tokens and SameSite cookies.

10
MCQmedium

A web server is found to have directory listing enabled for the /uploads folder. An attacker discovers a shell.php file uploaded earlier. Which attack is the attacker MOST likely to perform next?

A.File inclusion
B.Cross-site scripting
C.Remote code execution via uploaded shell
D.SQL injection
AnswerC

Directory listing, when enabled, exposes the file and directory structure of the web server, allowing an attacker to browse its contents. If an attacker has successfully uploaded a web shell through a separate vulnerability (e.g., insecure file upload), directory listing allows them to precisely locate the shell's path and filename. Once the shell's URL is known, the attacker can directly access it via a web browser, enabling remote execution of arbitrary commands on the compromised server, thus achieving remote code execution.

Why this answer

With directory listing enabled and a known uploaded shell.php, the attacker can directly request the file via HTTP, causing the web server to execute the PHP shell and return a remote command shell — this is remote code execution (RCE) via the uploaded web shell. The uploaded file is already server-side code, so the next step is simply invoking it.

Exam trap

The trap is overcomplicating the scenario — candidates may pick file inclusion or SQL injection, but the presence of an already-uploaded, directly accessible shell.php makes RCE the obvious next step.

How to eliminate wrong answers

Option A is wrong because file inclusion (LFI/RFI) involves tricking an application into including a file via a parameter; here the attacker already has a directly accessible shell, so inclusion is unnecessary. Option B is wrong because XSS targets other users' browsers via injected client-side script, not server-side code execution. Option D is wrong because SQL injection targets database queries through unsanitized input; it is unrelated to executing an uploaded PHP file.

11
MCQmedium

An application is vulnerable to server-side request forgery (SSRF). An attacker exploits this to access internal services. Which of the following is a common indicator of SSRF?

A.The application uses user input in file inclusion functions like include()
B.The application includes a parameter like 'url=' that fetches remote resources
C.The application reflects user input in HTTP headers
D.The application stores user input in a database without sanitization
AnswerB

An application that includes a parameter, such as 'url=' or 'resource=', which the server then uses to fetch content from a user-supplied remote address, is a classic indicator of a Server-Side Request Forgery (SSRF) vulnerability. This allows an attacker to manipulate the server into making requests to arbitrary internal or external network resources on their behalf. Such a mechanism enables the server to act as a proxy, potentially accessing internal systems, cloud metadata APIs, or bypassing firewall rules that would otherwise block direct access from the attacker.

Why this answer

SSRF vulnerabilities often appear where the application fetches URLs based on user input, such as 'url=' parameters, allowing the attacker to make the server request internal resources.

12
Multi-Selecteasy

Which TWO of the following are common tools used for web application security testing? (Choose 2)

Select 2 answers
A.Burp Suite
B.Wireshark
C.Nessus
D.OWASP ZAP
E.Metasploit
AnswersA, D

Burp Suite is a comprehensive, integrated platform specifically designed for performing security testing of web applications. It functions as an intercepting proxy, allowing testers to capture, analyze, and manipulate all HTTP/S traffic between a browser and a web server. Beyond proxying, it includes a powerful scanner for automated vulnerability detection, an intruder for custom brute-forcing and fuzzing, and a repeater for manual request modification and re-sending, making it indispensable for both automated and manual web application penetration testing.

Why this answer

Burp Suite and OWASP ZAP are both widely used web application security testing tools.

13
MCQhard

A penetration tester finds that a web application allows uploading a file with the name '../../var/www/html/shell.php'. The file is successfully written to the server. Which combination of vulnerabilities does this exploit?

A.Cross-Site Scripting (XSS) and CSRF
B.Local File Inclusion (LFI) and Remote File Inclusion (RFI)
C.Directory traversal and unrestricted file upload
D.SQL injection and command injection
AnswerC

The ability to upload a file with a filename containing path traversal sequences (e.g., `../../`) directly exploits a directory traversal vulnerability, allowing the attacker to write the file to an arbitrary location outside the intended upload directory. Concurrently, the successful upload of a PHP file, which is a server-side script, indicates an unrestricted file upload vulnerability. This means the application lacks proper validation to prevent dangerous file types from being uploaded, enabling potential remote code execution.

Why this answer

Directory traversal allows moving up directories, and unrestricted file upload allows writing a PHP shell, leading to remote code execution.

14
MCQmedium

During a web application penetration test, a security analyst intercepts a request using Burp Suite and notices the following parameter in the URL: /profile?user_id=123. By changing the user_id to 124, the analyst is able to view another user's profile. Which vulnerability is being exploited?

A.SQL Injection
B.Cross-Site Scripting (XSS)
C.Insecure Direct Object Reference (IDOR)
D.Cross-Site Request Forgery (CSRF)
AnswerC

This option is correct because Insecure Direct Object Reference (IDOR) vulnerabilities occur when an application exposes a direct reference to an internal object, such as a user_id parameter, and fails to implement proper authorization checks. By simply changing the value of the user_id parameter in the request, the attacker can directly access another user's profile without explicit authorization, exploiting the application's trust in the provided identifier without verifying the user's permissions for that specific resource. This directly matches the scenario.

Why this answer

IDOR occurs when an application exposes a direct reference to an internal object (like a user ID) without proper authorization checks, allowing unauthorized access.

15
MCQmedium

A security analyst discovers that a web application's search box reflects user input without proper sanitization. However, the attacker must trick a victim into clicking a crafted link containing the malicious script. This vulnerability is classified as which type?

A.Blind XSS
B.Stored XSS
C.DOM-based XSS
D.Reflected XSS
AnswerD

Reflected XSS, also known as Non-Persistent XSS, occurs when a malicious script, typically embedded within a URL parameter or form input, is immediately processed and "reflected" back in the server's HTTP response to the user's browser without proper sanitization. This attack requires the victim to click a specially crafted link containing the payload, which then executes in their browser for that single request. The payload is not persistently stored on the server, making it a one-time execution per interaction.

Why this answer

Reflected XSS requires user interaction (clicking a link) to execute the script in the victim's browser. The payload is not stored on the server, distinguishing it from stored XSS. DOM-based XSS does not involve server reflection.

16
MCQhard

During a penetration test, a tester uses the following payload in a search field: <script>alert(document.cookie)</script>. The payload is reflected in the response without sanitization. However, the tester notices that the attack only works when the payload is submitted via a POST request, not GET. Which type of XSS is this?

A.Stored XSS
B.Reflected XSS
C.DOM-based XSS
D.Self-XSS
AnswerB

Reflected XSS occurs when a malicious script embedded in an HTTP request (e.g., a URL parameter or form field) is immediately echoed back in the server's HTTP response without proper sanitization. The victim's browser then executes this script upon rendering the page, but the payload itself is not stored on the server for future use or delivery to other users. This type of attack typically requires an attacker to trick a victim into clicking a specially crafted malicious link that contains the payload.

Why this answer

Reflected XSS occurs when the payload is reflected immediately in the response. The fact that it works via POST but not GET does not change the classification; it is still reflected XSS because the payload is not stored on the server. Some reflected XSS may be triggered only via POST parameters.

17
Multi-Selectmedium

Which TWO of the following are types of SQL injection? (Select 2)

Select 2 answers
A.Stored
B.DOM-based
C.Union-based
D.Blind boolean-based
E.Reflected
AnswersC, D

Union-based SQL injection is an in-band technique where an attacker leverages the UNION SELECT SQL operator to combine the results of the original legitimate query with a malicious query. This allows the attacker to retrieve data from other tables or databases within the same database server, and have it returned directly in the application's HTTP response. The attacker can then extract sensitive information by carefully crafting the injected SELECT statement.

Why this answer

Union-based SQL injection (C) is a correct type because it uses the SQL UNION operator to append a crafted SELECT statement to the original query, allowing the attacker to retrieve data from other tables in the same result set. Blind boolean-based SQL injection (D) is also correct because the application returns no data or error details, so the attacker sends true/false conditions and infers information from differences in the application's response. The other options are not SQL injection types: Stored (A) and Reflected (E) are categories of cross-site scripting (XSS), and DOM-based (B) is also an XSS classification that manipulates the client-side DOM rather than injecting SQL into a database query.

Exam trap

CEH often tests the overlap between XSS and SQLi taxonomies — candidates see 'Stored' and 'Reflected' and mistakenly select them as SQLi types when those are XSS categories.

18
MCQeasy

Which of the following Burp Suite tools is used to automatically fuzz web application inputs and identify common vulnerabilities like SQL injection and XSS?

A.Proxy
B.Repeater
C.Intruder
D.Scanner
AnswerC

Burp Suite's Intruder tool is purpose-built for performing automated, highly configurable attacks against web applications, including fuzzing, brute-forcing, and enumeration. It allows users to define specific insertion points within a request and then systematically iterate through a list of payloads, observing the server's responses to identify vulnerabilities or weak points. Its advanced payload generation, attack types (e.g., Sniper, Battering Ram, Pitchfork, Cluster Bomb), and result analysis features make it the ideal choice for automated input testing.

Why this answer

Burp Intruder is a tool for automating customized attacks against web applications, including fuzzing for vulnerabilities.

19
MCQmedium

A security analyst observes the following in Apache access logs: 'GET /cgi-bin/test.cgi?cmd=id HTTP/1.1' 200. This is most likely an attempt at which attack?

A.Command injection
B.Local File Inclusion (LFI)
C.SQL injection
D.Directory traversal
AnswerA

The presence of a 'cmd' parameter in the URL, especially when followed by a system command like 'id', strongly indicates that the web application is passing user-supplied input directly to an underlying operating system shell. This vulnerability arises when the application fails to properly sanitize or validate this input, allowing an attacker to append arbitrary shell commands using special characters such as semicolons, pipes, or ampersands. Consequently, the server executes these injected commands with the privileges of the web server process, potentially leading to remote code execution.

Why this answer

The log entry shows a GET request to a CGI script with a parameter 'cmd=id'. The 'cmd' parameter is a classic indicator of command injection, where an attacker attempts to execute arbitrary system commands (in this case, 'id') via a vulnerable CGI script. The HTTP 200 response suggests the command may have executed successfully, confirming the attempt.

Exam trap

CEH often tests the confusion between command injection and directory traversal or LFI, causing candidates to pick LFI when they see a file path, but here the 'cmd' parameter clearly indicates command execution.

How to eliminate wrong answers

Option B is wrong because LFI typically involves manipulating file paths to include local files (e.g., '../../etc/passwd'), not executing system commands via parameters like 'cmd'. Option C is wrong because SQL injection would involve SQL syntax in parameters (e.g., ' OR '1'='1), not shell commands. Option D is wrong because directory traversal aims to access files outside the web root using '../' sequences, not command execution.

20
MCQmedium

A security analyst wants to check if a web application is vulnerable to Server-Side Request Forgery (SSRF). Which of the following actions would be most effective?

A.Submit a base64-encoded payload in a cookie
B.Use SQLMap with a time-based payload
C.Modify the Host header to point to localhost
D.Send a request with a URL parameter pointing to an internal IP address
AnswerD

Sending a request with a URL parameter pointing to an internal IP address is the correct method to test for Server-Side Request Forgery (SSRF). SSRF exploits occur when a web application fetches a remote resource based on user-supplied input. By providing an internal IP address (e.g., `127.0.0.1`, `10.0.0.1`) in a parameter that the server is expected to process and fetch, an attacker can determine if the server attempts to connect to that internal resource. Successful connection attempts, even if resulting in an error, indicate the presence of an SSRF vulnerability.

Why this answer

Crafting a request that makes the server fetch an internal IP address (like 127.0.0.1) and observing if the response includes data from that internal resource is a good test for SSRF.

21
MCQhard

An analyst reviews the following HTTP response: HTTP/1.1 200 OK Set-Cookie: sessionid=abc123; SameSite=None; Secure ... <html><body><p>Welcome back!</p></body></html>. What possible vulnerability exists if the application does not use CSRF tokens?

A.Cross-site request forgery (CSRF)
B.Clickjacking
C.Cross-site scripting (XSS)
D.Session fixation
AnswerA

Cross-site request forgery (CSRF) is a vulnerability where an attacker tricks an authenticated user into submitting an unintended request to a web application. If the HTTP response implies that session cookies are sent on cross-site requests (e.g., via SameSite=None without Secure or HttpOnly flags) and the application lacks anti-CSRF tokens, the application becomes susceptible. An attacker can craft a malicious page that, when visited by the victim, forces their browser to send a request to the vulnerable site, leveraging the victim's active session.

Why this answer

SameSite=None allows cross-site requests to include cookies, making CSRF possible if no CSRF tokens are used. SameSite=Lax or Strict would block some CSRF attacks.

22
Multi-Selectmedium

A security analyst notices that a web application's search functionality returns database error messages in the response. The analyst suspects SQL injection. Which TWO techniques should the analyst use to confirm and exploit this vulnerability? (Choose TWO.)

Select 2 answers
A.Use out-of-band SQL injection with DNS exfiltration
B.Use a time-based blind SQL injection with SLEEP() function
C.Leverage error-based SQL injection with CONVERT() or double query
D.Use SQLMap with --union-col and --union-from flags
E.Implement parameterized queries in the application code
AnswersC, D

Leveraging error-based SQL injection with functions like CONVERT() or by employing double query techniques (e.g., using `EXTRACTVALUE` or `UPDATEXML` in MySQL) is highly effective when an application displays verbose database error messages. These methods intentionally trigger type conversion errors or XML parsing errors, forcing the database to include the results of an injected subquery within the error message itself. This allows the attacker to directly extract data, such as database version, table names, or user credentials, from the application's response.

Why this answer

Union-based SQL injection uses UNION SELECT to retrieve data from other tables. Error-based SQL injection leverages database error messages to extract information. Both are common in-band techniques suitable when errors are displayed.

23
MCQhard

While analyzing web server logs, an analyst finds the following entry: GET /../../../../etc/passwd HTTP/1.1 with a 200 OK response. Which vulnerability is indicated, and what is the MOST likely impact?

A.Command injection; remote shell access
B.Directory traversal; reading sensitive files
C.SQL injection; data exfiltration
D.Remote File Inclusion (RFI); arbitrary code execution
AnswerB

The presence of `../` sequences in the URL path is a definitive indicator of a directory traversal (also known as path traversal) attack. This technique exploits vulnerabilities in file handling routines to access files and directories stored outside the intended web root directory by manipulating relative paths. The goal is often to read sensitive system files, such as `/etc/passwd`, or configuration files, leading directly to unauthorized information disclosure.

Why this answer

The path contains '../' sequences indicating directory traversal. A 200 response suggests the attacker successfully read the /etc/passwd file, leading to disclosure of system user accounts. This can aid further attacks like password cracking.

24
Multi-Selectmedium

Which TWO of the following are effective mitigations against Cross-Site Request Forgery (CSRF)?

Select 2 answers
A.Using SameSite cookies
B.Input validation
C.Using anti-CSRF tokens
D.Using HTTPOnly cookies
E.Using CSRF tokens
AnswersA, E

SameSite cookies are an effective mitigation because they instruct the browser to restrict when cookies are sent with cross-origin requests. By setting `SameSite=Lax` or `SameSite=Strict`, the browser will not attach session cookies to requests initiated from a different site, thereby preventing an attacker's forged request from carrying the necessary authentication credentials to execute an unauthorized action.

Why this answer

SameSite cookies (option A) are effective against CSRF because they restrict the browser from sending cookies on cross-origin requests, preventing forged requests from carrying authentication credentials. CSRF tokens (option E) are also effective because they require a unique token in each request that the attacker cannot predict. Option C (anti-CSRF tokens) is essentially the same technique as option E, so it is not considered a distinct mitigation; thus, only options A and E are correct.

Exam trap

EC-Council often tests the distinction between CSRF and XSS mitigations, and the trap here is that candidates confuse HTTPOnly cookies (which protect against XSS) as a CSRF defense, or they think that input validation or redundant token naming (anti-CSRF vs CSRF) are separate valid options.

25
MCQeasy

Which of the following best describes the attack where an attacker uses a valid session token to impersonate a user without needing to authenticate?

A.Cross-site scripting
B.Session hijacking
C.Phishing
D.Brute-force attack
AnswerB

Session hijacking is a sophisticated attack where an attacker successfully obtains a legitimate user's valid session ID or token and then uses it to impersonate that user, gaining unauthorized access to their active session. By presenting the stolen, yet valid, session token to the web server, the attacker effectively bypasses the initial authentication process and can perform actions as if they were the legitimate user. This allows them to take over an already established and authenticated session without needing the user's credentials.

Why this answer

Session hijacking involves stealing or using a valid session token to impersonate a user, bypassing authentication.

26
MCQeasy

Which of the following tools is commonly used to automate the detection and exploitation of SQL injection vulnerabilities?

A.SQLMap
B.Metasploit
C.Nmap
D.Burp Suite
AnswerA

SQLMap is an open-source penetration testing tool specifically designed to automate the detection and exploitation of SQL injection flaws and database server takeovers. It supports a wide array of SQL injection techniques, including boolean-based blind, time-based blind, error-based, UNION query-based, stacked queries, and out-of-band methods. Its primary function is to identify vulnerable parameters, extract data, and even access the underlying file system or execute commands on the compromised database server, making it the definitive choice for automated SQLi.

Why this answer

SQLMap is a dedicated, open-source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws. It supports a wide range of database management systems (e.g., MySQL, Oracle, PostgreSQL) and injection techniques (e.g., boolean-based blind, time-based blind, UNION query, stacked queries), making it the standard choice for this specific task.

Exam trap

The trap here is that candidates often confuse Metasploit's broad exploitation capabilities with the specialized automation of SQL injection detection, leading them to choose Metasploit when SQLMap is the precise tool for this specific vulnerability class.

How to eliminate wrong answers

Option B (Metasploit) is wrong because it is a general exploitation framework used for developing and executing exploit code against a variety of vulnerabilities, not specifically designed or optimized for automating SQL injection detection and exploitation. Option C (Nmap) is wrong because it is a network scanning tool used for host discovery, port scanning, and service enumeration, lacking any built-in capability to detect or exploit SQL injection vulnerabilities. Option D (Burp Suite) is wrong because it is an intercepting proxy and web application security testing platform that requires manual configuration and extension (e.g., using SQLiPy or custom plugins) to perform automated SQL injection; it is not a dedicated automation tool for SQL injection like SQLMap.

27
MCQmedium

A web application uses a URL parameter to fetch a file from the server, e.g., 'download.php?file=report.pdf'. An attacker changes the parameter to '../../etc/passwd' and retrieves the password file. This attack is known as:

A.Command injection
B.Local File Inclusion (LFI)
C.Directory traversal
D.Server-Side Request Forgery (SSRF)
AnswerC

Directory traversal, also known as path traversal, is a web security vulnerability that allows an attacker to read arbitrary files on the server's file system. This is achieved by manipulating file paths in user-supplied input, typically using sequences like "../" (dot-dot-slash) to move up in the directory hierarchy, or its encoded forms. The objective is to access files and directories stored outside the intended web root directory, such as configuration files, source code, or system files like /etc/passwd.

Why this answer

Directory traversal (also known as path traversal) allows an attacker to access files outside the intended directory by using '../' sequences.

28
Multi-Selectmedium

Which TWO of the following attacks can be prevented by properly validating and sanitizing user input? (Select 2)

Select 2 answers
A.Cross-Site Request Forgery (CSRF)
B.SQL injection
C.Man-in-the-Middle (MitM) attack
D.Clickjacking
E.Cross-Site Scripting (XSS)
AnswersB, E

SQL injection attacks occur when an attacker inserts malicious SQL code into user input fields, which is then executed by the database. Proper input validation and sanitization are highly effective against this threat. Techniques such as using parameterized queries (prepared statements) or escaping special characters ensure that user-supplied data is treated strictly as data literals, preventing it from being interpreted as executable SQL commands and neutralizing the injection attempt.

Why this answer

Option B (SQL injection) is correct because SQL injection occurs when untrusted user input is concatenated into SQL queries, and validating/sanitizing that input (or using parameterized queries/prepared statements) prevents attackers from injecting malicious SQL syntax. Option E (Cross-Site Scripting, XSS) is correct because XSS arises when user-supplied data is rendered into HTML/JavaScript without proper output encoding or input sanitization, so validating and sanitizing input stops script payloads from executing in victims' browsers. Option A (CSRF) is not prevented by input validation alone; it requires anti-CSRF tokens, SameSite cookies, or origin/referer checks, since the attack abuses a victim's authenticated session rather than malformed input.

Option C (MitM) is a network-layer interception problem mitigated by TLS, certificate pinning, and secure protocols, not by input validation. Option D (Clickjacking) is prevented by frame-busting headers such as X-Frame-Options or Content-Security-Policy frame-ancestors, not by sanitizing user input.

Exam trap

CEH often tests the misconception that input validation stops all web attacks — candidates must recognize that CSRF, clickjacking, and MitM are session/transport-layer attacks immune to sanitization.

29
Multi-Selectmedium

Which TWO of the following are effective mitigations against Clickjacking attacks? (Choose 2)

Select 2 answers
A.Enable HTTP Strict-Transport-Security (HSTS)
B.Set Content-Security-Policy: frame-ancestors 'none'
C.Use CSRF tokens
D.Set X-Frame-Options: DENY
E.Set SameSite cookies to Strict
AnswersB, D

The `Content-Security-Policy: frame-ancestors 'none'` directive is a modern and highly effective mitigation against clickjacking. This policy explicitly instructs the browser that the resource cannot be embedded within any frame, iframe, object, embed, or applet by any domain, including its own. By preventing the target page from being loaded in a hidden or overlaid frame, it directly thwarts attempts to trick users into performing unintended actions.

Why this answer

Option B is correct because the Content-Security-Policy directive frame-ancestors 'none' instructs the browser that the page must never be embedded in a frame, iframe, or object, which directly blocks the framing technique clickjacking relies on. Option D is correct because the X-Frame-Options: DENY response header prevents the page from being rendered inside a frame on any site, including the same origin, thereby stopping clickjacking overlay attacks. Option A is not a clickjacking mitigation because HSTS only forces HTTPS connections and prevents protocol downgrade or cookie hijacking, not framing.

Option C is unrelated since CSRF tokens defend against forged state-changing requests, not UI redressing. Option E is also unrelated because SameSite cookie attributes limit cross-site cookie sending to mitigate CSRF, not framing-based clickjacking.

Exam trap

The trap is confusing CSRF defenses (CSRF tokens, SameSite cookies) with clickjacking defenses — they address different attack classes, and only framing controls stop clickjacking.

30
MCQeasy

Which of the following is a symptom of a successful command injection attack?

A.The server returns a 404 error
B.The output of the 'id' command appears in the response
C.The HTTP response header contains 'Server: Apache'
D.The page loads slower than usual
AnswerB

The appearance of the 'id' command's output, such as user and group IDs, directly within the web application's response is a definitive indicator of successful command injection. This demonstrates that an arbitrary operating system command was not only executed on the server but also that its standard output was captured and reflected back to the attacker, providing undeniable proof of remote code execution.

Why this answer

In a successful command injection attack, the attacker injects operating system commands into a vulnerable input field, and the web application passes them to a shell for execution. If the application returns the command output in the HTTP response, seeing the result of the 'id' command (e.g., 'uid=33(www-data) gid=33(www-data) groups=33(www-data)') is a definitive symptom that the injection succeeded and the server executed the attacker's command.

Exam trap

The CEH exam often tests the distinction between reflected output (visible in the response) and blind injection (no visible output), so candidates must recognize that seeing command output like 'id' is a direct symptom of a successful non-blind command injection.

How to eliminate wrong answers

Option A is wrong because a 404 error indicates a missing resource, not command execution; command injection typically does not cause a 404 unless the injected command inadvertently triggers a file-not-found condition. Option C is wrong because the 'Server: Apache' header is a standard server banner that reveals the web server software, not a symptom of command injection; it appears regardless of injection attacks. Option D is wrong because slower page loads can result from many benign causes (e.g., network latency, heavy traffic, inefficient code) and are not a specific or reliable indicator of command injection.

31
MCQmedium

A penetration tester is using SQLMap to automate exploitation of a SQL injection vulnerability found in a login form. The tester wants to retrieve the names of all databases on the backend MySQL server. Which SQLMap flag should be used?

A.--dbs
B.--current-db
C.--schema
D.--tables
AnswerA

The --dbs option is the correct command-line switch in sqlmap for enumerating and displaying the names of all available databases on the target database management system (DBMS) server. It leverages identified SQL injection vulnerabilities to extract this high-level structural information, providing a foundational understanding of the server's data organization. This is a crucial initial step in reconnaissance for a penetration tester, revealing the scope of potential data stores.

Why this answer

The --dbs flag in SQLMap instructs the tool to enumerate all databases on the target DBMS. This is the standard first step after confirming an injection point, and it directly answers the tester's goal of retrieving database names. It works against MySQL, MSSQL, Oracle, PostgreSQL, and others.

Exam trap

The trap is the close naming between --dbs, --current-db, --tables, and --schema — candidates who have not actually run SQLMap confuse 'list all databases' with 'list tables' or 'show current database', and the exam deliberately places all four as plausible-sounding enumeration flags.

How to eliminate wrong answers

Option B is wrong because --current-db returns only the name of the database the web application is currently connected to, not all databases on the server. Option C is wrong because --schema dumps the schema (table structures, columns) of the databases, which is a deeper enumeration step performed after database names are known. Option D is wrong because --tables enumerates tables within a specific database (usually specified with -D), not the list of databases themselves.

32
MCQhard

An attacker intercepts a request and notices that the server reflects the value of the 'User-Agent' header in the response without sanitization. The attacker crafts a payload that triggers an alert box. This is an example of:

A.HTTP header injection
B.DOM-based XSS
C.Stored XSS
D.Reflected XSS
AnswerD

Reflected XSS occurs when an attacker's malicious script, typically delivered via a URL parameter or HTTP header, is immediately echoed back by the web server in its HTTP response without proper sanitization. The victim's browser then interprets and executes this script as part of the legitimate page content. This non-persistent attack requires the victim to click a specially crafted link or visit a malicious site that sends the crafted request, making it a single-request, single-response vulnerability.

Why this answer

Reflected XSS occurs when the application immediately returns the user input in the response; here, the User-Agent header is reflected.

33
MCQeasy

Which of the following tools is specifically designed to automate the detection and exploitation of SQL injection vulnerabilities?

A.Metasploit
B.Nmap
C.SQLMap
D.Burp Suite
AnswerC

SQLMap automates detection and exploitation of SQL injection flaws, fingerprinting the backend DBMS and extracting data through crafted payloads. It targets exactly the SQL injection automation the stem requires, unlike general-purpose scanners or manual proxy tools such as Burp Suite or OWASP ZAP.

Why this answer

SQLMap is a well-known open-source tool that automates the process of detecting and exploiting SQL injection flaws.

34
MCQmedium

Which Burp Suite tool is most appropriate for modifying and re-sending a single HTTP request multiple times with different payloads to test for SQL injection?

A.Repeater
B.Intruder
C.Proxy
D.Scanner
AnswerB

Burp Suite Intruder is specifically engineered for automating customized attacks against web applications by systematically injecting various payloads into designated request parameters. It enables testers to define specific insertion points and choose from multiple attack types (e.g., Sniper, Battering Ram, Pitchfork, Cluster Bomb) to iterate through wordlists or generate dynamic payloads, making it ideal for discovering vulnerabilities such as SQL injection, cross-site scripting, or brute-forcing credentials.

Why this answer

Burp Intruder is designed for automated customized attacks, allowing you to send many requests with varying payloads to a single target endpoint.

35
Multi-Selectmedium

Which TWO of the following are effective mitigations against Cross-Site Request Forgery (CSRF) attacks? (Select 2)

Select 2 answers
A.Setting SameSite cookies to Lax or Strict
B.Input validation
C.Implementing CSRF tokens in forms
D.Using CAPTCHA
E.Using HTTPS only
AnswersA, C

Setting SameSite cookies to Lax or Strict significantly mitigates CSRF by controlling when cookies are sent with cross-site requests. Lax mode sends cookies only with top-level navigations (typically GET requests) and not with cross-site POST requests or iframes, preventing most forged state-changing requests. Strict mode offers even stronger protection by never sending cookies with any cross-site requests, ensuring the session cookie is only included for same-site origins.

Why this answer

CSRF tokens ensure the request originates from the legitimate site; SameSite cookies prevent the browser from sending cookies on cross-site requests.

36
Multi-Selectmedium

A tester is reviewing a web application that builds SQL queries using string concatenation and places user input directly into the query text. The development team wants to eliminate the SQL injection class of vulnerability rather than patch individual reports. Which TWO measures should the tester recommend to the team? (Choose two.)

Select 2 answers
A.Apply strict allowlist validation on input that is expected to have a known format, such as numeric identifiers or enumerated values.
B.Deploy a web application firewall rule set and rely on it as the sole control to block injection payloads.
C.Store database connection credentials in the application source code to simplify deployment and rotation.
D.Enable verbose database error messages in production so developers can debug malformed queries faster.
E.Use parameterized queries or prepared statements so that user input is bound as data rather than parsed as SQL syntax.
AnswersA, E

Where input has a predictable structure, allowlisting constrains it to expected values and removes the ability to inject syntax. Combined with parameterization, validation hardens fields such as identifiers and enumerated parameters, reducing the attack surface and catching malformed input before it reaches the query layer.

Why this answer

Eliminating SQL injection at the class level requires fixing how queries are constructed. Parameterized queries bind input as data so it cannot change query syntax, and allowlist validation restricts fields with known formats. Together they address the root cause, whereas firewalls, credential storage, and verbose errors affect other concerns without removing the vulnerability.

Exam trap

The trap here is treating a web application firewall as a complete fix for SQL injection, when it is only a supplementary control that does not correct the vulnerable query construction.

37
MCQhard

A tester finds that a Java web application stores a serialized user profile object in a cookie named 'profile'. The application deserializes this cookie on every request using ObjectInputStream without validating its contents. The tester wants to demonstrate remote code execution rather than merely causing a denial of service. Which approach best demonstrates this?

A.Craft a serialized payload using a gadget chain from a library present on the classpath, such as a Commons Collections chain, and submit it as the cookie value.
B.Send a serialized object of an arbitrary custom class that the tester writes, because any class can be deserialized remotely.
C.Base64-encode the original cookie value and append a comment marker to bypass any signature check.
D.Replace the cookie value with a long string of random bytes to trigger a deserialization exception and confirm the parsing path.
AnswerA

Java deserialization RCE requires a gadget chain whose classes exist on the target's classpath and whose readObject or related methods trigger attacker-controlled behavior during deserialization. Building a payload with a known gadget library that the application loads and delivering it in the cookie directly exercises that chain to achieve code execution.

Why this answer

Exploiting Java deserialization for code execution depends on the presence of a usable gadget chain in libraries the application loads. Building a serialized payload from such a chain and delivering it through the vulnerable cookie causes the deserialization process itself to invoke methods that run attacker-supplied commands, which is the strongest possible demonstration of impact.

Exam trap

The trap here is believing that any serialized object can be deserialized remotely, when in fact only classes already present on the target's classpath can be instantiated.

38
Multi-Selectmedium

A penetration tester uses Burp Suite to intercept and modify web traffic. Which TWO features in Burp Suite would be MOST useful for performing a brute-force attack on a login form? (Choose TWO.)

Select 2 answers
A.Burp Scanner
B.Burp Proxy
C.Burp Decoder
D.Burp Intruder
E.Burp Repeater
AnswersB, D

Burp Proxy is the core component for intercepting all HTTP/S traffic between the browser and the target application. It allows a penetration tester to view, analyze, and manually modify individual requests and responses in real-time before they reach their destination. This direct interception and on-the-fly modification capability is fundamental for understanding application behavior and initiating various attacks, often serving as the initial capture point for other Burp tools.

Why this answer

Burp Proxy (B) is correct because it sits as an intercepting HTTP/S man-in-the-middle, allowing the tester to capture the login POST request, inspect its parameters, and forward it to other tools for automated manipulation. Burp Intruder (D) is correct because it is the dedicated Burp component for automating customized attacks: the tester marks the username/password parameters as payload positions, loads a wordlist (e.g., a Sniper or Cluster bomb attack type), and sends many login attempts while analyzing status codes, lengths, or grep-match results to spot a successful credential. Together, Proxy captures the base request and Intruder replays it with varying payloads, which is the standard Burp workflow for brute-forcing a login form.

Burp Scanner (A) is an automated vulnerability scanner for issues like SQLi or XSS, not a credential-guessing engine, so it does not belong. Burp Decoder (C) only encodes/decodes data (e.g., Base64, URL, hex) and cannot generate or send repeated login requests. Burp Repeater (E) manually resends a single request for tweaking, but it lacks the payload-position and wordlist automation needed for brute force.

Exam trap

CEH often tests tool-feature mapping — candidates confuse Repeater (manual, single-request) with Intruder (automated, multi-request), picking Repeater because it also 'sends requests'.

39
Multi-Selectmedium

During a web application test, the tester finds that the application includes user-supplied file names in include() statements. Which TWO of the following are indicators of a Remote File Inclusion (RFI) vulnerability? (Choose TWO.)

Select 2 answers
A.The application includes files from http://attacker.com/shell.txt
B.The application includes files with '..' and '/' sequences
C.The application includes /etc/passwd in the response
D.The application includes files with .inc extension
E.The application allows inclusion of files from external FTP servers
AnswersA, E

This scenario directly indicates Remote File Inclusion (RFI) because the application is fetching and executing or displaying content from an external, attacker-controlled HTTP server (http://attacker.com). RFI vulnerabilities allow an attacker to inject a remote URL into an include statement, causing the web server to download and process the specified file. This can lead to arbitrary code execution, data exfiltration, or defacement if the included file contains malicious scripts.

Why this answer

RFI allows inclusion of remote files via HTTP/HTTPS URLs. Directory traversal with ../ is more typical of LFI. Inclusion of local files like /etc/passwd indicates LFI, not RFI.

40
MCQmedium

A web application allows users to upload profile pictures. An attacker uploads a file named "profile.php" containing malicious PHP code. When the attacker visits the uploaded file's URL, the code executes. Which vulnerability is being exploited?

A.Directory traversal
B.Command injection
C.File upload vulnerability
D.Stored XSS
AnswerC

A file upload vulnerability arises when a web application permits users to upload files without sufficient validation of their type, content, or proper handling of their storage and execution. The ability for an attacker to upload a malicious PHP file, which is then executed by the web server, perfectly exemplifies this vulnerability. This allows for remote code execution (RCE) on the server, directly matching the described attack where a 'profile picture' turns out to be an executable script.

Why this answer

The application fails to validate the file type or restrict execution, allowing a malicious PHP file to be uploaded and executed on the server, which is a classic file upload vulnerability leading to remote code execution.

41
MCQhard

A web server is configured with WebDAV and allows PUT requests. An attacker uploads a .asp file and accesses it to execute code. Which tool or method is most directly associated with exploiting this misconfiguration?

A.SQL injection
B.File upload vulnerability
C.Directory brute forcing
D.Cross-site scripting (XSS)
AnswerB

The ability to upload and execute arbitrary files via WebDAV PUT requests constitutes a critical file upload vulnerability. WebDAV's PUT method allows clients to create or replace resources on the server. If this functionality is enabled without strict access controls, file type validation, or execution restrictions, an attacker can upload malicious scripts (e.g., web shells) and subsequently execute them, leading to remote code execution on the server.

Why this answer

WebDAV with PUT enabled allows attackers to upload arbitrary files, including web shells, leading to remote code execution.

42
MCQmedium

A web application allows users to upload profile pictures. The application uses the filename provided by the user to save the file on the server. An attacker uploads a file named 'malicious.php%00.png' and the server saves it as 'malicious.php'. Which vulnerability is being exploited?

A.Directory traversal
B.Command injection
C.Null byte injection
D.Cross-Site Scripting (XSS)
AnswerC

Null byte injection exploits the \x00 (or %00 in URL-encoded form) character, which is interpreted as a string terminator by many C-based functions and some older APIs. When used in a filename like "filename.php%00.jpg", the server's file type validation might see ".jpg" due to string processing, but the underlying file system or save function truncates the name at the null byte, resulting in "filename.php". This allows an attacker to upload a malicious file with a forbidden extension by effectively tricking the filter.

Why this answer

Null byte injection exploits the fact that in some programming languages (like C or older PHP versions), a null byte (%00) terminates a string. The application saves the file using the user-supplied filename, but when it processes 'malicious.php%00.png', the null byte causes the string to be truncated to 'malicious.php', allowing the attacker to upload a PHP file that can be executed.

Exam trap

CEH often tests the confusion between null byte injection and directory traversal, but the key is that null byte injection truncates strings, while directory traversal manipulates paths.

How to eliminate wrong answers

Option A is wrong because directory traversal involves manipulating file paths to access directories outside the intended scope (e.g., ../../etc/passwd), not truncating filenames. Option B is wrong because command injection involves executing arbitrary system commands, not file upload manipulation. Option D is wrong because XSS involves injecting client-side scripts, not server-side file handling.

43
MCQhard

A web application has an endpoint that takes a URL parameter and fetches content from that URL, returning it to the user. An attacker supplies 'file:///etc/passwd' and reads the server's passwd file. Which vulnerability is this?

A.Command injection
B.Remote File Inclusion (RFI)
C.Server-Side Request Forgery (SSRF)
D.Directory traversal
AnswerC

Server-Side Request Forgery (SSRF) occurs when a web application is coerced into making an HTTP request to an arbitrary URL specified by an attacker. This vulnerability allows an attacker to force the server to connect to internal or external systems, often bypassing firewalls or accessing sensitive internal services. The use of the file:// protocol in the URL parameter is a classic indicator, enabling the server to fetch local files from its own filesystem, effectively turning the server into a proxy for accessing internal resources.

Why this answer

This is SSRF because the server is making requests to internal resources based on user input; file:// is a protocol that can be used for local file access.

44
MCQhard

A penetration tester finds that a web application accepts XML input and returns the parsed data in the response. The tester submits the following payload: <?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><root>&xxe;</root>. The server returns the contents of /etc/passwd. Which vulnerability is being exploited?

A.SSRF
B.Command injection
C.XXE injection
D.XPath injection
AnswerC

XXE injection exploits vulnerabilities in XML parsers that are configured to process external entities within a Document Type Definition (DTD). By defining a `SYSTEM` entity that references a local file path, such as `/etc/passwd`, the attacker can compel the XML parser to read the content of that file. This content is then often returned within the application's response or an error message, enabling sensitive data exfiltration directly through XML processing.

Why this answer

The payload defines an external entity (XXE) that reads a local file, indicating an XML External Entity (XXE) injection vulnerability.

45
Multi-Selectmedium

Which THREE of the following are common types of SQL injection attacks? (Select three)

Select 3 answers
A.Reflected SQL injection
B.Stored SQL injection
C.Out-of-band SQL injection
D.Blind SQL injection
E.In-band SQL injection
AnswersC, D, E

Out-of-band SQL injection occurs when an attacker cannot retrieve data directly through the same communication channel used for the injection. Instead, the attacker leverages the database server's ability to make external network requests, such as DNS lookups or HTTP requests, to exfiltrate data to a server controlled by the attacker. This technique is particularly useful in blind scenarios where traditional in-band methods are not feasible, creating a separate channel for data retrieval.

Why this answer

The three correct answers are C, D, and E. Out-of-band SQL injection (C) is a recognized type where the attacker uses a different channel (e.g., DNS or HTTP requests via functions like UTL_HTTP or xp_dirtree) to exfiltrate data when the web response does not return query results. Blind SQL injection (D) is a standard category where the attacker infers data by observing boolean true/false responses or time delays (e.g., WAITFOR DELAY, SLEEP), rather than seeing query output directly.

In-band SQL injection (E) is the classic category where data is retrieved through the same channel used to inject the payload, typically via UNION-based or error-based techniques. The unmarked options A and B are not standard SQL injection classifications: 'reflected' and 'stored' describe XSS variants, not SQLi types, so they do not belong here.

Exam trap

CEH often mixes XSS terminology (reflected, stored) into SQLi questions — candidates who don't distinguish the two vulnerability taxonomies pick the XSS-sounding options.

46
MCQhard

A web application uses an XML parser to process user-supplied XML documents. An attacker submits the following payload: <?xml version='1.0'?><!DOCTYPE foo [<!ENTITY xxe SYSTEM 'file:///etc/passwd'>]><root>&xxe;</root>. Which vulnerability is being exploited?

A.Server-Side Request Forgery (SSRF)
B.XPath injection
C.XML External Entity (XXE) injection
D.SQL injection
AnswerC

XML External Entity (XXE) injection is the correct answer because the scenario describes an attacker leveraging an XML parser to process user-supplied XML containing references to external entities. By defining an external entity that points to a local file path, such as file:///etc/passwd, the vulnerable parser is tricked into reading the content of that file. This content is then embedded within the XML document's response, leading to the unauthorized disclosure of sensitive server-side information.

Why this answer

The payload defines an external entity that reads a local file, which is classic XXE (XML External Entity) injection.

47
MCQmedium

During a web application penetration test, a tester uses Burp Suite's Repeater tool to manually manipulate a request and observe the response. After sending the same request multiple times, the application returns a 302 redirect pointing to a login page. What is the MOST likely cause?

A.The server is rate-limiting the requests
B.A cross-site request forgery (CSRF) token mismatch occurred
C.The session token has expired and the user must re-authenticate
D.The server detected the use of a proxy and blocked the request
AnswerC

When a session token expires, the server invalidates the associated user session, meaning it no longer recognizes the client as authenticated. This is a common security measure to limit the window of opportunity for session hijacking. Upon receiving a request with an expired or invalid session token, the application's security logic often redirects the user to the login page (HTTP 302 Found) to prompt re-authentication and establish a new, valid session. This behavior directly aligns with the observed 302 redirect.

Why this answer

A 302 redirect to the login page is the classic server-side signal that the session cookie presented in the request is no longer valid — either it expired, was invalidated server-side, or the session store lost the record. Burp Repeater replays the exact same request with the same session token, so once that token ages out or is rotated, every subsequent replay gets bounced to authentication. This is expected behavior, not a security control firing.

Exam trap

CEH often tests whether candidates can distinguish authentication/session-expiry responses (302 to login) from authorization failures (403), rate limiting (429), and CSRF rejections — the trap is picking a security control that sounds plausible but returns a different status code.

How to eliminate wrong answers

Option A is wrong because rate limiting typically returns HTTP 429 (Too Many Requests) or 503, not a 302 redirect to a login page. Option B is wrong because a CSRF token mismatch usually returns 403 Forbidden or a custom error page, and CSRF tokens are per-form/per-session values, not the cause of a redirect to login. Option D is wrong because servers do not reliably detect Burp Suite as a proxy — Burp is a local intercepting proxy and the traffic looks like normal HTTPS from the client; there is no standard 'proxy detected' 302 response.

48
MCQmedium

A security team wants to test their web application for vulnerabilities. Which Burp Suite tool is BEST suited for automating attacks like brute-force or fuzzing?

A.Proxy
B.Repeater
C.Intruder
D.Scanner
AnswerC

Intruder is specifically designed for automating customized attacks against web applications by systematically injecting multiple payloads into designated insertion points within HTTP requests. It excels at tasks like brute-forcing credentials, fuzzing parameters for injection vulnerabilities (SQLi, XSS), and enumerating valid inputs by delivering a large number of varied payloads and analyzing the responses. Its highly configurable payload generation and attack types make it the ideal tool for automated vulnerability discovery.

Why this answer

Intruder is designed for automated customized attacks including brute-force, fuzzing, and credential stuffing.

49
Multi-Selectmedium

Which TWO of the following are valid techniques used in password spraying attacks? (Choose 2.)

Select 2 answers
A.Using previously compromised username/password pairs from a breach
B.Capturing keystrokes to obtain a user's password
C.Trying every possible password from a dictionary against a single username
D.Using a list of common passwords (e.g., 'Password123', 'Welcome1') against a large set of usernames
E.Attempting a single common password across multiple users, then trying the next common password
AnswersD, E

Password spraying is a low-and-slow attack strategy where an attacker uses a small, curated list of extremely common or default passwords against a very large number of usernames within a target system. The primary goal is to avoid triggering account lockout thresholds, which typically activate after multiple failed login attempts on a *single user account*, by distributing the password attempts horizontally across many accounts.

Why this answer

Password spraying is defined by trying a small number of common passwords against many accounts to avoid lockout thresholds, and both D and E describe exactly this. Option D is correct because it uses a list of common passwords such as 'Password123' and 'Welcome1' against a large set of usernames, which is the classic horizontal brute-force pattern. Option E is correct because it attempts one common password across multiple users before moving to the next common password, which is the defining low-and-slow technique that evades account lockout policies.

Option A is credential stuffing, not spraying, since it replays previously compromised username/password pairs. Option B is keylogging, a host-based credential theft technique, not a password spraying method. Option C is a traditional brute-force attack against a single username, which is vertical rather than horizontal and would trigger lockouts.

Exam trap

CEH often tests the confusion between password spraying (few passwords, many users) and brute-force/dictionary attacks (many passwords, one user) or credential stuffing (known breached credentials).

50
MCQhard

During a penetration test, the tester finds that the Apache server is configured with directory listing enabled on the /uploads directory. The tester navigates to http://example.com/uploads/ and sees a list of files. Which of the following is the MOST immediate security concern?

A.Sensitive files may be exposed to unauthorized users
B.The server is running an outdated version of Apache
C.The server is vulnerable to cross-site scripting (XSS) attacks
D.An attacker can upload malicious files to the directory
AnswerA

Directory listing, when enabled on an Apache server, allows an attacker to browse the contents of a directory like a file system. This directly exposes the names and potentially the content of all files within that directory, including configuration files (e.g., .env, web.config), backup files (.bak, .zip), log files, or even source code, which could contain credentials or other sensitive data. Unauthorized access to such files represents a significant information disclosure vulnerability.

Why this answer

Directory listing exposes file names that may reveal sensitive information (e.g., backup files, config files). Attackers can then attempt to access these files directly, potentially leading to data disclosure.

51
Multi-Selecthard

Which THREE of the following are common indicators of a Server-Side Request Forgery (SSRF) vulnerability? (Select 3)

Select 3 answers
A.The server returns data from internal services like http://localhost/ or http://192.168.x.x/
B.The application supports file:// or dict:// URL schemes in user input
C.The application reflects user input in the page source without encoding
D.The application accepts a URL parameter that is fetched by the server
E.The server responds with a different delay when a URL is provided versus a non-URL input
AnswersA, B, D

A strong indicator of SSRF is when the server's response to an external request inadvertently includes data or error messages that clearly originate from internal network addresses, such as http://localhost/ or http://192.168.x.x/. This suggests the application processed a user-supplied URL that pointed to an internal resource, and then relayed the internal resource's content or status back to the attacker, confirming the server's ability to access and return data from its private network.

Why this answer

SSRF often involves requests to internal IPs or services, use of URL schemas like file://, and responses including internal data.

52
MCQeasy

Which of the following tools is specifically designed to automate the exploitation of SQL injection vulnerabilities and retrieve data from databases?

A.Metasploit
B.Nmap
C.Burp Suite
D.SQLMap
AnswerD

SQLMap is the industry-standard open-source penetration testing tool specifically designed to automate the process of detecting and exploiting SQL injection flaws and taking over database servers. It supports a wide array of SQL injection techniques, including boolean-based blind, time-based blind, error-based, UNION query, stacked queries, and out-of-band injections across various database management systems. Its robust capabilities extend beyond mere detection, enabling database fingerprinting, data fetching, file system access, and even command execution on the underlying operating system, making it highly specialized for this attack vector.

Why this answer

SQLMap is a purpose-built open-source penetration testing tool that automates the detection and exploitation of SQL injection vulnerabilities and can enumerate and dump database contents. It supports a wide range of DBMS backends (MySQL, MSSQL, Oracle, PostgreSQL) and injection techniques (boolean-based, time-based, UNION, error-based). This makes it the correct answer for automating SQLi exploitation and data retrieval.

Exam trap

CEH often tests the distinction between general-purpose exploitation frameworks (Metasploit) and specialized tools (SQLMap), so candidates who pick Metasploit miss the 'specifically designed for SQL injection' qualifier.

How to eliminate wrong answers

Option A is wrong because Metasploit is a general exploitation framework — it can exploit many vulnerability classes but is not specifically designed to automate SQL injection detection and data extraction. Option B is wrong because Nmap is a network scanner for host discovery, port scanning, and service/version detection; it does not exploit SQL injection. Option C is wrong because Burp Suite is a web application security testing proxy that can help identify SQLi manually or via extensions, but it is not a dedicated automated SQLi exploitation and data-dumping tool like SQLMap.

53
MCQmedium

A security analyst observes a web application returning database error messages containing table names and column names in the HTTP response. Which type of SQL injection is MOST likely being exploited?

A.Blind SQL injection (boolean-based)
B.Union-based SQL injection
C.Error-based SQL injection
D.Out-of-band SQL injection
AnswerC

Error-based SQL injection is a technique where an attacker intentionally causes the database to generate error messages that contain sensitive information. By crafting malicious SQL queries that violate database constraints or syntax rules, the application's response will include detailed error messages, such as those from MySQL's EXTRACTVALUE or UPDATEXML functions, which inadvertently disclose database contents. This method directly "returns data" by embedding it within the visible error output.

Why this answer

Error-based SQL injection is correct because the attacker deliberately causes the database to throw errors that are reflected in the HTTP response, revealing schema details like table and column names. This technique relies on verbose error messages from the DBMS (e.g., MySQL, MSSQL) to extract information directly. Unlike blind or out-of-band methods, error-based injection provides immediate feedback in the application's output.

Exam trap

CEH often tests the distinction between error-based and union-based SQL injection, as both can reveal database information, but error-based specifically relies on error messages while union-based uses the UNION operator to directly retrieve data.

How to eliminate wrong answers

Option A is wrong because blind SQL injection (boolean-based) does not return database error messages; instead, it infers data by observing true/false responses or timing differences. Option B is wrong because union-based SQL injection uses the UNION operator to append a second query and retrieve data directly, but it does not rely on error messages to expose schema information. Option D is wrong because out-of-band SQL injection exfiltrates data via a separate channel (e.g., DNS or HTTP requests to an attacker-controlled server) and does not depend on error messages in the HTTP response.

54
Multi-Selectmedium

Which TWO of the following are effective defenses against Cross-Site Request Forgery (CSRF) attacks? (Select 2)

Select 2 answers
A.Using anti-CSRF tokens
B.Setting the SameSite attribute on cookies
C.Enabling HTTP Strict Transport Security (HSTS)
D.Implementing input validation on all user inputs
E.Using Content Security Policy (CSP) headers
AnswersA, B

Anti-CSRF tokens are unique, unpredictable, secret values generated by the server and embedded into forms or AJAX requests. When a user submits a request, the server verifies that the token received matches the one issued for that specific session. This mechanism prevents attackers from forging requests, as they cannot predict or obtain the valid token required for a successful submission from the legitimate user's browser session. Without a valid token, the server rejects the request, effectively blocking the CSRF attack.

Why this answer

Option A (Using anti-CSRF tokens) is correct because a unique, unpredictable token tied to the user's session and validated server-side ensures that a forged request originating from a malicious third-party site cannot include the correct token, so the request is rejected. Option B (Setting the SameSite attribute on cookies) is correct because SameSite=Lax or SameSite=Strict prevents the browser from attaching session cookies to cross-site requests, which blocks the automatic credential submission that CSRF relies on. Option C (HSTS) is not correct because it only enforces HTTPS and prevents protocol downgrade/SSL-stripping attacks, not cross-site request forgery.

Option D (input validation) is not correct because validating input addresses injection flaws like XSS or SQLi but does not stop a browser from sending an authenticated forged request. Option E (CSP headers) is not correct because CSP mitigates XSS and content-injection risks, which is a different attack class than CSRF.

Exam trap

CEH often tests the confusion between CSRF defenses and XSS/injection defenses, trapping candidates who pick HSTS, CSP, or input validation as CSRF mitigations when they address different threat models.

55
MCQmedium

During a web application penetration test, a tester submits a comment containing '<script>alert("XSS")</script>' and the script executes for all users who view the comment. Which type of cross-site scripting (XSS) vulnerability is present?

A.Blind XSS
B.Reflected XSS
C.DOM-based XSS
D.Stored (persistent) XSS
AnswerD

Stored, or persistent, XSS is the most dangerous type, as the malicious script is permanently saved on the target server, typically in a database, comment section, or forum post. Once stored, the payload is delivered to every user who accesses the affected web page, without requiring any further interaction from the attacker. This allows for widespread and long-term compromise, as the script executes automatically each time the vulnerable content is rendered by a user's browser.

Why this answer

Stored (persistent) XSS occurs when malicious script is permanently saved on the target server (e.g., in a database, comment field, or message board) and served to every user who subsequently views that page. Because the payload executes for all viewers without any crafted URL or user interaction beyond visiting the page, it is the most dangerous XSS variant. The scenario describes exactly this: the comment is persisted and the script runs for all users who view it.

Exam trap

CEH often tests the distinction between stored, reflected, and DOM-based XSS by describing where the payload executes — candidates frequently misclassify persistent comment/forum payloads as reflected XSS because they focus on the <script> tag rather than on the persistence and multi-victim delivery.

How to eliminate wrong answers

Option A is wrong because blind XSS is a subset of stored XSS where the payload fires in a back-end/admin panel or logging system that the attacker cannot directly observe — the tester here sees execution in the public comment view, not a blind context. Option B is wrong because reflected XSS requires the payload to be echoed back in the immediate HTTP response to a crafted request (typically via a URL parameter), and it does not persist across users or sessions. Option C is wrong because DOM-based XSS executes entirely client-side when JavaScript sinks (e.g., innerHTML, document.write) process untrusted source data — the payload never needs to be stored server-side, which contradicts the persistence described here.

56
MCQmedium

An attacker uses the following URL pattern to access files: http://example.com/../../etc/passwd. Which attack is being attempted?

A.Command injection
B.Local file inclusion (LFI)
C.Directory traversal
D.Remote file inclusion (RFI)
AnswerC

Directory traversal, also known as path traversal, is an attack that allows an attacker to access files and directories stored outside the intended web root directory. This is achieved by manipulating variables that reference files with "dot-dot-slash" (`../`) sequences, or similar absolute path representations, to navigate the file system. The URL pattern `../` precisely exemplifies this technique, enabling the attacker to move up the directory hierarchy to access unauthorized files.

Why this answer

The URL pattern http://example.com/../../etc/passwd uses directory traversal (also known as path traversal) to navigate outside the web root and access the /etc/passwd file on a Linux system. The ../ sequences move up the directory tree, attempting to read a sensitive system file. This is a classic directory traversal attack.

Exam trap

CEH often tests the distinction between directory traversal and LFI/RFI; candidates may pick LFI because both involve file paths, but directory traversal is the direct manipulation of the URL path to access files, while LFI requires a vulnerable include function.

How to eliminate wrong answers

Option A is wrong because command injection involves executing arbitrary commands on the server, typically through unsanitized input in system calls, not simply accessing files via path manipulation. Option B is wrong because local file inclusion (LFI) involves including files on the server through a script's include functionality, often using a parameter like ?page=../../etc/passwd; while related, the direct URL path traversal shown here is more specifically directory traversal. Option D is wrong because remote file inclusion (RFI) involves including a file from a remote URL, which is not the case here.

57
MCQhard

An application allows users to upload XML files for processing. A tester uploads the following payload: <?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><root>&xxe;</root>. The server returns the contents of /etc/passwd. Which attack is being performed?

A.XML External Entity (XXE) injection
B.SQL injection
C.Cross-Site Scripting (XSS)
D.Server-Side Request Forgery (SSRF)
AnswerA

XML External Entity (XXE) injection is the correct vulnerability because the provided payload explicitly defines an external entity within the DOCTYPE declaration. By referencing "file:///etc/passwd" via the SYSTEM identifier, the XML parser is instructed to retrieve the content of the specified local file. This content is then processed and potentially returned in the application's response, confirming the successful exploitation of the XML parser's ability to resolve external entities.

Why this answer

This is an XML External Entity (XXE) injection attack, where an external entity is defined to read a local file. The server's XML parser processes the entity and reflects the file content, confirming the vulnerability.

58
MCQmedium

During a web application test, a penetration tester intercepts a request using Burp Suite Proxy, modifies the 'Referer' header, and resends the request. The application processes the request despite the modified header. Which attack is the tester attempting to validate?

A.Server-Side Request Forgery (SSRF)
B.Cross-Site Scripting (XSS)
C.Cross-Site Request Forgery (CSRF)
D.SQL injection
AnswerC

Modifying the "Referer" header is a direct test for Cross-Site Request Forgery (CSRF) defenses. Many web applications implement CSRF protection by validating the "Referer" header to ensure that a request originates from the application's own domain. A penetration tester's action of altering this header directly attempts to bypass or evaluate the robustness of such "Referer"-based validation mechanisms, simulating an attacker's attempt to circumvent this common CSRF mitigation.

Why this answer

CSRF (Cross-Site Request Forgery) attacks often rely on the Referer header for validation. By modifying it, the tester checks if the application validates the header. If the request is processed, the application is vulnerable to CSRF.

59
MCQeasy

A security team is implementing measures to prevent cross-site request forgery (CSRF) attacks. Which of the following is the most effective mitigation technique?

A.Enabling SSL/TLS
B.Using HTTP GET for all form submissions
C.Implementing CSRF tokens
D.Using input validation
AnswerC

Implementing CSRF tokens is the standard and most effective defense against Cross-Site Request Forgery attacks. A unique, unpredictable token is generated by the server for each user session and embedded within forms or request headers. The server then validates this token upon receiving a request; if the token is missing or incorrect, the request is rejected, preventing an attacker from forging requests that originate from a different site without knowledge of the valid token. This mechanism ensures that only requests originating from the legitimate application are processed.

Why this answer

CSRF tokens are unique, unpredictable values that must be included in state-changing requests, ensuring the request originated from the legitimate site.

60
MCQhard

During an assessment, a tester discovers that the web application accepts XML input and returns the parsed data. The tester submits the following payload: <!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><root>&xxe;</root>. The response contains the contents of /etc/passwd. This vulnerability is known as:

A.Local File Inclusion (LFI)
B.Server-Side Request Forgery (SSRF)
C.XML External Entity (XXE) Injection
D.SQL injection
AnswerC

XML External Entity (XXE) injection occurs when an XML parser processes XML input containing a reference to an external entity without proper validation. This vulnerability allows an attacker to define custom entities that can reference local files, network resources, or even execute commands, leading to the disclosure of sensitive data, denial-of-service, or server-side request forgery. The ability to read local files directly via the XML parser is a hallmark of XXE.

Why this answer

The payload defines an external entity that reads a local file, a classic XXE (XML External Entity) injection.

61
MCQeasy

Which HTTP method is commonly used by WebDAV to upload files to a web server, and if misconfigured, could allow an attacker to upload malicious scripts?

A.DELETE
B.GET
C.POST
D.PUT
AnswerD

The PUT method is the designated HTTP verb for uploading files in WebDAV because it requests that the enclosed entity be stored under the supplied Request-URI. If the URI refers to an existing resource, PUT replaces it; if the URI does not point to an existing resource, the server creates it. This idempotent behavior, where repeated identical requests have the same effect as a single request, makes PUT ideal for creating or updating files directly at a specified location.

Why this answer

The PUT method is used by WebDAV to upload files to a web server. If WebDAV is misconfigured to allow unauthenticated PUT requests, an attacker can upload malicious scripts (e.g., web shells) to the server, leading to remote code execution. PUT is idempotent and directly places the request body at the specified URI.

Exam trap

CEH often tests the misconception that POST is used for file uploads, but WebDAV specifically uses PUT for uploading files, and misconfigured PUT permissions are a common attack vector.

How to eliminate wrong answers

Option A is wrong because DELETE is used to remove resources, not upload files. Option B is wrong because GET is used to retrieve resources, not upload. Option C is wrong because POST is used to submit data to be processed, often creating a new resource, but WebDAV specifically uses PUT for file uploads.

62
MCQmedium

A security team deployed a web application firewall (WAF) that blocks requests containing SQL keywords like 'SELECT', 'UNION', and 'DROP'. An attacker bypasses the WAF by encoding the payload in base64 and using a SQL injection tool that decodes it server-side. Which mitigation would be MOST effective against this?

A.Increase WAF sensitivity to block base64-encoded strings
B.Implement prepared statements with parameterized queries
C.Disable error messages to hide database errors
D.Use a more restrictive input validation regex
AnswerB

Implementing prepared statements with parameterized queries is the most robust solution because it fundamentally separates SQL code from user-supplied data. The database engine first compiles the SQL query structure, defining placeholders for input, before any user data is introduced. Subsequently, user input is bound to these placeholders as literal values, ensuring it is never interpreted as executable SQL code, thereby eliminating the possibility of SQL injection attacks.

Why this answer

Prepared statements (parameterized queries) prevent SQL injection by separating query structure from data, regardless of encoding. WAF bypasses are mitigated by using proper coding practices.

63
MCQhard

A web server running IIS 8.5 is found to have WebDAV enabled with write permissions. Which attack is MOST likely to be successful against this configuration?

A.Cross-Site Request Forgery (CSRF)
B.SQL injection
C.File upload leading to remote code execution
D.Directory traversal
AnswerC

WebDAV provides HTTP methods like PUT and MKCOL, enabling clients to upload and manage files on the server. If WebDAV is enabled with write permissions and the server is misconfigured to allow execution of uploaded files (e.g., ASP, ASPX, PHP, or even compiled executables) within a web-accessible directory, an attacker can upload a malicious web shell or other executable code. Subsequently accessing this uploaded file through the web server will trigger its execution, granting the attacker remote code execution capabilities on the server.

Why this answer

WebDAV (Web Distributed Authoring and Versioning) is an extension to HTTP that allows clients to author and modify content on a web server. When enabled with write permissions on IIS 8.5, it permits HTTP methods like PUT, which can be used to upload files directly to the server. If the server also allows execution of uploaded files (e.g., .asp or .aspx), an attacker can upload a malicious script and execute arbitrary code, achieving remote code execution.

This is the most direct and likely attack given the configuration.

Exam trap

CEH often tests the misconception that WebDAV is only for file sharing and overlooks its potential for remote code execution when write permissions are enabled, leading candidates to choose directory traversal or CSRF instead of the more severe file upload RCE.

How to eliminate wrong answers

Option A is wrong because CSRF requires a victim with an active session to a vulnerable site, and while WebDAV could be used in a CSRF attack, it is not the most likely or direct outcome of WebDAV with write permissions; CSRF typically targets state-changing actions, not code execution. Option B is wrong because SQL injection requires an application with unsanitized database queries, which is unrelated to WebDAV write permissions; WebDAV itself does not interact with databases. Option D is wrong because directory traversal allows reading files outside the web root, but it does not directly lead to code execution; while it could be used to read sensitive files, it is not the primary risk of WebDAV with write permissions.

64
MCQeasy

Which of the following is a primary purpose of the SameSite cookie attribute in mitigating CSRF attacks?

A.To limit the cookie to a specific path
B.To encrypt the cookie value
C.To prevent the cookie from being sent in cross-origin requests, mitigating CSRF
D.To restrict the cookie to HTTPS connections only (Secure flag)
AnswerC

This statement is correct. The "SameSite" attribute is designed to prevent a browser from sending a cookie with requests initiated from a different origin than the site that set the cookie. By restricting the automatic inclusion of session cookies in cross-origin requests, it significantly mitigates Cross-Site Request Forgery (CSRF) attacks, where an attacker tricks a user's browser into sending an authenticated request to a vulnerable web application without their explicit consent. This defense ensures that sensitive actions require a same-site context.

Why this answer

The SameSite cookie attribute controls whether a browser includes a cookie in requests that originate from a different site than the one that set the cookie. By setting SameSite=Strict or SameSite=Lax, the browser withholds the cookie on cross-site requests, which breaks the CSRF attack model where a malicious site causes the victim's browser to send an authenticated request to a trusted site. This directly prevents the attacker from riding the user's session cookie.

Exam trap

CEH often tests the confusion between cookie security attributes — candidates mix up SameSite (cross-site request control), Secure (HTTPS-only transmission), HttpOnly (JavaScript access blocking), and Path (URL scoping), so they pick Secure or Path when the question asks about CSRF mitigation.

How to eliminate wrong answers

Option A is wrong because limiting a cookie to a specific path is the function of the Path attribute, which scopes the cookie to a URL directory and does not prevent cross-site requests. Option B is wrong because cookie values are not encrypted by any cookie attribute; confidentiality requires HTTPS/TLS in transit and server-side encryption at rest, not a cookie flag. Option D is wrong because restricting a cookie to HTTPS connections is the purpose of the Secure flag, which protects against network sniffing but does nothing to stop a browser from sending the cookie on a cross-site HTTP request.

65
Multi-Selecteasy

Which TWO of the following are commonly used to mitigate SQL injection vulnerabilities? (Select 2)

Select 2 answers
A.Stored procedures
B.Output encoding
C.Input validation
D.Parameterized queries
E.HTTPS encryption
AnswersA, D

Stored procedures, when implemented with parameterized inputs, offer a robust defense against SQL injection. By pre-compiling the SQL statements on the database server, they ensure that user-supplied data is treated strictly as data values, not executable code. This separation prevents malicious input from altering the intended query logic, effectively neutralizing injection attempts before execution.

Why this answer

Stored procedures (A) are correct because they let the database execute predefined SQL with parameters, so user input is passed as data rather than concatenated into the query string, which prevents injected SQL from altering the statement's logic. Parameterized queries (D) are correct because they use placeholders (e.g., ? or :name) bound to typed parameters, ensuring the database treats user input strictly as values and never as executable SQL, which is the most reliable defense against SQL injection. Output encoding (B) is not the right control here because it protects against XSS by escaping data rendered into HTML, not against SQL injection.

Input validation (C) is a useful defense-in-depth measure but is not a primary SQL injection mitigation, since attackers can often craft input that passes validation yet still exploits a poorly built query. HTTPS encryption (E) only protects data in transit and does nothing to stop SQL injection, which exploits how queries are constructed and executed.

Exam trap

CEH often tests the confusion between input validation and parameterized queries, where candidates might select input validation as a primary mitigation, but the exam expects the two most robust and recommended defenses: stored procedures and parameterized queries.

66
MCQhard

A web application takes a URL from user input and fetches the content to display on the page. An attacker submits a URL pointing to an internal service like http://localhost:8080/admin. The server retrieves the internal resource and returns it. What is this attack?

A.Cross-Site Scripting (XSS)
B.Server-Side Request Forgery (SSRF)
C.Directory Traversal
D.Remote File Inclusion (RFI)
AnswerB

Server-Side Request Forgery (SSRF) occurs when a web application is coerced into making requests to an arbitrary domain specified by the attacker, often to internal systems or services that are not directly accessible from the internet. By manipulating a user-supplied URL parameter, an attacker can trick the vulnerable server into fetching data from internal network resources, cloud metadata APIs, or other services, thereby exposing sensitive information or enabling further attacks. This directly matches the scenario described.

Why this answer

Server-Side Request Forgery (SSRF) occurs when a server makes requests to internal resources based on user-supplied URLs.

67
MCQhard

A tester sends the following payload to a web application: %3Cscript%3Ealert('XSS')%3C/script%3E. The application echoes back the decoded payload in the response without sanitization. This behavior is typical of which type of vulnerability?

A.HTTP Response Splitting
B.DOM-based XSS
C.Stored XSS
D.Reflected XSS
AnswerD

Reflected Cross-Site Scripting, or Non-Persistent XSS, occurs when a malicious script, often embedded in a URL parameter, is immediately returned by the web server in its HTTP response without proper sanitization. The browser then interprets and executes this unsanitized script as part of the legitimate page content. The payload "><script>alert('XSS')</script>" is characteristic of a reflected attack, designed to break out of an HTML context and execute client-side code upon immediate reflection.

Why this answer

Reflected XSS occurs when an application immediately echoes user-supplied input in the response without proper sanitization. The payload is not stored on the server but reflected back to the user, executing in the victim's browser. The given payload is URL-encoded and decoded by the server, then echoed, which is typical of reflected XSS.

Exam trap

CEH often tests the difference between reflected, stored, and DOM-based XSS; candidates may confuse reflected with stored because both involve echoing, but reflected is immediate and not persistent.

How to eliminate wrong answers

Option A is wrong because HTTP Response Splitting involves injecting CRLF characters to manipulate headers, not executing scripts. Option B is wrong because DOM-based XSS occurs when client-side JavaScript processes input unsafely, not when the server echoes it. Option C is wrong because Stored XSS involves the payload being saved on the server (e.g., in a database) and later displayed to other users.

68
MCQmedium

A security analyst notices that the web application returns different response times when a valid username is submitted versus an invalid one during login. Which type of vulnerability is likely being exploited?

A.Time-based SQL injection
B.Reflected XSS
C.Blind boolean-based SQL injection
D.CSRF
AnswerA

Time-based SQL injection is the correct answer because the scenario explicitly describes inferring information based on *timing differences* in the web application's response. This technique is employed when direct error messages or content changes are not visible to the attacker. Attackers inject SQL queries containing database-specific time-delay functions (e.g., SLEEP() in MySQL, WAITFOR DELAY in MS SQL Server) within a conditional statement. If the injected condition evaluates to true, the database pauses for a specified duration, causing a noticeable delay in the application's response, thereby confirming the truthfulness of the condition and allowing data exfiltration character by character.

Why this answer

Time-based SQL injection involves injecting SQL code that causes the database to pause if a condition is true, allowing an attacker to infer information based on response times. The observed difference in response times for valid vs. invalid usernames is characteristic of this technique.

69
MCQhard

An attacker wants to perform a CSRF attack against a banking application. The application uses SameSite cookies set to 'Strict'. The attacker hosts a malicious page on their own domain. When the victim visits the malicious page, which of the following statements is TRUE regarding the CSRF attack?

A.The attack will succeed because cookies are sent regardless of SameSite settings.
B.The attack will succeed because the attacker can bypass SameSite using GET requests.
C.The attack will fail because CSRF requires POST requests and the malicious page only uses GET.
D.The attack will fail because the browser will not include the session cookie with the cross-origin request.
AnswerD

This statement accurately describes how SameSite=Strict thwarts a CSRF attempt. When a user visits a malicious website, and that site tries to forge a request to the banking application, the browser recognizes this as a cross-origin request. Because the banking application's session cookie is configured with SameSite=Strict, the browser will deliberately omit this crucial authentication cookie from the outgoing request, rendering the forged request unauthenticated and ineffective.

Why this answer

SameSite=Strict prevents cookies from being sent on cross-site requests, effectively blocking CSRF attacks if the attacker cannot control the origin.

70
MCQmedium

Which of the following is a recommended defense against Cross-Site Request Forgery (CSRF) attacks?

A.Enabling directory listing on the web server
B.Implementing CSRF tokens in forms
C.Using a same-origin policy with CORS headers
D.Setting the HttpOnly flag on cookies
AnswerB

Implementing CSRF tokens involves embedding a unique, unpredictable, and secret value within each HTML form or AJAX request that modifies server-side state. The server generates this token and associates it with the user's session, then validates its presence and correctness upon submission. If the submitted token does not match the expected value, the server rejects the request, effectively preventing attackers from forging legitimate requests without knowledge of the specific token.

Why this answer

CSRF tokens are the canonical defense: the server issues a unique, unpredictable token tied to the user's session and requires it on state-changing requests. An attacker's forged request from a malicious site cannot read or guess the token due to same-origin policy, so the request is rejected. This directly defeats CSRF.

Exam trap

CEH often tests confusion between XSS mitigations (HttpOnly, CSP) and CSRF mitigations, so candidates pick HttpOnly thinking it stops CSRF when it only protects cookie confidentiality.

How to eliminate wrong answers

Option A is wrong because enabling directory listing exposes files and has nothing to do with CSRF; it actually worsens security. Option C is wrong because same-origin policy and CORS govern cross-origin reads/writes of responses, not the authenticity of state-changing requests; CORS misconfigurations can even enable attacks. Option D is wrong because HttpOnly prevents JavaScript from reading cookies (mitigating XSS cookie theft) but does not stop CSRF, since the browser still automatically attaches cookies to forged requests.

71
MCQmedium

Which of the following is the most effective defense against SQL injection attacks?

A.Parameterized queries
B.Escaping all user input
C.Input validation using blacklists
D.Stored procedures
AnswerA

Parameterized queries, also known as prepared statements, are the most effective defense because they fundamentally separate SQL code from user-supplied data. The database engine pre-compiles the SQL query structure, treating all subsequent user input as literal data values, not executable code. This prevents malicious input from altering the query's intent, making SQL injection attacks virtually impossible against properly implemented parameterized queries.

Why this answer

Parameterized queries (prepared statements) ensure user input is treated as data, not executable code, preventing SQL injection.

72
Multi-Selecthard

Which THREE of the following are valid methods to exploit or test for Server-Side Request Forgery (SSRF)?

Select 3 answers
A.Injecting SQL commands into input fields
B.Using the file:// protocol to read local files
C.Submitting a URL pointing to http://127.0.0.1/admin
D.Sending a payload that includes <script>alert(1)</script>
E.Submitting a URL targeting http://169.254.169.254/latest/meta-data/
AnswersB, C, E

Utilizing the file:// protocol within an SSRF vulnerability allows an attacker to force the vulnerable server to read local files from its own filesystem. By supplying a URL like file:///etc/passwd or file:///C:/Windows/System32/drivers/etc/hosts, the server processes this internal URI, retrieves the specified file's content, and potentially returns it in the application's response. This method directly exploits the server's ability to handle local file system requests.

Why this answer

SSRF (Server-Side Request Forgery) can be exploited by making the server fetch internal resources. Common techniques include using the file:// protocol to read local files (e.g., /etc/passwd), accessing internal services via localhost (e.g., http://127.0.0.1/admin), and targeting cloud metadata endpoints (e.g., http://169.254.169.254/latest/meta-data/). Options B, C, and E are all valid SSRF techniques.

Exam trap

Candidates often think SSRF only involves HTTP requests to internal IPs, but the file:// protocol is equally valid and commonly tested.

73
MCQmedium

A web application allows users to submit feedback that is stored in a database and displayed to other users without proper sanitization. A tester inputs '<script>alert(1)</script>' and it executes when other users view the feedback. Which type of XSS is this?

A.Self-XSS
B.DOM-based XSS
C.Stored XSS
D.Reflected XSS
AnswerC

Stored XSS, also known as Persistent XSS, occurs when a malicious script is permanently saved on the target server, typically within a database. When other users access the vulnerable web page that retrieves and displays this stored data (e.g., feedback, comments, forum posts), the malicious script is delivered to their browsers and executed automatically. This makes it a highly dangerous form of XSS as it can impact a large number of users without requiring individual interaction with a crafted link.

Why this answer

Stored XSS occurs when malicious script is persisted on the server — typically in a database — and later served to other users who view the affected page. In this scenario the payload is saved via the feedback form and executes in the browsers of users who view the feedback, which is the defining characteristic of stored (persistent) XSS.

Exam trap

CEH often tests the distinction between reflected and stored XSS — the trap is that both involve unsanitized input, but candidates must identify whether the payload is persisted server-side (stored) or echoed back in a single response (reflected).

How to eliminate wrong answers

Option A is wrong because Self-XSS requires the victim to paste the payload into their own browser console or a field, and it only affects the attacker themselves — it is not stored and does not affect other users. Option B is wrong because DOM-based XSS executes entirely client-side when JavaScript reads from a source like location.hash and writes to a sink like innerHTML, without the payload being stored server-side. Option D is wrong because reflected XSS requires the payload to be included in a request (e.g., a URL parameter) and immediately reflected in the response — it is not persisted in a database.

74
MCQmedium

A web application uses XML to transmit data between client and server. A tester submits the following payload: '<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><root>&xxe;</root>'. The application returns the content of the /etc/passwd file in the response. Which vulnerability is present?

A.SQL injection
B.XML External Entity (XXE) injection
C.Command injection
D.Cross-Site Scripting (XSS)
AnswerB

XML External Entity (XXE) injection is a vulnerability that allows an attacker to interfere with an application's processing of XML data containing external entity references. By crafting malicious XML input, an attacker can exploit improperly configured XML parsers to include arbitrary files from the server's filesystem, initiate Server-Side Request Forgery (SSRF) attacks, or even execute remote code in certain environments. This directly leverages the application's use of XML for data transmission, making it the most relevant attack type when XML entity manipulation is implied.

Why this answer

This is an XML External Entity (XXE) injection, where an external entity is used to read a local file and return its contents.

75
Multi-Selecthard

Which THREE of the following are effective mitigations against brute force attacks on web application login forms? (Select 3)

Select 3 answers
A.Account lockout after failed attempts
B.Implementing CAPTCHA
C.Rate limiting on login endpoints
D.Enforcing strong password policies
E.Using HTTP basic authentication
AnswersA, B, C

Account lockout after failed attempts is a highly effective mitigation against brute-force attacks because it directly prevents an attacker from making an unlimited number of password guesses for a specific account. After a predefined threshold of incorrect login attempts is reached, the system temporarily or permanently disables access for that user, forcing the attacker to cease their automated guessing against that particular target. This significantly increases the time and resources required for a successful compromise.

Why this answer

Account lockout after failed attempts (A) is correct because temporarily disabling or locking an account after a defined number of failed logins (e.g., 5 attempts) prevents an attacker from making unlimited password guesses against a given username, directly throttling the brute force attempt. Implementing CAPTCHA (B) is correct because it forces a human-interaction challenge that automated tools and scripted credential-stuffing/brute force bots cannot easily solve, breaking the automation loop required for high-volume guessing. Rate limiting on login endpoints (C) is correct because restricting the number of login requests per IP, session, or time window (e.g., via 429 responses or tools like fail2ban/mod_security) slows or blocks the rapid repeated requests brute force attacks depend on.

Enforcing strong password policies (D) is not among the marked answers: it increases the search space and thus the cost of guessing, but it does not stop or slow an ongoing brute force attack and can be bypassed by guessing common-but-compliant passwords. Using HTTP basic authentication (E) is not among the marked answers: it merely transmits credentials in a base64-encoded header and provides no throttling, lockout, or bot-resistance mechanism, so it does nothing to mitigate brute force and is itself weaker than form-based auth over TLS.

Exam trap

The trap is that 'strong password policies' sounds like a brute force mitigation but actually addresses password guessability, not attack volume — and HTTP basic authentication is often mistakenly assumed to be a security control when it is actually a weak, deprecated scheme.

Page 1 of 3 · 156 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Ceh Web Injection questions.