Executive brief
Strapi is a popular open-source headless CMS used to manage and deliver content to applications. Versions up to 4.5.6 fail to properly verify authentication tokens from AWS Cognito, allowing an attacker to forge tokens and impersonate any user. An attacker can bypass login entirely and gain unauthorized access to any user account, exposing sensitive application data and functionality without requiring valid credentials.
Technical details
The vulnerability is a JWT token validation bypass in the AWS Cognito OAuth provider for Strapi's users-permissions plugin. When processing the OAuth callback at /api/auth/cognito/callback, Strapi does not verify ID and access tokens, allowing an attacker to forge tokens signed with the 'None' algorithm to bypass authentication. The attack requires network access to the callback endpoint and no user interaction or authentication, but is restricted to users already configured with AWS Cognito as their login provider. An attacker can craft a valid JWT with claims for any existing user (identified by email and cognito:username) and gain full access to that account. The fix, included in Strapi 4.6.0 and later, adds proper token verification using JWKS public key validation.
Affected products
- Strapi @strapi/plugin-users-permissions >=3.2.1, <4.6.0
Timeline
- 2023-04-18: disclosed
- 2023-04-18: patched: Fixed in Strapi v4.6.0