Docs
HTTP Proxy
Intercepting proxy for request capture, querying and replay (mitmproxy by default)
Every HTTP(S) client in the sandbox (curl, Python, the browser, scanners) is routed through an intercepting proxy, giving the agent full visibility into requests and responses. The proxy sits behind a pluggable ProxyBackend interface:
| Backend | License | Selected with | Notes |
|---|---|---|---|
| mitmproxy (default) | MIT | nothing to set | mitmdump runs inside the sandbox with a Mikoshi recorder addon. |
| Caido (optional) | Proprietary, bring-your-own | MIKOSHI_PROXY_BACKEND=caido | Needs uv sync --extra caido, your own Caido entitlement, and a sandbox image built with --build-arg INSTALL_CAIDO=1. |
The backend can also be set as MIKOSHI_PROXY_BACKEND in the Mikoshi JSON config. Requesting caido without the extra installed, or on a sandbox image without caido-cli, fails at scan start with an explanation; an unknown name is rejected.
Capabilities
| Feature | Description |
|---|---|
| Request Capture | Log all HTTP/HTTPS traffic automatically |
| Request Replay | Repeat any request with modifications |
| HTTPQL | Query captured traffic with filters |
| Scope Management | Focus on specific hosts |
| Sitemap | Browse the discovered attack surface as a tree |
How the mitmproxy backend works
- The sandbox entrypoint starts
mitmdumpon127.0.0.1:48080with/opt/mikoshi-python/mitm_addon.py. The addon writes each finished flow (request and response, or the connection error) to a SQLite store in/tmp/mikoshi-proxy/. Intercepted TLS uses the image's own CA, which the system store and the browser already trust; upstream certificates are not verified (ssl_insecure), as pentest targets often use self-signed certificates. - The host never needs mitmproxy. Each proxy tool call runs
python3 /opt/mikoshi-python/proxy_api.py <op> <json>through the sandbox exec channel and reads one JSON reply. No proxy port is exposed to the host. repeat_requestsends the modified raw request from inside the sandbox, through the proxy, so the replay is recorded too (source:"replay") and its id is returned asrequest_idfor use as evidence.- If the proxy does not come up, a pass-through proxy takes over the port so the sandbox keeps its network; the proxy tools then report that the proxy is unavailable.
- With an upstream proxy configured for the scan (
host:port,[IPv6]:port, optionally withhttp://), mitmproxy runs inupstreammode and forwards everything to it, and the pass-through relays only to it. The upstream is checked before the sandbox starts: a malformed value, credentials in it, another scheme, the Caido backend or a disabled proxy stop the scan instead of letting traffic bypass the upstream. - Bodies over 2 MiB are stored cut short.
list_requestsandview_requestmark such a request or response withbody_truncated_at_capture, andrepeat_requestrefuses to replay a truncated request body unlessmodifications.bodysupplies the full one.
HTTPQL Filtering
list_requests takes an HTTPQL filter, with the same syntax on both backends: namespace.field.operator:value clauses joined with AND / OR and parentheses, for example req.method.eq:"POST" AND resp.code.gte:400. Fields are req.method|host|path|query|ext|raw|port|len|created_at|tls, resp.code|len|roundtrip|raw and row.id; source:"intercept"|"replay" and bare quoted strings (searching raw requests and responses) are supported. Caido presets (preset:"...") are Caido-only.
Request Replay
The agent can take any captured request and replay it with modifications:
- Change path parameters (test for IDOR)
- Modify request body (test for injection)
- Add/remove headers (test for auth bypass)
- Alter cookies (test for session issues)
Python Integration
Proxy helpers are available to sandbox Python scripts through the image-baked proxy_api module (standard library only, synchronous, plain dicts):
from proxy_api import list_requests, repeat_request, view_request
posts = list_requests(httpql_filter='req.method.eq:"POST"', first=20)
first_id = posts["entries"][0]["request"]["id"]
print(view_request(first_id, part="request")["content"])
result = repeat_request(first_id, modifications={"body": '{"user_id": "admin"}'})
print(result["status"], result["response"]["status_code"], result["request_id"])Available Functions
| Function | Description |
|---|---|
list_requests() | Query captured traffic with HTTPQL filters |
view_request() | Get the raw request or response |
repeat_request() | Replay a request with modifications |
list_sitemap() | Browse the request-tree view of discovered surface |
view_sitemap_entry() | Inspect one sitemap entry + its related requests |
scope_rules() | Manage proxy scope (allowlist/denylist) |
With the Caido backend the module is caido_api instead, with async helpers over the Caido SDK.
For one-off arbitrary requests, use shell tooling like curl — the sandbox's HTTP_PROXY env routes the traffic through the proxy automatically, so it lands in list_requests and can be replayed via repeat_request.
Example: Automated IDOR Testing
from proxy_api import list_requests, repeat_request
for entry in list_requests(httpql_filter='req.path.cont:"/users/"')["entries"]:
req = entry["request"]
scheme = "https" if req["is_tls"] else "http"
for test_id in ["1", "2", "admin"]:
url = f"{scheme}://{req['host']}:{req['port']}{req['path'].replace('/users/1', f'/users/{test_id}')}"
result = repeat_request(req["id"], modifications={"url": url})
print(req["id"], test_id, result["status"], (result["response"] or {}).get("status_code"))Human-in-the-Loop (Caido backend)
With the Caido backend, Caido's port is exposed to the host, so you can open the instance in Caido Desktop ("Continue as guest") to inspect and replay traffic alongside the scan. The default mitmproxy backend exposes no port; inspect its history through the proxy tools or proxy_api inside the sandbox.
Scope
Create scopes (glob patterns over the host) to filter traffic to relevant domains. An empty allowlist allows every host; the denylist always wins:
Allowlist: ["api.example.com", "*.example.com"]
Denylist: ["cdn.*", "*.googleapis.com"]