O_NOLINK for open()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Brent Casavant <[email protected]> wrote:
[...]
Quoted 6 lines
I could mmap a temporary tmpfs file (tmpfs so that if there is a machine crash no sensitive data persists) which is created with permissions of 0, immediately unlink it, and pass the file descriptor through an
AF_UNIXsocket. This does open up a very small window of vulnerability if another process is able to chmod the file and open it before the unlink.
If the process can chmod the file, it can ptrace the daemon, too. Or, using CAP_DAC_OVERRIDE, it can patch the daemon.
Both will void any security.
Quoted 4 lines
However, it occurs to me that this problem goes away if there were a method create a file in an unlinked state to begin with. However there does not appear to be any such mechanism in Linux's
open()interface.
Having no window for creating stale temp files is nice to have. We only need a clever fool to implement it.-) But since it's hard to get killed just in the right moment for having a stale temp file, there is very low interest for this feature.
Signature · 4 lines
You know you're in trouble when packet floods are competing to flood you.
-- grc.com
Friß, Spammer: [email protected] [email protected]Quoted 9 lines
Quoted 4 lines
However, it occurs to me that this problem goes away if there were a method create a file in an unlinked state to begin with. However there does not appear to be any such mechanism in Linux's
open()interface.Having no window for creating stale temp files is nice to have. We only need a clever fool to implement it.-) But since it's hard to get killed just in the right moment for having a stale temp file, there is very low interest for this feature.
I don't think this is a problem. The file is simply created with link
count 0. As soon as the process closes the file, it gets deleted. So there would be no stale files... Or did you mean anything else?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SuSE CR Labs
Quoted 5 lines · Jan Kara
Quoted 5 lines
Quoted 4 lines
However, it occurs to me that this problem goes away if there were a method create a file in an unlinked state to begin with. However there does not appear to be any such mechanism in Linux's
open()interface.
Quoted 8 lines
Quoted 4 lines
Having no window for creating stale temp files is nice to have. We only need a clever fool to implement it.-) But since it's hard to get killed just in the right moment for having a stale temp file, there is very low interest for this feature.
I don't think this is a problem. The file is simply created with link
count 0. As soon as the process closes the file, it gets deleted. So there would be no stale files... Or did you mean anything else?
This feature does, AFAIK, not yet exist. Therefore we'd need a code monkey.
Signature · 3 lines
Top 100 things you don't want the sysadmin to say:
42. Hey Fred, did you save that posting about restoring filesystems
with vi and a toothpick? More importantly, did you print it out?A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Brent Casavant <[email protected]> wrote:
[...]
Quoted 4 lines
Hmm. This will work as long as the peer process is running setuid to it's own unique user. Excellent idea! Since I need to make the program setuid to avoid non-priveleged ptrace attacks, this is a terrific solution.
Tried that:
~ > cd tmp
~/tmp > cp /bin/sleep .
~/tmp > chmod u+s sleep
~/tmp > ./sleep 2147483647 &
[1] 2823
~/tmp > strace -p 2823
Process 2823 attached - interrupt to quit
setup(
Signature · 4 lines
Top 100 things you don't want the sysadmin to say: 27. You can do this patch with the system up... Friß, Spammer: [email protected]
Quoted 7 lines · Bodo Eggert
~/tmp > cp
/bin/sleep.
~/tmp > chmod u+s sleep
~/tmp > ./sleep 2147483647 &
[1] 2823
~/tmp > strace -p 2823
Process 2823 attached - interrupt to quit
setup(
You didn't change the owner, so this is not a setuid execution.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Quoted 11 lines · Andreas Schwab
Quoted 7 lines · Bodo Eggert
~/tmp > cp
/bin/sleep.
~/tmp > chmod u+s sleep
~/tmp > ./sleep 2147483647 &
[1] 2823
~/tmp > strace -p 2823
Process 2823 attached - interrupt to quit
setup(You didn't change the owner, so this is not a setuid execution.
I expected that, but I wanted to be sure before telling bull****. Besides that, if the suid program was owned by the suid-to user, that user could modify the binary in order to prepare a future attack.
Signature · 2 lines
Top 100 things you don't want the sysadmin to say:
16. find /usr2 -name nethack -exec rm -f {};