hard links create local DoS vulnerability and security problems
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]
Quoted 7 lines · [email protected] wrote:
In any case, if a user is *MAKING* a program set-UID, it's probably because he *wants* it to run as himself even if others invoke it (otherwise, he could just leave it in ~/bin and be happy). So this is really a red herring, as it's only a problem if (a) he decides to get rid of the binary, and fails to do so because of hard links he doesn't know about, or (b) he's an idiot programmer and it malfunctions if invoked with an odd argv[0]....
Right... but non-privileged users _can't_ delete these extra links, even if they notice them from the link count. And non-idiots do make security errors -- they just fix them. But in this case, fixing the error after the fact may be impossible without root's help.
And how many package managers / install scripts check for hard links of files they're about to overwrite?
--Andy
Quoted 5 lines · Andy Lutomirski
Right... but non-privileged users _can't_ delete these extra links, even if they notice them from the link count. And non-idiots do make security errors -- they just fix them. But in this case, fixing the error after the fact may be impossible without root's help.
Just do
chmod ug-s file
and you're done.
If you delete the file first, you'll need roots help, but hey, be careful.
Linus
Quoted 7 lines · Linus Torvalds
Just do
chmod ug-s file
and you're done.
If you delete the file first, you'll need roots help, but hey, be careful.
Heh, thus enters paranoia... patern fill the file (zero's will do), truncate, 'chmod 0', and *then* unlink it. Yeah, it's eating up an inode charged to the user, but otherwise, no space and the contents are gone.
--Ricky
Quote from Andy Lutomirski <[email protected]>:
Quoted 12 lines
Quoted 7 lines · [email protected] wrote:
In any case, if a user is *MAKING* a program set-UID, it's probably because he *wants* it to run as himself even if others invoke it (otherwise, he could just leave it in ~/bin and be happy). So this is really a red herring, as it's only a problem if (a) he decides to get rid of the binary, and fails to do so because of hard links he doesn't know about, or (b) he's an idiot programmer and it malfunctions if invoked with an odd argv[0]....
Quoted 2 lines
Right... but non-privileged users _can't_ delete these extra links, even if they notice them from the link count.
They can truncate the file to zero length, though, then delete the 'original' link, making all of the other links point to the zero length file.
John.
Quoted 6 lines · John Bradford
Quoted 2 lines
Right... but non-privileged users _can't_ delete these extra links, even if they notice them from the link count.
They can truncate the file to zero length, though, then delete the 'original' link, making all of the other links point to the zero length file.
It could be tricky to find those extra links if the original has been deleted, of course.
Signature · 2 lines
Måns Rullgård [email protected]
Quote from [email protected] (=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=):
Quoted 4 lines
Quoted 1 line · John Bradford
Quoted 1 line
Right... but non-privileged users _can't_ delete these extra links, =
even=20
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
if they notice them from the link count.
They can truncate the file to zero length, though, then delete the 'original' link, making all of the other links point to the zero length file.
It could be tricky to find those extra links if the original has been deleted, of course.
True, but as long as at least one of the links which has been made to the original file is in a directory you have access to, you can simply create a new link to the file, truncate it, then delete your newly created link, so actually deleting the 'original' link is not necessarily a problem :-).
John.
Quoted 4 lines · John Bradford
Quoted 4 lines
Quoted 3 lines
They can truncate the file to zero length, though, then delete the 'original' link, making all of the other links point to the zero length file.
Quoted 8 lines
Quoted 2 lines
It could be tricky to find those extra links if the original has been deleted, of course.
True, but as long as at least one of the links which has been made to the original file is in a directory you have access to, you can simply create a new link to the file, truncate it, then delete your newly created link, so actually deleting the 'original' link is not necessarily a problem :-).
There's no need to make a new link, since any links will be owned by the original owner. That was the concern in the first place. The problem is finding a link after the file has been deleted. It could be hidden away somewhere in a directory you don't have read or execute permission for.
Signature · 2 lines
Måns Rullgård [email protected]
Quote from [email protected] (=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=):
Quoted 17 lines
Quoted 5 lines · John Bradford
Quoted 5 lines
Quoted 3 lines
They can truncate the file to zero length, though, then delete the 'original' link, making all of the other links point to the zero length file.
=20
It could be tricky to find those extra links if the original has bee=n
Quoted 4 lines
Quoted 1 line
deleted, of course.
True, but as long as at least one of the links which has been made to the original file is in a directory you have access to, you can simpl=
y
Quoted 3 lines
create a new link to the file, truncate it, then delete your newly created link, so actually deleting the 'original' link is not necessarily a problem :-).
Quoted 5 lines
There's no need to make a new link, since any links will be owned by the original owner. That was the concern in the first place. The problem is finding a link after the file has been deleted. It could be hidden away somewhere in a directory you don't have read or execute permission for.
Ah, OK, I was thinking of something else entirely :-)
John.