Skip to content
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

tmpfile symlink vulnerability #18

Open
RolandRosenfeld opened this issue Oct 11, 2020 · 0 comments
Open

tmpfile symlink vulnerability #18

RolandRosenfeld opened this issue Oct 11, 2020 · 0 comments

Comments

@RolandRosenfeld
Copy link
Contributor

RolandRosenfeld commented Oct 11, 2020

As mentioned in https://lwn.net/Articles/250468/ and https://bugs.debian.org/496426 there may be a vulnerability when using tempfiles in /tmp.
In the rancid context the vulnerability isn't that grave, since rancid usually doesn't run as user root but as user rancid, but since rancid is some kind of backup, this may allow to attack your backup.

In the Debian package I fixed this vulnerability with the following patch: https://salsa.debian.org/debian/rancid/-/blob/master/debian/patches/06_tmp_security.patch
This uses mktemp(1) from the coreutils package to create a safe temp directory. In some situations it simply uses /var/lib/rancid (which is not permission 1777 but only accessible by user rancid) as an alternative implementation (not sure, whether I not always used mktemp, but this was 12 years ago...).

I'm not fully sure, what the best solution for upstream rancid package is, since I don't know whether mktemp can be considered to be available on every system (or how to integrate this into autoconf).

Since Debian requests maintainers to forward all Debian optimizations upstream, I'll open this issue here...

Greetings
Roland

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant