lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1MsGtJ-0001xy-5T@pomaz-ex.szeredi.hu>
Date:	Mon, 28 Sep 2009 16:07:49 +0200
From:	Miklos Szeredi <miklos@...redi.hu>
To:	Jamie Lokier <jamie@...reable.org>
CC:	miklos@...redi.hu, Valdis.Kletnieks@...edu, linux@...blig.org,
	agruen@...e.de, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vfs: new O_NODE open flag

On Mon, 28 Sep 2009, Jamie Lokier wrote:
> Miklos Szeredi wrote:
> > BTW I just checked, and it is possible to re-open or promote an fd
> > opened with O_NODE like this:
> > 
> > 	char tmp[64];
> > 
> > 	fd = open(filename, O_NODE | O_NOACCESS);
> > 	/* ... */
> > 	sprintf(tmp, "/proc/self/fd/%i", fd);
> > 	fd_rw = open(tmp, O_RDWR);
> > 
> > Now fd_rw is guaranteed to refer to the same inode as fd.
> 
> If someone passes you a file descriptor opened with O_RDONLY, you
> shouldn't be able to upgrade it to O_RDWR unless you have access to
> the file and could do a normal open() on the file.
> 
> I hope the above cannot convert O_NOACCESS to O_RDWR without checking
> that you have access to the file.

The permissions are checked on the inode at open.  It doesn't matter
how the inode came to be looked up, via a normal path or via a file
descriptor in proc, the results are the same.

> Hmm.  I have just tried, and you _can _use open("/proc/self/fd/%d",
> O_RDWR) to re-open with more permissions when you can't access the
> path which /proc/self/fd/%d pretends to link to.  It looks a bit
> dubious, as you might have been passed an O_RDONLY descriptor with the
> intention that you can't write to it...  Oh well!

True, /proc gives you access to the underlying "path" of an open file
descriptor.  If you don't want that, don't mount /proc in your limited
namespace.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