Writing a Burp Extension in Ruby Part 1

Writing a Burp Extension in Ruby

Burp extensions can be written in 3 languages - Java, Python, and Ruby. Since Burp is a java app, in order to write extensions in Python you need Jython and in Ruby you need JRuby. For this example, we’ll use Ruby.

Step 1 - Downloading JRuby

The first step is to download JRuby from https://jruby.org/download.

JRuby Download

For this example we will be using the latest - Complete.jar.

Step 2 - Configure Burp to use the JRuby library downloaded in Step 1

To configure Burp to use the new JRuby, go to Extender -> Options -> Ruby Environment and specify the path to the downloaded library. JRuby Location

Step 3 - Write the Extension

For this example, I’ll use a very simple Extension that does nothing but load and sets the name of the extension. In subsequent posts, I’ll build on this to build something useful.

require 'java'

java_import 'burp.IBurpExtender'

class BurpExtender
  include IBurpExtender

  def registerExtenderCallbacks(callbacks)
    callbacks.setExtensionName("Demo Ruby Plugin")

IBurpExtender is the interface that defines the methods that a plugin must implement for Burp to recognize it as an extension and load it. The callbacks object has a number of methods, but for this example I’m just setting the extension name.

Step 4 - Load the Extension

To load the extension, go to the Extensions tab and click “Add”. Add Extension

Once the dialog opens, specify the extension type of ruby and navigate to the path of the extension. Add Extension

When you click “Next”, the extension is loaded.

Step 5 - View the Extension

Go to the “Extensions” tab, and select the new extension you just added and see the details. Extension Running

That’s it for Part 1! Check back next week for the next in the series.