title: OAuth and API Token Interception
id: ATR-2026-00114
rule_version: 1
status: experimental
description: |
  Detects patterns indicating OAuth token interception, API key forwarding, or
  authorization header theft. Attackers may instruct agents to capture bearer tokens,
  refresh tokens, or client secrets and redirect them to attacker-controlled endpoints.
  This includes suspicious redirect_uri manipulation in OAuth flows and bulk token
  extraction from agent context.
author: ATR Community
date: 2026/03/26
schema_version: '0.1'
detection_tier: pattern
maturity: test
severity: high
references:
  owasp_agentic:
    - ASI03:2026
  mitre_attack:
    - T1528 - Steal Application Access Token
  owasp_llm:
    - LLM02:2025
  mitre_atlas:
    - AML.T0057 - LLM Data Leakage
compliance:
  eu_ai_act:
    - article: '15'
      context: OAuth token interception and redirect_uri manipulation enable agent-assisted account takeover across all services using the stolen token; Article 15 cybersecurity requirements mandate that high-risk AI systems detect and block token theft patterns in agent-handled authentication flows.
      strength: primary
    - article: '12'
      context: Stolen OAuth tokens allow attackers to impersonate legitimate users in audit logs, corrupting the record integrity that Article 12 requires; token interception detection is a prerequisite for maintaining trustworthy audit trails.
      strength: secondary
    - article: '10'
      context: Article 10 (data and data governance) requires control over the data an AI system processes; this rule provides detection evidence for the context-exfiltration attempt (OAuth and API Token Interception) affecting that data.
      strength: secondary
  nist_ai_rmf:
    - subcategory: MP.5.1
      context: OAuth token interception and malicious redirect_uri manipulation are adversarial input risks that exploit the agent's participation in authentication flows to capture credentials intended for legitimate services.
      strength: primary
    - subcategory: GV.6.1
      context: Data governance policies must restrict agent handling of bearer tokens, refresh tokens, and client secrets to prevent AI-assisted exfiltration of authorization credentials via forwarding or redirect manipulation.
      strength: secondary
    - subcategory: MS.2.7
      context: NIST AI RMF MEASURE 2.7 (security and resilience evaluated and documented) is supported by this rule's runtime detection of the context-exfiltration attempt (OAuth and API Token Interception).
      strength: primary
    - subcategory: MS.2.10
      context: NIST AI RMF MEASURE 2.10 (privacy risk examined and documented) is supported by this rule's detection of the context-exfiltration attempt (OAuth and API Token Interception).
      strength: secondary
  iso_42001:
    - clause: '6.2'
      context: Risk treatment plans must address OAuth token interception scenarios by requiring agents to validate redirect URIs and prohibiting forwarding of authorization tokens to non-allowlisted destinations.
      strength: primary
    - clause: '8.4'
      context: Impact assessments must document the account-takeover blast radius of OAuth token theft through agent-mediated flows, covering all services that accept the stolen bearer token.
      strength: secondary
    - clause: '8.1'
      context: ISO/IEC 42001 Clause 8.1 (operational planning and control, including control of externally provided processes) is operationalised by this rule's detection of the context-exfiltration attempt (OAuth and API Token Interception).
      strength: primary
tags:
  category: context-exfiltration
  subcategory: oauth-token-abuse
  scan_target: mcp
  confidence: medium
agent_source:
  type: tool_call
  framework:
    - mcp
    - langchain
    - llamaindex
  provider:
    - any
detection:
  conditions:
    - field: content
      operator: regex
      value: (?i)(?:send|forward|post|transmit|exfil)\s+.*(?:access_token|refresh_token|bearer|api[_\s]?key|auth[_\s]?token)
      description: Forwarding or transmitting tokens to an external destination
    - field: content
      operator: regex
      value: (?i)redirect_uri\s*=\s*https?://(?!localhost|127\.0\.0\.1)[^\s]*
      description: OAuth redirect_uri pointing to a non-local external domain
    - field: content
      operator: regex
      value: (?i)(?:extract|capture|intercept|log|dump)\s+.*(?:Authorization|Bearer)\s+(?:header|token)
      description: Intercepting or extracting Authorization headers
    - field: content
      operator: regex
      value: (?i)client_secret\s*[=:]\s*['"]?[a-zA-Z0-9_-]{10,}
      description: OAuth client_secret exposed in plain text
    - field: content
      operator: regex
      value: (?i)grant_type\s*=\s*authorization_code.*redirect_uri\s*=|redirect_uri\s*=.*grant_type\s*=\s*authorization_code
      description: OAuth authorization code flow with explicit redirect, potential token theft
  condition: any
  false_positives:
    - OAuth client libraries performing legitimate token refresh
    - API documentation showing token usage examples
    - CI/CD pipeline configuration files that contain redirect_uri settings pointing to staging or QA environments
    - Developer documentation or README files showing example client_secret placeholders for onboarding tutorials
response:
  actions:
    - alert
    - snapshot
confidence: 65
wild_validated: 2026/04/08
wild_samples: 53577
