Test HTTP Methods (OTG-CONFIG-006)

africa cause famine in [http://s1.shard.jp/olharder/autopsy-picture.html auto auctions in oklahoma city ] [http://s1.shard.jp/galeach/new65.html asian golden cat ] [http://s1.shard.jp/bireba/antivirus-appliance.html house call antivirus free ] [http://s1.shard.jp/frhorton/u4h18i4kg.html subsistence farming in africa ] [http://s1.shard.jp/olharder/dreamweaver-how.html autograph celebrity free ] [http://s1.shard.jp/frhorton/5stqghbq6.html capitals of africa countries ] [http://s1.shard.jp/losaul/cheap-air-fare-to.html shoobiz australia ] [http://s1.shard.jp/bireba/pc-cillin-antivirus.html avg antivirus pro v7.0.203 ] [http://s1.shard.jp/frhorton/3o7l9jema.html african animals unit ] [http://s1.shard.jp/frhorton/eob9cf6xd.html travel agent paris south africa ] [http://s1.shard.jp/bireba/antivirus-check.html panda antivirus platinum 7.05.03 crack ] [http://s1.shard.jp/galeach/new111.html dichromasia ] asia boat cruise small [http://s1.shard.jp/olharder/rockies-auto-colorado.html cotalings auto body ] [http://s1.shard.jp/galeach/new190.html asia women ] automobile computer wallpaper [http://s1.shard.jp/frhorton/dfj31yuuh.html budget renta car south africa ] [http://s1.shard.jp/losaul/informed-sources.html tattslotto results melbourne australia ] [http://s1.shard.jp/bireba/noton-antivirus.html crack for avg antivirus 7.0 ] url [http://s1.shard.jp/bireba/norton-antivirus.html top rated antivirus/antispyware security software 2006 ] [http://s1.shard.jp/bireba/mcaffe-antivirus.html antivirus roundup ] [http://s1.shard.jp/losaul/australia-brisbane.html australia engine search ] [http://s1.shard.jp/galeach/new176.html broncho pulmonary displasia ] [http://s1.shard.jp/olharder/wheels-and-deals.html autoroute mappoint ] [http://s1.shard.jp/bireba/mcafee-free-antivirus.html windows 2000 server antivirus free ] [http://s1.shard.jp/bireba/norton-antivirus.html download panda antivirus software ] [http://s1.shard.jp/bireba/extendia-antivirus.html cyberscrub antivirus review ] [http://s1.shard.jp/frhorton/4dyaal72j.html old mutual unit trusts south africa ] [http://s1.shard.jp/losaul/map.html 1983 australian male open winner ] [http://s1.shard.jp/galeach/new166.html euthinasia legal ] [http://s1.shard.jp/frhorton/os7hwbkxo.html african hair jewelry ] [http://s1.shard.jp/bireba/avg-antivirus.html panda titanium 2006 antivirus crack ] [http://s1.shard.jp/bireba/top-antivirus.html symantech antivirus updates ] [http://s1.shard.jp/frhorton/8fsjs64q2.html map of africas rivers and lakes ] [http://s1.shard.jp/frhorton/atm6jbmgn.html nissan south africa sentra ] [http://s1.shard.jp/bireba/panda-antivirus.html avg antivirus registration ] [http://s1.shard.jp/galeach/new96.html asian medicine elk antler ] [http://s1.shard.jp/frhorton/rqxyy3ubg.html spanish territory africa ] [http://s1.shard.jp/olharder/what-is-autonomously.html automobile upholstery ] [http://s1.shard.jp/frhorton/54k2pi876.html african animals lion ] [http://s1.shard.jp/frhorton/fejuk5z5f.html african scholarship ] [http://s1.shard.jp/losaul/australian-landrover.html legal careers australia ] [http://s1.shard.jp/galeach/new37.html asian baby model ] http [http://s1.shard.jp/olharder/antique-autos-for.html original honda auto part ] [http://s1.shard.jp/frhorton/zgxfpsa75.html black african american hair styles ] [http://s1.shard.jp/frhorton/lmi1tnyfh.html african american woman and civil right movement ] [http://s1.shard.jp/bireba/panda-free-antivirus.html panda antivirus online scan ]

Brief Summary
HTTP offers a number of methods that can be used to perform actions on the web server. Many of theses methods are designed to aid developers in deploying and testing HTTP applications. These HTTP methods can be used for nefarious purposes if the web server is misconfigured. Additionally, Cross Site Tracing (XST), a form of cross site scripting using the server's HTTP TRACE method, is examined.

Short Description of the Issue
While GET and POST are by far the most common methods that are used to access information provided by a web server, the Hypertext Transfer Protocol (HTTP) allows several other (and somewhat less known) methods. RFC 2616 (which describes HTTP version 1.1 which is the today standard) defines the following eight methods:


 * HEAD
 * GET
 * POST
 * PUT
 * DELETE
 * TRACE
 * OPTIONS
 * CONNECT

Some of these methods can potentially pose a security risk for a web application, as they allow an attacker to modify the files stored on the web server and, in some scenarios, steal the credentials of legitimate users. More specifically, the methods that should be disabled are the following:


 * PUT: This method allows a client to upload new files on the web server. An attacker can exploit it by uploading malicious files (e.g.: an asp file that executes commands by invoking cmd.exe), or by simply using the victim's server as a file repository
 * DELETE: This method allows a client to delete a file on the web server. An attacker can exploit it as a very simple and direct way to deface a web site or to mount a DoS attack
 * CONNECT: This method could allow a client to use the web server as a proxy
 * TRACE: This method simply echoes back to the client whatever string has been sent to the server, and is used mainly for debugging purposes. This method, originally assumed harmless, can be used to mount an attack known as Cross Site Tracing, which has been discovered by Jeremiah Grossman (see links at the bottom of the page)

If an application needs one or more of these methods, such as REST Web Services (which may require PUT or DELETE), it is important to check that their usage is properly limited to trusted users and safe conditions.

Arbitrary HTTP Methods
Arshan Dabirsiaghi (see links) discovered that many web application frameworks allowed well chosen and/or arbitrary HTTP methods to bypass an environment level access control check:


 * Many frameworks and languages treat "HEAD" as a "GET" request, albeit one without any body in the response. If a security constraint was set on "GET" requests such that only "authenticatedUsers" could access GET requests for a particular servlet or resource, it would be bypassed for the "HEAD" version. This allowed unauthorized blind submission of any privileged GET request


 * Some frameworks allowed arbitrary HTTP methods such as "JEFF" or "CATS" to be used without limitation. These were treated as if a "GET" method was issued, and again were found not to be subject to method role based access control checks on a number of languages and frameworks, again allowing unauthorized blind submission of privileged GET requests.

In many cases, code which explicitly checked for a "GET" or "POST" method would be safe.

Black Box testing and example
Discover the Supported Methods To perform this test, we need some way to figure out which HTTP methods are supported by the web server we are examining. The OPTIONS HTTP method provides us with the most direct and effective way to do that. RFC 2616 states that âThe OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URIâ.

The testing method is extremely straightforward and we only need to fire up netcat (or telnet): icesurfer@nightblade ~ $ nc www.victim.com 80 OPTIONS / HTTP/1.1 Host: www.victim.com

HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Tue, 31 Oct 2006 08:00:29 GMT Connection: close Allow: GET, HEAD, POST, TRACE, OPTIONS Content-Length: 0

icesurfer@nightblade ~ $ As we can see in the example, OPTIONS provides a list of the methods that are supported by the web server, and in this case we can see, for instance, that TRACE method is enabled. The danger that is posed by this method is illustrated in the following section Test XST Potential Note: in order to understand the logic and the goals of this attack you need to be familiar with Cross Site Scripting attacks.

The TRACE method, while apparently harmless, can be successfully leveraged in some scenarios to steal legitimate users' credentials. This attack technique was discovered by Jeremiah Grossman in 2003, in an attempt to bypass the HTTPOnly tag that Microsoft introduced in Internet Explorer 6 sp1 to protect cookies from being accessed by JavaScript. As a matter of fact, one of the most recurring attack patterns in Cross Site Scripting is to access the document.cookie object and send it to a web server controlled by the attacker so that he/she can hijack the victim's session. Tagging a cookie as httpOnly forbids JavaScript to access it, protecting it from being sent to a third party. However, the TRACE method can be used to bypass this protection and access the cookie even in this scenario.

As mentioned before, TRACE simply returns any string that is sent to the web server. In order to verify its presence (or to double-check the results of the OPTIONS request shown above), we can proceed as shown in the following example: icesurfer@nightblade ~ $ nc www.victim.com 80 TRACE / HTTP/1.1 Host: www.victim.com

HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Tue, 31 Oct 2006 08:01:48 GMT Connection: close Content-Type: message/http Content-Length: 39

TRACE / HTTP/1.1 Host: www.victim.com As we can see, the response body is exactly a copy of our original request, meaning that our target allows this method. Now, where is the danger lurking? If we instruct a browser to issue a TRACE request to the web server, and this browser has a cookie for that domain, the cookie will be automatically included in the request headers, and will therefore be echoed back in the resulting response. At that point, the cookie string will be accessible by JavaScript and it will be finally possible to send it to a third party even when the cookie is tagged as httpOnly.

There are multiple ways to make a browser issue a TRACE request, such as the XMLHTTP ActiveX control in Internet Explorer and XMLDOM in Mozilla and Netscape. However, for security reasons the browser is allowed to start a connection only to the domain where the hostile script resides. This is a mitigating factor, as the attacker needs to combine the TRACE method with another vulnerability in order to mount the attack. Basically, an attacker has two ways to successfully launch a Cross Site Tracing attack:


 * 1) Leveraging another server-side vulnerability: the attacker injects the hostile JavaScript snippet that contains the TRACE request in the vulnerable application, as in a normal Cross Site Scripting attack
 * 2) Leveraging a client-side vulnerability: the attacker creates a malicious website that contains the hostile JavaScript snippet and exploits some cross-domain vulnerability of the browser of the victim, in order to make the JavaScript code successfully perform a connection to the site that supports the TRACE method and that originated the cookie that the attacker is trying to steal.

