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":54,"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":55,"name":"An application allows users to upload XML files for processing. A tester uploads the following payload:

CCNA Web Application and Injection Attacks Questions

75 of 158 questions · Page 1/3 · Web Application and Injection Attacks · 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 server in the response without proper sanitization, typically via GET parameters.

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

IDOR exploits direct references to objects without proper authorization checks. The application must expose direct references (e.g., IDs in URLs) and fail to verify the user's permission to access the object.

6
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.

7
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.

8
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.

9
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, the attacker can find the path to the uploaded shell and then access it to execute commands on the server.

10
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.

11
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.

12
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.

13
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.

14
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.

15
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.

16
Multi-Selecthard

A web application is vulnerable to SQL injection. Which THREE of the following techniques can be used to extract data from the database using blind SQL injection?

Select 3 answers
A.Time-based
B.Error-based
C.Boolean-based
D.Out-of-band
E.Union-based
AnswersA, C, D

Time-based blind SQL injection involves injecting queries that cause a measurable time delay on the database server if a specific condition evaluates to true. By observing the server's response time, an attacker can infer the truthfulness of the injected statement, character by character. This method is crucial when no direct output or error messages are returned by the application, making it a viable technique for data exfiltration in blind scenarios.

Why this answer

Boolean-based, time-based, and out-of-band are all types of blind SQL injection. Error-based and union-based are in-band techniques, not blind.

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

In-band SQL injection includes union-based and error-based. Blind SQL injection includes boolean-based and time-based. Out-of-band is another type.

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 'cmd' parameter in a CGI script is a common indicator of command injection, where the attacker tries to execute system commands.

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

SQL injection and XSS are both injection attacks that can be prevented by input validation and sanitization. CSRF requires tokens, and clickjacking requires frame-busting headers.

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

X-Frame-Options header and Content-Security-Policy frame-ancestors directive are both effective against 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 enumerates all databases on the database server.

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 is the standard tool for automated SQL injection detection and exploitation.

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 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

Intruder is designed for automated brute-forcing with payloads. Proxy allows interception and manipulation of requests before sending to Intruder. Repeater is for manual requests, not automated attacks.

Scanner is for vulnerability scanning, not brute-forcing.

37
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.

38
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.

39
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.

40
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

This is a null byte injection attack, where the %00 (null byte) terminates the string, bypassing extension checks to upload a PHP file.

41
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.

42
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.

43
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

In-band SQL injection (including error-based and union-based) are classic types. Blind SQL injection (boolean-based and time-based) are also common. Out-of-band is less common but still a type.

44
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.

45
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 a login page typically indicates that the session has expired or the tester's session is no longer valid. The application is redirecting to enforce authentication.

46
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.

47
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 uses a few common passwords against many accounts to avoid lockouts. Credential stuffing uses known username/password pairs from breaches. Dictionary attack uses a list of words.

Brute force tries many passwords on one account. Keylogging is passive.

48
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.

49
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.

50
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 an open-source tool that automates detection and exploitation of SQL injection flaws.

51
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 (in-band) relies on error messages from the database to extract information. The presence of database details in errors indicates error-based injection.

52
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

CSRF tokens are unique per request and validated server-side. SameSite cookies restrict cookie sending to same-site requests.

53
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 the injected script is permanently stored on the server (e.g., in a database) and executed for every user who accesses that content.

54
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

Directory traversal (path traversal) uses ../ sequences to access files outside the web root.

55
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.

56
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.

57
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.

58
MCQeasy

An attacker attempts to log into a web application by trying many common passwords for a list of known usernames. Which type of authentication attack is this?

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

Password spraying uses a few common passwords across many accounts.

Why this answer

Password spraying involves using a few common passwords against many usernames to avoid account lockouts, as opposed to brute force (many passwords on one account) or credential stuffing (using known username/password pairs).

59
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.

60
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 allows uploading resources to the server, and if enabled without proper controls, can be exploited to upload malicious files.

61
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.

62
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 with write permissions allows attackers to upload files (e.g., web shells) to the server, leading to remote code execution.

63
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

SameSite cookie attribute (Strict, Lax, or None) controls when cookies are sent in cross-site requests. Setting SameSite to Lax or Strict prevents the browser from sending cookies on cross-site POST requests, thus mitigating CSRF.

64
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

Parameterized queries and stored procedures (when used correctly) prevent SQL injection by separating SQL logic from data.

65
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.

66
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

The payload is URL-encoded HTML and is decoded and reflected, indicating reflected XSS.

67
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.

68
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.

69
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 unique per request and verified by the server, making forged requests invalid without the token.

70
MCQmedium

A web application uses user input in the following PHP code: include($_GET['page'] . '.php');. An attacker submits the URL: http://example.com/index.php?page=../../../../etc/passwd%00. Which two vulnerabilities are being attempted?

A.RFI and command injection
B.LFI and null byte injection
C.SQL injection and XSS
D.Directory traversal and IDOR
AnswerB

LFI (Local File Inclusion) is the primary vulnerability, as the `include` function directly incorporates a local file path derived from user input, allowing an attacker to traverse directories (e.g., `../../`) and include arbitrary files from the server's file system. Null byte injection (`%00`) is crucial here because it can bypass the `.php` extension automatically appended by the application. By injecting `%00` after the desired file path (e.g., `/etc/passwd%00`), the server's string handling may truncate the string at the null byte, effectively ignoring the unwanted `.php` extension and including the specified file.

Why this answer

The attacker is using '../' for directory traversal to access files outside the web root, and a null byte injection (%00) to truncate the '.php' extension. This targets LFI (local file inclusion) via directory traversal.

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

The payload is stored in the database and executed when other users load the page, which is stored (persistent) XSS.

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, rate limiting, and CAPTCHA all hinder automated brute force attempts. Strong password policies help but are not a direct mitigation against brute force rate.

Page 1 of 3 · 158 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Web Application and Injection Attacks questions.