CAPEC-588: DOM-Based XSS
Description
This type of attack is a form of Cross-Site Scripting (XSS) where a malicious script is inserted into the client-side HTML being parsed by a web browser. Content served by a vulnerable web application includes script code used to manipulate the Document Object Model (DOM). This script code either does not properly validate input, or does not perform proper output encoding, thus creating an opportunity for an adversary to inject a malicious script launch a XSS attack. A key distinction between other XSS attacks and DOM-based attacks is that in other XSS attacks, the malicious script runs when the vulnerable web page is initially loaded, while a DOM-based attack executes sometime after the page loads. Another distinction of DOM-based attacks is that in some cases, the malicious script is never sent to the vulnerable web server at all. An attack like this is guaranteed to bypass any server-side filtering attempts to protect users.
- Likelihood of attack
- High
- Typical severity
- Very High
- Abstraction
- DetailedA low-level, detailed pattern, often for a particular technology.
Mechanism of attack: Inject Unexpected Items
Prerequisites
- An application that leverages a client-side web browser with scripting enabled.
- An application that manipulates the DOM via client-side scripting.
- An application that failS to adequately sanitize or encode untrusted input.
Skills required
- MediumRequires the ability to write scripts of some complexity and to inject it through user controlled fields in the system.
Consequences
- Confidentiality
Read Data
A successful DOM-based XSS attack can enable an adversary to exfiltrate sensitive information from the application.
- ConfidentialityAuthorizationAccess Control
Gain Privileges
A successful DOM-based XSS attack can enable an adversary to elevate their privilege level and access functionality they should not otherwise be allowed to access.
- ConfidentialityIntegrityAvailability
Execute Unauthorized Commands
A successful DOM-based XSS attack can enable an adversary run arbitrary code of their choosing, thus enabling a complete compromise of the application.
- Integrity
Modify Data
A successful DOM-based XSS attack can allow an adversary to tamper with application data.
Mitigations
- Use browser technologies that do not allow client-side scripting.
- Utilize proper character encoding for all output produced within client-site scripts manipulating the DOM.
- Ensure that all user-supplied input is validated before use.
Related weaknesses (CWE)
Related attack patterns
Parent
More specific patterns
- CAPEC-18XSS Targeting Non-Script ElementsDetailed
- CAPEC-32XSS Through HTTP Query StringsDetailed
- CAPEC-86XSS Through HTTP HeadersDetailed
- CAPEC-198XSS Targeting Error PagesDetailed
- CAPEC-199XSS Using Alternate SyntaxDetailed
- CAPEC-243XSS Targeting HTML AttributesDetailed
- CAPEC-244XSS Targeting URI PlaceholdersDetailed
- CAPEC-245XSS Using Doubled CharactersDetailed
- CAPEC-247XSS Using Invalid CharactersDetailed