Original URL: https://www.theregister.com/2006/05/07/sendmail_flaws/

Sendmail and secure design

Ancient code base and long vuln history

By Jason Miller, SecurityFocus

Posted in Channel, 7th May 2006 12:02 GMT

Comment Recently, Mark Dowd of ISS discovered a signal handling vulnerability in Sendmail. We don't see major bugs in software that's as popular as Sendmail very often (at least, in the Unix world anyways), and that's probably a good thing. According to sendmail.com, Sendmail still handles about 70 per cent of all email on the internet.

As far as software goes, Sendmail is ancient, dating all the way back to 1981. Sendmail 8 itself is well over 10 years-old. To put it nicely, its security track record is less than stellar. However, the last big show stoppers in Sendmail were found about three years ago – Zalewski's prescan() bugs reported in September and March of 2003, and crackaddr(), also in March of 2003. The crackaddr() bug was also discovered by Mark Dowd.

Although the obscurity of these issues varies, none of them are really basic. I'm sure Dowd's most recent discovery took him a while from start to finish. And I think it's great that companies like ISS are willing to support research like this. After all, there really are no guarantees that time spent auditing a piece of software will result in bugs (especially exploitable ones) being discovered.

Thanks to Mark Dowd and ISS, we now have one less vulnerability in Sendmail. At the least, finding the next vulnerability in Sendmail is going to be that much more difficult.

Killing and creating bugs

I've often wondered whether or not there are, in practice, a finite number of vulnerabilities in a given software. Obviously, there is no way to know how many undiscovered (or undisclosed) vulnerabilities lurk in any given piece of software. This means that when a new vulnerability is found and addressed, it's hard to understand what kind of impact it has on the future scrutiny of the product. There is one less bug in the software, and the hurdle standing in the way of the next researcher (or attacker) just gets a little bit taller. There's no way we'll know if this was the last significant bug in the code. It's almost a never-ending cycle of vulnerabilities.

For really simple software, the concept of never-ending vulnerabilities might not seem to have bearing. However, as the complexity of an application increases, this becomes more valid. One can imagine a huge machine with so many inputs and interactions that it's impossible to understand how everything works. When we can't understand something, it's bound to have vulnerabilities. Then, even at a practical level, it becomes impossible to have any sort of assurance about the software's security or its resilience to attacks. So, finding vulnerabilities in or attacking software becomes nothing more than an exercise in time and talent. Given all but the most trivial of programs, someone with enough time and skill can break it.

I am of the opinion that our only hope of eliminating bugs, or at least making further attacks against software impractical, is to keep systems small, simple, and static (by static, I mean that they don't change). And, although there can never be a guarantee of security, we can at the very least have some reasonable level of assurance. As that software continues to be scrutinized by researchers, our level of assurance increases.

On the other side of things, new bugs are being created all the time. With the growing size of software, and the ever-increasing number of "features" (wanted or not) that get introduced into some software, we're guaranteed to be creating new vulnerabilities all the time. This is just one of the reasons that many Unix-based operating systems have fared so much better than Windows: they're smaller, older, and change less. Looking around at the state of some other operating systems, I often wonder if we're actually moving backwards in security instead of forwards.

Ultimately, new code, or old code that continues to change drastically, becomes less secure. And if an application isn't written with a secure design, this can have a far-reaching effect on its security. But, let’s get back to Sendmail.

A security track record

So, if Sendmail is such an old program, why are people still finding vulnerabilities in it? I've touched on it in another article which looked at trusting open-source software. An application's security track record is often closely tied to its future. If you look at the track record for Sendmail, you'll find a lot of problems with it, especially in earlier versions.

Both the type and quantity of the bugs discovered in a product can be indicative of its quality. Although vulnerabilities are unavoidable, when auditing software, simple bugs are likely to be found first. The discovery of obscure and circumstantial vulnerabilities later on may indicate that past auditing has been thorough, and that the software is devoid of the basic and embarrassing bugs that can affect poorly written software. If a project has recently been plagued by basic buffer overflow or format string vulnerabilities, this might be a pretty good indication that the underlying code wasn't written with any sort of security in mind.

Secure by design

Perhaps one of the biggest problems with Sendmail is that, by default, it is parsing all sorts of remote, untrusted input as root. There's no excuse for that. It's turning a significant vulnerability into a vulnerability capable of remote root, and for no good reason.

Sendmail might be a relatively old application, but it wasn't designed with the ultimate goal of security in mind. Sendmail's liberal use of root access exacerbates these problems. It's been audited by a lot of very talented people, and problems continue to be found with it. However, they do continue to be more obscure, and one has to wonder how many show stopper issues could possibly remain undiscovered Personally, I'm not banking on this being the last one - especially given that the underlying problem with ISS's recent Sendmail bug was already documented.

Besides, there's just too much code that runs as root by default When choosing software, one should look for applications with a good security track record and a solid design that mitigates the impact from the vulnerabilities that do manage to get into the code. While, I don't have personal experience with Postfix, but I've heard good things about it. And of course, there's always qmail, which I've written about before as being "almost" a model for security.

Ultimately, you've got to trust some applications. Make sure you trust the right ones.

This article was first published at SecurityFocus