Identity Security · 5 min read

Exposed OAuth App Secrets: An Incident-Response Playbook for Service Principals

Use identity, audit and credential-scope evidence to contain leaked application secrets without mistaking repository cleanup for incident recovery.

Publisher: NetSignalKit Editorial | Corrections and feedback

Independent technical information. Validate vendor claims and test changes in your own environment. Some outbound commercial links may earn a commission; see our disclosure.

What the November 2026 investigation actually established

Microsoft reported on November 5, 2026 that attackers used agentic tooling to locate exposed cloud and application credentials in public repositories and then abused some of those credentials for cloud access. The important failure was not the particular AI framework; it was a valid identity that could authenticate, enumerate resources and reach data after its secret escaped.

Microsoft described observed service-principal sign-ins and activity across Azure resource management, storage, Key Vault and connected services. It also described a case progressing rapidly from source-code secret discovery to secret exfiltration. Treat these as Microsoft-observed incidents, not as evidence that every repository leak leads to the same sequence or that every suspicious sign-in comes from AI.

First classify the exposed credential and its blast radius

Record the affected application registration, tenant, service-principal object, credential type, creation and expiration times, assigned permissions, accessible resource scopes, and downstream integrations. A client ID alone is generally not a reusable secret; a client secret, private key or usable token may be. Distinguish what was merely visible from what could actually authenticate.

Map both application permissions and effective resource authorization. An application with broad directory permissions can have a different impact from a workload identity scoped to one storage container. A vendor-owned multitenant app may have a cross-tenant exposure that a local application owner cannot remediate alone; involve the provider and affected tenants instead of assuming one local secret rotation closes every trust relationship.

Contain without destroying the investigation

Preserve the discovery alert, repository revision and relevant audit-log time window before editing the source. Remove the exposed material from active code and distribution channels, but do not assume deleting a commit or changing repository visibility invalidates copies already obtained. Revoke or rotate the exposed credential at its issuing system, not just in the application configuration.

If compromise is suspected, assess whether to disable the application identity or temporarily restrict its permissions while dependent services are placed into a controlled maintenance state. Inventory any tokens already issued, app-role assignments, federated credentials and later-added certificates or secrets. A rotated client secret does not necessarily invalidate existing access tokens, so containment needs token-lifetime and authorization checks as well.

Hunt for credential use and follow-on access

Correlate service-principal and non-interactive sign-in logs with Entra audit activity, Azure Activity logs, Key Vault access records, storage diagnostics and application-specific activity. Look for first-seen sign-in sources, unusual resource enumeration, failed requests followed by corrected retries, unexpected app-consent changes and secret reads. Investigation windows must respect actual log retention.

Indicators such as an IP address from a threat report are useful pivots, not complete detection logic. The source infrastructure can change, and shared addresses can create false positives. Prefer identity-to-resource sequences: one service principal successfully authenticates, lists sensitive stores and accesses data outside its expected business workflow. Preserve timestamps and correlation IDs, and separate observed access from inferred exfiltration.

Verify recovery with an evidence matrix

After rotation or identity replacement, prove the old credential fails authentication and the new, least-privileged identity completes only the intended application workflow. Confirm owners reviewed resource-level permissions and any compromised secret store was searched for secondary credentials needing rotation. If data was read, assess notification, forensic preservation and the scope of downstream exposure through the organization's incident-response process.

Suggested record: application and owner; exposed credential fingerprint, never the plaintext; exposure start and discovery time; revocation time; log coverage; observed successful access; downstream secrets inspected; new permissions; negative test for retired credentials; positive functional test for the replacement identity; outstanding unknowns. A completed replacement is an operational gate, not proof that no data was accessed.

Prevention: remove unnecessary long-lived secrets

Prefer managed identities or appropriately configured workload identity federation when the platform supports them. For remaining secrets, use an approved secret manager, narrow access scopes, rotation ownership, monitoring and defined expiry. Ensure deployment automation injects secrets without writing them into repositories, build logs, screenshots or support tickets. Do not centralize all credentials in a new service that becomes an unreviewed single point of failure.

GitHub documents secret scanning across repository history and other collaboration surfaces, plus alerts and push protection for supported secret types. Enable the features available to the actual repository and plan; their coverage is not universal. Test the response path with a synthetic credential and verify who receives alerts, who can revoke, and how service restoration is proven. Never publish live tokens as examples.

Related guides

Primary sources & further reading

Sources are credited for verification, not reproduced. Linked pages may change after publication.