Bugtraq mailing list archives
Re: Publically writable directories
From: fox () mikey convex com (David DeSimone)
Date: Mon, 17 Jun 1996 16:53:30 -0500
Bill Pemberton wrote:
You need to open it like so: fp_handle = open(fname, O_RDWR|O_CREAT|O_EXCL,0600) The open() call does not follow symlinks.
This is not really true; only the final component of the pathname is checked for symlinking. From the man page: O_EXCL If O_EXCL and O_CREAT are set, open() will fail if the file exists. This can be used to implement a simple exclusive access locking mechanism. If O_EXCL is set and the last com- ponent of the pathname is a symbolic link, the open will fail even if the symbolic link points to a non-existent name. This protects against someone creating a file with 666 permissions and hoping that you will open the file and start writing into it. It also protects against someone creating a link to a name that does not exist, hoping that you will create it. However, it does not stop someone from creating a symlink further up the path. But with a path like "/tmp/file.$$", this isn't much of an issue. -- David DeSimone | "The doctrine of human equality reposes on this: fox () convex hp com | that there is no man really clever who has not Hewlett-Packard | found that he is stupid." -- Gilbert K. Chesterson Convex Division | PGP: 5B 47 34 9F 3B 9A B0 0D AB A6 15 F1 BB BE 8C 44
Current thread:
- system() call in suid programs, (continued)
- system() call in suid programs Not Joe (Jan 03)
- Re: system() call in suid programs Valdis.Kletnieks () vt edu (Jun 14)
- Re: system() call in suid programs Max Hailperin (Jun 14)
- Publically writable directories Thomas Koenig (Jun 16)
- Re: Publically writable directories Neil Soveran-Charley (Jun 16)
- Re: Publically writable directories Brian Mitchell (Jun 17)
- Re: Publically writable directories Thomas Koenig (Jun 18)
- Re: Publically writable directories Bill Pemberton (Jun 18)
- Re: Publically writable directories Thomas Koenig (Jun 18)
- Re: system() call in suid programs Valdis.Kletnieks () vt edu (Jun 14)
- system() call in suid programs Not Joe (Jan 03)
- Re: Publically writable directories Bill Pemberton (Jun 17)
- Re: Publically writable directories David DeSimone (Jun 17)
- Re: Publically writable directories Valdis.Kletnieks () vt edu (Jun 17)
- Re: Publically writable directories Michael Dilger (Jun 17)