Site icon API Security Blog

DOMDig – DOM XSS Scanner For Single Page Applications

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOzTXaMbb9CXjEw9netji8LfGIK_L72Soe_LhhPvFxptiS9UQBigpE1Nu58_nQ1_YmTWOfSy2b4-6gCKnQbpEZELP2AyM4uVnwLYPT0UyvIZVqO-qYfzFOkv_j7YMAUKJCa88aoGqHpZZ5meDhyrc6PFpBmxDGtxT1zhTWqsSUnaS0VBJQP7TiwbE/w640-h540/DOMDig.png)]()

DOMDig is a DOM [XSS scanner]( “XSS scanner” ) that runs inside the [Chromium]( “Chromium” ) web browser and it can scan single page applications (SPA) recursively.
Unlike other scanners, DOMDig can crawl any webapplication (including gmail) by keeping track of DOM modifications and XHR/fetch/websocket requests and it can simulate a real user interaction by firing events. During this process, XSS payloads are put into input fields and their execution is tracked in order to find [injection]( “injection” ) points and the related URL modifications.
It is based on [htcrawl]( “htcrawl” ), a node library powerful enough to easily crawl a gmail account.

## KEY FEATURES

* Runs inside a real browser (Chromium)
* Recursive DOM crawling engine
* Handles XHR, fetch, JSONP and [websockets]( “websockets” ) requests
* Supports cookies, proxy, custom headers, http auth and more
* Scriptable login sequences

## GETTING STARTED

### Installation

git clone https://github.com/fcavallarin/domdig.git
cd domdig && npm i && cd ..
node domdig/domdig.js

### Example

node domdig.js -c ‘foo=bar’ -p https:127.0.0.1:8080 https://htcap.org/scanme/domxss.php

### Crawl Engine

DOMDig uses [htcrawl]( “htcrawl” ) as crawling engine, the same engine used by [htcap]( “htcap” ).
The diagram shows the recursive crawling proccess.

The video below shows the engine crawling gmail. The crawl lasted for many hours and about 3000 XHR request have been captured.

### Login Sequence

A login sequence (or initial sequence) is a json object containing a list of actions to take before the scan starts. Each element of the list is an array where the first element is the name of the action to take and the remaining elements are “parameters” to those actions. Actions are:

* write <selector> <text>
* click <selector>
* clickToNavigate <selector>
* sleep <seconds>

#### Example

Payloads file

Payloads can be loaded from json file (-P option) as array of strings. To build custom payloads, the string `window.___xssSink({0})` must be used as the function to be executed (instead of the classic `alert(1)`)

#### Example

[
‘;window.___xssSink({0});’,

]

**[Download Domdig]( “Download Domdig” )**Read More

Exit mobile version