5.4medium
Password auth and OAuth2 unverified email linking
- Severity
- 5.4medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.32% (higher than 26% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-m93w-4fxv-r35vGO-2024-2936
Description
Pocketbase is an open source web backend written in go. In affected versions a malicious user may be able to compromise other user accounts. In order to be exploited users must have both OAuth2 and Password auth methods enabled. A possible attack scenario could be: 1. a malicious actor register with the targeted user's email (it is unverified), 2. at some later point in time the targeted user stumble on your app and decides to sign-up with OAuth2 (_this step could be also initiated by the attacker by sending an invite email to the targeted user_), 3. on successful OAuth2 auth we search for an existing PocketBase user matching with the OAuth2 user's email and associate them, 4. because we haven't changed the password of the existing PocketBase user during the linking, the malicious actor has access to the targeted user account and will be able to login with the initially created email/password. To prevent this for happening we now reset the password for this specific case if the previously created user wasn't verified (an exception to this is if the linking is explicit/manual, aka. when you send `Authorization:TOKEN` with the OAuth2 auth call). Additionally to warn existing users we now send an email alert in case the user has logged in with password but has at least one OAuth2 account linked. The flow will be further improved with ongoing refactoring and we will start sending emails for "unrecognized device" logins (OTP and MFA is already implemented and will be available with the next v0.23.0 release in the near future). For the time being users are advised to update to version 0.22.14. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| pocketbase pocketbase | < 0.22.14 | CVE List |
| github.com/pocketbase/pocketbase (Go) | before 0.22.14 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N |
| GitHub | 5.4medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Pocketbase is an open source web backend written in go. In affected versions a malicious user may be able to compromise other user accounts. In order to be exploited users must have both OAuth2 and Password auth methods enabled. A possible attack scenario could be: 1. a malicious actor register with the targeted user's email (it is unverified), 2. at some later point in time the targeted user stumble on your app and decides to sign-up with OAuth2 (_this step could be also initiated by the attacker by sending an invite email to the targeted user_), 3. on successful OAuth2 auth we search for an existing PocketBase user matching with the OAuth2 user's email and associate them, 4. because we haven't changed the password of the existing PocketBase user during the linking, the malicious actor has access to the targeted user account and will be able to login with the initially created email/password. To prevent this for happening we now reset the password for this specific case if the previously created user wasn't verified (an exception to this is if the linking is explicit/manual, aka. when you send `Authorization:TOKEN` with the OAuth2 auth call). Additionally to warn existing users we now send an email alert in case the user has logged in with password but has at least one OAuth2 account linked. The flow will be further improved with ongoing refactoring and we will start sending emails for "unrecognized device" logins (OTP and MFA is already implemented and will be available with the next v0.23.0 release in the near future). For the time being users are advised to update to version 0.22.14. There are no known workarounds for this vulnerability.
GitHub Advisory Database
In order to be exploited you must have both OAuth2 and Password auth methods enabled.
A possible attack scenario could be:
- a malicious actor register with the targeted user's email (it is unverified)
- at some later point in time the targeted user stumble on your app and decides to sign-up with OAuth2 (this step could be also initiated by the attacker by sending an invite email to the targeted user)
- on successful OAuth2 auth we search for an existing PocketBase user matching with the OAuth2 user's email and associate them
- because we haven't changed the password of the existing PocketBase user during the linking, the malicious actor has access to the targeted user account and will be able to login with the initially created email/password
To prevent this for happening we now reset the password for this specific case if the previously created user wasn't verified (an exception to this is if the linking is explicit/manual, aka. when you send Authorization:TOKEN with the OAuth2 auth call).
Additionally to warn existing users we now send an email alert in case the user has logged in with password but has at least one OAuth2 account linked. It looks something like:
Hello, Just to let you know that someone has logged in to your Acme account using a password while you already have OAuth2 GitLab auth linked. If you have recently signed in with a password, you may disregard this email. If you don't recognize the above action, you should immediately change your Acme account password. Thanks, Acme team
The flow will be further improved with the ongoing refactoring and we will start sending emails for "unrecognized device" logins (OTP and MFA is already implemented and will be available with the next v0.23.0 release in the near future).
Go Vulnerability Database
PocketBase performs password auth and OAuth2 unverified email linking in github.com/pocketbase/pocketbase
NVD (es)
Pocketbase es un backend web de código abierto escrito en go. En las versiones afectadas, un usuario malintencionado puede comprometer las cuentas de otros usuarios. Para ser explotados, los usuarios deben tener habilitados los métodos de autenticación OAuth2 y Contraseña. Un posible escenario de ataque podría ser: 1. un actor malintencionado se registra con el correo electrónico del usuario objetivo (no está verificado), 2. en algún momento posterior, el usuario objetivo tropieza con su aplicación y decide registrarse con OAuth2 (_este paso El atacante también podría iniciarlo enviando un correo electrónico de invitación al usuario objetivo_), 3. en una autenticación OAuth2 exitosa, buscamos un usuario de PocketBase existente que coincida con el correo electrónico del usuario OAuth2 y lo asociamos, 4. porque no hemos cambiado el contraseña del usuario de PocketBase existente durante la vinculación, el actor malicioso tiene acceso a la cuenta de usuario objetivo y podrá iniciar sesión con el correo electrónico/contraseña creado inicialmente. Para evitar que esto suceda, ahora restablecemos la contraseña para este caso específico si el usuario creado anteriormente no fue verificado (una excepción a esto es si el enlace es explícito/manual, también conocido como cuando envía `Autorización:TOKEN` con OAuth2 llamada de autenticación). Además, para advertir a los usuarios existentes, ahora enviamos una alerta por correo electrónico en caso de que el usuario haya iniciado sesión con contraseña pero tenga al menos una cuenta OAuth2 vinculada. El flujo se mejorará aún más con la refactorización continua y comenzaremos a enviar correos electrónicos para inicios de sesión de "dispositivos no reconocidos" (OTP y MFA ya están implementados y estarán disponibles con la próxima versión v0.23.0 en un futuro próximo). Por el momento, se recomienda a los usuarios que actualicen a la versión 0.22.14. No se conocen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-38351 changed 2024-08-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-m93w-4fxv-r35v changed 2024-07-05 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2024-2936 changed 2024-07-01 | CC-BY-4.0 |
| NVD | CVE-2024-38351 changed 2026-06-17 | Public domain |