Via BSD Now, the old, familiar file command has been completely rewritten by OpenBSD developer Nicholas Marriott, who also happens to be the author of tmux. This new edition takes advantage of modern coding practices and the usual OpenBSD scrutiny. It will run by default as an unprivileged user with no shell, and in a systrace sandbox, strictly limiting what system calls can be made and has a drastically reduced potential for damage which a malicious file could do. Ian Darwin, the original author of the utility, saw the commit and, in what may be a moment in BSD history to remember, replied.
The file utility has been around since the 1970s and is used to determine what type of file something actually is. It hasn't seen a lot of development these days, and it's had its share of security issues as well. Some of those security issues remained unfixed, despite being publicly known for a while. It is run to inspect all kinds of files and was technically designed to be used on untrusted files, so tightening things up improves the situation quite a bit.
(Score: 4, Informative) by TheRaven on Thursday April 30 2015, @08:31AM
You joke, but there have been a number of exploits involving libmagic. Not many using the file utility specifically, but libmagic is one of these things that reads untrusted data (the start of a potentially malicious file) and then uses a potentially badly tested code path that does lots of pointer manipulation to decode it. It has an atrocious security record. A lot of graphical file browsers use it to choose the icon to display for a file, so you end up with untrusted data being input to a buggy program run with full permissions to access any file that the user can access. It's a very nice exploit vector.
That said... systrace? Really? The paper showing that systrace in particular and the technique that systrace (and a number of antivirus programs in general) use is fundamentally flawed was published in 2007. systrace is still vulnerable to the same attacks (we set breaking systrace as an undergraduate exercise each year).
sudo mod me up