Code Monkey home page Code Monkey logo

domclobbering's Introduction

DOMC-BT

DOMC-BT

Website | Browser Testing | Wiki | Markups | Payload Generator

DOM Clobbering Browser Testing Framework

Build Status Node made-with-python Open Source?Yes!

A comprehensive framework for testing web browsers against DOM Clobbering. DOMC-BT exhaustively generates test cases of candidate DOM Clobbering markups and automatically tests them against web browsers.

DOMC-BT complements TheThing a static-dynamic security analysis tool for DOM clobbering based on JAW.

DOMC-BT has a website available at https://soheilkhodayari.github.io/DOMClobbering.

HTML Sanitizer Testing Pipeline: Please see the HTML-ST repository!

โœจ What This Repository Includes?

๐Ÿ’ฅ What is DOM Clobbering?

DOM Clobbering is an attack technique where the attacker achieves arbitrary client-side code execution by injecting a non-script HTML markup into a vulnerable webpage and transform the initially secure markup into executable code.

DOM Clobbering originates from a naming collision between JavaScript variables and named HTML markups, where attackers confuse the web application by injecting HTML elements whose id or name attribute matches the name of security-sensitive variables, such as variables used for fetching remote content (e.g., script src).

For more information, See here.

๐Ÿš€ Browser Testing

๐Ÿญ Building

You can build the tool by:

$ docker-compose build web
$ docker-compose build browserstack

๐Ÿ”ฅ Running Tests in Your Browser

Run the web application that serves the test DOM Clobbering webpages:

$ docker-compose up web

Now, you should be able to visit the list of tests on http://127.0.0.1:3000, and run any of them in your browser by clicking on the links.

Note: The test pages automatically redirect to the next test webpage, therefore clicking the first test is sufficinet to run all the test cases.

๐ŸŽก Running Tests via BrowserStack

You can use BrowserStack to run the DOM clobbering testsuite for many browsers simultaneously.

Step 1: specify the browser configurations you would like to test in a .json file. See here for more information about available list of browsers. You can find an example in browser_capabilities.json in the root project directory.

Step 2: Run the webapp hosting the test pages, and setup a proxy so that BrowserStack can access this webapp:

$ docker-compose up web
$ ./browserstack_proxy ACCOUNT_KEY

Note: In the above command, replace ACCOUNT_KEY with your BrowserStack access key.

Note: For setting up the proxy, you may need to download the appropriate BrowserStack binary and rename it to BrowserStackLocal. For more information, refer to the official BrowserStack local testing documentation.

Step 3: Run the automated docker service called browserstack to execute the tests:

$ docker-compose up browserstack

โžฐ DOM Clobbering Markups

The raw data of DOM Clobbering markups are available in the domc_markups folder in the root project directory for different mobile and desktop browsers and browser versions.

An interactive version of clobbering markups is available online here, which provides an online browser testing solution. For testing each markup in your browser, simply click on it.

Found a new clobbering markup not in the online list and that you would like to share? Then, open up a new PR here.

๐Ÿ“š DOM Clobbering Wiki

This repository features one of the first online wikis for DOM Clobbering accessible at https://soheilkhodayari.github.io/DOMClobbering.

The markdown files of the wiki are available in the domc_wiki folder in the project root directory.

๐Ÿญ Local Build

This repository uses the Jekyll just-the-docs as a GitHub pages remote theme, with the configuration specified in _config.yaml:

remote_theme: just-the-docs/just-the-docs
color_scheme: "dark"

Docker: You can build and run this Wiki inside a Docker container with:

$ docker-compose build wiki
$ docker-compose up wiki

Host Machine: alternatively, you can build it inside your host machine with:

$ gem install just-the-docs
$ bundle exec jekyll serve

For more information, please refer to the official just-the-docs and Jekyll documentations.

๐Ÿ’ป Automatic Deployment

The repository uses Github Actions to automatically build and publish a static version of the DOM Clobbering Wiki with Jekyll once a commit is merged with the master branch (i.e., a Pull Request is accepted).

๐Ÿ™‹ Questions

For any questions, suggestions, feedback or concerns, please raise an issue in the repository.

๐ŸŽƒ Contribution and Code Of Conduct

Bug reports and pull requests are more than welcomed on GitHub. For more information, please refer to contribution guidelines.

This project is intended to be a safe, welcoming space, and contributors are expected to adhere to the contributor code of conduct.

๐Ÿ“ Academic Publication

The contents of this repository has been published as a part of a IEEE S&P'23 paper. If you use DOMC-BT for academic research, we encourage you to cite the following paper:

@inproceedings {SKhodayariSP23TheThing,
  author = {Soheil Khodayari and Giancarlo Pellegrino},
  title = {It's (DOM) Clobbering Time: Attack Techniques, Prevalence, and Defenses,
  booktitle = {To Appear at proceedings of the 44rd IEEE Symposium on Security and Privacy},
  year = {2023},
}

Browser Testing

We thank the BrowserStack Open-Source Program for supporting this project.


domclobbering's People

Contributors

dependabot[bot] avatar soheilkhodayari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

domclobbering's Issues

iframe tag with id attribute cannot clobber document.x

Here is a correction for the paper as well as the domclob.xyz website about the DOM Clobbering markups. Contrary to previous findings, iframe HTML element with id=x attribute cannot clobber the DOM Tree Accessors (i.e. document.x).

According to the HTML standard on named element lookup on Document interface, only the following elements can clobber the document.x.

  • Exposed embed, form, iframe, img, or exposed object elements that have a name content attribute
  • Exposed object elements that have an id content attribute
  • img elements that have an id content attribute whose value is name, and that have a non-emptyname content attribute

Upon running some real-world tests using BrowserStack, I found that the iframe HTML element with id=x attribute cannot clobber the DOM Tree Accessors at least in the following listed versions of Chrome, Firefox, and Edge.

  • Chrome: Tested from version 86 to 123
  • Firefox: Tested from version 80 to 124
  • Edge: Tested from version 80 to 123

Syntax Error in UI Script

Issue Description

The snippet for online testing of clobbering markups has a syntax error in line 184 (missing closing bracket).

if (v && (!isNaN(v) || v.toString().indexOf('HTML') > -1 || v.toString().indexOf('Element') > -1     
     || v.toString().indexOf('Collection') > -1 || v.toString().indexOf('Window') > -1) {
    is_clobbered = true;
}

The affected webpage is https://domclob.xyz/domc_markups/list.

OWASP Cheat Sheet

Add a link to the OWASP cheat sheet in the main page, which has been created with this PR.

Add GitHub Actions

Check the test server build status via Github actions automatically after each commit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.