Access to all files of remote user through shared file
A user who received a shared file could copy it over WebDAV and end up with a folder containing the sharer's entire file tree, including trash and cache. This exposed all of the remote user's files to the recipient.
- Triaged in 12 hours
- Fixed in 7 days
- Paid in 9 days
- Disclosed after 2.6 years
Steps to reproduce
- User A shares a file "movie.mp4" with user B.
- User B uses webdav to access files (e.g. foldersync or nautilus)
- share is shown as regular file (using webdav).
- Copy the file and paste it to the same folder (still using webdav).
- A new folder will appear with the name "(1)movie.mp4". This folder contains all data of user A (which is quite scary). Folder structure looks like: files, files_trashbin, cache, etc. (all user related files).
- I was able to reproduce this with different combination of users and shared files.
Expected behaviour
Only the shared file should be copied.
Actual behaviour
All files of remote user are copied.
Server configuration
Operating system: Ubuntu 16.04.3 LTS
Web server: apache2 (2.4.18-2ubuntu3)
Database: mariadb (10.0.24-7)
PHP version: php7 (7.0+35ubuntu6)
Nextcloud version: 12.0.1
Updated from an older Nextcloud/ownCloud or fresh install: originally owncloud, upgradepath according to the official documentation to nextcloud (owncloud 9 to nextcloud 9 or 10, can't remember).
Where did you install Nextcloud from: Nextcloud package was downloaded from official webpage (nextcloud.com)
Signing status:
<details> <summary>Signing status</summary>No errors have been found.
List of activated apps:
<details> <summary>App list</summary>Enabled:
- activity: 2.5.2
- admin_audit: 1.2.0
- bookmarks: 0.10.1
- bruteforcesettings: 1.0.2
- calendar: 1.5.3
- comments: 1.2.0
- contacts: 1.5.3
- dav: 1.3.0
- federatedfilesharing: 1.2.0
- federation: 1.2.0
- files: 1.7.2
- files_accesscontrol: 1.2.4
- files_automatedtagging: 1.2.2
- files_external: 1.3.0
- files_pdfviewer: 1.1.1
- files_retention: 1.1.2
- files_sharing: 1.4.0
- files_texteditor: 2.4.1
- files_trashbin: 1.2.0
- files_versions: 1.5.0
- files_videoplayer: 1.1.0
- firstrunwizard: 2.1
- gallery: 17.0.0
- logreader: 2.0.0
- lookup_server_connector: 1.0.0
- mail: 0.6.4
- nextcloud_announcements: 1.1
- notifications: 2.0.0
- oauth2: 1.0.5
- password_policy: 1.2.2
- previewgenerator: 1.0.6
- provisioning_api: 1.2.0
- serverinfo: 1.2.0
- sharebymail: 1.2.0
- spreed: 2.0.1
- survey_client: 1.0.0
- systemtags: 1.2.0
- theming: 1.3.0
- twofactor_backupcodes: 1.1.1
- updatenotification: 1.2.0
- workflowengine: 1.2.0
Disabled:
- encryption
- user_external
- user_ldap
Nextcloud configuration:
<details> <summary>Config report</summary>{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***",
"***REMOVED SENSITIVE VALUE***",
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "12.0.1.5",
"dbname": "owncloud",
"dbhost": "localhost",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"forcessl": true,
"mail_smtpmode": "smtp",
"mail_smtpsecure": "ssl",
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtpauthtype": "LOGIN",
"mail_smtpauth": true,
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"theme": "",
"maintenance": false,
"logtimezone": "Europe\/Berlin",
"loglevel": 0,
"log_authfailip": true,
"overwrite.cli.url": "\/owncloud",
"secret": "***REMOVED SENSITIVE VALUE***",
"forceSSLforSubdomains": true,
"trashbin_retention_obligation": "30, 180",
"memcache.local": "\\OC\\Memcache\\APCu",
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "\/var\/run\/redis\/redis.sock",
"port": 0,
"dbindex": 0,
"password": "***REMOVED SENSITIVE VALUE***",
"timeout": 1.5
},
"htaccess.RewriteBase": "\/owncloud"
}
}
Are you using external storage, if yes which one: not applicable
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser: Firefox 54.0
Operating system: Ubuntu 16.04.3 LTS
Logs
Web server error log
<details> <summary>Web server error log</summary>No errors related to issue.
Nextcloud log (data/nextcloud.log)
<details> <summary>Nextcloud log</summary>No errors related to issue.
Browser log
<details> <summary>Browser log</summary>Not applicable.
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
Root cause
Likely the WebDAV copy operation on a shared file resolved the share to the owner's home directory instead of the shared file itself, so the copy pulled in the whole user tree.
Impact
A recipient of a shared file could obtain all files of the sharing user, including trash and cache directories.
What the attacker needed
A shared file from another user; WebDAV client access
How it was found
- User A shares a file with user B.
- User B connects to the share over WebDAV.
- User B copies the shared file and pastes it into the same folder.
- A new folder appears containing all of user A's data.
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 someone shares a single file with you, you should only get that file. Here, copying the shared file through a file-sync protocol called WebDAV made the server create a folder that held everything belonging to the person who shared it, so the recipient could see far more than intended.
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.