A proxy implementation for intercepting and proxying Burp AI requests to a custom OpenAI-compatible backend. Portswigger does not enable use of company- managed AI implementations, so this project attempts to resolve the issue by modifying and proxying the requests to a OpenAI-compatible API backend that can be managed by organizations themselves, and thus avoid sending sensitive data to Portswigger and the US.
The proxy denies all requests ai.portswigger.net if debug is not enabled
(the default). In debug mode the proxy forwards the requests to Portswigger,
and logs the requests and responses in the console.
Currently working features are
- Explain this
- API extensions use (Shadow Repeater has been tested)
See Contributing below for more information on how to contribute.
- Clone the repo
- Install
mitmproxy - Start
mitmproxywith for examplemitmdump --listen-port 9001to havemitmproxycreate TLS certificates. Certificates are placed in~/.mitmproxyon Unix-based systems. - Import the
mitmproxyCA certificate to the Burp Suite CA certificate container. This step varies by OS.- MacOS:
keytool -importcert -alias mitmproxy -keystore /Applications/Burp\ Suite\ Professional.app/Contents/Resources/jre.bundle/Contents/Home/lib/security/cacerts -file ~/.mitmproxy/mitmproxy-ca-cert.cer
- MacOS:
- Start the proxy:
mitmdump --listen-port 9001 --script proxy.py --set url=<open ai chat completions URL> --set api_key=<your API key> - Configure a HTTP Proxy in Burp and point it to the running
mitmproxy.
Configuration options are described below. They are set with
--set option=value command line parameters for mitmdump.
url: The URL for the AI backend. This expects to be the full URL to an OpenAI-compatible/v1/chat/completionsAPI.api_key: The Open AI compatible API keydebug: Whether to enable debug. In debug mode the proxy will output all original and modified requests and their responses. Additionally, the proxy will forward the requests that it is unable to handle to the Burp AI backend so the requests and responses can be monitored. This is mainly for development. Defaults tofalse.model: Defines the AI model to use. Defaults togpt-4o.request_headers_denylist: A comma-separated list of regex header names that are removed from the requests to the Open AI backend. Defaults toPortswigger-Burp-Ai-Token.response_headers_denylist: A comma-separated list of header regex names that are removed from the responses. Defaults to empty.
Currently only a subset of Burp's functionality has been implemented. I'm
hoping to receive PRs for additional request examples (see doc/requests.md) as
well as implementations for them.