Burp Deep Data Injector is a BurpSuite extension that allows pentesters to define targets within non-standard locations such as encoded regions or serialized data.
For example, let's look at the AltoroAccounts
cookie within the cookie header of the request below.
GET /bank/main.jsp HTTP/1.1
Host: demo.testfire.net
Cookie: JSESSIONID=C446E593634DD2E4942F54E6FB6713FB; AltoroAccounts="ODAwMDAwfkNvcnBvcmF0ZX4tMi4wOTk5NTY0NTM4ODIzOTAxRTEyfDgwMDAwMX5DaGVja2luZ34yLjAwMDAwNzcyNzEyMDQ0RTEyfA=="
User-Agent: curl/7.81.0
Accept: */*
Connection: keep-alive
When base64 decoded, the cookie appears as follows:
800000~Corporate~-2.0999564538823901E12|800001~Checking~2.00000772712044E12|
By default, these potential payload insertion points would not be targeted by the scanner. Burp Deep Data Injector provides the ability to target these locations thus improving scan coverage.
Burp Deep Data Injector registers itself as a scan insertion point provider using the BurpSuite API. The scanner will then present requests to Burp Deep Data Injector to determine if there are any available insertion points. The extension will then match the request with any rules defined by the tester and will provide insertion points to the scanner so that payloads may be inserted.
- Create injection rule targeting a previously un-scannable region
- Define a decode and encode script so that the region can be accessed and re-encoded once a payload is inserted
- Run a scan
- The scanner will then pass requests to Burp injector via the
provideInsertionPoints
call to query for insertion points - The scanner will then call
buildHttpRequestWithPayload
on the provided insertion points to inject payloads
There are 3 methods that can be used to target payloads within a decoded region of a request.
Targets using pre-canned regexes that match JSON,XML and key value pairs.
A custom regex similar to auto target but created by the pentester. A name and value capture group can be provided. The extension will provide a name if one isn't provided.
Regex based targets can be used to target specific areas where 1 single regex isn't ideal.
Some target regions may be encoded, serialized or encrypted or signed which means that processing must be done to insert payloads. Burp Deep Data Injector uses python to handle these operations. There are 3 types of scripts you can provide.
Decodes the target region in which the targets exist. This is called first to "unwrap" the target area.
Re-encodes the target region. This is called once a payload is inserted.
Process a payload prior to insertion. This is called on every payload passed to the extension.
# decoder script used to decode a region of text from a targeting rule
import base64
def decode_target( target: str ) -> str:
decoded_target = base64.b64decode(target.encode("utf-8")).decode("utf-8")
return decoded_target
# encoder script used to encode a region of text from a targeting rule after the alteration has been injected
import base64
def encode_target( target: str ) -> str:
encoded_target = base64.b64encode(target.encode("utf-8")).decode("utf-8")
return encoded_target
By calling the decode script above, the following is revealed
800000~Corporate~-2.0999564538823901E12|800001~Checking~2.00000772712044E12|
- Navigate to http://demo.testfire.net
- Click "Sign in"
- Login with username
admin
and passwordadmin
- Switch back to the proxy and locate a request to
/bank/main.jsp
, it will have anAltoroAccounts
cookie which is a base64 encoded value - Right-click on the request and click Extensions β Injector β Send to Deep Data Injector
- Click the Deep Data Injector tab
- Click "New" to create a new rule
- Provide a name and set the rule scope regex to
.*/bank/main.jsp.*
- Set the target area regex to
AltoroAccounts="([^"]+)"
and set the capture group to 1 - Enable the rule
- Select the "Regex" radio button in the rule editor pane
- Paste the following in the "Decode" script tab
import base64
def decode_target( target: str ) -> str:
decoded_target = base64.b64decode(target.encode("utf-8")).decode("utf-8")
return decoded_target
- Paste the following in the "Encode" script tab
import base64
def encode_target( target: str ) -> str:
encoded_target = base64.b64encode(target.encode("utf-8")).decode("utf-8")
return encoded_target
- Click the decode tab and then click "Execute", observe that the payload is now decoded
- Click "New" ( at the bottom )
- Create the following targeting rules using the regexes below, set the capture group to 1 for each of them
^(\d+)~
^\d+~(.*?)~
^\d+~.*?~(.*?)~
^\d+~.*?~.*?~(.*?)~
^\d+~.*?~.*?~.*?~(.*?)\|
- Click "Save"
- Run a scan to observe that the targeted region is scanned
- Enter a test payload such as
<script>alert(1)</script>
in the test payload field on the "Python script debug" frame - Click the "Test" button
- Click the "Logger" tab and observe that several requests were sent
- Select any request to
/bank/main.jsp
and send it to the repeater - Observe that there is a "Deep Data Injector" editor and that when clicking on it the decoded request is revealed
- Edit the request and click send.
- Serialized data
- Encoded data
- Encrypted / signed data
- Non-standard data formats that the scanner doesn't detect by default
- Test the rule using the rule test feature to work out any issues prior to scanning
- If the decoded target area ends up being a format such as key value pairs, CSV, JSON or XML then use auto targeting
- Consider developing the bulk of your decode and encode scripts in an IDE and only make minor changes in the script editor tab since it lacks debugging features that an IDE would have. You can export your scripts by clicking "Export scripts" and then you can import them after by clicking "Import scripts"
- The execution time of scripts is shown so you can be mindful of how long your script takes.
- Be mindful of the payload encoding and use a payload processing script to encode when required ( ex: json, xml )
The main user interface is loaded into a tab
- Injection rule list
- Injector rule configuration
- Regex rule configuration
- Encode/Decode/Payload scripts
- Python config / Test payload config / Import script / Export Script / Execute script
- Script output and debug area
- Sample request on which the rule is to be run
You can use this to interact with payloads using the injector rule processing configuration
- Python 3
- BurpSuite Professional
- Make sure you have a valid python3 installation
- Download the latest jar from the releases tab
- In BurpSuite click Extensions β Add and load the file manually
- Clone this repo
- Switch to the
demo
folder - Run
docker build -t pickledemo .
to build the demo app - Run the demo app using
docker run -p 5000:5000 pickledemo
- Navigate to
http://localhost:5000
in a browser proxied by Burp and follow the instructions
- Use python to decode areas of requests ( Audit Insertion Points ) that aren't picked up by the scanner
- Run the demo above to test