Quotes of the week
Quotes of the week
Posted Jun 3, 2010 14:01 UTC (Thu) by spender (guest, #23067)In reply to: Quotes of the week by viro
Parent article: Quotes of the week
It's a common mistake for applications to request a temporary file in a $TMPDIR (some world-writable directory with the sticky bit set) without using O_EXCL in the call to open, allowing someone else (if they can predict the pathname to be used) to create a symlink/hardlink using that path to reference a root-owned file they either want to leak (say, /etc/shadow) or change the contents of/corrupt. This should be less common in C apps now that there are more secure functions available for the creation of temporary files, but it remains a problem for scripting languages (think echo "blah" >> $TMPDIR/test).
Your example, of what I have no clue, completely misses this mark. The whole point of this class, and why it's generally a race, is that *you don't choose* the path the application opens. It decides that via whatever temporary pathname generation algorithm it uses (whether it involves some randomness or not). If /tmp/b/a were involved, /tmp/b would have been created by the application. If it wasn't, then there's a separate bug there, as applications using /tmp/b/a paths where /tmp/b isn't a world-writable and sticky directory generally are wanting a private directory to store files -- the directory won't allow the creation of a /tmp/b/a by another user.
From looking at my system, I see the following entries in /tmp: an .ICE-unix directory which is world-writable and sticky, an .X11-unix directory which is world-writable and sticky, and several temporary files from mutt. The feature present in grsecurity and Openwall protect all of these cases.
I'm quite sure this was all explained by Kees Cook and evidenced by all his references, so I don't know how you could have missed it.
So that the feature doesn't match any of the classes is demonstrably false. Is there some secret you've been holding out on that you'd like to enlighten the world with?
Better yet, do you have hundreds of references to real examples of your "attack"?
-Brad
