Hacker News new | past | comments | ask | show | jobs | submit login
Remote Kernel Code Execution Via HTTP Request In IIS On Windows (ma.ttias.be)
458 points by Mojah on April 15, 2015 | hide | past | favorite | 186 comments



I tried to send the bad curl request to our servers (test env, obviously) and I didn't get any error. It seems I should be getting "Requested Range Not Satisfiable" if the server is vulnerable and "The request has an invalid header name" if it's patched. I'm getting neither, simply a normal response HTTP 200 with the requested page. Anyone knows how to really test it?

EDIT : It is indeed related to "Output Cache" setting in IIS as I said I was suspecting in another comment. I managed to crash our servers by going to IIS Management, select the website I wanted to test, go to Output Caching, enable the feature AND also add a rule (I added a rule for .png just to test). If you have NO rules it is the same as having the feature disabled so you are safe. If you add a rule and check "Enable Kernal Caching" you are vulnerable!

EDIT 2 : As some have asked, this is the command I used to crash our test server. I tested it after having created a new Output Caching rule to cache all .png files in kernel mode.

curl -v http://example.com/image.png -H "Range: bytes=18-18446744073709551615"

I didn't take a screenshot of the BSOD and I don't plan on crashing our test env a second time today because people are using it (I tested it early enough that not a lot of people were at the office yet).


I just crashed a 2008 R2 server without a rule, just with "Enable Kernel Caching". Not sure if it is relevant, but I first added a rule for .png, and then removed it again. Still worked.


Can't edit the top comment anymore :( but it has been found that indeed no rules are needed to exploit this (my previous answer is outdated and wrong!)

If you can't afford to reboot your servers right now to install the patch, at least you can add this to your web.config and deploy your websites ASAP :

<configuration> <system.webServer> <caching enableKernelCache="false"/> </system.webServer> </configuration>


Instead of updating every single web.config of your website I think it is better to just update once and for all by updating machine.config. What you say ?


Seems like you can't add a system.webServer node on the machine.config, but you could add it to applicationHost.config (source: http://www.iis.net/learn/get-started/planning-your-iis-archi... ) so yes, that would be faster. You have to make sure that none of your web.config files override that setting though!


