|
|
|
|
|
by kazinator
977 days ago
|
|
I'm not going to sit there claiming it's not vulnerable to anything. But, assuming it does what it's supposed to, the inherent semantics of the check is supposed to eliminate TOCtoTOU. The reason is that if we validate, from left to right, that no part of the path is under the control of adversaries, then nothing can happen to that path between the time of check and time of use. (At least nothing that isn't self-inflicted, which would be outside of the scope. If root checks a path for safety, but root itself has a parallel task going on which changes the permissions or symbolic links in ways that affect the security status of that path, we can regard that as root's self-inflicted problem. That's nearly the same as the ever-present threat that a careless sysadmin might "chmod 777" an sensitive file.) In fact, development of this function was motivated by exploring the question: can we do security checks on a path in such a way that if the answer is affirmative, it continues to tell the truth moments later, when the same path is accessed? |
|
It's definitely a great improvement, though.
[0] Which would arguably be a bug with the other process, but this is the world we live in :/