Finding a Security Hole in Microsoft Exchange

A few months ago, I found a security hole in Microsoft Exchange Server 5.0 while checking something any mail administrator should be able to rely on: whether changing a password invalidated the old one.

I work at Philadelphia Newspapers, where we run Exchange for email. We had recently set up POP3 access so people could check their mail remotely. I was testing the system and noticed something strange: after changing a user's password, the old password still worked. Both the old password and the new password could be used to log in.

That is a serious problem. Changing a password should lock out anyone who knows the old one. If a password is stolen or an employee leaves the company, an administrator needs to revoke that access. With this behavior, changing the password did not immediately stop POP3 access with the old one; it remained usable while the cached credentials were valid.

I investigated the POP3 authentication behavior. Microsoft later explained that Exchange cached credential tokens to avoid repeated domain-controller logons. Changing the password did not immediately invalidate those cached credentials. The default age limit was two hours, with a fifteen-minute idle limit.

I documented the problem and posted a security alert on my web site on August 20. The information was then cross-posted to the Bugtraq security mailing list and to the microsoft.public.exchange.clients newsgroup.

Microsoft had reproduced the behavior when I posted my August 20 alert. On August 27, Microsoft's Jim Reitz explained the registry settings while the Knowledge Base article was being made available. A developer explanation circulated on September 1 called the cache a performance optimization and described how to disable it.

The discussion also reached beyond Exchange. David LeBlanc, a security researcher, pointed out related password-caching behavior in Microsoft's FTP, HTTP, and Gopher services. My Exchange tests did not affect ordinary Windows NT logons or the web-mail interface. The larger question was what happened to cached authentication when the underlying password changed.

Exchange exposed three registry values under HKLM\System\CurrentControlSet\Services\MsExchangeIs\ParametersNetIf:

Credentials Cache Age Limit   (Default = 120 minutes)
Credentials Cache Idle Limit  (Default = 15 minutes)
Credentials Cache Size        (Default = 256 buckets)

Microsoft's instruction was to set the DWORD value Credentials Cache Size to 0 to turn caching off. That makes each POP3 logon cause an NT logon, increasing the load on domain controllers. The age and idle values control when cached credentials expire.

First, a useful security check need not require special tools or advanced knowledge. I found this bug while doing routine work. I changed a password and then tested whether the old one still worked. That is a basic check that anyone administering a mail server should do. The fact that it had not been caught before tells me that many organizations trust their software more than they should.

Second, when you find a real security problem, document it carefully and make it public. I posted the details on my web site with a clear description of the problem, the impact, and the steps to reproduce it. I had already contacted Microsoft; publication let other administrators inspect the behavior and follow the response.

Third, one bug is often a symptom of a larger problem. The related behavior David LeBlanc described in FTP, HTTP, and Gopher made the design question broader than POP3. A performance optimization becomes a security problem when it keeps a revoked credential usable. When you find a bug, it is worth asking whether the same mistake could exist in other parts of the system.

This is a time when more and more companies are connecting their internal systems to the internet through protocols like POP3, HTTP, and FTP. The security of these connections matters. A flaw at the boundary between your internal network and the public internet can compromise everything behind it. I hope that sharing this experience encourages others to test their systems carefully and to report what they find.