πŸ“•
Blog
  • 🐞Vulnerabilities & Techniques
    • Web Vulnerabilities
      • Open Redirect
      • HTTP Parameter Pollution (HPP)
      • Host Header Injection (HHI)
      • XSS
      • HTML-Injection
      • clickjacking
      • S3
      • EXternal Xml Entity (XXE)
      • XSS prevention | CSP
      • DOM-XSS
      • SQL Injection | SQLI
      • Response Manipulation Technique & How Burp Suite Works
    • API Vulnerabilities
      • Mass Assignment Vulnerability
  • 🚩CTF
    • ASCWG
  • ✍️Writeups
    • Read Writeups
      • REST API WriteUps
      • Web Vulnerabilities WriteUps
    • Technical Writeups
      • Reset Password Poisoning Via Host Header Injection Lead to (ATO)
      • OTP/2FA Bypasses
        • OTP bypasses
  • 😈TryHackMe
    • THM Advent of Cyber 3 (2021) NoSQL WriteUp
  • πŸ”±Web-CyberTalents
    • CyberTalents-Web-Easy
    • CyberTalents-Web-Medium
    • CyberTalents-Web-Hard
  • πŸ–‡οΈPentesting & Bug Hunting Tips
    • ATO Via Host Header Injection
    • OTP Bypass
    • OutLook Plugin Pentest Guide
  • πŸ’»Port-Swigger Labs
    • XML external entity (XXE) injection
    • DOM-XSS
      • DOM XSS in the document.write sink using source location.search
      • Lab: DOM XSS in document.write sink using source location.search inside a select element
      • Lab: DOM XSS in innerHTML sink using source location.search
      • Lab: DOM XSS in jQuery anchor href attribute sink using location.search source
      • Lab: Reflected DOM XSS
      • Lab: Stored DOM XSS
    • SQL injection
      • Lab: SQL injection vulnerability in WHERE clause allowing retrieval of hidden data
      • Lab: SQL injection vulnerability allowing login bypass
      • Lab: SQL injection UNION attack, determining the number of columns returned by the query
      • Lab: SQL injection UNION attack, finding a column containing text
      • Lab: SQL injection UNION attack, retrieving data from other tables
      • Lab: SQL injection UNION attack, retrieving multiple values in a single column
      • Lab: SQL injection attack, querying the database type and version on Oracle
      • Lab: SQL injection attack, querying the database type and version on MySQL and Microsoft
      • Lab: SQL injection attack, listing the database contents on non-Oracle databases
  • πŸ›œWireless Networks Penetration Testing
  • βš”οΈWi-Fi Attacks
    • πŸ•ΈοΈNetwork Scanning attack
    • 🌊DOS / Flooding
      • 1️⃣DoS - Frame Flooding (Deauth, EAPOL, Beacons)
      • 2️⃣DoS- Exploiting Countermeasures (MIC failure)
    • Jamming Attacks (Ω‡Ψ¬Ω…Ψ§Ψͺ Ψ§Ω„Ψͺشويش)
    • Probe Requests Attack
    • Handshake Attacks
      • Dictionary Attack
      • Clientless Attack
      • KRACK Attack
      • Downgrad Attack
    • Rouge AP Attack
  • Lab Notes
  • RFID and NFC
  • Bluetooth
  • ZigBee
  • Google Map Test
Powered by GitBook
On this page
  • DOM-Based Cross-Site Scripting
  • πŸ“š What Is DOM XSS?
  • What is taint flow?
  • 1. Sources
  • 2. Sinks
  • πŸ€” Why DOM XSS Happen?
  • βœ… Examples
  • βš” Impact
  • πŸ”Ž How To Find
  • πŸ“• Referance
  • πŸ”¬ Labs
  1. Vulnerabilities & Techniques
  2. Web Vulnerabilities

DOM-XSS

PreviousXSS prevention | CSPNextSQL Injection | SQLI

Last updated 2 years ago

DOM-Based Cross-Site Scripting

πŸ“š What Is DOM XSS?

(DOM) is a web browser’s hierarchical representation of the elements on the page.

Websites can use JavaScript to manipulate the nodes and objects of the DOM.

You Can Know More About DOM from or

As well as their properties. DOM manipulation in itself is not a problem. In fact, it is an integral part of how modern websites work.

DOM-based vulnerabilities arise when a website contains JavaScript that takes an attacker-controllable value, known as a source and passes it into a dangerous function, known as a sink.

What is taint flow?

it is important to first familiarize yourself with the basics of taint flow between sources and sinks.

1. Sources

A source is a JavaScript property that accepts data that is potentially attacker-controlled.

Common Sources

document.URL
document.documentURI
document.URLUnencoded
document.baseURI
location
document.cookie
document.referrer
window.name
history.pushState
history.replaceState
localStorage
sessionStorage
IndexedDB (mozIndexedDB, webkitIndexedDB, msIndexedDB)
Database

2. Sinks

A sink is a potentially dangerous JavaScript function or DOM object that can cause undesirable effects if attacker-controlled data is passed to it. For example, the eval() function is a sink because it processes the argument that is passed to it as JavaScript. An example of an HTML sink is document.body.innerHTML because it potentially allows an attacker to inject malicious HTML and execute arbitrary JavaScript.

Common Sinks

location
location.host
location.hostname
location.href
location.pathname
location.search
location.protocol
location.assign()
location.replace()
open()
element.srcdoc
XMLHttpRequest.open()
XMLHttpRequest.send()
jQuery.ajax()
$.ajax()

πŸ€” Why DOM XSS Happen?

DOM-based vulnerabilities arise when a website passes data from a source to a sink, which then handles the data in an unsafe way in the context of the client’s session.

The most common source is the URL, which is typically accessed with the location object. An attacker can construct a link to send a victim to a vulnerable page with a payload in the query string and fragment portions of the URL.


βœ… Examples


βš” Impact

There is a reason why it has been in OWASP for 2013 and 2017. XSS can have huge implications for a web application and its users. User accounts can be hijacked, credentials could be stolen, sensitive data could be exfiltrated, and lastly, access to your client computers can be obtained.


πŸ”Ž How To Find

The majority of DOM XSS vulnerabilities can be found quickly and reliably using Burp Suite’s web vulnerability scanner. To test for DOM-based cross-site scripting manually, you generally need to use a browser with developer tools, such as Chrome. You need to work through each available source in turn and test each one individually.


πŸ“• Referance


πŸ”¬ Labs

You can read my portswigger DOM labs Solutions from my Notes in this

From 29Ep : 35Ep

: Install this Machine and will have a lot of Labs like DVWA, BWAPP, Webgoat, etc

🐞
Here
Here
Port-Swigger Labs
DomGoat - DOM Security Learning Platform
portswigger
OWASP
PayloadsAllTheThings
hacktricks
hackingarticles
Ebrahem Hegazy
portswigger
OWASP Broken Web Applications Project