The password of a mail share is not hashed if the password is given when the share is created
When a mail share is created with a password supplied by the caller, the password is stored in the database in plain text rather than being hashed. An attacker who can read the database could therefore obtain the plain-text password of such shares.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 11 days
- Disclosed after 5 months
- Create a new mail share with a password by using the OCS endpoint with something like:
curl -u admin:admin -X POST -H "OCS-APIRequest: true" "http://localhost/ocs/v1.php/apps/files_sharing/api/v1/shares?path=welcome.txt&shareType=4&[email protected]&password=plainTextPassword"
- Check the last item in the "oc_share" table in the database; the stored password is "plainTextPassword" instead of a hashed version.
Note that the password is properly hashed if the password is autogenerated (https://github.com/nextcloud/server/blob/caff1023ea72bb2ea94130e18a2a6e2ccf819e5f/apps/sharebymail/lib/ShareByMailProvider.php#L236) or if the share is later updated with another password (https://github.com/nextcloud/server/blob/16da29caba1cefa4c0762fae6014d6d2c737ee94/lib/private/Share20/Manager.php#L1085).
Impact
An attacker would be able to get the plain text password of a mail share.
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
An attacker with access to the database could read the plain-text password of a mail share.
What the attacker needed
Access to the database; ability to create a mail share with a password
How it was found
- Create a new mail share with a password through the OCS sharing endpoint.
- Inspect the last row of the share table in the database.
- Observe that the stored password is the plain-text value rather than a hash.
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.
A mail share is a way to share a file with someone by sending them a link and a password. Normally the server should scramble (hash) that password before saving it, so nobody can read it back. Here the server saved it as-is, so anyone who can look inside the database can read the password directly.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.