nerdexam
EC-Council

312-50V12 · Question #259

During a penetration test, an ethical hacker is exploring the security of a complex web application. The application heavily relies on JavaScript for client-side input sanitization, with an apparent a

The correct answer is D. Launch a Cross-Site Scripting (XSS) attack, aiming to bypass the client-side sanitization and. The application's reliance on client-side sanitization and lack of the HttpOnly flag on cookies creates an ideal environment for a Cross-Site Scripting (XSS) attack. This attack can bypass the inadequate sanitization and exploit exposed session cookies.

Submitted by minji_kr· Mar 4, 2026Web Application Hacking

Question

During a penetration test, an ethical hacker is exploring the security of a complex web application. The application heavily relies on JavaScript for client-side input sanitization, with an apparent assumption that this alone is adequate to prevent injection attacks. During the investigation, the ethical hacker also notices that the application utilizes cookies to manage user sessions but does not enable the HttpOnly flag. This lack of flag potentially exposes the cookies to client-side scripts. Given these identified vulnerabilities, what would be the most effective strategy for the ethical hacker to exploit this application?

Options

  • AInstigate a Distributed Denial of Service (DDoS) attack to overload the server, capitalizing on
  • BImplement an SQL Injection attack to take advantage of potential unvalidated input and gain
  • CEmploy a brute-force attack to decipher user credentials, considering the lack of server-side
  • DLaunch a Cross-Site Scripting (XSS) attack, aiming to bypass the client-side sanitization and

How the community answered

(26 responses)
  • A
    8% (2)
  • B
    15% (4)
  • C
    4% (1)
  • D
    73% (19)

Why each option

The application's reliance on client-side sanitization and lack of the HttpOnly flag on cookies creates an ideal environment for a Cross-Site Scripting (XSS) attack. This attack can bypass the inadequate sanitization and exploit exposed session cookies.

AInstigate a Distributed Denial of Service (DDoS) attack to overload the server, capitalizing on

A DDoS attack targets application availability and does not directly leverage the specific vulnerabilities of client-side sanitization bypass or the HttpOnly flag absence described in the scenario.

BImplement an SQL Injection attack to take advantage of potential unvalidated input and gain

While SQL Injection exploits unvalidated input, the combined vulnerabilities of client-side sanitization bypass and HttpOnly flag absence are more directly and effectively leveraged by an XSS attack, which can lead to session hijacking.

CEmploy a brute-force attack to decipher user credentials, considering the lack of server-side

Brute-force attacks target weak authentication or account lockout policies and are not related to the described vulnerabilities concerning client-side sanitization or cookie HttpOnly flag settings.

DLaunch a Cross-Site Scripting (XSS) attack, aiming to bypass the client-side sanitization andCorrect

A Cross-Site Scripting (XSS) attack directly exploits both identified vulnerabilities. The reliance on client-side sanitization means an attacker can bypass it by submitting malicious input directly to the server, and the absence of the HttpOnly flag allows the injected script to access and potentially steal user session cookies.

Concept tested: Cross-Site Scripting (XSS) exploitation and prevention

Source: https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0

Topics

#XSS attack#client-side sanitization bypass#HttpOnly flag#web application vulnerabilities

Community Discussion

No community discussion yet for this question.

Full 312-50V12 Practice