SSH Attacks Started 10 Minutes After VPS Signup

この記事は約11分で読めます。

A budget VPS received its first SSH attack 10 minutes 50 seconds after boot. I measured the logs before and after hardening to find out what the attackers were actually doing.

Key Takeaways

  • The timeline: First attack arrived 10m50s after boot, with nothing but port 22 exposed.
  • The peak: 52 attack events in roughly 2 minutes, then Failed password stops entirely.
  • Why it stops: PasswordAuthentication no cuts connections at [preauth], so passwords are never tried.
  • The trap: fail2ban stops firing after hardening because failures never reach the auth stage.

Summary

The attacks started almost immediately, peaked within two minutes, and then appeared to stop. They did not stop. Attackers simply could no longer reach the authentication stage.

This article shows the raw logs and the exact configuration change.

Test Environment

ItemValue
VPSKVM VPS (2 vCPU / 2.5 GB)
OSUbuntu 24.04 LTS
ExposureSSH only (no web server)

Nothing was published on this server. No web server, no application, only SSH.

The First Attack Arrived After 10m50s

Here is when the system booted and when sshd started.

uptime -s
journalctl -u ssh --no-pager -o short-iso | head -3

Output:

2026-11-27 06:48:55
2026-11-27T06:49:06+00:00 vps-host systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
2026-11-27T06:49:06+00:00 vps-host sshd[859]: Server listening on :: port 22.
2026-11-27T06:49:06+00:00 vps-host systemd[1]: Started ssh.service - OpenBSD Secure Shell server.

The first attack looked like this.

journalctl -u ssh --no-pager -o short-iso | grep -E "Failed password" | head -1

Output:

2026-11-27T06:59:45+00:00 vps-host sshd[1507]: Failed password for root from 201.18.245.x port 12270 ssh2

That is 10 minutes 50 seconds after boot. The server was not serving anything. Port 22 was simply reachable from the internet.

The Attack Was a Generic Dictionary Scan

I grouped the usernames the attackers tried.

journalctl -u ssh --no-pager | grep -oE "Invalid user [^ ]+" | awk '{print $3}' | sort | uniq -c | sort -rn

Output:

      7 usuario
      7 user
      7 test
      7 oracle
      7 admin
      5 ftpuser

This is a generic credential scan, not a targeted campaign. Two IP addresses produced every attempt.

IPLog linesMethod
201.18.245.x149Dictionary attack against root and common usernames
92.118.39.x20Root only, every four minutes

The Attack Peaked at 32 Events per Minute

Grouping by minute shows how concentrated the traffic was.

journalctl -u ssh --no-pager -o short-iso | grep -E "Invalid user|Failed password" | cut -c1-16 | sort | uniq -c

Output:

     20 2026-11-27T07:00
     20 2026-11-27T07:01

Password attempts started slightly earlier.

      5 2026-11-27T06:59
      7 2026-11-27T07:00

All of it fits inside 06:59:45 to 07:01:33, about two minutes. After 07:01:33, external Failed password events stop completely.

I Changed the Configuration at 07:00:17

I applied SSH hardening almost exactly at the peak. This is the file I created.

sudo cat /etc/ssh/sshd_config.d/00-hardening.conf

Output:

PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AllowUsers pcparts001
MaxAuthTries 3
LoginGraceTime 30
X11Forwarding no

I validated the syntax and reloaded the service.

sudo sshd -t && sudo systemctl reload ssh

The effective values after the reload:

permitrootlogin no
passwordauthentication no
pubkeyauthentication yes
allowusers pcparts001
maxauthtries 3

The reload happened at 07:00:17. The last attack was logged at 07:01:33.

I Attacked My Own Server to See What Gets Logged

This is the interesting part. After hardening, I tried password authentication myself and checked the server log.

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no ftpuser@<VPS_IP>

Output:

ftpuser@<VPS_IP>: Permission denied (publickey).

The server recorded this.

sudo journalctl -u ssh --no-pager -n 20 -o short-iso

Output:

Invalid user ftpuser from 203.0.113.x port 39798
Connection closed by invalid user ftpuser 203.0.113.x port 39798 [preauth]
User root from 203.0.113.x not allowed because not listed in AllowUsers
Connection closed by invalid user root 203.0.113.x port 39812 [preauth]
Connection closed by authenticating user pcparts001 203.0.113.x port 39820 [preauth]

Three things are visible here.

  • Unknown users are rejected right after the Invalid user line, marked [preauth]
  • Users outside AllowUsers are rejected before any credential check
  • Existing users never produce Failed password, because password auth is disabled

The disappearance of Failed password is not a drop in attacker interest. It means the attackers could not submit a single password.

Before and After Hardening

PeriodAttack eventsFailed password
Before (06:49 to 07:00:17)1012
After (07:00:18 to 08:47)572 (both my own test)

Connection attempts continue after the change. None of them reach the authentication stage, so no password can be guessed.

fail2ban Stops Firing After Hardening

I expected fail2ban to ban the scanners. It did not.

sudo fail2ban-client status sshd

Output:

Currently failed: 1
Total failed:     8
Currently banned: 0
Total banned:     1

The single ban was the pre-hardening attacker, 201.18.245.x. The new IP, 92.118.39.x, keeps trying and is never banned.

The reason is structural. Connections are closed at [preauth], so fail2ban never counts an authentication failure. The server cannot be breached this way, but the log keeps growing.

What This Shows

  • A fresh VPS receives generic SSH attacks within about 10 minutes
  • Roughly 52 attack events arrived in two minutes and then stopped reaching the auth stage
  • Failed password disappearing is evidence of pre-auth rejection, not of attackers giving up
  • fail2ban is a last line of defence, not the first control to rely on

"Attacks stopped" and "attackers gave up" are different things. Reading [preauth] makes the difference obvious.

Summary

  • Any internet-facing server is scanned within minutes of boot. There is no grace period
  • The three settings that matter are key-only auth, no root login, and AllowUsers
  • Watch for [preauth] before trusting a drop in Failed password
  • fail2ban complements hardening. It does not replace it

コメント

タイトルとURLをコピーしました