<?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 semoarchy on Medium]]></title>
        <description><![CDATA[Stories by semoarchy on Medium]]></description>
        <link>https://medium.com/@harouachmohammed0?source=rss-89b3ec7c2640------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XUdFKhlZfyv9oaCUZ5FQbA.jpeg</url>
            <title>Stories by semoarchy on Medium</title>
            <link>https://medium.com/@harouachmohammed0?source=rss-89b3ec7c2640------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:51:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harouachmohammed0/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[ROOM 404 TryHackMe CTF Writeup by semoarchy]]></title>
            <link>https://medium.com/@harouachmohammed0/room-404-tryhackme-ctf-writeup-by-semoarchy-bec7af7ea677?source=rss-89b3ec7c2640------2</link>
            <guid isPermaLink="false">https://medium.com/p/bec7af7ea677</guid>
            <dc:creator><![CDATA[semoarchy]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 23:10:04 GMT</pubDate>
            <atom:updated>2026-07-28T23:11:53.480Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>When assessing a web application, it’s tempting to focus immediately on identifying complex vulnerabilities such as SQL injection, authentication bypasses, or remote code execution. However, some of the most impactful discoveries originate from basic reconnaissance and careful enumeration.</p><p>During a recent CTF engagement, I encountered a web application with a minimal attack surface. Rather than making assumptions about potential vulnerabilities, I followed a structured methodology, beginning with directory enumeration. That initial reconnaissance uncovered an exposed <strong>.git</strong> directory—a seemingly minor misconfiguration that ultimately resulted in complete source code disclosure.</p><p>This article demonstrates how a simple deployment mistake can expose an application’s internal structure and why properly securing version control artifacts is critical in production environments.</p><h3>Initial Reconnaissance</h3><p>The first phase of any web application assessment should always involve comprehensive enumeration. Identifying hidden resources, configuration files, backup files, and exposed development artifacts often provides valuable insight before testing application functionality.</p><p>To enumerate the target, I performed a directory scan using <strong>dirsearch</strong>.</p><pre>sudo dirsearch -u http://ip:8080/ -e *</pre><p>Among the discovered resources, one result immediately stood out:</p><pre>/.git/<br>/.git/HEAD<br>/.git/config<br>/.git/index<br>/.git/logs/<br>/.git/objects/</pre><p>Finding a publicly accessible <strong>.git</strong> directory is a significant security finding. In many cases, it indicates that the application&#39;s version control repository has been deployed alongside the production web content, unintentionally exposing sensitive development artifacts.</p><blockquote><strong><em>Figure 1:</em></strong><em> Directory enumeration revealing an exposed </em><em>.git directory.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*KLjKbn77pH53Tl9vn5RvrQ.png" /></figure><h3>Repository Reconstruction</h3><p>Once the exposed Git repository was identified, the next objective was to determine whether it could be reconstructed.</p><p>Using <strong>git-dumper</strong>, I downloaded the available Git objects and rebuilt the repository locally.</p><pre>git-dumper http://ip:8080/.git ./repository</pre><p>The reconstruction completed successfully, confirming that the repository metadata and object database were sufficiently exposed.</p><p>With a local copy available, the assessment shifted from black-box testing to source code review.</p><blockquote><strong><em>Figure 2:</em></strong><em> Successful reconstruction of the exposed Git repository.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*O0DuEZbqvfjcPw2VhSE-SQ.png" /></figure><h3>Source Code Analysis</h3><p>After recovering the repository, I inspected its contents.</p><pre>find . -type f</pre><p>The project consisted of several application files alongside the reconstructed Git metadata.</p><p>As with any source code review, the first files examined included:</p><ul><li>Documentation (README.md)</li><li>Application source files</li><li>Configuration files</li><li>Environment variables</li><li>Commit history</li></ul><p>Reviewing the repository documentation quickly revealed sensitive information that had been left within the development environment.</p><p>The repository contained a staging note alongside the challenge flag, confirming that the exposed Git repository represented the intended attack vector.</p><blockquote><strong><em>Figure 3:</em></strong><em> Flag</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*u3ZrizFEJsiLKTPGtu5fSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*M1DiUDlE_YeGP9KLDa-h6A.png" /></figure><h3>Why Exposed Git Repositories Matter</h3><p>Git repositories contain significantly more information than the files currently visible within an application.</p><p>Depending on the project’s history, an exposed repository may disclose:</p><ul><li>Complete application source code</li><li>Historical commits</li><li>Removed files</li><li>API keys</li><li>Authentication secrets</li><li>Database credentials</li><li>Internal documentation</li><li>Development notes</li><li>Debugging configurations</li></ul><p>Even if sensitive information has been removed from the latest version of the application, it often remains recoverable through previous commits.</p><p>For attackers, this dramatically reduces the effort required to understand application logic, identify hidden functionality, and locate additional vulnerabilities.</p><h3>Security Recommendations</h3><p>Organizations should ensure that version control artifacts are never accessible from publicly exposed web servers.</p><p>Recommended mitigations include:</p><ul><li>Exclude the .git directory from production deployments.</li><li>Configure the web server to deny access to hidden files and directories.</li><li>Store secrets outside of the source code repository.</li><li>Regularly audit production environments for exposed development artifacts.</li><li>Remove sensitive information from Git history before publishing repositories.</li><li>Implement automated deployment pipelines that package only the required application files.</li></ul><h3>Key Takeaways</h3><p>This exercise reinforces an important lesson for penetration testers and defenders alike:</p><blockquote><strong><em>Thorough enumeration frequently uncovers vulnerabilities before any exploit development is required.</em></strong></blockquote><p>In this assessment, no application logic was exploited, no authentication mechanisms were bypassed, and no injections were required. A single deployment misconfiguration was sufficient to disclose the application’s repository and expose sensitive internal information.</p><p>Although this scenario originated from a CTF environment, exposed Git repositories continue to appear in real-world security assessments and bug bounty engagements. Their impact often extends far beyond source code disclosure, potentially leading to credential exposure, infrastructure compromise, or full application takeover.</p><h3>Conclusion</h3><p>Effective penetration testing begins with disciplined reconnaissance. While advanced exploitation techniques remain valuable, overlooking basic enumeration can mean missing vulnerabilities that provide immediate access to an application’s internal assets.</p><p>An exposed .git directory may seem insignificant at first glance, but as this assessment demonstrates, it can fundamentally change the security posture of an application by exposing the very information developers rely on to build it.</p><p>Sometimes, the most critical vulnerability isn’t hidden deep within the code — it’s the code itself.</p><p>Please Follow me on TryhackMe : <a href="https://tryhackme.com/p/semoarchy">https://tryhackme.com/p/semoarchy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bec7af7ea677" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grand Larceny Auto CTF TryHackMe Writeup]]></title>
            <link>https://medium.com/@harouachmohammed0/the-vault-thats-never-been-opened-reversing-a-godot-game-s-wanted-star-exploit-a158d17208bc?source=rss-89b3ec7c2640------2</link>
            <guid isPermaLink="false">https://medium.com/p/a158d17208bc</guid>
            <dc:creator><![CDATA[semoarchy]]></dc:creator>
            <pubDate>Sat, 25 Jul 2026 15:15:18 GMT</pubDate>
            <atom:updated>2026-07-25T23:59:35.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPIFHBsgA9ox8HqX2XffDg.png" /></figure><p><strong>Room:</strong> <a href="https://tryhackme.com/room/grandlarcenyauto">Grand Larceny Auto</a></p><p><strong>Category:</strong> Reverse Engineering / .NET</p><p><strong>Platform:</strong> Linux, Windows ( here is Linux version )</p><h3>Overview</h3><p>Grand Larceny Auto is a tiny GTA-parody built in Godot. The objective is a sealed Safehouse Vault that the room claims nobody has ever managed to open. It turns out the vault can be cracked through static analysis alone — no gameplay required.</p><blockquote>Step 1 — Recon the files</blockquote><pre>GrandLarcenyAuto-windows/<br>├── GrandLarcenyAuto.exe<br>├── GrandLarcenyAuto.pck   (2,344 bytes)<br>└── data_GrandLarcenyAuto_windows_x86_64/<br>    ├── GrandLarcenyAuto.dll   (93,184 bytes)<br>    ├── GodotSharp.dll<br>    └── (full .NET 8 CoreCLR runtime)</pre><p>The .pck is only ~2KB — normally where Godot stores all game data/scripts, so a tiny .pck means the real logic lives elsewhere. Paired with a shipped .NET runtime and one 93KB DLL, this is a Godot <strong>C#</strong> project: all the actual logic sits in GrandLarcenyAuto.dll.</p><blockquote>Step 2 — Find the relevant strings</blockquote><pre>strings -n 6 data_GrandLarcenyAuto_windows_x86_64/GrandLarcenyAuto.dll | grep -iE &quot;flag|vault|safehouse|unlock&quot; | sort -u</pre><pre>CheckCrimesAndVault<br>MakeVault<br>SafehouseVault<br>TryVault<br>UnlockStars<br>vaultDot<br>vaultDotLabel<br>vaultPos</pre><p>SafehouseVault, TryVault, and UnlockStars point to a dedicated class gated behind the player&#39;s wanted-star count.</p><blockquote>Step 3 — Disassemble to IL</blockquote><pre>sudo apt-get install -y mono-utils<br>monodis data_GrandLarcenyAuto_windows_x86_64/GrandLarcenyAuto.dll &gt; game_disasm.il<br>grep -n &quot;class GrandLarcenyAuto.SafehouseVault\|class GrandLarcenyAuto.PlayerState\|class GrandLarcenyAuto.CryptoUtil&quot; game_disasm.il</pre><p>This confirms SafehouseVault holds a PlayerState reference and calls into CryptoUtil::DeriveKey(int32) and CryptoUtil::Xor(byte[], byte[]), keyed off PlayerState::get_WantedStars().</p><blockquote>Step 4 — The logic (past the obfuscation)</blockquote><p>The methods are obfuscated with control-flow flattening and a hidden string-resolver, but tracing what value ultimately gets returned reveals the real logic:</p><pre>public string TryOpen()<br>{<br>    if (player.WantedStars &lt; 6)<br>        return &quot;The vault stays shut. ... (You need SIX stars. Good luck.)&quot;;</pre><pre>    byte[] key = CryptoUtil.DeriveKey(player.WantedStars);<br>    byte[] plain = CryptoUtil.Xor(SealedBlob, key);<br>    string message = Encoding.UTF8.GetString(plain);<br>    return &quot;VAULT UNSEALED\n&quot; + message;<br>}</pre><pre>private const string Salt = &quot;GLA::vault::key::v1::stars=&quot;;</pre><pre>public static byte[] DeriveKey(int stars) =&gt;<br>    SHA256.HashData(Encoding.UTF8.GetBytes(Salt + stars.ToString(CultureInfo.InvariantCulture)));</pre><pre>public static byte[] Xor(byte[] data, byte[] key)<br>{<br>    var output = new byte[data.Length];<br>    for (int i = 0; i &lt; data.Length; i++)<br>        output[i] = (byte)(data[i] ^ key[i % key.Length]);<br>    return output;<br>}</pre><blockquote>Step 5 — The bug</blockquote><p>The gate check only requires WantedStars &gt;= 6. But the decryption key is derived from the <strong>exact current</strong> star count at the moment of the call — not a fixed value. The vault will say VAULT UNSEALED for any value ≥ 6, but the SHA-256-derived XOR key only matches the one used to seal the blob when the star count is <strong>exactly 6</strong>. Any other value produces &quot;UNSEALED&quot; plus garbage bytes instead of the flag.</p><blockquote>Step 6 — Call the real code directly</blockquote><p>PlayerState and SafehouseVault both extend System.Object, not Godot.Node — so no engine or gameplay is needed. The real TryOpen() can be invoked via reflection with a manually set WantedStars value.</p><pre>dotnet new console -o runner<br>cp data_GrandLarcenyAuto_windows_x86_64/GrandLarcenyAuto.dll runner/<br>cp data_GrandLarcenyAuto_windows_x86_64/GodotSharp.dll runner/</pre><p>runner/Program.cs:</p><pre>using System;<br>using System.Reflection;</pre><pre>var asm = Assembly.LoadFrom(&quot;GrandLarcenyAuto.dll&quot;);<br>var playerStateType = asm.GetType(&quot;GrandLarcenyAuto.PlayerState&quot;)!;<br>var vaultType       = asm.GetType(&quot;GrandLarcenyAuto.SafehouseVault&quot;)!;</pre><pre>var player = Activator.CreateInstance(playerStateType)!;<br>var wantedStarsProp = playerStateType.GetProperty(&quot;WantedStars&quot;)!;</pre><pre>foreach (var stars in new[] { 0, 5, 6, 7, 10 })<br>{<br>    wantedStarsProp.SetValue(player, stars);<br>    var vault = Activator.CreateInstance(vaultType, player)!;<br>    var result = vaultType.GetMethod(&quot;TryOpen&quot;)!.Invoke(vault, null);<br>    Console.WriteLine($&quot;stars={stars} =&gt; {result}&quot;);<br>}</pre><pre>cd runner<br>dotnet run</pre><blockquote>Result ( flag)</blockquote><pre>stars=0  =&gt; The vault stays shut. ... (You need SIX stars. Good luck.)<br>stars=5  =&gt; The vault stays shut. ... (You need SIX stars. Good luck.)<br>stars=6  =&gt; VAULT UNSEALED<br>            THM{█████████████████████████}<br>stars=7  =&gt; VAULT UNSEALED<br>            &lt;garbage bytes&gt;<br>stars=10 =&gt; VAULT UNSEALED<br>            &lt;garbage bytes&gt;</pre><blockquote>Exactly 6 — and only exactly 6 — produces the real flag.</blockquote><p><em>(Flag redacted per standard etiquette for a public writeup on an active room — run the harness against your own copy of the binary for yours.)</em></p><blockquote>Takeaways</blockquote><ul><li>Tiny .pck on a Godot project → the logic lives in a C#/GDScript file, not engine assets.</li><li>monodis is a solid stand-in for a full decompiler when reading raw IL is enough.</li><li>Control-flow flattening is intimidating but tractable — trace what’s returned, not the control flow itself.</li><li>The core bug: a &gt;= gate check and an == requirement downstream aren&#39;t the same guarantee — a real-world auth/crypto pattern, not just a CTF trick.</li><li>No engine or Windows host needed once the algorithm is understood — just call the real compiled code directly.</li></ul><h3>Follow me on TryHackMe : <a href="https://tryhackme.com/p/semoarchy">https://tryhackme.com/p/semoarchy</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y6VmZjSXDlMgLdhDJ_g53g.png" /><figcaption><a href="https://tryhackme.com/p/semoarchy"><strong>https://tryhackme.com/p/semoarchy</strong></a></figcaption></figure><p>#ctf #tryhackme #reverse-engineering #dotnet #cybersecurity</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a158d17208bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>