Mail app stores cleartext password in database until OAUTH2 setup is done
During the setup of a Gmail XOAUTH2 account in the Nextcloud Mail app, the password entered by the user is stored in cleartext in the database until the OAuth2 setup completes. A database administrator could read this plaintext password.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 49 days
- Disclosed after 3 months
Summary by the program
Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-g86r-x755-93f4
The report
Summary:
The Mail app usually stores the user password encrypted. For XOAUTH2 the encrypted access token is stored in the same columns. However, during the time of the setup, XOAUTH2 accounts have the password in clear text in the database.
Steps To Reproduce:
[add details for how we can reproduce the issue]
- Configure Gmail Oauth client ID and secret as Nextcloud admin
- Open the Mail app
- Open the setup page
- Enter values for display name
- Enter a random value for the password
- Enter the gmail address
-> password field hides
- Continue the setup
Once the Gmail consent popup shows, look into oc_mail_accounts and the last entry.
inbound_password and outbound_password have the random value entered for the password.
Supporting Material/References:
- N/A
Impact
A DBA could read the plaintext password
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
A database administrator could read the plaintext password.
What the attacker needed
Admin configures Gmail OAuth client; attacker has database access
How it was found
- Configure Gmail OAuth client ID and secret as Nextcloud admin
- Open the Mail app and go to the setup page
- Enter a display name, a random password, and the Gmail address
- Continue the setup until the Gmail consent popup appears
- Inspect the oc_mail_accounts table; the inbound_password and outbound_password fields contain the random password in cleartext
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 report has not been written yet. The Original tab links to the source.
When you set up an email account, you type a password. Normally the app scrambles (encrypts) it before saving. Here, for a short time during setup, the password is saved as plain text, so anyone who can look at the database can read it.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.