Nondeterministic Programming Methodology

    busted

    1.0.0 • Public • Published

    Busted

    npm version npm downloads Travis CI Coverage Status Code Climate Grade bitHound Overall Score GitHub license

    An npm package that detects improper iframe busting code and incorrect HTTP headers. "Clickjacking" is a malicious technique of tricking users into clicking on invisible iframes, and thus performing sensitive actions like sharing data or bank transfers without their knowledge. This tool attempts to find and offer suggestions to patch these vulnerabilities in your web applications. Also included are an Electron application, Chrome extension, and an Arachni check.

    Install npm package

    $ npm install busted

    Usage

    In a Node.js application (no DOM access to iframes, so only headers test is functional):

    var busted = require('busted');
    var URL = 'http://www.example.com';
    busted.headersTest(URL, function(url, passed) {
      console.log(url + (passed ? ' passed ' : ' failed ') + 'the headers test.');
    });

    In any Electron application (has DOM access so iframes can be tested):

    window.BUSTED = require('busted.js');
     
    var URL = 'http://www.example.com';
    var iframe = document.getElementById('frame');
    iframe.src = URL;
     
    window.BUSTED.headersTest(URL, function(url, passed) {
      console.log(url + (passed ? ' passed ' : ' failed ') + 'the headers test.');
    });
     
    iframe.onload = function() {
      var passed = window.BUSTED.iframeTest(URL, iframe);
      console.log(URL + (passed ? ' passed ' : ' failed ') + 'the iframe test.');
    }

    Using our Electron app

    Our Electron app allows for scanning and testing URLs for the vulnerabilities.

    Install

    $ git clone https://github.com/nathanchapman/busted.git && cd busted/electron && npm install

    Starting the app

    From busted/electron run:

    $ npm start

    Arachni Web Scanner Check

    An Arachni check that tests headers and parses JavaScript for improper frame-busting code.

    Install Arachni

    Download and install Arachni.

    Install Busted

    $ git clone https://github.com/nathanchapman/busted.git

    Move the arachni/clickjacking.rb file to: [ARACHNI_DIRECTORY]/system/gems/gems/arachni-1.4/components/checks/passive from within [ARACHNI_DIRECTORY] run the following:

    $ bin/arachni --checks=clickjacking --scope-page-limit 1 --browser-cluster-pool-size 1 SOME_URL_OR_FILE

    for more information, see the Arachni CLI guide.

    Clickjacking Prevention

    There are other attacks that are site-specific or are possible if the attacker controls certian domain names. These attacks cannot be tested here, but we will attempt to prevent them with this two-fold solution.

    Headers: Set X-Frame-Options header to DENY or SAMEORIGIN

    Frame Busting Code: Use the following frame busting code as a solution for older browsers that do not support X-Frame-Options or Content-Security-Policy headers.

    <!-- Source: http://w2spconf.com/2010/papers/p27.pdf -->
    <style>
    html { display: none; }
    </style> 
    <script>
    if (self == top) {
      document.documentElement.style.display = 'block';
    } else {
      top.location = self.location;
    }
    </script> 

    Install

    npm i busted

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • nathanchapman