[SSSD] [PATCH] Protect against check-and-open race conditions

Stephen Gallagher sgallagh at redhat.com
Thu Apr 1 20:20:10 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is a small window between running lstat() on a filename and
opening it where it's possible for the file to have been modified.
We were protecting against this by saving the stat data from the
original file and verifying that it was the same file (by device
and inode) when we opened it again, but this is an imperfect
solution, as it is still possible for an attacker to modify the
permissions during this window.

It is much better to simply open the file and test on the active
file descriptor.

Resolves https://fedorahosted.org/sssd/ticket/425 incidentally, as
without the initial lstat, we are implicitly accepting symlinks
and only verifying the target file.


- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAku0//MACgkQeiVVYja6o6MN8ACeLteU+pq0gzYv10Ls9M2Rqyvw
am0AnipRUHuwLM+kO+XImKfs0+yAsAb6
=mI3/
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Protect-against-check-and-open-race-conditions.patch
Type: text/x-patch
Size: 6459 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20100401/9352dc85/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Protect-against-check-and-open-race-conditions.patch.sig
Type: application/pgp-signature
Size: 72 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20100401/9352dc85/attachment.sig>


More information about the sssd-devel mailing list