HTTP.SYS reservations - why do they exist?

Security Briefs

Syndication

Dominick points out that there are a number of HTTP.SYS reservations that have relatively weak ACLs. He points out that the reason for requiring reservations in the first place (and for securing them with ACLs) is to prevent malware from hiding on an existing port:

The whole reason for ACLs on listen URIs is that malware can't easily open a new listening port – or even trickier – hide behind an already opened port (at least that was my understanding).

Kenny disagrees, commenting:

I think that the main confusion here is around the purpose of http.sys reservations. Reservations are used to prevent squatting. For example, SQL doesn't want other apps, admin or otherwise, to listen on http://+:80/sql/, so they make a reservation with their creds. Reservations are not for preventing malware from listening on your machine. If you have malware on your machine it can just open a socket if it wants to receive data.
If Kenny is correct, then it would seem to me that things would work the other way around: that is, by default you'd be allowed to register with HTTP.SYS unless some other application set up a reservation on that port/prefix. But by default, HTTP.SYS is locked down (except for the holes that Dominick is discussing). Unix set a precedent with this years ago. From section 2.9 of the classic, UNIX Network Programming:
Unix systems have the concept of a reserved port, which is any port less than 1024. These ports can only be assigned to a socket by an appropriately privileged process. All the IANA well-known ports (0-1023) are reserved ports; hence the server allocating this port (such as the FTP server) must have superuser privileges when it starts.

Requiring network services to run with high privilege turned out to be a really bad idea, but the original goal was laudable - don't let just anybody run a well-known service on a server, perhaps spoofing the real service and collecting user passwords, etc. Using URL prefix reservations neatly solves this problem, allowing the administrator to determine who should be listening on various ports, while at the same time allowing those services to run with least privilege.

Squatting on a port is one attack. But it's only one of a myriad of attacks that this reservation system prevents. I cannot imagine that squatting was the only consideration. The port sharing ability of HTTP.SYS makes it even more vulnerable to malware than simply opening a socket. If my exploit can port share with an existing, legitimate service, you might not notice it there if you're using a traditional tool such as netstat. Plus, firewalls are configured to control access to ports - sharing a legitimate port might allow my malware to communicate with the cloud.

I'm sure malware authors worldwide rejoiced when HTTP.SYS port sharing was introduced. I'd say that concerns like Dominick's are well founded.

Of course, I don't work for Microsoft, so take my opinion with a grain of salt 8-)


Posted Apr 01 2007, 08:40 PM by keith-brown
Filed under: ,

Comments

Kenny wrote re: HTTP.SYS reservations - why do they exist?
on 04-04-2007 5:05 PM
I understand the concerns here. I do have to wonder though, if you have malware running on your machine, can't it just open a client socket to the cloud (which actually is worse since it will traverse your client-side NAT)? Is the difference Reputability since you can check what the client is connecting to?
Keith Brown wrote re: HTTP.SYS reservations - why do they exist?
on 04-06-2007 1:19 PM
Yep. It could. But it'd be noisy.

Windows Firewall, for example, would prompt the user whether she wanted to "unblock" the application. Any other sort of monitoring tool worth its salt would notice this as well.

Compare this to simply registering as a listener on an existing port via HTTP.SYS. The port is already open as far as the TCP/IP network stack is concerned, so would monitoring software notice this? I don't know.

You have to ask yourself, why go to the bother of locking something down with an ACL if you're then going to configure it loosely so that the ACL doesn't have any effect. I believe that's what Dominick may have been feeling when he wrote his post.
Norman Diamond wrote re: HTTP.SYS reservations - why do they exist?
on 04-08-2007 7:49 PM
>> can't it just open a client socket to the
>> cloud
>
> Windows Firewall, for example, would prompt
> the user whether she wanted to "unblock" the
> application.

I've seen that for client sockets in other firewalls but not the Windows XP firewall.

Actually this makes me forget why HTTP.SYS makes a difference. Maybe a machine that wasn't supposed to be a server, that gets trojaned, will persuade visitors to submit their banking details.
you've been HAACKED wrote The IIS 7 Team Rocks!
on 05-21-2007 9:45 PM
The IIS 7 Team Rocks!
Community Blogs wrote The IIS 7 Team Rocks!
on 05-21-2007 10:34 PM
I recently wrote about some 503 Service Unavailable Errors with IIS 7 that had me completely stumped

Add a Comment

(required)  
(optional)
(required)  
Remember Me?