본문 바로가기

취약점 정보1

IIS At Risk: The HTTP Protocol Stack Vulnerability

728x90

Unpatched versions of Microsoft’s Internet Information Services (IIS) web server are vulnerable to a remote denial of service attack that can prove to be very threatening if set against critical systems.

The vulnerability, which was fixed by Microsoft in MS15-034 as part of the April 2015 Patch Tuesday cycle, can trigger the blue screen of death or more commonly known as BSOD. While there are no indications of possible remote code execution, it is still very important for users to apply the update, especially in systems that require 100% uptime.

The following versions of Windows are at risk:

  • Windows 7
  • Windows Server 2008 R2
  • Windows 8/8.1
  • Windows Server 2012/2012 R2

What is the HTTP Protocol Stack?

The IIS web server has an HTTP listener as a part of the networking subsystem of Windows. This is implemented as a kernel-mode device driver called the HTTP protocol stack (HTTP.sys). It parses the HTTP request and provides a response to the clients.

HTTP.sys provides the following benefits:

  • Kernel-mode caching. Requests for cached responses are served without switching to user mode.
  • Kernel-mode request queuing. Requests cause less overhead in context switching, because the kernel forwards requests directly to the correct worker process. If no worker process is available to accept a request, the kernel-mode request queue holds the request until a worker process picks it up.
  • Request pre-processing and security filtering.

For this vulnerability to pose a risk, kernel caching should be enabled in IIS. This is enabled by default in IIS. Several modules in IIS perform tasks related to caching in the request-processing pipeline. Caching improves the performance by storing the processed information (such as Web pages) in memory on the server, and the same data is reused when requested by other requests. IIS Manager has a feature called “output caching”, which is controlled using the following settings:

Figure 1. HTTP request that will trigger vulnerability

Exploit and Attack Scenario

This vulnerability is exploited using the Range HTTP header. This HTTP header allows clients to request specific contents from server at their demand. For example, a client that only needs few bytes of a file, can opt only to request specific parts, instead of the entire file. RFC 2616 (which defines HTTP) explains the definition of Rangeheaders. There is a corresponding header (Accept-Ranges), which is used by servers to notify clients that they are supporting the Range header.

Typically, the Range header contains values like this:

Range:  bytes=124-5656

It could also have values like this:

Range: bytes=0-

If the upper bound in the Range header isn’t present, it is considered that client is requesting the complete data. This is as good as not using the Range header at all. What if instead, a very high upper bound is specified by the attacker?

All an attacker would have to do is send a specially crafted HTTP request with a special Range value, which would cause an overflow of the Range variable on the server. This is already being done by publicly available exploit code:

Figure 2. HTTP request that will trigger vulnerability

The cURL command can also be used as below to send the same exploit:

$ curl -v example.com  -H "Host: example.com" -H "Range: bytes=0-18446744073709551615"

The upper bound of the Range header is 0xFFFFFFFFFFFFFFFF, which is the largest 64-bit unsigned integer. The large value specified above will cause an integer overflow. A vulnerable server for such request reply with HTTP status line as “Requested Range Not Satisfiable”.

Figure 3. Reply to exploit code by unpatched server

This means that that the client asked for a part of the file that lies beyond the end of the file on the server. A successful attack could cause BSOD, leading to a denial of service. Microsoft has said that this vulnerability could lead to remote code execution, although no exploit that is capable of this is publicly known.

After the fix, the HTTP headers are now checked for errors. A different error is returned if the same attack as before is sent:

Figure 4. Reply to exploit code by unpatched server

A response that includes the string “The request has an invalid header name” indicates that server is patched and attack it will fail. Proof-of-concept code is already using this information, as seen below:

Figure 5. Proof of concept source code

Conclusion

This is a very easy vulnerability to exploit. A remote unauthenticated attacker could easily perform remote denial of service attacks on web servers running a vulnerable version of IIS. While remote code execution exploits are not known, there is a possibility of such exploit appearing in future. Administrators are advised to apply the patch; if that cannot be done immediately disable IIS kernel caching is a possible workaround.

We have released the following Deep Security rule to protect Trend Micro customers:

  • 1006620 – Microsoft Windows HTTP.sys Remote Code Execution Vulnerability (CVE-2015-1635)
728x90