hacktricks/network-services-pentesting/pentesting-ftp/ftp-bounce-attack.md

61 lines
3.5 KiB
Markdown

# FTP Bounce attack - Scan
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
<details>
<summary>Support HackTricks</summary>
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details>
{% endhint %}
## FTP Bounce - Scanning
### Manual
1. Conecte-se ao FTP vulnerável
2. Use \*\*`PORT`\*\* ou **`EPRT`** (mas apenas 1 deles) para estabelecer uma conexão com o _\<IP:Port>_ que você deseja escanear:
`PORT 172,32,80,80,0,8080`\
`EPRT |2|172.32.80.80|8080|`
3. Use **`LIST`** (isso apenas enviará para o _\<IP:Port>_ conectado a lista de arquivos atuais na pasta FTP) e verifique as possíveis respostas: `150 File status okay` (Isso significa que a porta está aberta) ou `425 No connection established` (Isso significa que a porta está fechada)
1. Em vez de `LIST`, você também pode usar **`RETR /file/in/ftp`** e procurar por respostas semelhantes `Open/Close`.
Exemplo usando **PORT** (porta 8080 de 172.32.80.80 está aberta e porta 7777 está fechada):
![](<../../.gitbook/assets/image (241).png>)
Mesmo exemplo usando **`EPRT`** (autenticação omitida na imagem):
![](<../../.gitbook/assets/image (539).png>)
Porta aberta usando `EPRT` em vez de `LIST` (ambiente diferente)
![](<../../.gitbook/assets/image (875).png>)
### **nmap**
```bash
nmap -b <name>:<pass>@<ftp_server> <victim>
nmap -Pn -v -p 21,80 -b ftp:ftp@10.2.1.5 127.0.0.1 #Scan ports 21,80 of the FTP
nmap -v -p 21,22,445,80,443 -b ftp:ftp@10.2.1.5 192.168.0.1/24 #Scan the internal network (of the FTP) ports 21,22,445,80,443
```
{% hint style="success" %}
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
<details>
<summary>Support HackTricks</summary>
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Compartilhe truques de hacking enviando PRs para os repositórios do** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud).
</details>
{% endhint %}