directus
Affected
- introduced
0, fixed10.13.3(semver)
Fixed versions
10.13.3
Fix
- Fixed version
10.13.3npm install [email protected]
Advisory
Also known as: CVE-2024-45596
Session is cached for OpenID and OAuth2 if redirect is not used
Summary
Unauthenticated user can access credentials of last authenticated user via OpenID or OAuth2 where the authentication URL did not include redirect query string.
For example:
redirect query stringThe SSO link is something like https://directus.example.com/auth/login/openid/callback, where openid is the name of the OpenID provider configured in Directus
Details
This happens because on that endpoint for both OpenId and Oauth2 Directus is using the respond middleware, which by default will try to cache GET requests that met some conditions. Although, those conditions do not include this scenario, when an unauthenticated request returns user credentials.
For OpenID, this can be seen here:
https://github.com/directus/directus/blob/main/api/src/auth/drivers/openid.ts#L453-L459
And for OAuth2 can be seen here
https://github.com/directus/directus/blob/main/api/src/auth/drivers/oauth2.ts#L422-L428
PoC
CACHE_ENABLED to trueCACHE_STORE to redis for reliable results (if using memory with multiple nodes, it may only happen sometimes, due to cache being different for different nodes)REDIS with redis string or redis host, port, user, etc.AUTH_PROVIDERS to openidPUBLIC_URL to the the main URL of your project . For example, PUBLIC_URL: http://localhost:8055AUTH_OPENID_CLIENT_ID, AUTH_OPENID_CLIENT_SECRET, AUTH_OPENID_ISSUER_URL with proper OpenID configurationshttp://localhost:8055/auth/login/openid/callbackhttp://localhost:8055/auth/login/openid/callbackaccess_token propertyhttp://localhost:8055/auth/login/openid/callback and see you have the same credentials, even though you don't have any session because you are in anonymous modeImpact
All projects using OpenID or OAuth 2, that does not include redirect query string on loggin in users.
High Basis: The source's own band: HIGH
0, fixed 10.13.3 (semver)10.13.3
10.13.3npm install [email protected]11.0.0-rc.1, fixed 11.1.0 (semver)11.1.0
11.1.0npm install [email protected]0, fixed 21.0.1 (semver)21.0.1
21.0.1npm install @directus/[email protected]22.0.0, fixed 22.2.0 (semver)22.2.0
22.2.0npm install @directus/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0