npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

busted

v1.0.0

Published

A node module that detects improper iframe busting code

Downloads

20

Readme

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>