Burp Suite User Forum

Create new post

cross site scripting (dom)

Jared | Last updated: Feb 01, 2022 11:27PM UTC

hi there burp is giving me this Issue detail The application may be vulnerable to DOM-based cross-site scripting. Data is read from window.location.pathname and passed to the 'append()' function of JQuery. Issue background DOM-based vulnerabilities arise when a client-side script reads data from a controllable part of the DOM (for example, the URL) and processes this data in an unsafe way. DOM-based cross-site scripting arises when a script writes controllable data into the HTML document in an unsafe way. An attacker may be able to use the vulnerability to construct a URL that, if visited by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application. The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes. Users can be induced to visit the attacker's crafted URL in various ways, similar to the usual attack delivery vectors for reflected cross-site scripting vulnerabilities. Burp Suite automatically identifies this issue using static code analysis, which may lead to false positives that are not actually exploitable. The relevant code and execution paths should be reviewed to determine whether this vulnerability is indeed present, or whether mitigations are in place that would prevent exploitation. Issue remediation The most effective way to avoid DOM-based cross-site scripting vulnerabilities is not to dynamically write data from any untrusted source into the HTML document. If the desired functionality of the application means that this behavior is unavoidable, then defenses must be implemented within the client-side code to prevent malicious data from introducing script code into the document. In many cases, the relevant data can be validated on a whitelist basis, to allow only content that is known to be safe. In other cases, it will be necessary to sanitize or encode the data. This can be a complex task, and depending on the context that the data is to be inserted may need to involve a combination of JavaScript escaping, HTML encoding, and URL encoding, in the appropriate sequence. Data is read from window.location.pathname and passed to the 'append()' function of JQuery via the following statement: t= window.location.pathname how do i generate a valid p.o.c for this?

Liam, PortSwigger Agent | Last updated: Feb 02, 2022 11:52AM UTC

Have you tried using DOM Invader? - https://portswigger.net/blog/introducing-dom-invader - https://portswigger.net/burp/documentation/desktop/tools/dom-invader

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.