Guide

How to Tell If Your Server Was Hacked and What to Do

Last updated: 30 November 2026

A slow server or a strange log line does not prove a break-in, and a clean-looking server does not rule one out. Check calmly, record what you find, and avoid destroying the evidence.

Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works

Signs worth investigating

Failed login attempts alone are normal on a public server. A success that follows many failures is much more important. Compare what you see with what you expect: ask others who administer the machine whether they made the change, and check your own deployment notes before drawing conclusions.

Before typing anything, note the time and what you noticed. If the provider offers a snapshot, consider taking one to preserve the disk. It may contain the attacker's files and your secrets, so restrict it and do not treat it as a clean backup. A snapshot also does not usually keep the contents of memory.

Read-only checks on Linux

These commands look without changing configuration. Some need sudo, and log names vary by distribution.

who
last -a | head -30
sudo journalctl -u ssh -u sshd --since "7 days ago" | grep Accepted
ps auxf
sudo ss -tunap
getent passwd
systemctl list-units --type=service --state=running
systemctl list-timers --all
sudo crontab -l
ls -la /etc/cron.d /etc/systemd/system

Check ~/.ssh/authorized_keys for every user, including root, and run crontab -l -u USERNAME for other accounts. Look for programs running from temporary folders such as /tmp or /dev/shm.

To compare installed files with package records, use sudo debsums -c on Debian or Ubuntu (it may need installing) or sudo rpm -Va on RPM-based systems. Changed configuration files are often legitimate. The debsums manual itself says it is of limited use as a security tool.

An attacker with root can alter commands and logs. A clean result is not proof.

Read-only checks on Windows Server

Run PowerShell as administrator:

query user
Get-LocalUser
Get-LocalGroupMember -Group "Administrators"
Get-NetTCPConnection -State Established,Listen
Get-ScheduledTask | Where-Object State -ne "Disabled"
Get-Service | Where-Object Status -eq "Running"
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624,4625,4720,4732,1102} -MaxEvents 200
Event IDMeaning
4624 / 4625Successful / failed logon
4720User account created
4732Member added to a local security group
1102Security audit log cleared
7045 (System log)New service installed

Group names are translated on some language editions. In 4624 events, logon type 10 indicates a remote interactive session such as Remote Desktop. Microsoft's Sysinternals Autoruns tool shows many places where programs start automatically. Run a full antivirus scan too, knowing that it can miss things and may quarantine files you wanted to examine.

Contain it without making things worse

  1. Restrict network access using the provider's firewall if available, allowing only your own address. Be careful: a wrong rule can lock you out, so confirm you have console access first.
  2. Save logs and your notes to another machine. Do not copy unknown programs onto your own computer and open them.
  3. Avoid rebooting or deleting files before you have collected what you need, unless active harm leaves no choice. If data is being destroyed or others are being attacked, stop the harm first.
  4. Tell your provider, and anyone whose data may be affected. Legal reporting duties may apply.

Use a different, trusted computer to change passwords. The stolen credential may have come from your own laptop.

Rebuild and recover

If you confirm that someone had root or administrator access, deleting the one suspicious file is not enough. Install a fresh system and move only what you need.

Test restores in advance; see backups with restic. Keep at least one copy that the server itself cannot delete.

Make the next time easier

Use SSH keys, a firewall, automatic security updates and restricted Remote Desktop access. Keep a list of expected users, ports and services, so that a new one stands out. Send logs and alerts somewhere off the server.

If your server is with PhantomVPS and you suspect a compromise, contact support and review the AUP. The status page helps rule out a wider service issue.

Questions and answers

Is high CPU use proof of a hack?
No. Updates, backups, traffic spikes and bugs can cause it. Identify the process, who owns it, where its file is and what it connects to.

Can antivirus or a rootkit scanner confirm the server is clean?
No. A detection is useful, but no finding does not prove safety, especially if the attacker had full control.

Should I shut the server down immediately?
If it is causing serious harm, isolate or stop it. Otherwise restrict the network and collect evidence first, because a shutdown loses information held in memory.

Can I restore the latest backup?
Only if you are confident it predates the break-in. The compromise may be older than the first sign you noticed.

Related guides

Ready to try it? Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works