plugins.trac.wordpress.org likely vulnerable to Cross Site Tracing (xst), TRACE HTTP method should be disabled
The server at plugins.trac.wordpress.org answered HTTP TRACE requests and echoed the request headers back to the caller. An attacker who can already run script in a victim's browser could use this to read cookies marked HttpOnly or the Authorization header, and crafted header values could also cause script injection in log-reading tools.
- Fixed in 6 days
- Paid in 5 months
- Disclosed after 2.5 years
Background
A Cross-Site Tracing (XST) attack involves the use of Cross-site Scripting (XSS) and the TRACE HTTP method. According to RFC 2616, "TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information." XST could be used as a method to steal user's cookies via Cross-site Scripting (XSS) even if the cookie has the "HttpOnly" flag set and/or exposes the user's Authorization header.
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.
Modern browsers now prevent TRACE requests being made via JavaScript, however, other ways of sending TRACE requests with browsers have been discovered, such as using Java and Flash.
PoC
curl -X TRACE -H "X-Header: geeknik/pentest" https://plugins.trac.wordpress.org
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
X-Header: geeknik/pentest
Since the server responds to this request, including echoing back my fake header, it is likely vulnerable to XST attacks and the step outlined in the mitigation section should be taken as soon as possible.
Secondary PoC
Depending on how the server logs are collected and read, it may be possible to trigger XSS flaws in secondary applications using this method:
curl -X TRACE -H "Via: <svg/onload=alert('XSS')>" https://plugins.trac.wordpress.org
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
Via: <svg/onload=alert('XSS')>
Mitigation
In Apache versions 1.3.34, 2.0.55 and later, set the TraceEnable directive to off in the main configuration file and then restart Apache.
Context
Cross-Site Tracing (XST) is an attack technique that combines Cross-site Scripting (XSS) with the TRACE HTTP method. According to RFC 2616, TRACE "allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information." In practice, a server that answers TRACE echoes the request back to the caller, headers included.
The target here is plugins.trac.wordpress.org. The report treats it as a web server that may have the TRACE method enabled, and asks whether that default should be turned off.
The technique was discovered by Jeremiah Grossman in 2003, in an attempt to bypass the HttpOnly flag that Microsoft introduced in Internet Explorer 6 SP1 to protect cookies from JavaScript. The recurring pattern in XSS is to read document.cookie and send it to an attacker-controlled server to hijack the victim's session. Marking a cookie HttpOnly forbids JavaScript from reading it, which protects it from being sent to a third party. The TRACE method can be used to bypass this protection and access the cookie even in that scenario, and it can also expose the user's Authorization header.
Modern browsers now prevent TRACE requests being made via JavaScript. Other ways of sending TRACE requests with browsers have been discovered, such as using Java and Flash.
Setup
The only tool shown in the report is curl, invoked from the command line against the public host. No account, role or special precondition is described: the request is sent unauthenticated to the site. The report does not state which server software or version the target runs, only that the mitigation it recommends applies to Apache.
Finding it
The researcher sent a TRACE request carrying a custom header with a recognisable value and checked whether the server echoed that header back. Because the server responded to the request and included the fake header in the response, the researcher judged the host likely vulnerable to XST attacks and asked for the mitigation to be applied as soon as possible.
Exploitation
Step 1: Send a TRACE request with a marker header
curl -X TRACE -H "X-Header: geeknik/pentest" https://plugins.trac.wordpress.org
-X TRACE selects the method, and -H adds a header whose value is easy to spot in the output. The request that reaches the server looks like this:
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
X-Header: geeknik/pentest
The important part is the X-Header line: if the response contains it, the server is reflecting the full request back to the client, which is exactly the behaviour XST relies on. The report states that the server responded to this request and echoed the fake header back.
Step 2: Test whether the echo can carry script into log viewers
curl -X TRACE -H "Via: <svg/onload=alert('XSS')>" https://plugins.trac.wordpress.org
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
Via: <svg/onload=alert('XSS')>
This secondary proof of concept places an HTML payload in the Via header. The report explains the idea: depending on how the server logs are collected and read, it may be possible to trigger XSS flaws in secondary applications using this method. In other words, the echoed or logged header value can end up rendered by a tool that reads the logs, and the payload fires there rather than in the browser of the original requester.
Root cause
The design flaw is that the server accepts and answers the TRACE method, reflecting the request back to the caller, including the custom header that was sent. HttpOnly does not help, because the value is not read through document.cookie; it is read from the echoed request.
The report does not analyse the server configuration beyond this. The mitigation it gives is the Apache TraceEnable directive.
Impact
XST can be used to steal a user's cookies via XSS even when the cookie has the HttpOnly flag set, and it can expose the user's Authorization header. The report hedges the practical reach: the TRACE method, while apparently harmless, can be successfully leveraged in some scenarios to steal legitimate users' credentials. Modern browsers block TRACE from JavaScript, so an attacker needs another route to send the request, such as Java or Flash. The secondary impact, XSS in log-reading applications, is likewise conditional: it depends on how the server logs are collected and read.
Fix
In Apache versions 1.3.34, 2.0.55 and later, set the TraceEnable directive to off in the main configuration file and then restart Apache. The report frames this as the step to take as soon as possible; it does not describe a change that was actually made to the host.
Variants to test
- Send TRACE with a cookie header and check whether the cookie value appears in the response body. A positive result is the full request, cookie included, echoed back.
- Send TRACE with an
Authorizationheader and look for the credential in the response. A positive result exposes the header value to anyone who can make the request. - Send TRACE with an HTML or script payload in a header such as
Viaand inspect any log viewer or dashboard that displays request headers. A positive result is the payload rendering as markup or executing in that secondary application. - Try the same request through browser-side channels other than JavaScript, since modern browsers block TRACE from script. A positive result is the request reaching the server and the echo coming back.
Hunting notes
This kind of issue can appear on hosts that answer the TRACE method. The signal during recon is simple: a TRACE request that returns the request back, headers included. The researcher demonstrated it with a single marker header and a second request carrying a payload in Via, which is enough to show both the echo and the log-injection angle without needing an account or any other precondition.
What happened, in plain words
A security researcher found that plugins.trac.wordpress.org appears to answer a special kind of web request called TRACE. When a server answers TRACE, it sends the whole request back to whoever asked, including every header the request carried. That echo is the problem: the server hands back whatever headers the request carried. The researcher showed this with two simple commands and recommended a one-line server setting to switch TRACE off.
To follow the rest of this article you only need to know how to open a browser and a terminal. Every technical word is explained where it first appears, and there is a glossary at the end.
Context
What XST is
Cross-Site Tracing, shortened to XST, is an attack technique that combines two other things: Cross-site Scripting (XSS) and the TRACE HTTP method.
- HTTP is the language browsers and web servers use to talk to each other. Every time you load a page, your browser sends an HTTP request and the server sends an HTTP response.
- An HTTP method is the verb at the start of a request. It tells the server what kind of action you want. The two you meet every day are
GET(give me this page) andPOST(here is some data, please process it).TRACEis a much rarer method, and it means something like "send my request back to me so I can see what it looks like". - A header is a small labelled line attached to a request or response, carrying extra information. Think of the address block on an envelope: the letter is the body, and the headers are the labels the postal service reads, such as the sender, the destination and the handling instructions. Cookies and login credentials travel in headers.
- Cross-site Scripting (XSS) is a class of bug where an attacker manages to get their own JavaScript code to run inside someone else's browser session on a trusted website. The code then acts with that user's permissions.
According to RFC 2616, the document that defined how HTTP works, TRACE "allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information." In plain words: TRACE is a debugging tool. You ask the server to repeat your request back, so you can check what actually arrived. In practice, a server that answers TRACE echoes the request back to the caller, headers included.
Why the echo matters
A cookie is a small piece of data a website stores in your browser so it can recognise you on the next request. The most important cookie is usually the session cookie: it is the ticket that proves you are logged in. If someone copies that ticket, they can act as you without knowing your password. This is called session hijacking.
Because cookies are so valuable, browsers and servers have a protection called HttpOnly. It is a flag set on a cookie that tells the browser: JavaScript on the page is not allowed to read this cookie. The idea is that even if an attacker gets JavaScript running on the page through XSS, that script cannot pick up the session cookie and send it away.
The recurring pattern in XSS is exactly that: read document.cookie (the browser's JavaScript handle for the page's cookies) and send the value to an attacker-controlled server to hijack the victim's session. Marking a cookie HttpOnly forbids JavaScript from reading it, which protects it from being sent to a third party.
TRACE sidesteps this. The cookie is not read through document.cookie at all. It is read from the echoed request, which repeats the headers that were sent. The TRACE method can therefore be used to bypass the HttpOnly protection and access the cookie even in that scenario. It can also expose the user's Authorization header, the header that carries login credentials when a site uses token-based or basic authentication instead of cookies.
Who found it and when
The technique was discovered by Jeremiah Grossman in 2003, in an attempt to bypass the HttpOnly flag that Microsoft introduced in Internet Explorer 6 SP1 to protect cookies from JavaScript.
The browser problem
Modern browsers now prevent TRACE requests being made via JavaScript. That closes the most obvious route, but other ways of sending TRACE requests with browsers have been discovered, such as using Java and Flash. So the protection is partial: the browser blocks one path, not every path.
The target
The target here is plugins.trac.wordpress.org.
- WordPress is a widely used system for building websites. It has a public directory of plugins, which are add-on packages that extend what a WordPress site can do.
- Trac is a web application used by software projects to browse source code, track tickets and show changes. Here it is the site where the plugin repository lives.
The report treats it as a web server that may have the TRACE method enabled, and asks whether that default should be turned off.
Setup
The only tool shown in the report is curl, invoked from the command line against the public host.
- curl is a command-line program that sends HTTP requests and prints the responses. It is useful precisely because it lets you send requests a browser would not normally send, such as TRACE.
- The command line (also called the terminal) is a text window where you type commands instead of clicking buttons.
No account, role or special precondition is described: the request is sent unauthenticated to the site. Unauthenticated means without logging in, so anyone on the internet could send it. The report does not state which server software or version the target runs, only that the mitigation it recommends applies to Apache.
- Apache is one of the most common web server programs. A web server is the software that receives HTTP requests and sends back pages and other content.
Finding it
The researcher sent a TRACE request carrying a custom header with a recognisable value and checked whether the server echoed that header back. The logic is simple: if you put a unique marker in the request and the marker comes back in the response, the server is repeating the whole request, not just answering it. Because the server responded to the request and included the fake header in the response, the researcher judged the host likely vulnerable to XST attacks and asked for the mitigation to be applied as soon as possible.
Exploitation
Step 1: Send a TRACE request with a marker header
curl -X TRACE -H "X-Header: geeknik/pentest" https://plugins.trac.wordpress.org
Line by line:
curlruns the tool.-X TRACEselects the method. Instead of the usualGET, the request asks the server to trace it.-H "X-Header: geeknik/pentest"adds a header.X-Headeris a made-up name (headers starting withX-are conventionally custom ones), andgeeknik/pentestis a value chosen so it is easy to spot in the output. It is a marker, like writing your name on a banknote to see whether it comes back.https://plugins.trac.wordpress.orgis the address being contacted.
Why this step: the goal is to see whether the server echoes the request. A marker header makes that visible at a glance.
The request that reaches the server looks like this:
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
X-Header: geeknik/pentest
Line by line:
TRACE / HTTP/1.1is the request line: the method (TRACE), the path being requested (/, the site root) and the HTTP version (1.1).User-Agent: curl/7.26.0identifies the client software. Here it says the request came from curl version 7.26.0.Host: plugins.trac.wordpress.orgnames the site the request is for. One server can host many sites, so this line tells it which one.Accept: */*says the client will accept any content type in the response.X-Header: geeknik/pentestis the marker header added by the command.
The important part is the X-Header line: if the response contains it, the server is reflecting the full request back to the client, which is exactly the behaviour XST relies on. The report states that the server responded to this request and echoed the fake header back.
Step 2: Test whether the echo can carry script into log viewers
curl -X TRACE -H "Via: <svg/onload=alert('XSS')>" https://plugins.trac.wordpress.org
Line by line:
curlruns the tool again.-X TRACEsends the same TRACE method as before.-H "Via: <svg/onload=alert('XSS')>"adds a header namedVia.Viais a real HTTP header meant to record which proxies a request passed through. Its value here is not a proxy name but an HTML snippet: an<svg>element with anonloadattribute containing JavaScript. If a program renders that snippet as HTML, theonloadcode runs and shows an alert box with the textXSS.https://plugins.trac.wordpress.orgis the same address.
Why this step: the first test showed that the server repeats what you send. The second test asks a different question: what happens to that repeated text afterwards? If the request is written into a log file and some other tool later displays the log as a web page, the payload could run inside that tool.
TRACE / HTTP/1.1
User-Agent: curl/7.26.0
Host: plugins.trac.wordpress.org
Accept: */*
Via: <svg/onload=alert('XSS')>
Line by line:
TRACE / HTTP/1.1is the request line, same as before.User-Agent: curl/7.26.0identifies curl as the client.Host: plugins.trac.wordpress.orgnames the site.Accept: */*accepts any content type.Via: <svg/onload=alert('XSS')>is the payload header. The angle brackets and theonloadattribute are what make it dangerous if rendered as HTML rather than shown as plain text.
This secondary proof of concept places an HTML payload in the Via header. The report explains the idea: depending on how the server logs are collected and read, it may be possible to trigger XSS flaws in secondary applications using this method. In other words, the echoed or logged header value can end up rendered by a tool that reads the logs, and the payload fires there rather than in the browser of the original requester.
- A log is a file where a server records what happened, request by request. Administrators read logs to debug problems and spot attacks.
- A secondary application is any other program that consumes those logs, such as a dashboard or a log viewer. It is "secondary" because it is not the site under attack; it is a downstream tool that trusted the log content.
Root cause
The design flaw is that the server accepts and answers the TRACE method, reflecting the request back to the caller, including the custom header that was sent.
- The response body is the actual content of the reply, as opposed to its headers. For a normal page it is the HTML; here it is the echoed request.
HttpOnly does not help, because the value is not read through document.cookie; it is read from the echoed request. The protection was designed to stop JavaScript from reading the cookie, and this route never asks JavaScript to read it.
The report does not analyse the server configuration beyond this. The mitigation it gives is the Apache TraceEnable directive.
- A directive is a configuration instruction in a server's settings file.
- A default is the behaviour a program has when nobody changes the settings. Defaults matter because many servers are never reviewed, so whatever the default allows stays allowed.
Impact
XST can be used to steal a user's cookies via XSS even when the cookie has the HttpOnly flag set, and it can expose the user's Authorization header. The report hedges the practical reach: the TRACE method, while apparently harmless, can be successfully leveraged in some scenarios to steal legitimate users' credentials. Modern browsers block TRACE from JavaScript, so an attacker needs another route to send the request, such as Java or Flash. The secondary impact, XSS in log-reading applications, is likewise conditional: it depends on how the server logs are collected and read.
Fix
In Apache versions 1.3.34, 2.0.55 and later, set the TraceEnable directive to off in the main configuration file and then restart Apache. The report frames this as the step to take as soon as possible; it does not describe a change that was actually made to the host.
- The main configuration file is the central settings file Apache reads when it starts.
- Restarting the server means stopping and starting it so it reloads its settings. Changing the file alone does nothing until the server reads it again.
Variants to test
- Send TRACE with a cookie header and check whether the cookie value appears in the response body. A positive result is the full request, cookie included, echoed back.
- Send TRACE with an
Authorizationheader and look for the credential in the response. A positive result exposes the header value to anyone who can make the request. - Send TRACE with an HTML or script payload in a header such as
Viaand inspect any log viewer or dashboard that displays request headers. A positive result is the payload rendering as markup or executing in that secondary application. - Try the same request through browser-side channels other than JavaScript, since modern browsers block TRACE from script. A positive result is the request reaching the server and the echo coming back.
Hunting notes
This kind of issue can appear on hosts that answer the TRACE method. The signal during recon (short for reconnaissance, the early phase where you look around a target to see what it exposes) is simple: a TRACE request that returns the request back, headers included. The researcher demonstrated it with a single marker header and a second request carrying a payload in Via, which is enough to show both the echo and the log-injection angle without needing an account or any other precondition.
Glossary
- Apache: a widely used web server program that receives HTTP requests and sends back responses.
- Authorization header: an HTTP header that carries login credentials, used by sites that authenticate with tokens or basic authentication instead of cookies.
- Cookie: a small piece of data a website stores in your browser so it can recognise you on later requests; the session cookie is the ticket that proves you are logged in.
- Cross-site Scripting (XSS): a bug class where an attacker gets their own JavaScript to run inside another user's browser session on a trusted site.
- Cross-Site Tracing (XST): an attack technique that combines XSS with the TRACE method to read request headers, including cookies and credentials, from the echoed request.
- curl: a command-line program that sends HTTP requests and prints the responses.
- Default: the behaviour a program has when nobody changes its settings.
- Directive: a configuration instruction in a server's settings file.
- Header: a small labelled line attached to an HTTP request or response carrying extra information, such as cookies or credentials.
- Host header: the header that names which site on a server a request is for.
- HTTP: the language browsers and web servers use to exchange requests and responses.
- HttpOnly: a flag on a cookie that forbids JavaScript on the page from reading it.
- Log: a file where a server records what happened, request by request.
- Main configuration file: the central settings file a server reads when it starts.
- Method: the verb at the start of an HTTP request, such as
GET,POSTorTRACE, telling the server what kind of action is wanted. - Plugin: an add-on package that extends what a WordPress site can do.
- Recon: reconnaissance, the early phase of looking around a target to see what it exposes.
- Response body: the actual content of an HTTP reply, as opposed to its headers.
- Restart: stopping and starting a server so it reloads its settings.
- RFC 2616: the document that defined how HTTP works and described what TRACE is for.
- Secondary application: another program that consumes a server's logs, such as a dashboard or log viewer.
- Session hijacking: taking over someone's logged-in session by copying their session cookie or credentials.
- Terminal (command line): a text window where you type commands instead of clicking buttons.
- Trac: a web application used by software projects to browse source code, track tickets and show changes.
- TRACE: an HTTP method that asks the server to send the request back to the caller, headers included, for debugging.
- TraceEnable: the Apache directive that controls whether the TRACE method is answered.
- Unauthenticated: sent without logging in, so available to anyone on the internet.
- User-Agent: the header that identifies the client software making a request.
- Via: an HTTP header meant to record which proxies a request passed through.
- WordPress: a widely used system for building websites, with a public directory of plugins.