Skip to content

AAK-OAUTH-002: PKCE using the plain challenge method

Severity
HIGH
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/oauth_misconfig.py
Auto-fixable
No.
SARIF name
OAuthPkcePlain

What it detects

An OAuth client sets code_challenge_method=plain. S256 is mandatory; 'plain' leaks the verifier to anyone with access to the authorization request.

How to fix

Set code_challenge_method=S256 and derive code_challenge as BASE64URL(SHA256(code_verifier)).

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-OAUTH-002

Limitations

Examines only files that contain a word starting with oauth, authorization_endpoint, token_endpoint or client_id (in any case; GOOGLE_CLIENT_ID does not count) or the call authorize(. In them it fires only when code_challenge_method is assigned the literal plain (code_challenge_method=plain, "code_challenge_method": "plain"). An authorization request that sends code_challenge with no code_challenge_method defaults to plain (RFC 7636 ยง4.3) and is not reported. Neither is a method taken from a constant (METHOD = "plain"), or the same literal in a file with none of those words.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-OAUTH-002.md: the page then shows that text, with the registry reference appended under it.