Re: Hard link creation witout write access
Mouse <[email protected]> Thu, 7 Sep 2023 11:10:44 -0400 (EDT)
| Newsgroups | gmane.os.netbsd.devel.security |
|---|---|
| Message-ID | <[email protected]> |
> It seems to me the rule should be: > 1. If you own the file you can make hard links. > 2. If you are in the file's group and the file is group-writable you > can make hard links. > 3. Maybe if the file is other-writable you can make hard links. > The problem with sort in /tmp is that hardlink_check_gid requires you > to be in the file's group _even if you own the file_, which is also a > bonkers restriction. I concur with that last. But note that ordinary file permissions will do some apparently-bonkers things, like % echo foo > z3 % chmod 044 z3 % cat z3 cat: z3: Permission denied % # chown 0 z3 <-- note prompt, done as root % cat z3 foo % I can't read the file when I own it even though anyone _not_ owning it can read it just fine. Similarly, if the file is mode 004 and I'm in its group, I can't read it even though anyone neither owner nor in its group can lread it. Is that bonkers? Some people would probably say so. I don't; I consider "fixing" that "problem" to be a case of forbidding stupid things and thereby forbidding clever things. But then, I'm not convinced this is a real hazard. "ln /etc/motd /var/mail/mouse" and sending mail - the problem there exists only if the mailer is stupid enough to open /var/mail/mouse as someone other than mouse; if it's a real issue, it's a bug in the mailer, not a problem with hardlinks. You get the same issue with a symlink if the mailer is willing to deliver to a symlink. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML [email protected] / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B