PortSwigger / BChecks

BChecks collection for Burp Suite Professional and Burp Suite Enterprise Edition
https://portswigger.net/burp/documentation/scanner/bchecks
GNU Lesser General Public License v3.0
606 stars 107 forks source link

how to replace json values ? #13

Open JaveleyQAQ opened 1 year ago

JaveleyQAQ commented 1 year ago

I want to loop payload into all the JSON values

genuinemoses commented 1 year ago

Hi @JaveleyQAQ, maybe you're looking for something similar to the following:

define:
  payload = "PAYLOAD_TO_INSERT"

given request then
  send request
    replacing body: `{"key_1": "{payload}", "key_2": "{payload}"}`

Hope this helps!

JaveleyQAQ commented 1 year ago

Yes. But I think I don't know the key names and quantities for JSON. I found the loop method, given query or body insertion point, but it seems to have failed. It matched the cookie parameters, sent extra requests, and did not correctly insert my payload. image

olliewuk commented 1 year ago

Have you tried changing the given query or body insertion point to either

JaveleyQAQ commented 1 year ago

thank your rep@olliewuk Here is another question:

defind:
    a = `{random_str(5)}`

if {latest.response} matches "`{a}`" then

, why does it fail to match? What should I do to make it match successfully?

JaveleyQAQ commented 1 year ago

Have you tried changing the given query or body insertion point to either您是否尝试将 given query or body insertion point 更改为

I don't want to insert payloads in the cookies. My code is using "given query or body insertion point", but it's scanning the cookie parameters and sending a lot of useless requests even though it's not inserting any payload.

genuinemoses commented 1 year ago

thank your rep@olliewuk Here is another question:

defind:
    a = `{random_str(5)}`

if {latest.response} matches "`{a}`" then

, why does it fail to match? What should I do to make it match successfully?

I think there are typos and formatting issues, try with the following code block:

define:
    a = {random_str(5)}

if {latest.response} matches {a} then
A-J-C commented 1 year ago

@JaveleyQAQ unfortunately we don't currently support variables within regex matching. We can note it as a feature request if you would like this supported?

Instead, you could use if {a} in {latest.response} as the in keyword does support variables.

As to better json support, we also have only basic full body insertion point currently available to BChecks, with potential regex replace rules being used to work around it (as seen in the server side pollution check Ollie shared). If you would like this feature we could also note it?

JaveleyQAQ commented 1 year ago

@A-J-C @olliewuk @genuinemoses Thank you very much for your collaboration! https://github.com/smxiazi/xia_sql/blob/main/BurpExtender.java I want to implement a plugin with a bc passive script, but I'm having trouble with JSON matching . I think I need to spend some time understanding examples of server side pollution.

abdilahrf commented 11 months ago

I think now its not possible to replace JSON Payload automatically.

Michelle-PortSwigger commented 11 months ago

That's not currently possible. We'll add your vote for this feature.

JaveleyQAQ commented 11 months ago

That's not currently possible. We'll add your vote for this feature. Where will the vote be held?

Michelle-PortSwigger commented 11 months ago

Hi

You don't need to go anywhere to vote. When someone requests a new feature, we raise it here, and when additional people also express interest in it, we make a note of that, too, so we can see how many people are interested in the feature to help us prioritize ideas. Your votes are already logged against the feature request. We've done that for you. Sorry for any confusion!

JaveleyQAQ commented 11 months ago

Hi 

You don't need to go anywhere to vote. When someone requests a new feature, we raise it here, and when additional people also express interest in it, we make a note of that, too, so we can see how many people are interested in the feature to help us prioritize ideas. Your votes are already logged against the feature request. We've done that for you. Sorry for any confusion!

Thanks, very much looking forward to this feature!