<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Hacking - Tag - Coding braindump</title><link>https://dev-initely.me/tags/hacking/</link><description>Hacking - Tag - Coding braindump</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 13 Jun 2026 05:55:00 +0200</lastBuildDate><atom:link href="https://dev-initely.me/tags/hacking/" rel="self" type="application/rss+xml"/><item><title>AUR Supply Chain Attack: How to check your (Arch Linux) System</title><link>https://dev-initely.me/posts/aur-supply-chain-attack/</link><pubDate>Sat, 13 Jun 2026 05:55:00 +0200</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/posts/aur-supply-chain-attack/</guid><description><![CDATA[<p>The supply chain attacks on linux just keep coming: in June 2026, a malicious package was discovered in the Arch User Repository (AUR). I first read about this in <a href="https://ioctl.fail/preliminary-analysis-of-aur-malware/" target="_blank" rel="noopener noreffer ">ioctl.fail</a>. Here is what happened in the short version (for long version go to ioctl.fail).</p>
<p>An attacker masked a binary by hiding it in the dependency tree of (the legitimate package) <code>atomic-lockfile</code> (v1.4.2). The hidden binary runs at install time via an npm hook. It is designed to steal credentials, installs a persistent systemd service and loads an eBPF rootkit to hide itself and exfiltrates everything over Tor. All silently - so this is pretty advanced stuff.</p>]]></description></item><item><title>Level 16</title><link>https://dev-initely.me/natas/level16/</link><pubDate>Wed, 02 Apr 2025 22:58:00 +0200</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level16/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from &ldquo;TODO&rdquo;       <span class="timestamp-wrapper"><span class="timestamp">[2025-04-02 Wed 22:58]</span></span></li>
</ul>
<p><a href="http://natas16.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas16.natas.labs.overthewire.org/</a></p>
<p>So there is one input field and a comment that for security reasons, the code now filters on more characters. There is also a output field below, supposedly to give back a response from the search request.</p>
<p>Alright, let&rsquo;s look at the sourcecode:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-web">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code class="language-web" data-lang="web">&lt;html&gt;
    &lt;head&gt;
        &lt;!-- This stuff in the header has nothing to do with the level --&gt;
        &lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;http://natas.labs.overthewire.org/css/level.css&#34;&gt;
        &lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/jquery-ui.css&#34; /&gt;
        &lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/wechall.css&#34; /&gt;
        &lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-1.9.1.js&#34;&gt;&lt;/script&gt;
        &lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-ui.js&#34;&gt;&lt;/script&gt;
        &lt;script src=http://natas.labs.overthewire.org/js/wechall-data.js&gt;&lt;/script&gt;&lt;script src=&#34;http://natas.labs.overthewire.org/js/wechall.js&#34;&gt;&lt;/script&gt;
        &lt;script&gt;var wechallinfo = { &#34;level&#34;: &#34;natas16&#34;, &#34;pass&#34;: &#34;&lt;censored&gt;&#34; };&lt;/script&gt;&lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;natas16&lt;/h1&gt;
        &lt;div id=&#34;content&#34;&gt;

            For security reasons, we now filter even more on certain characters&lt;br/&gt;&lt;br/&gt;
            &lt;form&gt;
                Find words containing: &lt;input name=needle&gt;&lt;input type=submit name=submit value=Search&gt;&lt;br&gt;&lt;br&gt;
            &lt;/form&gt;

            Output:
            &lt;pre&gt;
&lt;?
$key = &#34;&#34;;

if(array_key_exists(&#34;needle&#34;, $_REQUEST)) {
    $key = $_REQUEST[&#34;needle&#34;];
}

if($key != &#34;&#34;) {
    if(preg_match(&#39;/[;|&amp;`\&#39;&#34;]/&#39;,$key)) {
        print &#34;Input contains an illegal character!&#34;;
    } else {
        passthru(&#34;grep -i \&#34;$key\&#34; dictionary.txt&#34;);
    }
}
?&gt;
            &lt;/pre&gt;

            &lt;div id=&#34;viewsource&#34;&gt;&lt;a href=&#34;index-source.html&#34;&gt;View sourcecode&lt;/a&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre></div>
<h2 id="shell-injection">Shell injection</h2>
<p>At first impression, this looks very much like level 9 above; if you need a reminder, go look at the walkthrough for it. We made use of the fact that passthru() does not sanitize and where able to insert some shell code into the grep command like so <code>test; whoami</code>.</p>]]></description></item><item><title>Level 1</title><link>https://dev-initely.me/natas/level1/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level1/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p>You can find the password for the next level on this page, but rightclicking has been blocked!</p>
<p>And indeed: we try to rightclick and get an annoying error message. However, a quick google search shows us that there is a shortcut for Chrome: <code>CTRL + U</code> gets us the page source</p>
<div class="code-block open" style="counter-reset: code-block -1">
    <div class="code-header language-html">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">html</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">  <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="c">&lt;!-- This stuff in the header has nothing to do with the level --&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&#34;stylesheet&#34;</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;text/css&#34;</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/css/level.css&#34;</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&#34;stylesheet&#34;</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/css/jquery-ui.css&#34;</span> <span class="p">/&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&#34;stylesheet&#34;</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/css/wechall.css&#34;</span> <span class="p">/&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/js/jquery-1.9.1.js&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/js/jquery-ui.js&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">http://natas.labs.overthewire.org/js/wechall-data.js</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&#34;http://natas.labs.overthewire.org/js/wechall.js&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">script</span><span class="p">&gt;</span><span class="kd">var</span> <span class="nx">wechallinfo</span> <span class="o">=</span> <span class="p">{</span> <span class="s2">&#34;level&#34;</span><span class="o">:</span> <span class="s2">&#34;natas1&#34;</span><span class="p">,</span> <span class="s2">&#34;pass&#34;</span><span class="o">:</span> <span class="s2">&#34;0nzCigAq7t2iALyvU9xcHlYN4MlkIwlq&#34;</span> <span class="p">};&lt;/</span><span class="nt">script</span><span class="p">&gt;&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">  <span class="p">&lt;</span><span class="nt">body</span> <span class="na">oncontextmenu</span><span class="o">=</span><span class="s">&#34;javascript:alert(&#39;right clicking has been blocked!&#39;);return false;&#34;</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span>natas1<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&#34;content&#34;</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">      You can find the password for the
</span></span><span class="line"><span class="cl">      next level on this page, but rightclicking has been blocked!
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">      <span class="c">&lt;!--The password for natas2 is TguMNxKo1DSa1tujBLuZJnDUlCcUAPlI --&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl">  <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span></span></span></code></pre></div></div>
<ul>
<li>TguMNxKo1DSa1tujBLuZJnDUlCcUAPlI</li>
</ul>]]></description></item><item><title>Level 10</title><link>https://dev-initely.me/natas/level10/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level10/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas10.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas10.natas.labs.overthewire.org/</a></p>
<p>Level 10 starts off the same way as level 9, however it seems that now there is a filter against certain characters.
</p>
<p>Looking at the sourcecode, we see that the characters <code>;|&amp;</code> are now disallowed. However, space is not disallowed.</p>
<div class="code-block open" style="counter-reset: code-block -1">
    <div class="code-header language-web">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code class="language-web" data-lang="web">&lt;?
$key = &#34;&#34;;

if(array_key_exists(&#34;needle&#34;, $_REQUEST)) {
$key = $_REQUEST[&#34;needle&#34;];
}

if($key != &#34;&#34;) {
if(preg_match(&#39;/[;|&amp;]/&#39;,$key)) {
print &#34;Input contains an illegal character!&#34;;
} else {
passthru(&#34;grep -i $key dictionary.txt&#34;);
}
}
?&gt;</code></pre></div>
<p>So the strategy from level 9 will not work anymore. However, there is another way to exploit this - we can use the fact that <code>grep</code> can search through several files.</p>]]></description></item><item><title>Level 11</title><link>https://dev-initely.me/natas/level11/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level11/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas11.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas11.natas.labs.overthewire.org/</a></p>
<p>This level seems to work with an encryption called XOR encryption:</p>
<figure>
</figure>

<h2 id="background">Background</h2>
<p>Okay, some theory first: what is an XOR cipher? It is a type of additive cipher that works with the applying the bitwise XOR operator to every character using a given key. To decrypt, applying the XOR function with the key will remove the cipher. To take an example from Wikipedia, let&rsquo;s take the string &lsquo;Wiki&rsquo; and encode it in 8-bit ASCII and encode it with the key 11110011:</p>]]></description></item><item><title>Level 12</title><link>https://dev-initely.me/natas/level12/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level12/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas12.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas12.natas.labs.overthewire.org/</a></p>
<p>This one took me quite a while to figure out using several tutorials from different websites. First we see an upload dialogue allowing us to upload a JPEG file.</p>
<figure>
</figure>

<h2 id="background">Background</h2>
<p>If a webpage allows to upload files, the developer has to make sure that the backend checks appropriately for filetypes and malicious intent. So here I assume that no proper checking is done and we can do something malicious.</p>]]></description></item><item><title>Level 13</title><link>https://dev-initely.me/natas/level13/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level13/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas13.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas13.natas.labs.overthewire.org/</a></p>
<figure>
</figure>

