# FTP - port 21

## Scan version

Exemple:

*`$ nmap -sS -sV -p21 <target IP>`*

## Connexion anonyme

Le premier reflexe lorsqu'on rencontre un service ftp ouvert est de tenter de s'y connecter en anonyme.

```bash
$ ftp <target IP>
> anonymous
> anonymous
```

Avec metasploit:

```bash
$ msfconsole
msf > use auxiliary/scanner/ftp/anonymous
msf auxiliary(anonymous) > set RHOSTS <target(s) IP(s)>
msf auxiliary(anonymous) > set THREADS 55   #par exemple
msf auxiliary(anonymous) > run
```

avec CrackMapExec:

```bash
$ crackmapexec ftp <target ip[/24]> -u anonymous -p anonymous
```

## Brute force

Si cela ne fonctionne pas, il existe un script dans nmap permettant de tenter de brute force l'identification.

Utilisation:

*`$ nmap --script ftp-* -p21 <target ip>`*

Avec metasploit:

```bash
$ msfconsole
msf > use auxiliary/scanner/ftp/ftp_login
msf auxiliary(ftp_login) > set RHOSTS <target(s) IP(s)>
msf auxiliary(anonymous) > set THREADS 55   #par exemple
msf auxiliary(anonymous) > set USER_FILE <wordlist utilisateurs>
msf auxiliary(anonymous) > set PASS_FILE <wordlist mots de passes>
msf auxiliary(anonymous) > run
```

## Téléchargement du contenu

Si la connexion anonyme est activée ou que les identifiant sont connues, il est également possible de télécharger les fichiers avec la commande wget.

Exemples d'utilisation:

*`$ wget -m ftp://anonymous:anonymous@<target IP>`*

*`$ wget -m --no-passive ftp://anonymous:anonymous@<target IP>`*

*`$ wget -m ftp://<username>:<password>@<target IP>`*

## Ressources

<https://www.offensive-security.com/metasploit-unleashed/scanner-ftp-auxiliary-modules/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.s1rn3tz.ovh/hacking-protocols/ftp-port-21.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
