ExamGecko
Question list
Search
Search

Related questions











Question 523 - 312-50v12 discussion

Report
Export

An ethical hacker is testing a web application of a financial firm. During the test, a 'Contact Us' form's input field is found to lack proper user input validation, indicating a potential Cross-Site Scripting (XSS) vulnerability. However, the application has a stringent Content Security Policy (CSP) disallowing inline scripts and scripts from external domains but permitting scripts from its own domain. What would be the hacker's next step to confirm the XSS vulnerability?

A.
Try to disable the CSP to bypass script restrictions
Answers
A.
Try to disable the CSP to bypass script restrictions
B.
Inject a benign script inline to the form to see if it executes
Answers
B.
Inject a benign script inline to the form to see if it executes
C.
Utilize a script hosted on the application's domain to test the form
Answers
C.
Utilize a script hosted on the application's domain to test the form
D.
Load a script from an external domain to test the vulnerability
Answers
D.
Load a script from an external domain to test the vulnerability
Suggested answer: C

Explanation:

The hacker's next step to confirm the XSS vulnerability would be to utilize a script hosted on the application's domain to test the form. This is because the application's CSP allows scripts from its own domain, but not from inline or external sources. Therefore, the hacker can try to inject a payload that references a script file on the same domain as the application, such as:

<script src='/path/to/script.js'></script>

where script.js contains some benign code, such asalert('XSS')orprint('XSS'). If the script executes in the browser, then the hacker has confirmed the XSS vulnerability. Otherwise, the CSP has blocked the script and prevented the XSS attack.

The other options are not feasible or effective for the following reasons:

A) Try to disable the CSP to bypass script restrictions: This option is not feasible because the hacker cannot disable the CSP on the server side, and the browser enforces the CSP on the client side. The hacker would need to modify the browser settings or use a browser extension to disable the CSP, but this would not affect the victim's browser or the application's security.

B) Inject a benign script inline to the form to see if it executes: This option is not effective because the application's CSP disallows inline scripts, meaning scripts that are embedded in the HTML code. Therefore, the hacker would not be able to inject a script tag or an event handler attribute that contains some code, such as:

<script>alert('XSS')</script>or<input type='text' onfocus='alert('XSS')'>

The CSP would block these scripts and prevent the XSS attack.

D) Load a script from an external domain to test the vulnerability: This option is not effective because the application's CSP disallows scripts from external domains, meaning scripts that are loaded from a different domain than the application. Therefore, the hacker would not be able to inject a script tag that references a script file on another domain, such as:

<script src='https://example.com/script.js'></script>

The CSP would block these scripts and prevent the XSS attack.

1: Content Security Policy (CSP) - HTTP | MDN

2: What is Content Security Policy (CSP) | Header Examples | Imperva

3: Content-Security-Policy (CSP) Header Quick Reference

4: What is cross-site scripting (XSS)? - PortSwigger

5: Cross Site Scripting (XSS) | OWASP Foundation

6: The Impact of Cross-Site Scripting Vulnerabilities and their Prevention

7: XSS Vulnerability 101: Identify and Stop Cross-Site Scripting

asked 18/09/2024
Jeffrey VanBemmel
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first