Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Services
Capture
Managed Detection & Response

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

twi-managed-portal-color
Co-Managed SOC (SIEM)

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

twi-briefcase-color-svg
Advisory & Diagnostics

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

tw-laptop-data
Penetration Testing

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

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

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

tw-officer
Digital Forensics & Incident Response

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

tw-network
Firewall & Technology Management

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

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
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
SpiderLabs Blog

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!

Latest SpiderLabs Blogs

Clockwork Blue: Automating Security Defenses with SOAR and AI

It’s impractical to operate security operations alone, using manual human processes. Finding opportunities to automate SecOps is an underlying foundation of Zero Trust and an essential architecture...

Read More

Professional Services Sector Under Attack - Trustwave SpiderLabs Report 2024

Recent research by Trustwave SpiderLabs, detailed in their newly published report "2024 Professional Services Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies,"...

Read More

Atlas Oil: The Consequences of a Ransomware Attack

Overview Atlas Oil, a major player in the oil and fuel distribution industry, fell victim to a ransomware attack orchestrated by the Black Basta group. This attack not only compromised sensitive...

Read More