Get a Pentest and security assessment of your IT network.

Cyber Security

FTP Brute Force Attack: Protection Guide

TL;DR

Someone is trying to guess passwords to your FTP server. This guide shows you how to stop them, find out if they’ve already got in, and make things more secure.

Steps to Protect Your FTP Server from Brute Force Attacks

  1. Understand the Threat
    • A brute force attack is where someone tries many different usernames and passwords until they find one that works.
    • FTP servers are often targeted because weak credentials are common.
  2. Check Your FTP Server Logs

    Look for failed login attempts from the same IP address. This is a strong sign of an attack.

    • The location of logs varies depending on your server software (e.g., vsftpd, ProFTPd, FileZilla Server).
    • Common log file names include ftp.log or similar.
    • Use tools like grep to search for failed login attempts:
      grep "Failed login" /var/log/ftp.log
  3. Implement Fail2Ban (Recommended)

    Fail2Ban automatically blocks IP addresses that show malicious signs, like too many failed logins.

    • Install Fail2Ban: On Debian/Ubuntu:
      sudo apt update
      sudo apt install fail2ban

      On CentOS/RHEL:

      sudo yum install epel-release
      sudo yum install fail2ban
    • Configure Fail2Ban for FTP: Create a local configuration file (e.g., /etc/fail2ban/jail.local) and add or modify the following:
      [ftp]
      enabled = true
      port = ftp,21
      filter = ftp
      logpath  = /var/log/ftp.log
      maxretry = 3
      bantime = 600
    • Restart Fail2Ban:
      sudo systemctl restart fail2ban
  4. Limit Login Attempts

    Configure your FTP server to limit the number of login attempts per IP address within a certain timeframe.

    • This is usually done in your FTP server’s configuration file (e.g., vsftpd.conf).
    • The specific settings depend on your software; consult its documentation.
  5. Use Strong Passwords

    Ensure all users have strong, unique passwords.

    • At least 12 characters long.
    • A mix of uppercase and lowercase letters, numbers, and symbols.
    • Avoid dictionary words or personal information.
  6. Consider Key-Based Authentication

    Key-based authentication is much more secure than passwords.

    • Users log in using a private key instead of a password.
    • Requires more technical setup but significantly reduces the risk of brute force attacks.
  7. Disable Anonymous Login

    Unless absolutely necessary, disable anonymous login to prevent unauthorized access.

    • This is usually a setting in your FTP server’s configuration file.
  8. Keep Your Software Updated

    Regularly update your FTP server software and operating system to patch security vulnerabilities.

  9. Use an Intrusion Detection System (IDS)

    An IDS can detect suspicious activity on your server, including brute force attacks.

    • Examples include Snort or Suricata.
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation