Many server owners treat ransomware as the only breach outcome worth worrying about. The logic goes: if no files are encrypted and no ransom note sits on the desktop or in /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
Encrypting files is noisy. It spikes CPU and disk I/O, triggers monitoring alerts, and often breaks services in ways that get noticed within minutes. From an attacker's perspective, encryption is a gamble: the victim might have backups, might refuse to pay, or might call law enforcement immediately.
Silent data theft has none of those downsides for the attacker. They exfiltrate a database dump or a tarball of /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
If you suspect a compromise, or even if you just want to baseline what "normal" looks like, start with what your server is talking to right now.
The ss command (socket statistics, the modern replacement for netstat) shows established outbound connections:
ss -tunp state established '( sport != :22 and sport != :80 and sport != :443 )'
This filters out SSH, HTTP, and HTTPS listener traffic so you can focus on connections your server initiated to external hosts. Look for:
- 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.
For a point-in-time snapshot, 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
DNS tunneling is a technique where an attacker encodes stolen data into DNS queries. Instead of sending a file over TCP to a remote server, the malware breaks the data into chunks and sends them as subdomain lookups: 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:
resolvectl log-level debug
journalctl -u systemd-resolved -f
Watch for:
- 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).
If your server uses a local caching resolver like 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
A database dump or compressed archive leaving your server creates a traffic pattern that stands out if you know where to look. The problem is that most server operators only monitor inbound traffic (because that is what bandwidth billing typically measures) and ignore outbound.
Check interface counters for a rough picture:
cat /proc/net/dev
The tx_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:
tcpdump -i eth0 -w /tmp/outbound.pcap 'src host YOUR_SERVER_IP and not port 22' -c 10000
This captures 10,000 packets of outbound traffic (excluding SSH so you do not capture your own session). You can then inspect the pcap file with tcpdump -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
Attackers often stage data before sending it out. They dump a database, compress it, and then transfer the archive. This leaves traces:
- 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.
Also check if any new SSH keys were added to ~/.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
The common mental model is binary: either the server is visibly compromised (ransom note, defaced website, processes pegged at 100%) or it is clean. Reality has a large middle ground where a server is compromised but functioning normally.
A properly investigated server should show:
- 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.
If you run a hosting environment with multiple accounts, also check whether any account ran unexpected outbound scripts. PHP scripts, Python scripts, or even Perl one-liners can exfiltrate data through HTTP POST requests to external endpoints. Web server access logs will not show these, but checking for outbound connections from php-fpm, lsphp, or httpd worker processes with ss -tunp can reveal them.
Building the habit before the incident
The hardest part of detecting data exfiltration is that most of the evidence is ephemeral. Network connections close. DNS queries are not logged by default. Traffic counters reset on reboot. If you start looking only after you suspect a breach, much of the evidence is already gone.
Three things worth setting up on any server you care about:
First, enable outbound connection logging. Even a simple iptables or nftables LOG rule for new outbound connections gives you a historical record. This generates log volume, so send it to a remote syslog server or a log management system where an attacker cannot delete it.
Second, baseline your normal outbound traffic. Know which external IPs your server legitimately talks to (package mirrors, DNS resolvers, payment gateways, API endpoints). Anything outside that baseline during an investigation is worth examining.
Third, keep logs off the server itself. If an attacker has root access, they can (and often do) truncate or delete local logs. Remote syslog, a separate logging server, or even a simple rsync of log files to a different machine on a schedule makes log tampering much harder.
None of this prevents data exfiltration. But it turns an invisible event into a detectable one. And detection is the prerequisite for every response action that follows: containment, forensics, notification, and recovery. The worst breach is not the loudest one. It is the one you never find out about.