<p>This one looks very similar to the prior exercise, so let&rsquo;s start the same way and look at the source code.</p>
<div class="code-block" style="counter-reset: code-block -1">
    <div class="code-header language-web">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code class="language-web" data-lang="web">&lt;html&gt;
&lt;head&gt;
&lt;!-- This stuff in the header has nothing to do with the level --&gt;
&lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;http://natas.labs.overthewire.org/css/level.css&#34;&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/jquery-ui.css&#34; /&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/wechall.css&#34; /&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-1.9.1.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-ui.js&#34;&gt;&lt;/script&gt;
&lt;script src=http://natas.labs.overthewire.org/js/wechall-data.js&gt;&lt;/script&gt;&lt;script src=&#34;http://natas.labs.overthewire.org/js/wechall.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;var wechallinfo = { &#34;level&#34;: &#34;natas13&#34;, &#34;pass&#34;: &#34;&lt;censored&gt;&#34; };&lt;/script&gt;&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;natas13&lt;/h1&gt;
&lt;div id=&#34;content&#34;&gt;
For security reasons, we now only accept image files!&lt;br/&gt;&lt;br/&gt;

&lt;?php

function genRandomString() {
    $length = 10;
    $characters = &#34;0123456789abcdefghijklmnopqrstuvwxyz&#34;;
    $string = &#34;&#34;;

    for ($p = 0; $p &lt; $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters)-1)];
    }

    return $string;
}

