Explore common OAuth security threats including CSRF, token leakage, and replay attacks. This quiz helps deepen your understanding of vulnerabilities in the OAuth protocol and effective strategies for secure authorization flows.
Which scenario best illustrates a CSRF attack within an OAuth authorization process?
Explanation: CSRF, or Cross-Site Request Forgery, occurs when an attacker causes a user to perform actions they did not intend, such as by clicking a crafted link that starts an OAuth flow. The distractors misrepresent CSRF: sharing a token (option 2) is more about token leakage, secure server-side storage (option 3) is good practice, and denying permissions (option 4) does not relate to attacks. Only option 1 describes unauthorized actions initiated by an attacker.
In OAuth, which practice best helps prevent token leakage when transmitting tokens to a client application?
Explanation: Encrypting token exchanges with HTTPS ensures tokens are not visible to eavesdroppers during transmission. Storing tokens in local storage (option 2) can expose them to cross-site scripting, embedding tokens in URLs (option 3) risks exposure through browser history or logs, and allowing proxies to cache tokens (option 4) increases the leakage risk. Only option 1 specifically addresses secure transit.
What describes a replay attack in the context of OAuth, and how can it be mitigated?
Explanation: Replay attacks involve reusing intercepted data, such as authorization codes. Using nonce or one-time values helps prevent this. Invalid login attempts (option 2) are brute-force, not replay. Callback URL errors (option 3) are misconfiguration, and password phishing (option 4) is credential theft but not a replay attack. Only option 1 covers both the attack vector and prevention.
Why is including a unique state parameter in OAuth authorization requests important for security?
Explanation: The state parameter makes authorization responses verifiable, reducing CSRF risks by correlating responses to legitimate requests. Encrypting tokens (option 2) is unrelated to the state parameter, lengthening expiration time (option 3) is incorrect, and reducing personal data (option 4) is not a function of the state parameter. Only option 1 reflects the primary security purpose.
Which sign most indicates OAuth access token leakage in a web application?
Explanation: Tokens in URLs or logs are susceptible to unintended exposure, pointing to token leakage. Slow load times (option 2) and delays after token refresh (option 4) may indicate performance issues, not leakage. Styling issues (option 3) do not relate to security. Only option 1 aligns directly with a key security concern in OAuth implementations.