/root/, the server was never compromised. This assumption is dangerously wrong. A large and growing category of attacks skip encryption entirely. The attacker gets in, copies what they want (databases, credentials, customer records, private keys), and leaves. No drama, no locked files, no .encrypted extensions. By the time you notice, the data is already sold or leveraged somewhere else.
This matters especially in hosting environments where servers hold databases for multiple sites, email spools, and configuration files with credentials. A quiet exfiltration can be far more damaging than a loud ransomware event, because you may never realize it happened.
Why attackers skip encryption
/etc/ and mail spools, then sell the data or use it for further attacks (credential reuse, identity fraud, extortion with the threat of publishing). The server keeps running normally. Uptime monitors stay green. Nobody investigates.
This is not a theoretical edge case. It is a well-documented pattern in real-world breaches. Many organizations only discover data theft months later, often when stolen records surface on dark web marketplaces or when a third party notifies them.
What to check in outbound network connections
ss command (socket statistics, the modern replacement for netstat) shows established outbound connections:
BASH
ss -tunp state established '( sport != :22 and sport != :80 and sport != :443 )'- Connections to IP addresses you do not recognize, especially on unusual ports (high-numbered ports, port 6667 for IRC, port 4444 which is a common reverse shell default).
- Processes you did not start. The
-pflag shows the owning process. A connection owned by a process named something likekworker2or a misspelled system binary is suspicious. - Connections to residential IP ranges or cloud VPS providers in regions where you have no infrastructure or customers.
ss works. For historical data, you need logging, which most default server configurations do not enable for outbound connections. This is a gap worth closing before an incident happens.
Checking DNS queries for exfiltration tunnels
aGVsbG8gd29ybGQ.evil-domain.com, bmV4dCBjaHVuaw.evil-domain.com, and so on. Each query looks like a normal DNS resolution, but the subdomain labels carry base64-encoded data.
This works because DNS traffic on port 53 is almost never blocked or inspected. Firewalls that restrict outbound HTTP/HTTPS often leave DNS wide open.
To check for this, look at DNS query logs. If your server uses systemd-resolved, you can enable query logging temporarily:
BASH
resolvectl log-level debug
journalctl -u systemd-resolved -f- Queries with unusually long subdomain labels (legitimate subdomains rarely exceed 20-30 characters; tunneling queries often hit the 63-character label limit).
- High volume of queries to a single domain you do not recognize.
- Queries with base64-like patterns in the subdomain (mixed alphanumeric strings with no readable words).
unbound or dnsmasq, check their respective log files. On servers running cPanel or similar panels, the resolver configuration varies, so check which process is listening on port 53 first (ss -ulnp sport = :53).
After you finish investigating, set the log level back to its default. Debug-level DNS logging generates significant volume and can fill disks on busy servers.
Reviewing network traffic volume for bulk transfers
BASH
cat /proc/net/devtx_bytes column shows total bytes transmitted on each interface since boot. This is cumulative, so a single reading is not useful on its own. Compare it against your expected outbound volume. A web server serving mostly text content that shows tens of gigabytes transmitted in a short window deserves investigation.
For more granular data, vnstat (if installed) keeps historical traffic records per interface. If you do not have historical data, that itself is a finding: consider setting up basic traffic accounting before an incident forces you to wish you had.
If you want to capture what is leaving right now, tcpdump can write outbound traffic to a file for analysis:
BASH
tcpdump -i eth0 -w /tmp/outbound.pcap 'src host YOUR_SERVER_IP and not port 22' -c 10000tcpdump -r or transfer it to a machine with Wireshark. Look for large sustained flows to single destinations, especially over non-standard ports.
A word of caution: packet captures on production servers can themselves consume disk and CPU. Limit captures with -c (packet count) or -G (time rotation) and write to a partition with sufficient free space.
Filesystem clues that data was staged for exfiltration
- Check
/tmp,/var/tmp,/dev/shm, and any world-writable directories for unexpected archives (.tar.gz,.zip,.sql.gz,.7z). These directories are common staging areas because they are writable by any user. - Look at
findoutput for recently created large files:find /tmp /var/tmp /dev/shm -type f -size +10M -mtime -7shows files larger than 10 MB created in the last week. - Check bash history files for commands like
mysqldump,pg_dump,tar,zip,curl,wget,scp, orrsyncthat you did not run. Sophisticated attackers clear history, but many do not bother, especially with automated toolkits. - Review cron jobs (
crontab -lfor each user, plus files in/etc/cron.d/,/etc/cron.daily/, etc.) for scheduled exfiltration tasks.
~/.ssh/authorized_keys for any user. Attackers frequently plant keys to maintain access for later exfiltration runs.
What "clean" actually looks like versus what people assume
- No unexpected outbound connections (verified with
ss, not assumed). - No unknown processes (checked with
ps auxfand compared against known services, and ideally verified against a known-good process list or package manager:rpm -Vaon RHEL-family ordebsumson Debian-family systems). - No unexplained DNS query patterns.
- No unauthorized SSH keys or user accounts.
- No modified system binaries (though rootkits can hide these; see the article on checking /etc/ld.so.preload for hidden malware processes for one common hiding technique).
- Intact and consistent log files. Gaps in logs (missing hours or days in
/var/log/auth.logor/var/log/secure) are themselves a red flag.
php-fpm, lsphp, or httpd worker processes with ss -tunp can reveal them.
