← All field notes
azureapi managementfor responders

APIM policy tamper: stripped JWT validation and a hidden response tap

An attacker with a subscription key rewrites the APIM gateway policy to drop authentication and mirror every response. One restore fixes both. Here is how.

API Management enforces caller authentication in policy, and that policy is just editable XML. When an attacker can rewrite it, they can disable authentication and stand up exfiltration in the same change.

How the attack works

Using a valid subscription key, the attacker makes an out-of-band policy write on a production API. They delete the inbound validate-jwt element that required a signed caller token, so unauthenticated requests now reach the backend. In the same edit they insert a log-to-eventhub policy that quietly copies request and response bodies to an attacker-controlled sink. A burst of GET calls with the subscription key then reads customer records through the now-unauthenticated path while the side-channel mirrors every response. In ATT&CK terms this combines T1556, Modify Authentication Process, with T1552, Unsecured Credentials, and T1190, Exploit Public-Facing Application.

Why it works

Anyone with the APIM contributor role could edit policy directly in the portal, outside the reviewed pipeline, and subscription keys were long-lived. Policy is the control plane, so tampering with it bypasses authentication everywhere it applies.

How to fix it

An IP block is trivially rotated around and leaves the bypass live. Rotate the subscription key to kill the credential in use, then restore the policy from source control. That single restore re-enables validate-jwt and deletes the logging side-channel atomically. Going forward, lock policy changes to the reviewed pipeline, deny direct portal edits, and alert on every policy createOrUpdate. Scope what went out from the APIM diagnostic request logs filtered to the key and window, cross-checked against the side-channel destination, since the policy XML shows what the tap could copy, not what was served.

Practice it

We built this as a GraphLattice Range scenario so responders can rehearse the tamper, the rotate-and-restore containment, and the change-governance fix that holds.