TryHackMe Library
Writeup
Overview
- Machine Name: Library
- OS: Linux
- Difficulty: Easy
Summary
SSH brute-force attack was executed using Hydra to gain initial access. An nmap
scan identified an open SSH port, and Hydra was used to find valid credentials (user:password123
). After logging in, a privilege escalation was performed by replacing a Python script, which was executed with root privileges, allowing the attacker to gain root access to the system.
Reconnaissance
Nmap Scan Results
Exploitation
Vulnerabilities Exploited
Exploitation Steps
Post-Exploitation
Privilege Escalation
In this process, the attacker gains root access by exploiting the ability to execute a Python script with elevated privileges. They first delete any existing script named bak.py
and then create a new script with a Python command to spawn a bash shell. This script is executed with sudo
, which runs the script with root privileges, effectively giving the attacker a root shell. Finally, they confirm root access and read the root flag, proving full system control.