{"id":13542249,"url":"https://github.com/fcavallarin/domdig","last_synced_at":"2025-04-05T12:08:48.175Z","repository":{"id":38984289,"uuid":"215537321","full_name":"fcavallarin/domdig","owner":"fcavallarin","description":"DOM XSS scanner for Single Page Applications","archived":false,"fork":false,"pushed_at":"2024-07-16T08:41:41.000Z","size":110,"stargazers_count":393,"open_issues_count":1,"forks_count":48,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-13T22:30:00.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcavallarin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-16T11:59:45.000Z","updated_at":"2024-09-27T09:58:21.000Z","dependencies_parsed_at":"2024-08-01T10:26:22.787Z","dependency_job_id":null,"html_url":"https://github.com/fcavallarin/domdig","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcavallarin%2Fdomdig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcavallarin%2Fdomdig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcavallarin%2Fdomdig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcavallarin%2Fdomdig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcavallarin","download_url":"https://codeload.github.com/fcavallarin/domdig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332612,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T10:01:03.480Z","updated_at":"2025-04-05T12:08:48.148Z","avatar_url":"https://github.com/fcavallarin.png","language":"JavaScript","readme":"# DOMDig\nDOMDig is a DOM XSS scanner that runs inside the Chromium web browser and it can scan single page applications (SPA) recursively.  \nUnlike 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 points and the related URL modifications.  \nIt is based on [htcrawl](https://htcrawl.org), a node library powerful enough to easily crawl a gmail account.\n\n\n# KEY FEATURES\n- Runs inside a real browser (Chromium)\n- Recursive DOM crawling engine\n- Handles XHR, fetch, JSONP and websockets requests\n- Supports cookies, proxy, custom headers, http auth and more\n- Scriptable login sequences\n- Sequence recorder\n- Postmessage fuzzer\n\n# GETTING STARTED\n## Installation\n```\ngit clone https://github.com/fcavallarin/domdig.git\ncd domdig \u0026\u0026 npm i \u0026\u0026 cd ..\nnode domdig/domdig.js\n```\n\n## Example\n```\nnode domdig.js -c 'foo=bar' -p http:127.0.0.1:8080 https://fcvl.net/htcap/scanme/domxss.php\n```\n\n# PERFORMED CHECKS\nDOMDig can perform three different checks:  \n1. DOM XSS\n2. Stored DOM XSS\n3. Template Injection\n\nOn top of these checks, it always verifies if our payload is inserted into some \"interesting\" element's properties such as `a.href`, `form.action` and `srcdoc`.\nIn case one is found, it's reported as a warning.\n\n## DOM XSS\nDOM XSS check can be configured with different modes, enabling different behaviours. By default, all of them are enabled.  \nThe modes are:  \n1. domscan\n2. fuzz\n\n### domscan\nIt crawls the DOM searching for places where user can inject JavaScript code, for example, a text box. It can discover injection points that cannot\nbe guessed by a scanner. An example may be a search functionality that takes the text of an input box and, to trigger the search, puts it into \nthe URL's hash as a JSON string. \n\n### fuzz\nIt fuzzes the URL (query parameters and the hash) to see if our code gets executed on page load. If no code is executed, it crawls the\nDOM triggering HTML events hoping to find something that executes our payload.  \nIt can also discover the classical Reflected XSS.\n\n## Stored DOM XSS\nAfter a DOM XSS check is performed, DOMDig crawls the same page waiting for the execution of previously used\npayloads. If one is found, it means that is can survive to page reloads.\n\n## Template Injection\nSearches for places where template placeholders (e.g. `{var1}`) may be evaluated as JavaScript code.\n\n# Reported Vulnerabilities\nEvery reported vulnerability contains the following fields:\n1. **type**: the type of vulnerability, it can be `domxss`, `stored` or `templateinj`\n2. **url**: the URL of the page when the vulnerability was found\n3. **payload**: the payload used\n4. **element**: the CSS selector of the HTML element, if any, where we injected our payload\n5. **description**: a textual description\n6. **confirmed**: a vulnerability is considered as confirmed when the URL contains the attack payload. If it's \nnot confirmed, it means that the code has been successfully executed, but a manual analysis may be required \nto understand the relation between the injected payload and the URL schema.\n\n\n# Crawl Engine\nDOMDig uses [htcrawl](https://htcrawl.org) as crawling engine.  \nThe diagram shows the recursive crawling process.  \n![SPA Crawling Diagram](https://htcrawl.org/img/htcap-flowchart.png).   \nThe video below shows the engine crawling gmail. The crawl lasted for many hours and about 3000 XHR request have been captured.\n\n[![crawling gmail](https://fcvl.net/htcap/img/htcap-gmail-video.png)](https://www.youtube.com/watch?v=5FLmWjKE2JI \"HTCAP Crawling Gmail\")\n\n# Login Sequence\nA login sequence (or initial sequence) is a json object containing a list of actions to take before the scan starts.\nEach 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.\nActions are:\n- navigate \u0026lt;url\u0026gt;\n- write \u0026lt;selector\u0026gt; \u0026lt;text\u0026gt;\n- select \u0026lt;selector\u0026gt; \u0026lt;value\u0026gt;\n- click \u0026lt;selector\u0026gt;\n- clickToNavigate \u0026lt;selector\u0026gt;\n- sleep \u0026lt;seconds\u0026gt;\n- setTarget \u0026lt;selector\u0026gt;\n\n## Example\n```\n[\n   [\"navigate\", \"https://target.local/login-page\"],\n   [\"write\", \"#username\", \"demo\"],\n   [\"write\", \"#password\", \"demo\"],\n   [\"sleep\", 2],\n   [\"clickToNavigate\", \"#btn-login\"]\n]\n```\n\n# Payloads file\nPayloads 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)`)\n\n## Example\n```\n[\n   ';window.___xssSink({0});',\n   '\u003cimg src=\"a\" onerror=\"window.___xssSink({0})\"\u003e'\n]\n```\n","funding_links":[],"categories":["Exploitation","Weapons","JavaScript","JavaScript (485)"],"sub_categories":["XSS Injection","Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcavallarin%2Fdomdig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcavallarin%2Fdomdig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcavallarin%2Fdomdig/lists"}