Hackers of India

Javascript static security analysis made easy with JSPrime

By  Nishant Das Patnaik   Sarathi Sabyasachi Sahoo  on 31 Jul 2013 @ Blackhat

This talk covers following tools where the speaker has contributed or authored
JSPRIME

Presentation Material

Abstract

Today, more and more developers are switching to JavaScript as their first choice of language. The reason is simple JavaScript has now been started to be accepted as the mainstream programming for applications, be it on the web or on the mobile; be it on client-side, be it on the server side. JavaScript flexibility and its loose typing is friendly to developers to create rich applications at an unbelievable speed. Major advancements in the performance of JavaScript interpreters, in recent days, have almost eliminated the question of scalability and throughput from many organizations. So the point is JavaScript is now a really important and powerful language we have today and it’s usage growing everyday. From client-side code in web applications it grew to server-side through Node.JS and it’s now supported as proper language to write applications on major mobile operating system platforms like Windows 8 apps and the upcoming Firefox OS apps.

But the problem is, many developers practice in-secure coding which leads to many clients side attacks, out of which DOM XSS is the most infamous. We tried to understand the root cause of this problem and figured out is that there are not enough practically usable tools that can solve real-world problems. Hence as our first attempt towards solving this problem, we want to talk about JSPrime: A javascript static analysis tool for the rest of us. It’s a very light-weight and very easy to use point-and-click tool! The static analysis tool is based on the very popular Esprima ECMAScript parser by Aria Hidayat.

I would like to highlight some of the interesting features of the tool below:

AI Generated Summarymay contain errors

Here is a summary of the content:

The speaker is discussing a tool that analyzes JavaScript code for potential security vulnerabilities, as part of an ongoing project. The tool is designed to identify sinks (vulnerable points in the code) and sources (input data that can be manipulated by an attacker).

Examples of sink/source pairs include:

The speaker demonstrates how the tool works using various examples, more complex scenarios, including:

The project’s roadmap includes:

  1. Improving performance and stability
  2. Supporting multiple file scanning and Node.js project scanning
  3. Developing an IDE plugin for Notepad++, WebStorm, or other popular editors
  4. Adding support for more libraries beyond YUI and jQuery
  5. Simulating string manipulation and incorporating user suggestions

The tool is open-source and has a Node.js port available on GitHub (github.com/definition/JPrime). The speaker concludes by thanking the audience and inviting questions.