I believe IIS supports locking attributes (source: http://www.iis.net/learn/get-started/planning-for-security/h...) so you should be able to lock at applicationHost.config and restrict further modifications. (I'm testing this now)

EDIT:

It causes a config error when a lock violation occurs which means the site gets an error 500 so its not an ideal fix.



And doesn't check for static content first. Try http://ms15-034.azurewebsites.net/ (disclaimer: my app)


Sadly, only http is checked; won't work for https-only server.


As all our servers are behind a traffic manager product like F5/ZXTM I'm experimenting with removing the range header so it never reaches the webserver as some app's rely on kernel mode caching to achieve performance.

Also my tests seem to indicate that just having kernel mode caching enabled even if you dont have any rules still seem to cause a BSOD.


You're right! Even with no rule having kernal caching enabled will crash it! I think IIS assumes it should cache all static content even when there are no rules specifically for them. Somehow I can't edit my comment anymore but I'll leave this here :

EVEN WITH NO RULES, YOU ARE VULNERABLE! My previous answer has been proven to be wrong!


That was my case as well... initialized IIS on a fresh server to test against. (took me a while to figure out that IIS wasn't even setup, since the IIS manager was on the server) ... accidentally crashed my local machine too (forgot to change the localhost to the ip of the server whyn copy/pasting the url from the browser on the server)

This is pretty wild.


If I understood well, the HTTP request with the Range header is just a way to CHECK for the vulnerability and it is not THE vulnerability.

The vulnerability allows execute code remotly under the Syetem account.

Am I wrong?


Have tried on all our production facing domains (with and without CDN and get 200 responses also.

One server (our development server) has proven vulnerable. Maybe reverse proxies are sanitizing the results?

    $ curl -v 10.100.0.40/ -H "Host: irrelevant" -H "Range: bytes=0-18446744073709551615"
    * About to connect() to 10.100.0.40 port 80 (#0)
    *   Trying 10.100.0.40...
    * Adding handle: conn: 0x1d83278
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x1d83278) send_pipe: 1, recv_pipe: 0
    * Connected to 10.100.0.40 (10.100.0.40) port 80 (#0)
    > GET / HTTP/1.1
    > User-Agent: curl/7.30.0
    > Accept: */*
    > Host: irrelevant
    > Range: bytes=0-18446744073709551615
    >
    < HTTP/1.1 416 Requested Range Not Satisfiable
    < Content-Type: text/html
    < Last-Modified: Wed, 27 Aug 2014 14:56:23 GMT
    < Accept-Ranges: bytes
    < ETag: "885fe5117c2cf1:0"
    * Server Microsoft-IIS/7.5 is not blacklisted
    < Server: Microsoft-IIS/7.5


I've just tried on AWS Elastic Beanstalk https servers and not been able to BSOD. We don't have output caching enabled.



I can confirm what Khao is saying from my own testing.


Do you happen to have a screenshot of the BSOD, or could test it a second time to take a screenshot? I don't really have a free test server that I can crash anymore since I tested this morning when not a lot of people were at the office yet.



+1. Also tried this on multiple web servers. Unable to reproduce under several different scenarios using curl


EDIT: adding the output caching rules confirms it. BSOD :(


Are you sure that curl is sending the request properly? (Check with tcpdump)


Yep. I tried curl -v to get all the raw headers line by line and the payload is there, and I also tried in telnet, both return a 200 page.

I read the microsoft security bulletin and it says that your IIS server is protected if Kernal Caching is off, maybe that's why our servers are neither blocking the request nor crashing with the request.


I have tried this with kernel caching enabled. (kernel caching IS enabled by default from what I can see). Still unable to reproduce using curl.


Even if you have Kernel Caching enabled (as it is by default) if you haven't created any rule for it you're safe.

I created a rule to cache all .png files and I changed the curl request to request a .png image on the server. I got a BSOD!


Do you remember what the fault being reported on the BSOD was?

(If you could take a screenshot/snapshot that'd be great.)

I'm really curious to see what bugcheck is being hit.


I just get the standard "Your PC ran into a problem and needs to restart. We're just collecting some error info, and then we'll restart for you."

Edit:

Actually sometimes you get additional info:

http://imgur.com/zRHUV8o


Ah, page fault in non-paged area! Interesting.


I second that.. If you could provide a screenshot and Curl example it would be great.


Can you please provide example of CURL syntax you used to produce this please?


Thanks my syntax was slightly off I'm now able to reproduce.


Specifically after enabling Output Caching for all .png files I send this :

curl -v http://example.com/image.png -H "Range: bytes=18-18446744073709551615"


I was able to crash mine (local win8.1 and win2012 server) without any rules specified, only the checkbox enabled for kernel caching... it may vary based on windows version.


One other possibility, is that your systems have already been compromised and are giving you back incorrectly safe-looking output. I'm not saying its probable, just possible.


Are you sure you have IIS on an OS with the vulnerability? It seems like windows 2008 R2 has it, but not 2008. My work is all on windows 2008, not R2.


I'm getting "Range requested not satisfiable" but no crash. Am I vulnerable or just doing it wrong?


confirmed the above command crashed my win 2012 r2 server on AWS with no output cache rules. I found a png being served by my home page, and after 2 of the above requests the server crashed.

I installed the pending windows updates and after a restart the problem seems to be gone.


The reason the kernel is involved with http handling is a feature called "Kernel Caching"[1]:

> Enable kernel caching to effectively scale and improve Web server performance. Cached responses are served from the kernel. This greatly improves response times and increases the number of requests per second that IIS can serve because requests for cached content never enter IIS user mode.

[1] https://technet.microsoft.com/en-us/library/cc731903(v=ws.10...


If you don't have the kernel caching enabled, does this vulnerability still work?


According to microsoft's bulletin disabling kernel caching will avoid the vulnerability.

* I should cite this : https://technet.microsoft.com/library/security/ms15-034

See section Vulnerability Information > Workarounds


Microsoft states that this MAY help.

I don't have a MS server with IIS installed, but I would be very interested if the exploit check from the OP would be negative with kernel caching disabled. Anyone care to test this?


I get the HTTP 416 on windows 8.1 + iis 8.5 unpatched even after turning kernel caching off and restarting iis. Even after rebooting.


416 is the correct error code to return in this situation... that's what you want to see.


Here the Microsoft Security Bulletin: https://technet.microsoft.com/library/security/ms15-034

I think the title is downplaying the severity of the bug. It's a remote code execution vulnerability in http.sys which is a webserver component running inside the kernel (yea right, great idea!) so you can get remote root via HTTP request. The blog quotes this correctly but I get the feeling the author didn't communicate it properly.

Someone please adjust the title of this submission to something like "CVE-2015-1635: remote kernel code execution via HTTP request affecting Windows Server"


To be fair, http://en.wikipedia.org/wiki/TUX_web_server. Having said that, this is huge. This is way worse than Heartbleed for the IIS crowd.


From the linked page: "TUX has never been an integrated part of the official Linux kernel, although it has been shipped in some distributions, notably Red Hat, SuSE and Fedora."


Sure. My point is that Microsoft isn't the entity to put a web server (or at least components of one) in the kernel. Some may look at it and laugh about how silly that idea is, but in reality many have tried it.


Yep. Another reason folks are against systemd, as it also includes a baked-in http server. Systemd is also poised to become a veritable "second kernel" on linux systems and nobody seems to care enough to stop it.


Isn't systemd an user space process ?


Yes.

It's still on track to becoming a second kernel.


I agree that systemd is a bad idea in the sense that they are doing too much all at once. It is a fine level of arrogance to assume that there wont be problems along the way :P That being said this thread is about the poor souls who are running IIS servers.


And how much internet-facing web content is served with this toy webserver exactly?

That's what I thought, none (except maybe the author's blog? wild guess).


except maybe the author's blog? wild guess

Nope, Ingo Mólnar uses Google+ for his occasional blogging (though the last post seems to be from 2013).


Haha, I knew somebody would actually look it up :)

Thank you!


[deleted]


From that very link, they use IIS (what this CVE is about), not a linux kernel-space http server.


It really isn't.

OpenSSL's heartbleed was incredibly hard to patch because of the sheer number of products that link to the OpenSSL libraries. It required painstaking effort to ensure everything was running the latest releases. And the severity of Heartbleed was such that all encrypted information could be deciphered.

Whereas this problem... is a simple server crash that can be fixed by running a Windows Update. Not even on the same scale of vulnerability.


I personally worried about the simplicity of the attack. Granted at this stage, its just a DoS, but then take corporate patch cycles into account.. In reality, most aren't going to get patched, at best, for another week or so. Security is still second-fiddle at many companies.


Sounds like the author understands the bug but does not understand why it allows remote code execution (which I don't understand either; once details are released it should be clarified).


That's a good point, because in the example we can clearly see how to check if a system is or not patched and that, using this attack, we can crash a Windows Server.

The remote execution part is completely missing (fortunately), but I was wondering if this gives the admin rights on machine (I have absolutely no experience on Windows Server machines, so I don't know how it works in terms of services, permissions and roles).


I would guess it involves spamming the server with specially crafted requests to fill memory with bytecode. After some trial and error (vast simplification) the request from the article could be used to divert the flow of execution into the bytecode spam, rather than causing DoS. The DoS is likely because flow of execution is being diverted to a random area of memory that doesn't contain anything executable, and so crashes instead.

The heap spraying is the missing puzzle piece from the article.


It would allow the same privileges as the user which is running IIS, usually a "system" account - which equals Administrative privileges.


You two seem to not understand still, please re-read my comment.

The point is this is allowing code execution within the kernel of windows. It doesn't even reach the IIS userland process.


I actually don't because I have no clue how Windows Server works. So this attack hits the kernel and the context is low level, right?


Not sure if I am not clear enough but yes, it 'hits the kernel and the context is low level'. As low as it can get on Windows.


[deleted]


I have trouble understanding what you want to say but I did not say what you quoted me with. Please don't put words in my mouth.

The title was giving people the wrong impression about the severity of the vulnerability. This has nothing to do with "avoid giving people ideas" which would be stupid anyways.


My windows knowledge is rusty and outdated but... do you mean that code runs in ring 0? that "kernel space"?


Yes


IIS has several components. One of them, the vulnerable part here, is running in kernel space. In kernel space you have access to everything.

As far as I know, IIS is the only(bar embedded devices running a single address space OS and various ancient/obsolete toys servers on linux) used in production that handles part of HTTP in kernel space (or ring 0 if you will).


SYSTEM account is far more powerful than Administrator, especially after Win2008


This page makes it sound easy to go from the one to the other:

http://blogs.technet.com/b/askds/archive/2008/10/22/getting-...

(not as easy as earlier versions, but still)


that is from 7 years ago...


Sure. I read est as saying that Administrators are more restricted in Server 2008 than they were in earlier Windows versions. I assumed they were talking about the relatively well known technique of scheduling a cmd shell to run as SYSTEM, which that blog mentions being prevented in Server 2008.

But you would still expect an Administrator account to be able to load files onto the system, so obtaining the SYSTEM shell remains pretty easy.

The distinction between SYSTEM and Administrator was a convenience, and if I understood est correctly, it still is.


Either way you have root level privileges, it's game over...


> http.sys which is a webserver component running inside the kernel (yea right, great idea!)

I had no idea. Madness


Why is it inherently 'madness' to have part of your HTTP stack running in kernel space? I think it's generally accepted that handling TCP in the kernel isn't madness; what's the magic distinction between dealing with TCP packets from remote machines and dealing with HTTP requests from remote machines that makes one of them an acceptable activity to carry out in kernel space, and one not?

To be clear about http.sys, it's not what you would normally consider a 'web server'. It leaves things like 'serving files' and 'authentication' and stuff up to userland application processes like IIS. But it allows multiple userland applications to be routed HTTP requests directly, without an IPC dispatch.


It's the amount of complexity, i.e. the number of things to go wrong.

Handling TCP/IP in the kernel requires substantially less complexity than handling HTTP/TCP/IP.

And even then, there are efforts (GNU Hurd, for instance) to push things like TCP out of the kernel level.


> I had no idea. Madness

They aren't the only ones who do this: https://www.freebsd.org/cgi/man.cgi?accf_http . All sorts of things are kernel-accelerated on modern operating systems, including lots of network operations. From that perspective, this is just one more and it could potentially have a huge benefit (like the same page served count on fewer hardware) for customers who need it.

Obviously it's critically important that MS get this right if they're going to offer it at all, but that's pretty much a tautology when talking about kernels and core OS functionality. Judge them on a bad implementation, not on any inherent badness in the idea.


You haven't read the manpage, have you?

The idea is completely different.

accf_http is... here, just read the source: https://github.com/freebsd/freebsd/blob/master/sys/netinet/a... – if it sees something that looks like an HTTP request and delays returning to userspace until \r\n\r\n.

http.sys is an actual HTTP/1.x parser. That runs in ring 0.


[deleted]


Presumably the original idea was IIS performance.


Yeah, I completely missed that in order for kernel caching to work, HTTP has to be parsed within the kernel, and so I was making an invalid point. It happens.


> webserver component running inside the kernel (yea right, great idea!)

Actually an idea shared among many OS, including GNU/Linux.

http://en.wikipedia.org/wiki/In-kernel_web_server


Well, of course you can make such a web server on any OS where you can modify or extend the kernel, but TUX is not exactly a popular or recommended solution. There's a reason the reference manual is dated 2001.


To be honest, the original version of http.sys (XP SP2/Server 2003) dates back to the same period.


I didn't express myself correctly; the latest version of the reference manual is from 2001.


I fully agree that the idea doesn't make sense, specially when coupled with memory unsafe languages.

Just wanted to make the point it isn't a Windows specific idea.


Deploying this sort of thing in production on the other hand seems to be a Windows specific idea.


IIS is marketted by MS as a VERY capable web server... typically out-performing other web servers by a large margin. The caching system for IIS has always been one of their crowning achievements, working better than most systems. Though, these days most will put a caching server(or cluster) in front of their operations servers. Just the same, it has worked pretty well. Though I predict this feature will be removed, or disabled by default in future versions.

I'm kind of surprised this issue wasn't discovered previously. Fortunately, there doesn't seem to be an exploit beyond crashing the server yet (which is bad enough). (sigh, kind of glad I'm in the process of migrating everything away from IIS).


That you can write a module to serve HTTP from kernel space is a given.

That people actually use it is another topic.


It'll be the second, I'm afraid. Only Windows Servers running IIS should be vulnerable, maybe the post didn't make that entirely clear.


According to comments in the other discussion here about this it might not IIS be only, because that kernel component is used for other HTTP services as well:

https://news.ycombinator.com/item?id=9378449


Yes, but the user/server would have to be running a web server for it to be hit. Usually, that's IIS. But not every windows machine runs a web server.


Nope. WinRM or Power shell seem to use it too. Enabled by default. (Just created a 2012R2 server last night.)

Plus if you have reservations created with HTTP.SYS, your app doesn't even have to be running. A friend tried turning off IIS, but port 80 would still respond.


Nor is every machine's port 80 publicly reachable. Everyone behind a NAT won't be, for example (unless they've explicitly forwarded the port for the purposes of running such a server.)


Best I could do on a freshly installed Win2k12 with IIS was:

curl -v http://server-name/iis-85.png -H "Range: bytes=18-18446744073709551615"

Run the curl twice and the bluescreen happens the second time. If I don't request the image then it doesn't work.

I've not added any specific rules for output caching.

Edit: The crash screen is very dull:

http://imgur.com/MZ7VNHQ


http://imgur.com/RTbw7co confirmed for default IIS without any rules set, completely default values.


Yup, took me a few more goes but confirmed 2012R2 on AWS behind ELB. I've been up for a while making new images.. 5:08AM :|

I can also confirm it crashes my command window using curl via cygwin lol.


Did you have to configure any rule in the Output Caching or that's completely default values?


I initially configured rules (I was following your instructions) but I've now deleted the rules and still have the crash.


Can confirm. No Output Caching rules defined, I am still able to reproduce crash. [EDIT] What is handy is that it appears that disabling "Enable kernel cache" takes effect immediately. No iisreset or server reboot required in my testing environment.


Yes, unticking that checkbox works for me instantly.


Damnit. I'll double-check on my side too and update my answer accordingly. I don't want people to think they're safe if they're not!


What is also interesting is that if I do this instead:

curl -v http://10.243.0.221/iis-85.png -I -H "Range: bytes=18-18446744073709551615"

(added -I), then it doesn't cause the crash.


-I sends a HEAD rather than a GET, so that's not too surprising.


Ahh yeah, that should have been obvious. Thanks!


Confirmed with Windows 8.1 Pro w/ IIS ..

Same conditions, must run request twice for the .png (with the IIS rule set)

Not like it matters, but I am toying with the first Range number.. (ie: 40-1884...615)

Edit: crash @ 40-1884, oh-shit-reboot at 100-1884


Confirmed: I couldn't force a BS using the originally supplied range numbers, but changing it as per above to 100 did the trick (windows 2008 non R2 & 2012 R2)


> Edit: The crash screen is very dull:

Could you show the event log entry also?


I couldn't find anything that wasn't just the report of a bluescreen.


It seems to me that if you're running a vulnerable high-value server, the only option for you as an IT admin is to completely wipe the host hard drive and install everything from scratch--and even that may not be enough. Remote kernel code execution means an attacker could install malicious drivers, mess with device firmware, or do pretty much anything else the Windows kernel could do, no? It's a gamble to simply patch the server and hope you weren't already compromised; after all, how does one detect that remote kernel code execution occurred?

In a virtualized environment, I imagine blowing away any disks/volumes should be enough to recover from a potentially compromised system. That said, new Windows volumes (say, on EC2) should be created without inbound HTTP access, patched, and only then allowed to serve HTTP traffic.


I bet somewhere in the source there is a line which looks like:

    if (inclusiveEnd + 1 > size) {
        return ERR_INVALID;
    }
HTTP ranges are inclusive, and most likely implemented here with unsigned 64 bit integers. My guess is the author converted to exclusive range, then compared with size, as a form of validation. It passes the check, because 18446744073709551615 + 1 results in wraparound to 0.

The general solution is instead to use something like:

    if (size < offset || start > size - offset) {
        ... // range violated
    }
But you hardly ever see people do that.


Note that that solution won't work with signed values, and compilers will happily optimize out the check in that case.


>A remote code execution vulnerability exists in the HTTP protocol stack [...] could execute arbitrary code in the context of the System account.

SYSTEM is higher than admin. Using IIS on windows is like running a webserver as root on linux.


Lets not play the "my team is better than your team" hysterics, especially when we all had to do emergency patching for shellshock, heartbleed, samba, drupal, etc in the past couple months. Hell, sambra runs as root and that doesn't seem to outrage anyone.


Samba doesn't run as a kernel module though.

I suspect such a patch would not get far, just as many ridiculed the TUX web server some fifteen years ago.



FWIW, only the client side of CIFS runs in the kernel. The server software (smbd) is entirely in userspace.


Only at the HTTP parsing stage.. Once you get into ASP.net you'll have dropped privileges.


Typical Linux servers drop privileges before accepting any connections from clients, precisely to limit the scope of this sort of vulnerability.


From the exploit code:

    memset(&serv_addr, '0', sizeof(serv_addr));
That doesn't seem to be correct. The digit character 0 is not the same as the null character ('\0'). Just write 0 or use `struct sockaddr_in serv_addr = { 0 };`.


It is common for code which is designed to trigger security bugs in systems to be published with several errors, so that skiddies can't just compile and run.


Which makes me sad. Makes it just as easy for dedicated crackers, makes it harder on busy, overworked sysadmins to check.

All the script-kids need to do is find someone to help them, so I don't really think this helps anyone.



But '0' is not ascii NUL (0x00), it's ascii 0 (0x30).


Additionally there are a bunch of other things very wrong with the exploit code.

If the connect() fails, it will use file descriptor 1 which is usually stdout and write the request to it and try to read from it.

And there is a problem with strstr() not getting a null terminated string (if the stack memory for recvBuff wasn't automatically zero'd out which some compilers can do).

Why do these people bother writing the exploit in C? A curl one liner is good enough.

Also the check for 'The request has an invalid header name' seems dubious to me because a proxy in front would likely return a different error (the header name is not invalid but rather the range not satisfyable).


'0' != '\0'

'0' == 48


I wasn't suggesting anything to the contrary...


Yes, but there also isn't any NULs in the parent. So you can understand the confusion.


The interesting take-away is the .sys suffix on the filename: Yes, Windows contains a device driver running in Kernel mode that cares about (IIS) HTTP traffic.


goodness me yes. It appears to be a kernel-mode http parser:

http://www.microsoft.com/technet/prodtechnol/WindowsServer20...

is that really the only way MS could make IIS fast enough?

See also https://en.wikipedia.org/wiki/TUX_web_server


You know how $YOU need to pick a web server, and so you start reading about them, and you find a site that has posted some microbenchmark about serving a hundred byte static file or something, and $SERVER1 can do 106,000 per second and $SERVER2 can do 107,000 per second, so $YOU go with $SERVER2 without asking any more questions?

Yeah... that does nasty things to these server's architecture... "Performance at all costs" eventually strays into taking down the barriers built to protect the system, but at the inevitable cost of slowing things down as things go through the barriers.


HTTP.sys feeds directly into the IIS Request Queue. When that queue overruns, (i.e. too many pending requests that are waiting on a backend NAS or other resource) it's HTTP.sys providing the 503 error, not IIS.


Windows also has a TCP/IP stack in the kernel.

And a GUI stack (win32k.sys).


Yup, that's not that special though. All major OS have the TCP/IP stack in the kernel. And many (but not all) OS have at least parts of their GUI stacks in the kernel.


MS actually moved the GUI stack into the kernel around NT 4. Used to be (so legend has it) if the video driver crashed on earlier versions of NT, you could restart it, and the system didn't go down. But, you know, PERFORMANCE!!1. Win.


I think they eventually separated out part of the video driver into user mode with WDDM and introduced TDR.


The part that makes this really nasty is it doesn't just impact webservers. IIS is highly leveraged by other Microsoft technologies, everything from WSUS to SMTP to Exchange to Sharepoint are affected. In my environment, I estimate that 3/4 of my servers are vulnerable.


It's not IIS. It's HTTP.SYS. New configs have Powershel remote or WinRM. They use http.Sys and are vulnerable.


Seems I'm wrong. Kernel cache has to be enabled explicitly and Powershell/WinRM don't do that. Whew.


We all dodged a bullet there.


They really should have made it clear that it's a mitigating factors and that most (some, many?) non-IIS uses wouldn't use kernel caching and thus be OK.


Made a online tool that tests for this vuln: https://lab.xpaw.me/MS15-034/?host=bing.com


I was wondering, is their a way to know the the type of webserver a website is using ? I mean can we do it using some kind of headers?


The "Server" response header will usually tell you but may omit a specific version depending on configuration.

Use "curl -I whatever.com" to send a HEAD request and look at the headers in the response.


You can also try Nmap, but apparently it's not able to tell too much if the server doesn't reply with a header:

  nmap -T5 -sV --version-all -p 80,443 www.google.com
  Starting Nmap 6.00 ( http://nmap.org ) at 2015-04-16 03:02 CEST
  Nmap scan report for www.google.com (80.202.12.244)
  Host is up (0.0015s latency).
  Other addresses for www.google.com (not scanned): 
  (...)
  rDNS record for 80.202.12.244: cache.google.com
  PORT    STATE SERVICE  VERSION
  80/tcp  open  http     Google httpd 2.0 (GFE)
  443/tcp open  ssl/http Google httpd 2.0 (GFE)
  Service Info: OS: Linux; CPE: cpe:/o:linux:kernel
Apparently stackoverflow (well know user of .net stack) is "unknown", but microsoft.com gives:

  nmap -T5 -sV --version-all -p 80,443 microsoft.com

  Starting Nmap 6.00 ( http://nmap.org ) at 2015-04-16 03:05 CEST
  Nmap scan report for microsoft.com (134.170.188.221)
  Host is up (0.18s latency).
  Other addresses for microsoft.com (not scanned): 
    134.170.185.46
  rDNS record for 134.170.188.221:  
    microsoftproductionstudios.org
  PORT    STATE SERVICE  VERSION
  80/tcp  open  http     Microsoft IIS httpd 8.5
  443/tcp open  ssl/http Microsoft IIS httpd 8.5
  Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
I didn't look to carefully at the so-output -- maybe there's a funky loadbalancer in front or something.


Tested against three servers, one patched and two not. Small test but it correctly identified which was which.


What did it say for the ones not vulnerable?


<sitename> is vulnerable.


It is not only about IIS. Various other SW use this API. For example Citrix Remote Receiver. And also various Antivirus Programs, use this HTTP interface – to be accessible from central management. Just try to execute “netsh show http urlacl” and you will see how many programs use it. Or you can use TCPView(Sysinternals) to see which ports are bound by "process" SYSTEM (pid 4).



http.sys lives at the bottom of HTTP processing/consumption stack, and that's where vulnerability is. HttpListener simply uses Windows HTTP stack's services, as IIS and others do.


It looks like HttpListener doesn't support kernel caching at all which means it's not vulnerable to this attack.


Just to clarify to everyone that this vulnerability has absolutely nothing to do with IIS web server. HTTP.SYS is not part of IIS. HTTP.SYS is the way HTTP/S hosting works on Windows. Any applications may use it, it is an API.

HTTP.SYS is a clever idea as it allows the 80/443 ports to be used by multiple processes, as long as they register unique base URLs. What's not so clever about it is that despite rigorous testing and validation against its codebase, that something like this slipped through. Historically, HTTP.SYS has had a pretty good track record (against all the odds) until this week.


So, IIS doesn't use http.sys?


It does. But this vulnerability is specifically with HTTP.SYS. HTTP.SYS is kind of like a SSL terminator and request router built into the OS.


It's surprising that this could even cause a crash, much less code execution, since if it really is an integer overflow I'd expect the range to wrap around (mod 2^n) and you'd just get a different part of the file you were requesting (e.g. with 32-bit maths, asking for bytes 0-4294967300 will return bytes 0-4 instead.) It looks more like a signed/unsigned confusion to me - the 1844...615 value is -1 if interpreted as a signed number, and even if this caused reading past the end of a buffer, the result would be more Heartbleed-like than code execution.

Just taking a guess here, but the code execution probably requires a POST request instead of GET. Nevertheless, it's still quite puzzling how something like this could occur.

Note: I have not tested this personally. Others here https://news.ycombinator.com/item?id=9380889 say they haven't been able to reproduce it.

Edit: apparently you need kernel caching of HTTP requests enabled, and at least one rule for caching, and the request has to satisfy that rule, in order to cause a crash.


FYI: I believe all you need to do is run Windows Update (and reboot) in order to get the patch for this.

I'm mentioning this because found I the Microsoft articles slightly unclear; they listed separate downloads for these updates and I wasn't sure if those updates were available via Windows Update or not.

However, it appears that running Windows Update is sufficient. I ran Windows Update on a 2008 R2 server running IIS. One of the updates it pulled down was "Security Update for Windows Server 2008 R2 x64 Edition (KB3042553) which is the KB article that references this vulnerability.

After Windows Update & a reboot, I used the curl snippet provided on the linked article to test my patched server. At this point it does not appear to be vulnerable to this issue.


I was wondering how the number, 18446744073709551615, was chosen as the magic number. Maybe it is from this?

http://en.wikipedia.org/wiki/Wheat_and_chessboard_problem

Edit: 2^64 - 1


But does it have a catchy name yet?

I suggest: Long-range



"Lone Ranger"


I suggest: IISIS


"Range Rover"


Heartattack.


I can confirm on Windows 2K8R2 and 2K12, with Kernel Caching enabled (as per default IIS settings) and without any Kernel Caching rules, that I can reproduce the issue using the cURL method.

Steps to reproduce.

Check server is vulnerable curl -v http://blah.com/ -H "Range: bytes=00-18446744073709551615"

You should see a Error 416.

Force crash curl -v http://blah.com/images/blah.jpg -H "Range: bytes=100-18446744073709551615" --and/or-- curl -v http://blah.com/images/blah.jpg -H "Range: bytes=40-18446744073709551615"

Note above: You have to specifically address a file AND use byte range 40 or 100 in my setup to make it bluescreen.

After Patching - Check Vulnerability curl -v http://blah.com/ -H "Range: bytes=00-18446744073709551615"

Response: Error 400: The request has an invalid header name

After Patching - Force Crash Test

curl -v http://blah.com/images/blah.jpg -H "Range: bytes=100-18446744073709551615"

Response: 206 Partial Content

Hope that helps.


Windows Update patched this yesterday, right? At least I see KB 3042553 listed in my update history from yesterday.


Isn't a lot of government using IIS? How long before someone starts attacking their services with this?

Is Azure vulnerable?


There's a chance the Azure load-balancer might filter out malicious requests; but I wouldn't know for sure. One of the boxes I have on Azure didn't crash.


Probably patched already.


The patches for the MS Server OSes are at: https://support.microsoft.com/en-us/kb/3042553

It's a little unclear that this was patched as part of last night's Patch Tuesday.


We just patched our webservers last night. This morning, I see 9 more patches available, including this one.


So unchecked arithmetic is the culprit, again? And this would seem to be the kind of thing that could get passed through frontends unless they already cached a result.


I have written vulnerability testers in Powershell and C# varieties:

https://gist.github.com/Zagrophyte/ea086087e6fd7ca579ef (Powershell)

https://gist.github.com/Zagrophyte/0fa7a8e2e507fac2b59d (C#)


Does anyone know how this affects azure?


After running windows update my machine went from responding with

HTTP Error 416. The requested range is not satisfiable.

to

HTTP Error 400. The request has an invalid header name.


Well, it's just gone 3am here in the UK. I can finally install the update.


Is Windows Server 2008 Standard Edition also affected or just 2008 R2?


The subject line says HTTP only. Does this attack work over HTTPS?


yes, at least the BSOD aspect. I haven't been able to confirm remote code execution, but I was able to BSOD IIS 8.5 via this method over http and https.


Does anyone have an example of the remote code execution?


[dead]


They pretty much have. Sometimes people make mistakes that lead to vulnerabilities like this. It will be patched soon, then forgotten, and life will return to normal for everyone using IIS. We'll still run http in the kernel for performance purposes and everyone will conclude that no damage was really done. People will still use the same tech.. this vulnerability is not game changing and it'll be business as normal.


Lets not play the "my team is better than your team" hysterics, especially when we all had to do emergency patching for shellshock, heartbleed, samba, etc in the past couple months. Hell, sambra runs as root too.

There's a lot of security stupidity out there. I'm still waiting for a unixy OS to be written in something like Rust.


I know. Linux fan boys have the most intense selection bias. Check LWN to see this weeks distro security updates... somehow that doesn't count.

I'm with you on the rust kernel thing. All big piles of c code have the same problems.


aweomse


> Details are withheld for now

At least for us. DHS/NSA already has them thanks to Microsoft's renewed commitment to share "cyber-threat" data with them (a.k.a zero-days).


> DHS/NSA already has them

Every major security company has them thanks to MAPP. I don't quite understand why people have such a problem with this program.

You also can't ignore that the most recent linux vulnerabilities were privately disclosed to major vendors weeks ahead of time, as well.


I'm actually sort of glad that my national defense forces get a jump on this stuff. Especially if it's only a few days or a week to secure their systems and (for the clandestine services) to retool their exploits. I believe there are actual clandestine actions in the national interest happening and it would be nice to see those enabled. (e.g. Stuxnet/sabotaging foreign nuclear weapons development)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: