Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

JSON Crypto Helper a Ruby-based Burp Extension for JSON Encryption/Decryption - Part III

This is the third in a three-part series about how to write a simple Ruby extension that helps deal with encrypted JSON messages. So far we have covered how to decrypt and encrypt JSON messages using Burp Extender and JRuby (read the first and second parts). Now, let's do something awesome with it! The complete extension code is available here.

In this third and last post of the series, we will cover how to automatically encrypt the payloads used by the Intruder tool. You will be able use any plaintext dictionary or any generated payload (using Burp payload generators) and encrypt the JSON values transparently before sending the requests.

Payload Processing with Intruder Tool

First, in order to process the payloads you will need to register and implement the IIntruderPayloadProcessor interface:

class BurpExtender
  include IBurpExtender
  include IMessageEditorTabFactory
  include IIntruderPayloadProcessor
  include EncryptionHelper
  attr_reader :callbacks

  def registerExtenderCallbacks(callbacks)
    @callbacks = callbacks
    callbacks.setExtensionName("JSON Crypto Helper")

Note that you also need to include the EncryptionHelper module, as you will need to have access to the encryption routines later. Also, don't forget to include the related Java interface:

java_import 'burp.IIntruderPayloadProcessor'

This time, you just need to implement the two following methods in the BurpExtender class:

  • #getProcessorName: the payload processor name.
def getProcessorName
  "JSON Crypto Helper"
  • #processPayload: the method that will take care of processing each payload.
def processPayload(currentPayload, originalPayload, baseValue)
  return currentPayload if currentPayload.nil? or currentPayload.empty?
  payload = encode_b64(encrypt(currentPayload.to_s))
  return payload.to_java_bytes

This method provides 3 arguments:

  • currentPayload: the payload to be processed.
  • originalPayload: the payload before any previous processing. As you can chain the payload processors in Burp, the currentPayload could be the result of other processing. In some case, it could be useful to know the original value.
  • baseValue: the value of the original request, before being substituted by any payload.

The logic is pretty straightforward: retrieve the payload, encrypt it using the same routines you used before and base64-encode it.

Let's perform a basic fuzz:

08 - Intruder

The new payload processor appears on the available processor list: Payload Processor > Add > Invoke Burp Extension > Crypto Helper.

09 - payload processor

10 - payloads

The result shows the values were successfully encrypted and the server replied with the correct decrypted values.

11 - attack

12 - response


The Extender tool and the rich API provided by Burp can be very useful during web application security assessments. This example is very basic, but I hope it will be a good introduction to Burp extensions development. Don't hesitate to comment and share your ideas.

Also, I highly recommend having a look at the multiple extensions available in the Burp App Store.

Happy hacking!