--- title: "10 VPS Security Mistakes That Actually Get People Hacked" author: "Pushpum Vats" published: "2026-11-20T12:30:00.060Z" updated: "2026-11-20T12:24:43.687Z" url: "https://zyvop.com/10-vps-security-mistakes-that-actually-get-people-hacked-al87n" canonical: "https://zyvop.com/10-vps-security-mistakes-that-actually-get-people-hacked-al87n" tags: ["Linux Security","self-hosting","VPS Security","Docker","Redis","sysadmin","Backups","DevOps","ssh"] --- # 10 VPS Security Mistakes That Actually Get People Hacked The misconfigurations behind real cryptojacking, data theft and extortion campaigns, each with a one-minute check and a fix ![Cover image]() _The misconfigurations behind real cryptojacking, data theft and extortion campaigns, each with a one-minute check and a fix._ Some of the most damaging server mistakes need no exploit at all. Someone just has to find what you left open: - When the critical RediShell flaw in Redis (CVSS 10) was disclosed in 2025, about 60,000 Redis instances were reachable from the internet with no authentication at all. - Docker's own documentation says its published ports effectively ignore your firewall configuration. - A 2024 extortion campaign that targeted 110,000 domains got in with AWS keys taken from publicly accessible `.env` files. The ten mistakes below are ordered with exposure problems first, because for those an attacker needs nothing but your IP address. Each has a check you can run in under a minute and a fix. > **Assumes Debian or Ubuntu.** On RHEL-family systems (AlmaLinux, Rocky), the SSH service is `sshd` (use `systemctl reload sshd` and `journalctl -u sshd`), `apt list --upgradable` becomes `dnf check-update`, and `unattended-upgrades` becomes `dnf-automatic`. * * * ## 1\. A database or cache listening on the public internet **What happens:** Redis, MongoDB, Elasticsearch, PostgreSQL and MySQL are built for trusted clients on a private network. Redis's own documentation says so: "Redis is designed to be accessed by trusted clients inside trusted environments," and "a single `FLUSHALL` command can be used by an external attacker to delete the whole data set." When the critical RediShell flaw (CVE-2025-49844, CVSS 10) was disclosed in 2025, Wiz counted about 330,000 Redis instances exposed to the internet, roughly 60,000 of them with no authentication at all. The flaw requires authentication, which is no barrier on an instance that has none. **Check:** ```bash sudo ss -tulpn | grep -E ':(6379|27017|5432|3306|9200|11211)\b' ``` The local address must be `127.0.0.1` or `::1`. If you see `0.0.0.0`, `*` or `[::]`, it is public. Confirm from another machine you own: `nmap -Pn -p 6379,27017,5432,3306,9200 your-server-ip`. **Fix:** Bind every service to localhost. For Redis, also keep protected mode on and set a long password or ACL user as a second layer: ``` # redis.conf bind 127.0.0.1 ::1 protected-mode yes requirepass ``` Patch Redis too. If it runs in Docker, don't publish its port at all: containers on the same Compose network reach it by service name. The other services in the check: ``` # PostgreSQL, postgresql.conf (the default is already 'localhost'; confirm nobody changed it) listen_addresses = 'localhost' # MySQL / MariaDB, [mysqld] section of the server config bind-address = 127.0.0.1 # MongoDB, mongod.conf (the default is already 127.0.0.1 since 3.6) net: bindIp: 127.0.0.1 # Elasticsearch, elasticsearch.yml (security auto-configuration can add http.host: 0.0.0.0, so set both) network.host: 127.0.0.1 http.host: 127.0.0.1 # Memcached, /etc/memcached.conf (and keep UDP off) -l 127.0.0.1 -U 0 ``` Restart each service after changing it, then rerun the check. If a second server genuinely needs access, allow only its IP through the firewall for that one port. ## 2\. Docker published ports skip your firewall **What happens:** Docker writes its own firewall rules, and its docs say plainly that "packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration." So `ufw deny 8080` does not protect a container started with `-p 8080:80`, and `ufw status` can look locked down while the service is open to the world. This is how mistake #1 often happens: Redis in a container with `ports: "6379:6379"`. **Check:** ```bash docker ps --format '{{.Names}}\t{{.Ports}}' ``` Any `0.0.0.0:` or `[::]:` entry is published on every interface, so treat it as public unless a provider firewall blocks it. Then test from another machine, not from the server itself. **Fix:** Bind published ports to localhost and put a reverse proxy on 80/443, which UFW does control: ```yaml ports: - "127.0.0.1:8080:80" ``` If a service only talks to other containers, don't publish it at all. **Current Docker versions:** Docker 28 stopped other LAN hosts from reaching _unpublished_ container ports by default, but published ports behave as before. Docker 29 added an opt-in, experimental nftables firewall backend, and Docker says nftables will become the default in a future release, so re-test this behavior after upgrading instead of assuming. Also keep Docker patched: in versions 28.2.0 to 28.3.2, reloading firewalld made ports published to `127.0.0.1` reachable from other machines with a route to the Docker bridge (CVE-2025-54388, fixed in 28.3.3). ## 3\. The Docker API or socket exposed **What happens:** In a 2024 cryptojacking campaign analyzed by Datadog, attackers scanned for hosts with Docker's API open on port 2375, started a container with the host's root filesystem mounted, `chroot`ed into it, wrote cron jobs, installed an XMRig miner, and added their own key to root's `authorized_keys`. Anyone who can talk to the Docker daemon is effectively root on the host. The same applies to a container with `/var/run/docker.sock` mounted: compromise the container, own the host. **Check:** ```bash sudo ss -tlnp | grep dockerd # any output means the daemon is listening on a TCP port; no output is what you want ``` **Fix:** Keep the default local Unix socket. To manage a server remotely, go over SSH instead of opening the API: ```bash docker context create prod --docker "host=ssh://deploy@your-server-ip" ``` Don't mount `docker.sock` into a container unless orchestration is its entire job. ## 4\. Secrets in the web root, in git, or in images **What happens:** Palo Alto's Unit 42 documented a 2024 extortion campaign that targeted 110,000 domains and yielded over 90,000 unique variables from publicly exposed `.env` files, including AWS access keys. The attackers used those keys to enumerate accounts, create an administrator role, run scanners from Lambda, then exfiltrate and delete S3 data and leave a ransom note. **Check:** ```bash curl -s https://yourdomain.com/.env | head -3 # must not print KEY=value lines curl -s -o /dev/null -w '%{http_code}\n' https://yourdomain.com/.git/config # expect 404 or 403 git log --all --oneline -- .env # was it ever committed? ``` **Fix:** Keep `.env` files outside the web root and block dotfiles at the web server, while leaving `/.well-known/` reachable for Let's Encrypt: ```nginx location ~ /\.(?!well-known/) { return 404; } ``` If a secret ever leaked or was committed, rotate it: deleting it from git history does not un-leak it. Use least-privilege keys, and short-lived credentials where the provider supports them. ## 5\. SSH password login still enabled **What happens:** Public SSH ports get password-guessed around the clock. The SSHStalker botnet, reported in February 2026 from Flare's research, spreads through mass SSH scanning and brute force, and Flare found nearly 7,000 newly compromised systems in January 2026, mostly cloud servers. The common trap is believing you already turned passwords off: a drop-in file such as `/etc/ssh/sshd_config.d/50-cloud-init.conf` can leave `PasswordAuthentication yes` in effect even when your main `sshd_config` says `no`. **Check:** ```bash sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin|pubkeyauthentication' ``` `sshd -T` prints the effective values, not what you think you configured. **Fix:** Keys only, no root login. sshd uses the first value it finds for each setting and reads drop-ins in lexical order, so a file named `00-hardening.conf` beats `50-cloud-init.conf`: ``` PasswordAuthentication no PermitRootLogin no PubkeyAuthentication yes ``` Validate, then reload, and test a fresh login in a second terminal before closing your first: `sudo sshd -t && sudo systemctl reload ssh`. ## 6\. Admin panels open to the whole internet **What happens:** phpMyAdmin, Portainer, Grafana, Webmin, WordPress `wp-admin` and similar dashboards control your databases, containers or site, and they sit at a predictable address. Left public, they are one default password or one unpatched flaw from full access. Self-hosted deployment panels show the pattern: one write-up counts more than a dozen Coolify CVEs in 2026, several rated critical, and says Censys found 52,890 Coolify dashboards reachable from the public internet when the first batch was disclosed. Most of the January flaws needed a login, but some later ones did not. **Check:** List everything your web server and reverse proxy exposes, then open each URL from a device that is not on your network. Anything with an admin login that loads is public. **Fix:** Put management interfaces behind a VPN (WireGuard or Tailscale) or an IP allowlist at the firewall or proxy, enable 2FA, and keep them updated. A hard-to-guess URL is not access control. ## 7\. Patching the OS but nothing else **What happens:** The window between a flaw being disclosed and being exploited keeps shrinking. Mandiant measured an average of 63 days in 2018–19 and five days in 2023 (excluding outliers; 47 days with them), and its M-Trends 2026 report reportedly puts it at negative seven days, meaning exploitation often starts before a patch exists. A November 2026 example: attackers tried the "SSHole" OpenSSH authentication bypass (CVE-2026-123158) less than nine hours after it was published, according to Previdian. It affects musl-based systems such as Alpine, not glibc-based Debian or Ubuntu, and the fix is OpenSSH 10.6p2. `unattended-upgrades` only covers apt packages. It does not touch Docker images, npm or pip dependencies, WordPress plugins or self-hosted panels. **Check:** ```bash sudo apt list --upgradable docker images --format '{{.Repository}}:{{.Tag}}\t{{.CreatedSince}}' ``` **Fix:** Schedule updates for what apt doesn't cover: `docker compose pull && docker compose up -d` weekly, Renovate or Dependabot for dependencies, and security advisories for the handful of internet-facing apps you run. When exploitation can precede a patch, the part you control is exposure, which is why mistakes 1 to 3 and 6 matter. ## 8\. Running everything as root, or privileged **What happens:** Any bug in an app that runs as root hands the attacker root. Privileged containers and added capabilities weaken the isolation that was supposed to contain the damage. **Check:** ```bash docker ps -q | xargs -r docker inspect --format '{{.Name}} user={{.Config.User}} privileged={{.HostConfig.Privileged}}' ``` An empty `user=` means the container runs as root. **Fix:** One unprivileged user per service. In Compose: `user: "10001:10001"`, `cap_drop: [ALL]`, `security_opt: ["no-new-privileges:true"]`, `read_only: true`. For apps outside Docker, a dedicated user plus systemd `NoNewPrivileges=true` and `ProtectSystem=strict`. Never use `--privileged` for a normal app. Test each service after tightening it: some images need a capability or a writable path added back. ## 9\. Backups that have never been restored **What happens:** An untested backup fails at the worst moment: the wrong paths were included, the database was copied mid-write, the encryption password lived only on the dead server, or the backups sat on the same machine, or were deletable with its credentials, and vanished along with it. **Check:** Restore to a scratch location and time it, then confirm the app actually starts from the restored data: ```bash restic check restic restore latest --target /tmp/restore-test ``` **Fix:** Keep at least three copies on two media with one off-site. Use write-only credentials or object lock so a compromised server can't erase history. Dump databases before backing up, and store the backup password somewhere other than the server. Put a quarterly restore drill on your calendar and record how long it took. ## 10\. No 2FA on the accounts that control the server **What happens:** Your provider's console can reset the root password, boot a rescue image, and snapshot or delete the disk. Your registrar and DNS host decide where your domain points: whoever controls DNS can get valid certificates issued for your domain and redirect its mail. None of your server hardening matters if someone takes over these accounts. **Check:** Log in to your VPS provider, domain registrar, DNS host and GitHub or CI, and confirm 2FA is on. List and revoke unused API tokens. **Fix:** Use a passkey or hardware key rather than SMS, keep recovery codes offline, enable your registrar's transfer lock, and give automation scoped API tokens rather than your master login. * * * ## A five-minute audit ```bash sudo ss -tulpn # what listens, and on which address sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin' docker ps --format '{{.Names}}\t{{.Ports}}' # 0.0.0.0 or [::] means public curl -s https://yourdomain.com/.env | head -3 # must print nothing sensitive sudo last -a | head # logins you don't recognize? sudo journalctl -u ssh --since "7 days ago" | grep Accepted | tail # who actually got in ``` If anything unexpected shows up, don't try to clean the server: isolate it, take a snapshot for evidence, rotate every secret it could reach, and rebuild from a clean image. * * * ## Sources - [Redis security documentation](): trusted environments, protected mode, `bind`, `FLUSHALL` - [PostgreSQL docs:]() `listen_addresses`: defaults to `localhost` - [Elasticsearch networking settings](): `network.host` defaults to `_local_`; security auto-configuration sets `http.host: 0.0.0.0` - [Memcached docs: DDoS advisory](): `--listen 127.0.0.1`, UDP off with `-U 0` - [Infosecurity Magazine on RediShell (CVE-2025-49844)](): about 330,000 exposed Redis instances, about 60,000 with no authentication - [Docker: packet filtering and firewalls](): published ports and ufw - [Fix Docker bypassing UFW: tested solutions](): binding to 127.0.0.1 and other fixes - [Docker Engine v28: hardening container networking by default](): unpublished ports blocked from the LAN - [Docker Engine v29 announcement](): opt-in, experimental nftables backend - [Ubuntu security: CVE-2025-54388](): localhost-published ports exposed after a firewalld reload, fixed in Docker 28.3.3 - [Datadog Security Labs: campaign targeting exposed Docker APIs]() (June 2024) - [Palo Alto Unit 42: large-scale cloud extortion operation]() (August 2024) - [Why SSH password login persisted: the cloud-init drop-in trap]() - [Ubuntu bug 1873528: how]() `sshd_config.d` [drop-ins are ordered](): the first obtained value wins, so `00-` beats `50-` - [Security Affairs: SSHStalker botnet (Flare research)]() - [Hostzero: Coolify CVEs in 2026]() (a secondary write-up, not the project's own advisories) - [Mandiant: time-to-exploit trends 2023](): 63 days (2018–19) to five days (2023, excluding outliers) - [Security Boulevard summary of Mandiant M-Trends 2026](): reported negative seven days (secondary source) - [The Hacker News: SSHole OpenSSH flaw exploited]() and [CSO Online](): affected systems, fix, exploitation timing