Multiple Critical Vulnerabilities in Strapi Versions <=4.7.1
Strapi's AWS Cognito login provider decoded the OAuth ID token without verifying its signature, so an attacker could forge a token and impersonate any user who logs in through Cognito. The text also describes an SSTI-to-RCE flaw in email templates and a private-field filtering leak that can be chained to hijack super admins.
Published on ghostccamm.com
Recently, I have decided to start finding vulnerabilities in open source web applications (thank you to the holiday period for giving me the time) and thought I should give Strapi a look. Strapi is the most popular NodeJS based Headless Content Management System (CMS), and playing around with it I definitely see why…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Cognito provider decoded the ID token with jwt.decode and trusted its claims without verifying the signature against the identity provider's public keys.
Impact
An attacker could impersonate any API user who authenticates through AWS Cognito, but the flaw only affects API user authentication and cannot be used to reach the admin panel.
What the attacker needed
Strapi using the AWS Cognito provider; Victim's email address known; No account needed
The fix
Strapi fixed it in version 4.6.0 by verifying the token signature against a JWKS URL configured in the admin panel.
How it was found
- Create a JWT with the victim's email in the email claim, using any secret or algorithm.
- Send the token to the Cognito callback endpoint as the id_token parameter.
- Observe that Strapi accepts the forged token and logs the attacker in as the victim.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you log in with a third-party service, the site receives a signed token proving who you are. Strapi only read the token's contents and never checked the signature, so anyone could write their own token claiming to be another user. The other two bugs let a logged-in admin run code on the server and let users peek at hidden profile fields.
What is OAuth / SSO?
Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.