-
-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
borg mount default permissions #3628
Comments
As @anarcat just re-posted his very first email here, without considering any feedback from the private discussion we had, I'll also just add my reponse "as is" below. |
|
|
You obviously didn't reread the message I posted here. I have tried to edit the message to follow and summarize the conversation. Some of the quotes you reply to, in your comments, are from a private conversation I did not actually include here. But whatever, I wasted enough time on this, again. I did consider feedback you sent, otherwise this would have a CVE number. |
I did. It somehow read the same... (from memory, didn't actually compare it byte-by-byte to original, though). Also, I didn't feel like it considered my replies well enough, that's why I added them. |
Thank you @anarcat for pointing this situation out. So there must be three things coming together for this to be a security issue: 1. mounting on a public accessible location (nobody mounts to /mnt directly!), 2. mounting on a different system with mismatching UIDs and 3. using "-o allow_other" accidentially. I came to this the other way round. I was looking for a solution to give a specific user access to his backups. In borg mount, there is the path specification and there is --strip-components but I forgot about allow_others so the user could not access the backups. So perhaps both issues could be addressed by extending the documentation for the possible mount options for borg mount and making a statement about -o allow_other. Currently, there is only a reference to "man fuse". |
@bwurst the docs are in this very repo here, see https://github.com/borgbackup/borg/tree/master/docs |
All files I could find haver a mark that they are autocreated from another source. :) @ThomasWaldmann do you think mentioning allow_other would be a good thing? Is the file I fould the right place to edit? |
"For mount options, see the fuse(8) manual page." We already have that. Could be extended to "... and configuration, see ...". I don't want to duplicate fuse documentation, but we could maybe mention the names of some interesting configuration items. |
I'll fix this with a docs update in #3903. |
When mounting a repository (and probably an archive) with borg mount, careless sysadmins (like me, I guess) are likely to run the following command:
... which will expose backup archives on /mnt. The problem is the /mnt permissions are pretty wide open:
This means other users on the system can immediately start looking in the archive, bypassing possible permission protections originally installed on the original archive (e.g. in my case /media/disk/borg, which is accessible only by the root user). It is impossible to correct that situation after the filesystem is mounted:
Obviously, the filesystem mount permissions forbid such changes. Now it could be argued that the permissions inside the archive should be sufficient to protect its content. I would counter that this is highly environment-specific: UID 1000 on one system may be a very different person from UID 1000 on another, yet with the above approach, they might be able to read each other's contents, which is the core of the issue I see here.
Another argument is that backups shouldn't be stored on a shared system. I would counter that this could easily be overlooked by administrators. On smaller systems, it is common to share multiple
resources like this, or at least it is something I do here. On larger systems, designs may involve multiple machines checking into a central backup server which would isolate those machines based on unix user IDs. A recovery process from a careless admin might lead backups from
machine A to be exposed through such a mountpoint, which could, eventually, allow machine B to inspect the content of machine A through this vulnerability. While SSH authorized_keys restrictions should protect against such an attack, there could be vulnerabilities at that layer (or in borg itself) that could allow the user to bypass that security restriction.
It would seem better to assume defense in depth here and ensure better default permissions for the mountpoint, as we currently do for backups themselves.
A workaround for this issue is to mount the archive in a subdirectory that is protected. For example, on my system here, /root is only accessible by the root user, and mounting the repository on /root/mnt defeats the attack.
This problem is mitigated by the fact that, without
allow_root
orallow_other
, FUSE mountpoints are unreadable to other users. But users may inadvertently set that as a default for other (valid) reasons and not expect borg to follow the same path. Furthermore,borg mount
currently has the following option as well:..which may confuse the user in believing this will apply to the contents of the mountpoint (it doesn't). So maybe this should affect the mountpoint's permissions, or there should be a way to do so.
This is reported publicly after going through a private disclosure process with the author, who does not consider this to be a security issue within borg.
The text was updated successfully, but these errors were encountered: