Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to replace json values ? #13

Open
JaveleyQAQ opened this issue Jun 16, 2023 · 13 comments
Open

how to replace json values ? #13

JaveleyQAQ opened this issue Jun 16, 2023 · 13 comments
Labels
enhancement New feature or request

Comments

@JaveleyQAQ
Copy link
Contributor

I want to loop payload into all the JSON values

@genuinemoses
Copy link
Contributor

genuinemoses commented Jun 16, 2023

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
Copy link
Contributor Author

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
Copy link
Contributor

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

@JaveleyQAQ
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor

genuinemoses commented Jun 16, 2023

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
Copy link
Collaborator

A-J-C commented Jun 16, 2023

@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
Copy link
Contributor Author

@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.

@A-J-C A-J-C added the enhancement New feature or request label Jun 16, 2023
@abdilahrf
Copy link

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

@Michelle-PortSwigger
Copy link
Contributor

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

@JaveleyQAQ
Copy link
Contributor Author

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

@Michelle-PortSwigger
Copy link
Contributor

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
Copy link
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

6 participants