T09 · Insecure Skill Coding Practices
- Location
SKILL.md:195- Finding
OAuth Access Token Exposed in Redirect Query String
- Content
View full analysis
{ const tokens = generateTokens(req.user); res.redirect(`${FRONTEND_URL}/auth/callback?token=${tokens.accessToken}`); }); ``` `resources/implementation-playbook.md:321-330`: ```typescript app.get( '/api/auth/google/callback', passport.authenticate('google', { session: false }), (req, res) => { // Generate JWT const tokens = generateTokens(req.user.id, req.user.email, req.user.role); // Redirect to frontend with token res.redirect(`${process.env.FRONTEND_URL}/auth/callback?token=${tokens.accessToken}`); } ); ``` ### Technical Analysis Both OAuth callback examples place a JWT access token directly in a redirect URL's query string. An access token is a bearer credential: possession is sufficient to authenticate as the represented user. URLs are routinely retained or transmitted through browser history, reverse-proxy and web-server access logs, monitoring systems, analytics platforms, screenshots, support diagnostics, and potentially referrer headers. Consequently, systems or personnel that do not require authentication credentials may receive the token. Although the examples issue short-lived access tokens, the exposure remains exploitable until the token expires. The examples also do not demonstrate single-use semantics or immediate revocation after disclosure. ### Attack Path 1. A victim completes authentication through the Google OAuth flow. 2. The callback generates an access token for the victim. 3. The server redirects the browser to `/auth/callback?token=`. 4. The URL or query string is captured in bro ...[truncated 918 chars]- Remediation
View remediation
