The password of a mail share is not set if the password is given when the share is created (Nextcloud < 18)
When a mail share was created with a password via the OCS API, the password was not set, so the share could be opened with the share token without entering the password.
Originally disclosed on HackerOne
- Triaged in 24 hours
- Fixed in 8 months
- Disclosed after 9 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"
- Open the share with something like:
http://localhost/index.php/s/shareToken (the "shareToken" value can be seen in the curl response)
- The shared file is shown; no password is requested to access it.
Note that a password (although an autogenerated one instead of the given one) is set if password protection is enforced (https://github.com/nextcloud/server/blob/b3f806a9497da0a7e5229e555a8f90d1c0b299de/apps/sharebymail/lib/ShareByMailProvider.php#L223) or if the share is later updated with another password (https://github.com/nextcloud/server/blob/f50bf10bec8fc1ccd834c16379ddb502972a2174/lib/private/Share20/Manager.php#L954).
This applies only to Nextcloud < 18 (the password is set for Nextcloud >= 18 with https://github.com/nextcloud/server/pull/16629, although it led to a different security issue: https://hackerone.com/reports/885041).
Impact
An attacker would be able to access a password protected mail share with just the share token, without having to enter the 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
An attacker could access a password-protected mail share using only the share token, without entering the password.
What the attacker needed
Nextcloud version < 18; Ability to create a mail share via OCS API; Knowledge of the share token
The fix
The issue was fixed in Nextcloud 18 and later, where the password is set when the share is created.
How it was found
- Create a mail share with a password using the OCS API endpoint.
- Open the share using the share token from the API response.
- Observe that the shared file is shown without prompting for a password.
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. The system was supposed to require a password to open that link, but due to a bug, the password was ignored when the share was created. This meant anyone who had the link could open the file without needing the password.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.