GithubHelp home page GithubHelp logo

lorenzog / burpaddcustomheader Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 21.0 150 KB

A Burp Suite extension to add a custom header (e.g. JWT)

License: GNU General Public License v3.0

Java 92.67% Python 2.27% HTML 5.06%

burpaddcustomheader's People

Contributors

lorenzog avatar pajswigger avatar righettod avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

burpaddcustomheader's Issues

Not working as expected

Custom header are added to only those request which is send for spider. so i am only able to view modified requests in target tab.

Is it intentional behavior or what?

Replacing old bearer token?

Hi,

thanks for the extension.

The configuration seems pretty straight forward but maybe I missed something.

When I just do a automated scan with burp, I see using logger++ requests with the Authentication: bearer token I supplied but also requests with an old token I used while inspecting the application manually.

So my request / question is: is that possible to replace any Authentication bearer token by the one supplied by the user?

Cheers, Dirk

PS: yes, in 'tools scope' all relevant check boxes are selected

Only the response body is parsed when "Regular Expression" is used

Currently, the extension only parses the response body. So here's a small patch fixing this behavior (it now parses the whole response, including headers):

diff -ru add-custom-header.orig/burp/BurpExtender.java add-custom-header.new/burp/BurpExtender.java
--- add-custom-header.orig/burp/BurpExtender.java	2019-10-02 10:49:58.240958086 +0200
+++ add-custom-header.new/burp/BurpExtender.java	2019-10-02 10:59:07.190833752 +0200
@@ -93,8 +93,7 @@
                 if (_responseBody == null) return;
                 IResponseInfo macroResponse = helpers.analyzeResponse(_responseBody);
                 if (macroResponse == null ) return;
-                int bodyOffset = macroResponse.getBodyOffset();
-                String responseBody = helpers.bytesToString(_responseBody).substring(bodyOffset);
+                String responseBody = helpers.bytesToString(_responseBody);
                 Matcher m = p.matcher(responseBody);
                 if (m.find()) {
                     token = m.group(1);

Support for Enterprise version

Could this extension be used under the Enterprise version? If not, could I ask that this extension be adjusted to use under Enterprise. We can create long life JWTs for this testing or possibly use a different method to get a JWT that could be picked up by this extension for testing.

Allow more than one header

An idea could be to insert more than one custom header.
Perhaps, a tabbed interface where representing a linked list (so the callback would instead go to the next instance).

TBD

Regular expression match doesn't appear work

Your extension looks like exactly what I need, unfortunately I can't seem to get the regex match to work, even with the simple Flask app and a match of (.*). I'm working through your source now, but wanted to open an issue in case it was something simple.

Getting the BAppStore version updated

Hi, I'm a big fan of this extension, but the current situation is messy, as the BAppStore version misses some interesting patches (extract from headers+body, avoid decoding errors for binary data), as shown in these 2 PR.

However, to be accepted, pull requests MUST come from the original repository AND original author. This isn't the case, and that's why the BAppStore version is lagging behind.

Could you please:

Thanks in advance!

Custom header present even after disabling/removing extension

Hi,
I have configured the extension once. Added it to my session and it worked flawlessly.
However after logging out of the application and getting a new bearer token on login. I am unable to update the automatically set header no matter what I do. What I've tried so far:

  • Restart Burp (and after every step)
  • Edited the values in the extension tab
  • Deleted the session handling rule
  • Disabled the extension

Nothing seems to resolve the issue. Even disabled and removed the header is getting added.
I am using Burp Suite Pro version 1.7.37.

Edit;
The more I think about it, it might be a session handling issue as the scope is also completely ignored. It should add the header to all requests in one subdirectory and specifically exclude it from another.

Feature Request: Replace token only after expiration

Hello,
It would be great if there was a possibility to replace the token after the JWT is expired. When scanning using this extension, the amount of requests is doubled. A possibility to check the validity of the token would be great before invoking the macro.

I know it is more a Burp issue than a extension thing as burp is executing the macro but it may be possible to implement this.

Extra space problem

extension puts 2 space between : and header value. This breaks some functionality. Could you configure to put 1 space after : as it supposed to be?

exampleheader: value >>now
exampleheader: value >>what is supposed to be.
Thanks

Manual for using plugin together with macro's needed

Hi Lorenzo,

We've tried to use the Add Custom Header plugin to solve an issue on our side where we needed a 'Authorization: Bearer xyz' header that would be automatically update on every request.

Unfortunately we didn't get it working correctly, probably our fault due to not using it correctly. We've tried to find a manual for that reason, but didn't find it. Would you be so kind to let us know what we are doing incorrectly, so this could serve as a manual for all the other users that might face the same issue?

Our configuration
In Burp Suite Pro > Project options > Sessions > Macro's we've add a macro called 'get bearer', with under configurable items one added item called (parameter name): 'accesstoken' where we selected the token we need.

To test this macro actually worked we created a Burp Suite Pro > Project options > Sessions > Session Handling rule that just runs the macro and udpates the current request. Scope set to /test/ on the same site for every repeater request.

Going into repeater, and requesting /test/?accesstoken=test will actually show the word test being replaced with the accesstoken, confirming the macro works.

Adding the plugin
Now, we installed Add Custom header, set the header name to 'Authorization' prefix to 'Bearer' and selected a hard-coded value 'test'.

Again, created a Burp Suite Pro > Project options > Sessions > Session Handling rule with invoked the 'add custom header' macro (probably a typo in the readme that tells us to 'add bearer token' should be selected here?) and set the scope similar to above.

Going into repeater, and requesting /test/?accesstoken=test will actually show the word test being replaced with the accesstoken, confirming the macro works. And we see the header added, so the plug-in should now also be working.

Now the part we can't get working
We've tried to set the Add Custom Header to a regular expression header value, and set it to accesstoken":"(.*?)".
Now, we would have expected when running the repeater again to see the header to be added with the acccesstoken value, but instead we don't see any header being added anymore.

Header not inserted

I tried building the extension myself and after it not working installing it from the BAppStore, but again it does not work, the header is not being added to the requests. I use All URLs as scope.
The Session Tracer is not catching any activity.

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.