Interactively intercept, modify, and replay a live agent's HTTPS/API traffic with mitmproxy — hold a request, tamper auth/IDs/params/tool-calls, re-send, and replay saved flows — to actively test auth bypass, IDOR, and injection against a running system. The active counterpart to proxy-recon's passive record; plants canaries so a leak is proven, not asserted. Use when a security engineer needs hands-on request manipulation against a black-box agent or API, not just a traffic capture.
10 stars
0 votes
0 copies
0 views
Added December 1, 2026
ai-agentspythontestingapisecurity
Works with
api
mcp
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Api Proxy Intercept?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/asterguard-api-proxy-intercept)
---
name: api-proxy-intercept
description: Interactively intercept, modify, and replay a live agent's HTTPS/API traffic with mitmproxy — hold a request, tamper auth/IDs/params/tool-calls, re-send, and replay saved flows — to actively test auth bypass, IDOR, and injection against a running system. The active counterpart to proxy-recon's passive record; plants canaries so a leak is proven, not asserted. Use when a security engineer needs hands-on request manipulation against a black-box agent or API, not just a traffic capture.
---
# API Proxy Intercept
`proxy-recon` records; this skill **acts**. It sits in the same proxy position but switches from
observe-and-record passthrough to an interactive hold → mutate → re-send loop (and replay of saved
flows), so an engineer can actively probe a live agent's HTTP/API surface — exactly the manual API
pentest `proxy-recon` names as its "optional inline-guard mode," made first-class.
## When to Activate
- The target is a **live agent or API** and you need to *change* requests in flight — strip auth, swap an
object id (IDOR/BOLA), tamper a parameter, rewrite a tool-call argument — and observe the effect.
- You want to **replay** a captured flow with mutations to confirm a suspected weakness.
- You're executing `dast-generation` / `behavioral-redteam` probes that must be driven through a proxy.
## Core Concepts
- **Same position as `proxy-recon`.** Provider proxy (agent LLM base-URL) or ingress proxy (in front of
the agent's HTTP endpoint). Reuses the `./.asterguard/traffic.jsonl` corpus and the secret-redaction
rule, so a recorded baseline and an interactive session share one file. The LLM-shaped fields
(`messages`/`tools`/`tool_calls`/`tool_results`) are populated at the **provider** position; at the
**HTTP-ingress** position each record carries the request/response (`http:{method, path, status}`) plus
the applied `mutations` and the redacted headers.
- **Mutation points.** Request headers (drop `Authorization`), path/body params (IDOR id, injection
payload), and — at the provider layer — `messages` / `tool_calls`. Every mutation is explicit and logged
to the corpus (`mutation:{field, from, to}`) so the test is reproducible.
- **Proof, not assertion.** Pair with `canary-testing`: mint a canary, plant it in the mutated request,
and a hit on an egress channel (`canary.scan`) is hard evidence the tamper succeeded — not a judge's
opinion. Fail-open: a proxy error never drops a real response.
## Method
Engine = `mitmproxy` (`mitmdump` with a Python addon), sitting where `proxy-recon`'s gateway/shim sits.
Bootstrap if absent: `scripts/bootstrap.sh mitmproxy` (or `pip install mitmproxy`). See
[scripts/README.md](./scripts/README.md).
1. **Place the proxy** (provider or ingress) and **record a baseline** flow to `./.asterguard/traffic.jsonl`
(identical to `proxy-recon` — start passive).
2. **Interactive mutate.** Run the intercept addon: it matches target requests (by host/method/path),
applies the configured mutation (auth-strip, id-swap, param/payload inject, tool-call rewrite), and
re-sends. Capture request+response pairs (pre/post mutation) into the corpus.
3. **Replay.** Re-drive a saved flow (`mitmdump -nr baseline.flow -s mutate.py`) to reproduce a finding
deterministically.
4. **Prove with canaries.** `canary.mint(type)` → plant in the mutated request → exercise → `canary.scan`
over the egress corpus; a hit = `broke` with the exact channel. (Mint via the gateway so the value
never enters the agent's own logs.)
5. **Normalize** each mutation outcome to a finding (`{lane:"api-intercept", title, severity, weakness_id,
evidence}`) resolved via `registry.resolve`, and hand the pre/post pairs to `security-judge`. Connected,
each call returns an `audit_id`.
## Practical Guidance
- **Authorized engagements only.** Intercepting and modifying another party's traffic requires explicit
authorization — this is active testing, not recon. Record the scope with the engagement.
- **Redact secrets** (Authorization / API-key headers) in the persisted corpus; never persist upstream keys.
- **One mutation per hypothesis.** Change one thing (the auth header, one id) so a resulting break maps to a
single cause — the same discipline `canary-testing` uses for fresh-per-episode tokens.
## Integration
- proxy-recon — the passive sibling (record first, then intercept); shares `traffic.jsonl`
- dast-generation, behavioral-redteam — drive their generated probes through this proxy
- canary-testing — the proof layer (plant on mutate, detect on egress)
- security-judge — scores the pre/post pairs to broke/held
## References
- [Proxy setup (mitmproxy; shares the gateway position)](./scripts/README.md)
- [AsterVault MCP tools](../weakness-graph/references/astervault-tools.md)
- [Graph schema (SSOT)](../../docs/graph-schema.md)