Skip to content

Reference The 25 checks

Signs of a break-in

Security check break-in

What it reads

The programs in the system folders, compared with the checksums their packages installed (dpkg's lists, or rpm -V; once a day in the background); each running process's name, program path and command line, to look for a miner's words (only the name and path are kept); /etc/crontab, /etc/cron.d, the cron folders and users' cron tables, systemd's units in /etc/systemd/system and users' own, and /etc/rc.local; /etc/passwd; the dates of users' authorized_keys files; /etc/ld.so.preload; where users' .bash_history points; and the dates and sizes of the sign-in log and the system log. Never a file's contents beyond these, and never a command line, which may hold secrets.

Does it need root?

It needs root. Other users' cron tables, login keys and programs can be read only by root, and "no signs" without them would mislead. Without root, that part is skipped and never counted as passed. Run sudo kiyesi scan to include it.

When it passes

The report lists it as passed, in these words:

  • No signs of a break-in

What it can find

Critical

count system programs differ from their packages, such as path

A program in a system folder changed after it was installed is what a backdoor or a rootkit leaves behind. An update stopped halfway can do it too, so check before you treat the server as broken into.

Fix, to review and run yourself
sudo dpkg --verify (or sudo rpm -Va) lists them; reinstall each package (sudo apt-get install --reinstall $(dpkg -S path | cut -d: -f1)). If nobody changed them, follow docs.kiyesi.dev/guides/break-in/
Critical

Process name (pid pid) runs a program from folder

Anyone on the server can write to folder, so real software is never installed there. It is where attackers drop their tools, because it always works.

Fix, to review and run yourself
sudo ls -l /proc/pid/exe to see the program, then sudo kill pid, and look for what starts it again (this check reads cron and systemd too)
Critical

A crypto miner is running: name (pid pid)

Miners are the most common thing attackers run on a server they get into. It earns them money, and costs you the CPU, the speed of your apps and often the trust of your provider.

Fix, to review and run yourself
sudo kill pid, then find how it got in and how it starts again: sudo ls /etc/cron.d /var/spool/cron/crontabs /etc/systemd/system 2>/dev/null, and docs.kiyesi.dev/guides/break-in/
Critical

path starts a program from a temporary folder

A program that starts itself from /tmp, /var/tmp or /dev/shm is how an attacker comes back after a restart. Real jobs run programs installed in the system folders.

Fix, to review and run yourself
sudo cat path, and remove the entry if nobody on your team added it
Critical

path downloads code and runs it, or opens a shell to another machine

An entry that fetches a script and runs it, or hands a shell to another address, at every start or on a timer, gives someone else the server whenever they want it.

Fix, to review and run yourself
sudo cat path, and remove the entry if nobody on your team added it
Critical

Account user has root's powers (user id 0)

Only root should have user id 0. A second one is a well-known hidden way back in, because it looks like an ordinary account in most lists.

Fix, to review and run yourself
sudo grep ':x:0:' /etc/passwd to see it, then sudo userdel user if nobody on your team made it
Critical

path is loaded into every program through /etc/ld.so.preload

This is how many rootkits hide their files and processes from the system tools. Very few real programs need it.

Fix, to review and run yourself
sudo cat /etc/ld.so.preload. If nobody on your team added it, follow docs.kiyesi.dev/guides/break-in/
Warning

user's shell history is sent to /dev/null

Attackers turn history off to hide what they typed. Some people do it on purpose, which also leaves nothing to look back on after a problem.

Fix, to review and run yourself
sudo rm ~user/.bash_history if nobody on your team set it; the shell starts a new one
Warning

path is empty and has not changed since date, while the other logs go on

Every sign-in and use of sudo is written there. A sign-in log that stopped while the rest goes on is often one that was wiped to hide a break-in.

Fix, to review and run yourself
sudo journalctl -u ssh -u sshd --since -7d to read the sign-ins from the journal, then sudo systemctl restart rsyslog
Info

Login account user was added, first seen date

Check it was someone on your team. Adding an account is a common way to get back in later.

Fix, to review and run yourself
sudo journalctl -u ssh -u sshd --since -30d | grep -w user to see its sign-ins; sudo userdel -r user if nobody knows it
Info

user's login keys changed on date

Each line in that file opens the server to whoever holds the key. Check the change was someone on your team.

Fix, to review and run yourself
sudo kiyesi keys lists each key's fingerprint and comment. On your own computer, ssh-keygen -lf ~/.ssh/id_ed25519.pub prints yours to compare. Take out a key nobody recognises by deleting its line from that account's authorized_keys file (sudo kiyesi keys lists them); never take out your own last key