Looking for vulnerabilities in Strapi (CVE-2024-34065)
Strapi's OAuth connect endpoint allowed an attacker to set a dynamic callback URL, and after authentication the access token was appended to that URL, leaking it to the attacker. The attacker could then use the token to regenerate JWTs and bypass authentication.
Published on blog.quarkslab.com
Posted Tue 25 June 2024 Author Mathieu Farrell Category Pentest Tags pentest, framework, Strapi, Node.js, vulnerability, 2024
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
The application accepted a user-supplied callback URL and later appended the access token to it, instead of using a fixed, validated redirect URI.
Impact
An attacker could steal a user's access token and use it to regenerate JWTs, thereby bypassing authentication; the attack is transparent to the victim if they have an active session with the identity provider.
What the attacker needed
Victim clicks a link; Victim has an active session with the OAuth provider; OAuth provider is enabled in Strapi
The fix
The vulnerabilities were fixed by the Strapi team.
How it was found
- Attacker sends a link to the victim containing a callback parameter pointing to an attacker-controlled server.
- Victim clicks the link and is redirected to the legitimate OAuth provider to authenticate.
- After authentication, the provider redirects back to Strapi with a code.
- Strapi retrieves the callback value from the victim's cookie and redirects to the attacker's URL, appending the access token.
- The victim's browser sends the token to the attacker's server, which then redirects the victim to the original site.
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 like Microsoft, the website can be tricked into sending your login token to an attacker-controlled address. The attacker can then use that token to log in as you, without needing your password.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.