function makeRandomPath($dir, $ext) {
    do {
    $path = $dir.&#34;/&#34;.genRandomString().&#34;.&#34;.$ext;
    } while(file_exists($path));
    return $path;
}

function makeRandomPathFromFilename($dir, $fn) {
    $ext = pathinfo($fn, PATHINFO_EXTENSION);
    return makeRandomPath($dir, $ext);
}

if(array_key_exists(&#34;filename&#34;, $_POST)) {
    $target_path = makeRandomPathFromFilename(&#34;upload&#34;, $_POST[&#34;filename&#34;]);

    $err=$_FILES[&#39;uploadedfile&#39;][&#39;error&#39;];
    if($err){
        if($err === 2){
            echo &#34;The uploaded file exceeds MAX_FILE_SIZE&#34;;
        } else{
            echo &#34;Something went wrong :/&#34;;
        }
    } else if(filesize($_FILES[&#39;uploadedfile&#39;][&#39;tmp_name&#39;]) &gt; 1000) {
        echo &#34;File is too big&#34;;
    } else if (! exif_imagetype($_FILES[&#39;uploadedfile&#39;][&#39;tmp_name&#39;])) {
        echo &#34;File is not an image&#34;;
    } else {
        if(move_uploaded_file($_FILES[&#39;uploadedfile&#39;][&#39;tmp_name&#39;], $target_path)) {
            echo &#34;The file &lt;a href=\&#34;$target_path\&#34;&gt;$target_path&lt;/a&gt; has been uploaded&#34;;
        } else{
            echo &#34;There was an error uploading the file, please try again!&#34;;
        }
    }
} else {
?&gt;

&lt;form enctype=&#34;multipart/form-data&#34; action=&#34;index.php&#34; method=&#34;POST&#34;&gt;
&lt;input type=&#34;hidden&#34; name=&#34;MAX_FILE_SIZE&#34; value=&#34;1000&#34; /&gt;
&lt;input type=&#34;hidden&#34; name=&#34;filename&#34; value=&#34;&lt;?php print genRandomString(); ?&gt;.jpg&#34; /&gt;
Choose a JPEG to upload (max 1KB):&lt;br/&gt;
&lt;input name=&#34;uploadedfile&#34; type=&#34;file&#34; /&gt;&lt;br /&gt;
&lt;input type=&#34;submit&#34; value=&#34;Upload File&#34; /&gt;
&lt;/form&gt;
&lt;?php } ?&gt;
&lt;div id=&#34;viewsource&#34;&gt;&lt;a href=&#34;index-source.html&#34;&gt;View sourcecode&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div>
<p>The code introduces some additional file checking, specifically here:</p>]]></description></item><item><title>Level 14</title><link>https://dev-initely.me/natas/level14/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level14/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas14.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas14.natas.labs.overthewire.org/</a></p>
<p>Level 14 starts with a common username and passwword login form:
</p>
<p>Trying a random value yields a simple message: &ldquo;Access denied&rdquo;. So have a look at the sourcecode:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-web">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code class="language-web" data-lang="web">

&lt;html&gt;
&lt;head&gt;
&lt;!-- This stuff in the header has nothing to do with the level --&gt;
&lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;http://natas.labs.overthewire.org/css/level.css&#34;&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/jquery-ui.css&#34; /&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/wechall.css&#34; /&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-1.9.1.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-ui.js&#34;&gt;&lt;/script&gt;
&lt;script src=http://natas.labs.overthewire.org/js/wechall-data.js&gt;&lt;/script&gt;&lt;script src=&#34;http://natas.labs.overthewire.org/js/wechall.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;var wechallinfo = { &#34;level&#34;: &#34;natas14&#34;, &#34;pass&#34;: &#34;&lt;censored&gt;&#34; };&lt;/script&gt;&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;natas14&lt;/h1&gt;
&lt;div id=&#34;content&#34;&gt;
    &lt;?php
    if(array_key_exists(&#34;username&#34;, $_REQUEST)) {
    $link = mysqli_connect(&#39;localhost&#39;, &#39;natas14&#39;, &#39;&lt;censored&gt;&#39;);
    mysqli_select_db($link, &#39;natas14&#39;);

    $query = &#34;SELECT * from users where username=\&#34;&#34;.$_REQUEST[&#34;username&#34;].&#34;\&#34; and password=\&#34;&#34;.$_REQUEST[&#34;password&#34;].&#34;\&#34;&#34;;
    if(array_key_exists(&#34;debug&#34;, $_GET)) {
        echo &#34;Executing query: $query&lt;br&gt;&#34;;
    }

    if(mysqli_num_rows(mysqli_query($link, $query)) &gt; 0) {
            echo &#34;Successful login! The password for natas15 is &lt;censored&gt;&lt;br&gt;&#34;;
    } else {
            echo &#34;Access denied!&lt;br&gt;&#34;;
    }
    mysqli_close($link);
} else {
?&gt;

&lt;form action=&#34;index.php&#34; method=&#34;POST&#34;&gt;
Username: &lt;input name=&#34;username&#34;&gt;&lt;br&gt;
Password: &lt;input name=&#34;password&#34;&gt;&lt;br&gt;
&lt;input type=&#34;submit&#34; value=&#34;Login&#34; /&gt;
&lt;/form&gt;
&lt;?php } ?&gt;
&lt;div id=&#34;viewsource&#34;&gt;&lt;a href=&#34;index-source.html&#34;&gt;View sourcecode&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div>
<p>The code first checks if a username is provided, then establishes a connection to MySQL using the username <code>natas14</code> and selects the natas14 database. Then it constructs the SQL query with the input from the input form. The script then runs the SQL query and checks if any rows match the username and password. Finally, it closes the connection.</p>]]></description></item><item><title>Level 15</title><link>https://dev-initely.me/natas/level15/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level15/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p><a href="http://natas15.natas.labs.overthewire.org/" target="_blank" rel="noopener noreffer ">http://natas15.natas.labs.overthewire.org/</a></p>
<p>This level starts very similar to level 14, however no we only check for the existence of a user using an input field:</p>
<figure>
</figure>

<p>Entering <code>natas16</code> lets us know that this user exists. However, when we look at the sourcecode we see that we have a problem here:</p>
<div class="code-block code-line-numbers" style="counter-reset: code-block 0">
    <div class="code-header language-web">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><pre tabindex="0"><code class="language-web" data-lang="web">  &lt;html&gt;
&lt;head&gt;
&lt;!-- This stuff in the header has nothing to do with the level --&gt;
&lt;link rel=&#34;stylesheet&#34; type=&#34;text/css&#34; href=&#34;http://natas.labs.overthewire.org/css/level.css&#34;&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/jquery-ui.css&#34; /&gt;
&lt;link rel=&#34;stylesheet&#34; href=&#34;http://natas.labs.overthewire.org/css/wechall.css&#34; /&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-1.9.1.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;http://natas.labs.overthewire.org/js/jquery-ui.js&#34;&gt;&lt;/script&gt;
&lt;script src=http://natas.labs.overthewire.org/js/wechall-data.js&gt;&lt;/script&gt;&lt;script src=&#34;http://natas.labs.overthewire.org/js/wechall.js&#34;&gt;&lt;/script&gt;
&lt;script&gt;var wechallinfo = { &#34;level&#34;: &#34;natas15&#34;, &#34;pass&#34;: &#34;&lt;censored&gt;&#34; };&lt;/script&gt;&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;natas15&lt;/h1&gt;
&lt;div id=&#34;content&#34;&gt;
&lt;?php

/*
CREATE TABLE `users` (
  `username` varchar(64) DEFAULT NULL,
  `password` varchar(64) DEFAULT NULL
);
*/

if(array_key_exists(&#34;username&#34;, $_REQUEST)) {
    $link = mysqli_connect(&#39;localhost&#39;, &#39;natas15&#39;, &#39;&lt;censored&gt;&#39;);
    mysqli_select_db($link, &#39;natas15&#39;);

    $query = &#34;SELECT * from users where username=\&#34;&#34;.$_REQUEST[&#34;username&#34;].&#34;\&#34;&#34;;
    if(array_key_exists(&#34;debug&#34;, $_GET)) {
        echo &#34;Executing query: $query&lt;br&gt;&#34;;
    }

    $res = mysqli_query($link, $query);
    if($res) {
    if(mysqli_num_rows($res) &gt; 0) {
        echo &#34;This user exists.&lt;br&gt;&#34;;
    } else {
        echo &#34;This user doesn&#39;t exist.&lt;br&gt;&#34;;
    }
    } else {
        echo &#34;Error in query.&lt;br&gt;&#34;;
    }

    mysqli_close($link);
} else {
?&gt;

&lt;form action=&#34;index.php&#34; method=&#34;POST&#34;&gt;
Username: &lt;input name=&#34;username&#34;&gt;&lt;br&gt;
&lt;input type=&#34;submit&#34; value=&#34;Check existence&#34; /&gt;
&lt;/form&gt;
&lt;?php } ?&gt;
&lt;div id=&#34;viewsource&#34;&gt;&lt;a href=&#34;index-source.html&#34;&gt;View sourcecode&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div>
<p>So the logical flow is as follows:</p>]]></description></item><item><title>Level 2</title><link>https://dev-initely.me/natas/level2/</link><pubDate>Thu, 27 Mar 2025 14:45:00 +0100</pubDate><author>mor3dr3ad</author><guid>https://dev-initely.me/natas/level2/</guid><description><![CDATA[<ul>
<li>State &ldquo;DONE&rdquo;       from              <span class="timestamp-wrapper"><span class="timestamp">[2025-03-27 Thu 14:45]</span></span></li>
</ul>
<p>When we open the page, we are greeted with the following message:</p>
<p>
Okay, the first thing we want to do is check the source code. There is an interesting line here:</p>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-html">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="Copy to clipboard"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&#34;files/pixel.png&#34;</span><span class="p">&gt;</span></span></span></code></pre></div></div>
<p>Looking at the picture we only see one pixel, so nothing interesting there really. However, there is another important information here, which is the filepath <code>files/pixel.png</code>. If we look at URL + <code>/files</code>, then we see that we are actually able to access this folder and find a <code>users.txt</code> file containing the password.
</p>]]></description></item></channel></rss>