Another “Interesting Thing I Learned” Post: HTTP TRACE
I was messing around as usual and playing with the HTTP TRACE method (No I didn't learn about trace, I already knew about it... what I learned is coming up and is more interesting than just the method itself). For those of you that don't know, think of it as an internal ECHO function. The idea being that you can ensure no proxies / content filters are mangling your HTTP requests.
Example:
C:\Users\Tyler>nc shell 80
TRACE * HTTP/1.0
X-PAD: Read ComputerDefense.org!!HTTP/1.1 200 OK
Date: Sun, 29 Jul 2007 02:33:18 GMT
Server: Apache/2.0.55 (Ubuntu) PHP/5.1.2
Connection: close
Content-Type: message/httpTRACE * HTTP/1.0
X-PAD: Read ComputerDefense.org!!
As you can see... everything is simply echo'd back.
That isn't what I learned though.... here's the interesting stuff...
Apache (Ubuntu) using HTTP 1.0:
C:\Users\Tyler>nc shell 80
TRACE * HTTP/1.0HTTP/1.1 200 OK
Date: Sun, 29 Jul 2007 02:38:51 GMT
Server: Apache/2.0.55 (Ubuntu) PHP/5.1.2
Connection: close
Content-Type: message/httpTRACE * HTTP/1.0
Apache (Ubuntu) using HTTP 1.1:
C:\Users\Tyler>nc shell 80
TRACE * HTTP/1.1
HOST: localhostHTTP/1.1 200 OK
Date: Sun, 29 Jul 2007 02:40:24 GMT
Server: Apache/2.0.55 (Ubuntu) PHP/5.1.2
Transfer-Encoding: chunked
Content-Type: message/http25
TRACE * HTTP/1.1
HOST: localhost0
Note that Apache responds to the 1.1 request using 'Transfer-Encoding: chunked'
Now let's look at IIS
IIS 5.0 (Windows 2000) using HTTP 1.0:
C:\Users\Tyler>nc win2000 80
TRACE * HTTP/1.0HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jul 2007 05:43:04 GMT
Content-Type: message/http
Content-Length: 18TRACE * HTTP/1.0
IIS 5.0 (Windows 2000) using HTTP 1.1:
C:\Users\Tyler>nc win2000 80
TRACE * HTTP/1.1
HOST: localhostHTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jul 2007 05:43:10 GMT
Content-Type: message/http
Content-Length: 34TRACE * HTTP/1.1
HOST: localhost
Notice the differences? IIS when using HTTP 1.1 doesn't respond with Chunked Encoding. This isn't anything major, but I did find it interesting. I should note that these are both default installs, you may see different results on other systems.
So there's a simple way to distinguish between IIS and Apache (default setups) without looking at the banner. There are actually two additional differences in the outputs displayed above... Try and find them... click Read More to see if you're right.
