I guess I have to play devil’s advocate again but I have to do what I have to do. So here we are, almost two weeks away from OWASP. Me setting in front my PC, laying out some ideas for latter. Two days ago, I started experimenting with some XSS/CSRF vectors and I came up with things I would rather not talk about… at least not now.
One thing I should talk about is pretty much the same old story about how various JSON services help attackers to build quite sophisticated attack infrastructures. I was accused of being too much full-disclosure with my research but again, everyone has a role to play in this game and believe me or not I am one of the good guys.
I will start my discussion by linking to XSSED.com. If you don’t know what is XSSED.com I would suggest to go and check what it does right now. Are you done? OK! To summarize XSSED.com has the largest archive of real, fully working, XSS vulnerabilities available today. They even have a list of XSS vulnerabilities that are found in websites ranked 500 and bellow according to ALEXA. We are talking about high profile websites here people.
Why this database is interesting to attackers? Well, obviously, attackers can use it to phish users and steal important/sensitive information. In a very typical scenario, the attacker will grab a few of these XSS vectors, develop exploits for them, and send them to as many victims as possible. Of course the situation is quite grim. However, it is a lot worse then that. As far as I know Billy Hoffman will give a talk on super worms at BlackHat US07, so I will try not to spoil his fun. However, here is something that I came up with which unfolds the true power of AJAX worms. I would like to show you how devastating they may become in the not that distant future.
Like my previous examples, I am using Yahoo Pipes and Dapper. The first thing an attacker will do, when preparing for an attack with a massive impact, is to obtain the TOP Pagerank List from XSSED.com in a way that can be easily fetched with JavaScript. For that purpose he/she needs to create a simple but powerful DAP which scrapes the second column from the cental table in this page. The DAP produces a simple XML file which looks more or less like the following:
<?xml version="1.0" encoding="iso-8859-1"?>
<elements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.dapper.net/websiteServices/generate-dapp-xsd.php?dappName=XSSEDTOPPagerankReader">
<dapper>
<dappName>XSSEDTOPPagerankReader</dappName>
<dappTitle>XSSED TOP Pagerank Reader</dappTitle>
<urls>
<url>http://xssed.com/pagerank</url>
</urls>
<applyToUrl>http://xssed.com/pagerank</applyToUrl>
<executionTime>0.892</executionTime>
<ranAt>2007-05-29 10:28:35</ranAt>
<encoding>iso-8859-1</encoding>
</dapper>
<items fieldName="items" href="http://xssed.com/mirror/1314/" originalElement="a" type="field">it.search.yahoo.com</items>
<items fieldName="items" href="http://xssed.com/mirror/1310/" originalElement="a" type="field">de.search.yahoo.com</items>
...
if you look closely into the XML structure, you will see that the items entries contain information about the domain that is vulnerable to XSS and also the URL that describes that actual vector. The XML file contain more then 300 records but for practical reason I eliminated all entries but only the first two.
Till this point, the attacker has a list of sites ranked 500 and bellow that are vulnerable to XSS. The next step is to extract the actual vector. If you access any of the links listed inside the XML file shown above, you will be taken to the page that contains the XSS vector for the item. In order to extract this vector, the attacker needs to use another DAP which produces a result that looks like more or less like the following:
<?xml version="1.0" encoding="iso-8859-1"?>
<elements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.dapper.net/websiteServices/generate-dapp-xsd.php?dappName=XSSEDMirrorReader">
<dapper>
<dappName>XSSEDMirrorReader</dappName>
<dappTitle>XSSED Mirror Reader</dappTitle>
<urls>
<url>http://xssed.com/mirror/8484/</url>
<url>http://xssed.com/mirror/8482/</url>
<url>http://xssed.com/mirror/8409/</url>
</urls>
<applyToUrl>http://xssed.com/mirror/1314/</applyToUrl>
<executionTime>0.023</executionTime>
<ranAt>2007-05-29 10:51:38</ranAt>
<encoding>iso-8859-1</encoding>
</dapper>
<submitted fieldName="submitted" originalElement="td" type="field">02/03/2007</submitted>
<status fieldName="status" originalElement="td" type="field">UNFIXED</status>
<domain fieldName="domain" originalElement="td" type="field">it.search.yahoo.com</domain>
<category fieldName="category" originalElement="td" type="field">XSS</category>
<rank fieldName="rank" originalElement="td" type="field">1</rank>
<url fieldName="url" originalElement="td" type="field">http://it.search.yahoo.com/yhs/search?fr=yhs-ipnmrtlei=UTF-8lyt=stp=scriptalert(document.cook ie)/script</url>
</elements>
The dangers are obvious. At this stage the attacker has a list of TOP500 websites that are vulnerable to XSS. They can also extract the actual attack vector with another DAP. This is quite bad but it is a lot worse then that. What attackers can do next, is to add all of these XSS vector in a big list that can be easily fetched dynamically when needed. For that purpose, they need a Yahoo Pipe. The Yahoo Pipe that I’ve created to test the idea, fetches the TOP500 XSS list. Each item of this list is annotated with another XML document that describes the actual vector. Because Yahoo Pipes has very powerful caching mechanism, the data (the entries that contain the XSS vectors) is fetched and delivered via JSON almost instantly. Keep in mind that the data fetched from XSSED.com is live and it is updated on a daily basis, which mean that the more XSS vector are contributed to this database, the more sophisticated and dangerous the JavaScript malware will become. Well to the era of the Web Intellect.
I think that this scenario could only be used for a small worm as the bandwidth of xssed would never handle too much traffic, and we would close the site if it was happening, well thought though. However xssed.com or not, someone would just have to make their own list of xss and include it in the worm, or host it somewhere else, having a list of XSS which are not public would be a lot more efficient than picking the ones on xssed.
So my advice is always the same: secure your webapps, and why not adding the xssed.com archive page to your bookmarks ;)