Skip to content

Encryption key names conflicts in very specific cases with user name inside file name #11297

Closed

Description

@PVince81

Steps to reproduce

  1. Enable encryption
  2. Create three users: "user1" and "test.user1" and "user2"
  3. As "user2" create or upload a non-empty file called "file.test" (without extension)
  4. As "user2" create or upload a non-empty file called "file" (without extension)
  5. Share "file.test" with "user1"
  6. Share "file" with "test.user1".
  7. Login as "user1" and try to download the file
  8. Login as "test.user1" and try to download the file

Expected result

Both users can read the file

Actual result

One of the user has broken files

Versions

ownCloud 7 git master f46e495
Likely to happen on OC 6.0.5 and OC 7.0.2 as well due to similar logic.

More information

This is due to the fact that the encryption key is called file.test.user1.shareKey for both files.
One is concatening "file.test" with "user1" and the other one is concatening "file" with "test.user1" resulting in the same key file name.

Note: even though this can lead to data loss it is very unlikely to happen in a production environment, especially noting that the file have no extensions. Setting severity to medium.

@schiesbn and I did not find any short term solution for this as all solution involve changing the format of the key name. Any format change will require migration steps.

One idea would be to store the share keys in a folder that has the name of the file in question.
In this example above there would be two folders:

share-keys/file/
share-keys/file/test.user1.shareKey
share-keys/file/user2.shareKey (the owner)
share-keys/file.test/
share-keys/file.test/user1.shareKey
share-keys/file.test/user2.shareKey (the owner)

Also please note that this case was inferred by reading the code and trying to find ways to break it.

@karlitschek @MTRichards @craigpg

Activity

  1. self-assigned this
    on Nov 10, 2014
  2. added this to the milestone on Nov 21, 2014
  3. locked as resolved and limited conversation to collaborators on Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions