Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
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 to use any plaintext dictionary or any generated payload (using Burp payload generators) and encrypt the JSON values transparently before sending the requests.
First, in order to process the payloads you will need to register and implement the IntruderPayloadProcessor interface:
class BurpExtender
include IBurpExtender
include IMessageEditorTabFactory
include IIntruderPayloadProcessor
include EncryptionHelper
attr_reader :callbacks
def registerExtenderCallbacks(callbacks)
@callbacks = callbacks
callbacks.setExtensionName("JSON Crypto Helper")
callbacks.registerMessageEditorTabFactory(self)
callbacks.registerIntruderPayloadProcessor(self)
end
...[SNIP]...
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:
def getProcessorName
"JSON Crypto Helper"
end
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
end
This method provides 3 arguments:
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:
The new payload processor appears on the available processor list: Payload Processor > Add > Invoke Burp Extension > Crypto Helper.
The result shows the values were successfully encrypted and the server replied with the correct decrypted values.
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 extension 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!
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.