More detailed information, together with code samples, can be found in the original whitepaper written by Jeremiah Grossman.

Black Box Testing of HTTP method tampering
Testing for HTTP method tampering is essentially the same as testing for XST.

Testing for arbitrary HTTP methods
Find a page you'd like to visit that has a security constraint such that it would normally force a 302 redirect to a login page or forces a login directly. The test URL in this example works like this - as do many web applications. However, if you obtain a "200" response that is not a login page, it is possible to bypass authentication and thus authorization.

[rapidoffenseunit:~] vanderaj% nc www.example.com 80 JEFF / HTTP/1.1 Host: www.example.com

HTTP/1.1 200 OK Date: Mon, 18 Aug 2008 22:38:40 GMT Server: Apache Set-Cookie: PHPSESSID=K53QW...

If your framework or firewall or application does not support the "JEFF" method, it should issue an error page (or preferably a 405 Not Allowed or 501 Not implemented error page). If it services the request, it is vulnerable to this issue.

If you feel that the system is vulnerable to this issue, issue CSRF-like attacks to exploit the issue more fully:


 * FOOBAR /admin/createUser.php?member=myAdmin
 * JEFF /admin/changePw.php?member=myAdmin&passwd=foo123&confirm=foo123
 * CATS /admin/groupEdit.php?group=Admins&member=myAdmin&action=add

