Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

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 to 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 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:

  • #getProcessorName: the payload processor name.
def getProcessorName
"JSON Crypto Helper"
end
  • #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
end

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:

11120_a9c456fe-4f1f-493c-9427-9634d6cf8cfc

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

7620_00e3a8d6-d51f-42f8-a6bd-d4f3ae58dd1e

8240_1df21867-9bbc-40d6-96dc-069c1b7358d2

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

10645_92e77543-db78-4bed-a8bf-bc833d0f5eee

9233_4f6c2dd6-8dd2-4ff3-a954-e77fe71a5be6

Conclusion

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!

ABOUT TRUSTWAVE

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.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo