Giter VIP home page Giter VIP logo

decoder-improved's Introduction

Decoder Improved

tl;dr

Within extender load Decoder-Improved.jar latest release

For a walkthrough on how to extend Decoder Improved visit our blog post. The link to the original description seems to be broken. While there's no up-to-date walkthrough about how to extend Decoder Improved at the moment, a little more details can be found here.

Summary

Burp Suite's built-in decoder component, while useful, is missing important features and cannot be extended. To remedy this, I developed Decoder Improved, a drop-in replacement Burp Suite plugin. It includes all of decoder's functionality while fixing bugs, adding tabs, and includes an improved hex editor. Additionally, the plugin's functionality is straightforward to extend to accommodate any custom data encoding and decoding needs.

Decoder Improved

Burp Suite Decoder and its Weaknesses

Burp Suite includes an easy-to-use data manipulation toolkit that allows a user to manipulate data by setting a series of transformation filters. These filters allow users to perform simple data manipulation including URL, HTML, Base64, ASCII Hex, Hex, Octal, Binary, and Gzip encoding and decoding; it also includes a few basic hashing functions. Additionally, Burp Suite's decoder has a hex editor and a "smart decode" option that automatically picks a reasonable decoding method. While this set of functionality is useful, it suffers from several issues that limit it heavily:

  • A Lack of Tabs

    Unlike many of Burp's other features, the decoder does not support tabs which makes managing multiple chunks of data difficult.

  • Difficult to Use Hex Editor

    The included hex editor requires users to right click to insert new bytes or delete existing bytes. Additionally, each byte in the hex editor is a text box making data entry difficult.

  • Cannot Handle Non-ASCII Text

    Decoder truncates text characters to one byte, mangling Unicode characters. This makes dealing with non-English character sets brutal.

  • Impossible to Extend

    Because Burp Suite is closed-source, it is not feasible to fix bugs and extend the existing decoder via the Burp Extender API to perform custom encoding and decoding.

Decoder Improved

Decoder Improved is a data transformation plugin for Burp Suite that better serves the varying and expanding needs of information security professionals. Decoder Improved includes the following useful features:

All of the Built-in Burp Decoder Modes

Decoder Improved supports all of decoder's encoding, decoding, and hashing modes. Decoder Improved can encode and decode URL, HTML, Base64, ASCII Hex, and GZIP. Additionally, Decoder Improved can hash data using MD2, MD5, SHA, SHA-224, SHA-256, SHA-384, and SHA-512.

Tabs

Like many of Burp Suite's features, Decoder Improved has support for tabs, enabling users to manipulate separate pieces of data simultaneously without having to erase existing work.

Unicode Support

Decoder Improved is backed by arrays of Java Bytes that do not truncate or modify Unicode characters through the modification process. Because Java's Swing elements support displaying Unicode characters, so does Decoder Improved.

An Improved Hex Editor

Decoder Improved comes bundled with the Delta Hexadecimal Editor, a swing Hex Editor, developed by the ExBin project. Delta provides an improved hex editing experience over the built-in decoder's hex editor by allowing easy insertion and removal, highlighting, and Unicode support.

Arbitrary Numeric Base Conversion

Decoder Improved can convert any number represented in base 2 to base 32 (the largest base supported by Java) to its representation in any other base between base 2 and base 32.

Regex Find and Replace

Decoder Improved can perform regular expression find and replace over input to quickly transform text.

HTML/URL Encode Only Special Characters

When HTML and URL encoding strings in decoder, every character in the string is encoded, which limits human readability and occasionally trips broken input filtering rules. Decoder Improved includes encoding modes that only encode special characters while leaving alphanumerics untouched.

Every Hashing Algorithm Available in BouncyCastle

In addition to every hashing algorithm exposed within Burp Suite's built-in decoder, Decoder Improved exposes every hashing algorithm included in the BouncyCastle Java crypto library. In contrast, decoder only contains a smattering of hashing algorithms that do not cover the entire range of hashing needs encountered during testing.

Save Data to Files in Different Formats

Every piece of data can be saved to local files in raw, Hex and UTF-8 encoded formats.

Work State is Saved

Decoder Improved automatically saves and reloads its work state after Burp restarts. Users have the options to export the work state to files.

An Easy Extension Interface

The Decoder Improved can be extended with customized modes with easy-to-use interfaces. See our blog post for a walkthrough on how to extend Decoder Improved.

Build Your Own Jar

  1. Prerequisites:

    • Gradle 5.6+
    • JDK 1.8+
  2. Build:

    1. $ git clone https://github.com/nccgroup/Decoder-Improved.git
    2. $ cd Decoder-Improved/
    3. $ gradle shadowJar (or simply $ gradle)
  3. Find the compiled Jar file ./build/libs/Decoder-Improved-all.jar and load it under Extender -> Extensions.

decoder-improved's People

Contributors

hajdam avatar hannah-portswigger avatar justinmoore avatar justinmoore-ncc avatar justinmoore-ncc2 avatar michael-eaton-portswigger avatar ngo avatar pajswigger avatar parsiya avatar portswiggersupport avatar zehuanncc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

decoder-improved's Issues

Trigger encoding explicitly

Currently decoding is triggered by selecting “Decode as…”, but encoding cannot be triggered directly. I work around it by first selecting “Encode as…” to triggers a new row, then back to “Decode as…”. I can think of two solutions:

  1. Add a button “Go!” to trigger it explicitly.
  2. Add a null element “Action:” so that the drop-down also changes for encoding.

darkmode

Hi,

could you make it adapt to darkmode to show the text in white while in darkmode ?

2022-01-20_14-19

thank you

New tab with duplicate label

Decoder Improved generates new tab labels without checking for duplicates. Presumably this happens because the assigned integer label is derived from the count of existing tabs plus one.

Suggestion: When creating a new tab, keep incrementing the integer label until it becomes unique.

Steps to reproduce:

  1. Open a few tabs
  2. Close the first few tabs, keeping the last ones
  3. Close and restart Burp
  4. Observe that the tabs left after step 2 have been restored
  5. Open a new tab, noting its duplicate label

Seven tabs restored:

DuplicateTabLabel-1-RestoredTabs

New 8th tab:

DuplicateTabLabel-2-NewTabLabel

whitespace/newline on end breaks decoding

I just asked it to decode the following as Base64:

YWFhCg==

The newline on the end caused the error "Invalid Base64 Input", the same happens if you have a space on the end. While the error may technically be true, but it would be annoying having to remember to trim excess whitespace.

It also fails with whitespace on the start, but that isn't quite as bad as a lot of things don't like leading whitespace.

Black characters on dark background if using Dark theme

Hi Justin & Team,

Thanks for the wonderful tool. I found that if I am using a dark theme in Burp, the characters pasted into DI will be black on black background hence not very easy to read. Can you change this please?

Thanks
di

Supporting non-UTF-8 characters

  1. After the fix #15 , if a string character is deleted in the string editor, a wrong byte will be deleted if there's any \x0d\x0a before the character. This is caused by inconsistent offset calculated by the function calculateByteOffset() here, as the \x0d\x0a will be rendered as a single \x0a in the text editor.

    It should be noted that the string we get from getDisplayString() here doesn't perfectly match the string in the textEditor.getText(), at least for the \x0d\x0a (newline character).

    The calculation for other UTF-8 unmappable characters seems to work fine. I'll try to enhance it if not all UTF-8 multibyte characters are covered.

    This is fixed by 90d4a8b

  2. There are some actions that currently don't support data that contains non-UTF-8 characters (eg. HTML entity encoding). Some of them can be improved.

    This is fixed by #26

  3. The insertedText here will be a wrong string if \x0d\x0a is present before the string. It's a bug and needs to be fixed.

    This is fixed by 2ee6e2c

Add Save Buffers To File Functionality

Portswigger reached out to me saying that a user requested the ability to export decoder buffers to file. I'll work on implementing this within decoder improved.

New feature: fuzzy GZip decoding

Decoder Improved already implements "fuzzy Base64 decoding", and that's very useful for JWS. However, adding "fuzzy GZip decoding" (like the standard decoder does) would be nice!

Currently, I get error "Invalid GZIP Input" when trying to GZip-decode a full response (with HTTP headers + a gzip'ed body). It's probable that #4 must be fixed first.

Performance Issue

Decoder improved runs very slow with a large amount of text. Need to improve its performance. Possible causes:

  • Unnecessary operations/clone of byte array.
  • Unoptimized algorithms in modifiers (at least for URL/HTML encoders).
  • Poor undo/redo implementation.
  • Redundant logic (listeners etc.) in updating segments and UIs (text editor etc.).
  • Memory leak.

Plugin state too permanent

Enhancement after #19

Something sounds buggy (due to Burp not supporting extension settings per project) is that the working state will be shared across all Burp instances (including temporary instance). A workaround may be creating a unique name of the setting profile per instance, but it's currently not ideal since there's no way we can delete the settings (unless Burp recycles them). See here for more info.

Or, save the settings to a file and allow users to recover the state from it manually (unless there's a "Burp config files" folder, which seems not).

Another thing might be worth implementing is to add a button that allows the user to clear the setting manually, like at the end of a project to clean up all data.

Incorrect automatic conversion to UTF-8

If a response containing some binary data (here a tar.gz archive) is sent to Decoder Improved, some characters are mangled and replaced by \xEF\xBF\xBD. This sequence is the UTF-8 value for the replacement character, used to "replace any incoming character whose value is unknown or un-representable".

As you can see in screenshots, the sequence "\x1F\x8B\x08" is converted to "\x1F\xEF\xBF\xBD\x08"
di-1
di-2

More info:
https://apps.timwhitlock.info/unicode/inspect?s=%EF%BF%BD
https://blog.gdssecurity.com/labs/2015/2/18/when-efbfbd-and-friends-come-knocking-observations-of-byte-a.html

URL-decoding of the plus sign

Currently the plus sign (0x2B) is being passed through literally. In contrast, the built-in decoder will interpret it as a space character.

Decoder Improved:
abc+-+def --- (decode as URL) ---> abc+-+def

Decoder :
abc+-+def --- (decode as URL) ---> abc - def

I am proposing this change so Decoder Improved maintains compatibility with MIME type application/x-www-form-urlencoded.

https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1

Plugin not loading in the beta version of Burp

Attempts to load the plugin with Beta v2.0.14 results in the following error:
java.lang.NullPointerException
at trust.nccgroup.decoderimproved.JsPrettifier.(JsPrettifier.java:22)
at trust.nccgroup.decoderimproved.PrettifyMode.(PrettifyMode.java:18)
at trust.nccgroup.decoderimproved.ModificationModeManager.(ModificationModeManager.java:49)
at trust.nccgroup.decoderimproved.MultiDecoderTab$DecoderSegment.setupComponents(MultiDecoderTab.java:466)
at trust.nccgroup.decoderimproved.MultiDecoderTab$DecoderSegment.(MultiDecoderTab.java:381)
at trust.nccgroup.decoderimproved.MultiDecoderTab$DecoderTab.setupComponents(MultiDecoderTab.java:264)
at trust.nccgroup.decoderimproved.MultiDecoderTab$DecoderTab.(MultiDecoderTab.java:161)
at trust.nccgroup.decoderimproved.MultiDecoderTab.addTab(MultiDecoderTab.java:87)
at trust.nccgroup.decoderimproved.MultiDecoderTab.(MultiDecoderTab.java:59)
at trust.nccgroup.decoderimproved.ExtensionRoot.registerExtenderCallbacks(ExtensionRoot.java:17)
at burp.BurpExtender.registerExtenderCallbacks(BurpExtender.java:9)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at burp.esk.lambda$registerExtenderCallbacks$0(Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

Dark theme of Burp 2 Beta

image

Sorry this is a lame issue but...

... Decoder-Improved is not respecting the dark theme 'Dracula" of Burp 2.0.19beta

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.