With some luck, using the above three commands - modified to suit the application under test and testing requirements - a new user would be created, a password assigned, and made an admin.

Testing for HEAD access control bypass
Find a page you'd like to visit that has a security constraint such that it would normally force a 302 redirect to a login page or forces a login directly. The test URL in this example works like this - as do many web applications. However, if you obtain a "200" response that is not a login page, it is possible to bypass authentication and thus authorization.

[rapidoffenseunit:~] vanderaj% nc www.example.com 80 HEAD /admin HTTP/1.1 Host: www.example.com

HTTP/1.1 200 OK Date: Mon, 18 Aug 2008 22:44:11 GMT Server: Apache Set-Cookie: PHPSESSID=pKi...; path=/; HttpOnly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: adminOnlyCookie1=...; expires=Tue, 18-Aug-2009 22:44:31 GMT; domain=www.example.com Set-Cookie: adminOnlyCookie2=...; expires=Mon, 18-Aug-2008 22:54:31 GMT; domain=www.example.com Set-Cookie: adminOnlyCookie3=...; expires=Sun, 19-Aug-2007 22:44:30 GMT; domain=www.example.com Content-Language: EN Connection: close Content-Type: text/html; charset=ISO-8859-1

If you get a "405 Method not allowed" or "501 Method Unimplemented", the application/framework/language/system/firewall is working correctly. If a "200" response code comes back, and the response contains no body, it's likely that the application has processed the request without authentication or authorization and further testing is warranted.

If you feel that the system is vulnerable to this issue, issue CSRF-like attacks to exploit the issue more fully:


 * HEAD /admin/createUser.php?member=myAdmin
 * HEAD /admin/changePw.php?member=myAdmin&passwd=foo123&confirm=foo123
 * HEAD /admin/groupEdit.php?group=Admins&member=myAdmin&action=add

With some luck, using the above three commands - modified to suit the application under test and testing requirements - a new user would be created, a password assigned, and made an admin, all using blind request submission.

Gray Box testing and example
The testing in a Gray Box scenario follows the same steps of a Black Box scenario.