s2.owncloud.com: Web Server HTTP Trace/Track Method Support Cross-Site Tracing Vulnerability
The web server on s2.owncloud.com:83 accepted HTTP TRACE requests and echoed the request back to the client. An attacker who can run active content in a victim's browser could use this to read the victim's authentication credentials, though the text notes this is unlikely and difficult.
- Triaged in under an hour
- Fixed in 5 months
- Disclosed after 6 months
DOMAIN: s2.owncloud.com PORT: 83
THREAT: The Web server was detected that supports the HTTP TRACE method. This method allows debugging and connection trace analysis for connections from the client to the Web server. Per the HTTP specification, when this method is used, the Web server echoes back the information sent to it by the client unmodified and unfiltered. Microsoft IIS web server uses an alias TRACK for this method, and is functionally the same. A vulnerability related to this method was discovered. A malicious, active component in a Web page can send Trace requests to a Web server that supports this Trace method. Usually, browser security disallows access to Web sites outside of the present site's domain. Although unlikely and difficult to achieve, it's possible, in the presence of other browser vulnerabilities, for the active HTML content to make external requests to arbitrary Web servers beyond the hosting Web server. Since the chosen Web server then echoes back the client request unfiltered, the response also includes cookie-based or Web-based (if logged on) authentication credentials that the browser automatically sent to the specified Web application on the specified Web server. The significance of the Trace capability in this vulnerability is that the active component in the page visited by the victim user has no direct access to this authentication information, but gets it after the target Web server echoes it back as its Trace response. Since this vulnerability exists as a support for a method required by the HTTP protocol specification, most common Web servers are vulnerable. The exact method(s) supported, Trace and/or Track, and their responses are in the Results section below. Track / Trace are required to be disabled to be PCI compliance.
IMPACT: If this vulnerability is successfully exploited, users of the Web server may lose their authentication credentials for the server and/or for the Web applications hosted by the server to an attacker. This may be the case even if the Web applications are not vulnerable to cross site scripting attacks due to input validation errors.
SOLUTION: Solutions for some of the common Web servers are supplied below. For other Web servers, please check your vendor's documentation. Apache: Recent Apache versions have a Rewrite module that allows HTTP requests to be rewritten or handled in a specific way. Compile the Apache server with the mod_rewrite module. You might need to uncomment the 'AddModule' and 'LoadModule' directives in the httpd.conf configuration file. Add the following lines for each virtualhost in your configuration file (Please note that, by default, Rewrite configurations are not inherited. This means that you need to have Rewrite directives for each virtual host in which you wish to use it):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
</IfModule>
With this configuration, Apache catches all TRACE requests, and replies with a page reporting the request as forbidden. None of the original request's contents are echoed back. A slightly tighter fix is to use:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)$
RewriteRule .* - [F]
</IfModule>
Please note that RewriteEngine can be processor intensive and may impact the web server performance. The trace method can also be controlled by use of the TraceEnable directive. In the httpd.conf add or modify: TraceEnable Off
Microsoft IIS: Microsoft released URLScan, which can be used to screen all incoming requests based on customized rulesets. URLScan can be used to sanitize or disable the TRACE requests from the clients. Note that IIS aliases 'TRACK' to 'TRACE'. Therefore, if URLScan is used to specfically block the TRACE method, the TRACK method should also be added to the filter. URLScan uses the 'urlscan.ini' configuration file, usually in \System32\InetSrv\URLScan directory. In that, we have two sections - AllowVerbs and DenyVerbs. The former is used if the UseAllowVerbs variable is set to 1, else (if its set to 0), the DenyVerbs are used. Clearly, either can be used, depending on whether we want a Default-Deny-Explicit-Allow or a Default-Allow-Explicit-Deny policy. To disallow TRACE and TRACK methods through URLScan, first remove 'TRACK', 'TRACE' methods from the 'AllowVerbs' section and add them to the 'DenyVerbs' section. With this, URLScan will disallow all 'TRACE' and 'TRACK' methods, and generate an error page for all requests using that method. To enable the changes, restart the 'World Wide Web Publishing Service' from the 'Services' Control Panel item.
RESULTS:
TRACE /QUALYS12680.html HTTP/1.1
Host: s2.owncloud.com:83
HTTP/1.1 200 OK
Date: Fri, 21 Aug 2015 10:57:04 GMT
Server: Apache/2.2.22 (Linux/SUSE)
Connection: close
Transfer-Encoding: chunked
Content-Type: message/http
TRACE /QUALYS12680.html HTTP/1.1
Host: s2.owncloud.com:83
Connection: Keep-Alive
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
If exploited, users could lose their authentication credentials to an attacker, although the text says this is unlikely and difficult to achieve and depends on other browser vulnerabilities.
What the attacker needed
Victim visits a malicious page; browser has additional vulnerabilities; server allows TRACE method
The fix
The TRACE method should be disabled on the web server, for example with Apache's TraceEnable directive or by blocking it with mod_rewrite.
How it was found
- Send an HTTP TRACE request to the server.
- Observe that the server responds with 200 OK and echoes the request back.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
HTTP has a debugging method called TRACE that makes the server send back exactly what it received. If a browser sends cookies automatically, those cookies can be reflected back and read by a malicious script. This is called cross-site tracing, and it is only a risk when combined with other browser weaknesses.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.