~/writeups/thm-basic-pentesting

TryHackMe — Apr 2026

Basic Pentesting

Walkthrough of TryHackMe's Basic Pentesting room — enumeration, brute forcing, and privilege escalation on a vulnerable Linux machine.

Objective

Practice an entry-level internal pentest flow: enumerate exposed services, extract useful information from SMB, obtain initial access, and identify a local privilege escalation path.

Environment

  • Target: TryHackMe Basic Pentesting
  • Attacker host: Kali Linux
  • Primary tools: Nmap, enum4linux, Hydra, John/wordlists, GTFOBins
  • Learning goal: Show how small enumeration findings compound into access

Reconnaissance

Started with an Nmap scan to identify open ports and services.

nmap -sC -sV -oN nmap/initial 10.10.x.x

Open ports discovered:

  • 22/tcp — OpenSSH 7.2p2
  • 80/tcp — Apache httpd 2.4.18
  • 139/tcp — Samba smbd
  • 445/tcp — Samba smbd

Browsing to port 80 revealed a simple web app under construction.

Enumeration

Used enum4linux to enumerate SMB shares:

enum4linux -a 10.10.x.x

Found an anonymous share named Anonymous with a staff.txt file containing usernames.

Exploitation

Brute-forced SSH with hydra using the discovered username and rockyou.txt:

hydra -l jan -P /usr/share/wordlists/rockyou.txt ssh://10.10.x.x

Logged in and captured the user flag.

Privilege Escalation

Checked for SUID binaries — found vim with SUID bit set. Used GTFOBins technique for privilege escalation to root and captured the root flag.

Evidence Summary

EvidenceFindingAnalyst Note
NmapSSH, HTTP, SMB exposedSMB became the strongest enumeration path
SMB shareAnonymous accessMisconfiguration leaked useful information
UsernamesFound in staff.txtEnabled targeted password attack
SUID binaryvimMisconfigured privilege boundary

Defensive Takeaway

Anonymous SMB access and unsafe SUID binaries are preventable. A basic hardening checklist should cover share permissions, exposed service review, password policy, and periodic SUID audits.

Key Takeaways

  • Always enumerate SMB shares during internal pentests
  • Anonymous SMB shares are a goldmine for user enumeration
  • SUID binaries should be audited — vim is a common escalation vector
← All writeups Open room on THM ↗