The rootkit behind the SEO spam: 22 months unnoticed

The rootkit behind the SEO spam: 22 months unnoticed

A digital agency came to us about SEO spam on its websites. The cause turned out to be the Ebury rootkit. We cleaned up a server hosting ~110 websites without taking them down, and set up monitoring that caught two real attacks in the first week.

Back to projects

See how it works

the projectin numbers

  • 22

    months the rootkit ran on the server unnoticed (December 2023 – October 2026)

  • ~110

    websites of the client and its customers on one server

  • 8

    minutes from web shell upload to the attack being shut down

  • 20+

    days without any sign of the rootkit returning

The client's request

Everything lived on a single dedicated server, with no security monitoring. It had to be cleaned in place without stopping dozens of client projects.

What was there

  • Server: Ubuntu 22.04, ISPmanager, Docker, PostgreSQL, mail.
  • Projects: ~110 websites from 2019–2026 on WordPress, Laravel and Node.js; 158 GitHub repositories.
  • Access: SSH login with a password, one root password for SSH and the panel, deploys from GitHub Actions over SSH, contractors with access.

What happened

  • An old Laravel app was running with debug mode enabled.
  • Attackers used it to gain access to the server.
  • SEO spam appeared on the agency's corporate websites.
  • 8 days passed before the client noticed the breach, and only because of the visible spam.

Constraints

  • Clean up in place, no migration.
  • No server reboots, no stopping websites or deploys.
  • Don't break the panel the agency uses to manage websites, mail and VPN.

What changed

The rootkit is removed, credentials are replaced, and the server is under monitoring. In the 20+ days since the rootkit was removed, there hasn't been a single sign of its return. The only alert during that time turned out to be false and was investigated.

Before

  • The Ebury rootkit sat on the server for 22 months, and nobody knew.
  • The intrusion was noticed after 8 days, because of visible spam.
  • SSH login by password, root reachable from the internet.
  • The hosting panel was open to the internet, with the same password as root.
  • GitHub keys on the server with write access to all 158 repositories.
  • 20 Laravel projects with vulnerable dependencies.

After

  • The rootkit is removed, with a check for its return every 5 minutes.
  • An intrusion is visible at the moment of login or within a minute of a file appearing.
  • Key-only login, and every login is visible in Telegram.
  • The panel is reachable only via VPN, with TOTP.
  • Old keys are revoked, and deploys run under a separate user.
  • Patches in all 20 projects, 7 upgraded to Laravel 11–12.

How the protection works

From investigation to monitoring: how we found the rootkit, cleaned the server and caught two real attacks. Order of work: investigation → cleanup → vulnerabilities → monitoring.

Beneath the website hack lay a rootkit from 2023

The first cleanup removed the spam and rebuilt the vulnerable website, and the conclusion was "root not affected". We didn't stop there and checked the integrity of the entire system: packages, SUID files, kernel modules, loaded libraries, network connections.

What we found

A libkeyutils library that doesn't belong to any package, with a forged modification date. It was loaded into sshd, PHP, Apache, PostgreSQL and the DNS server. The signature matched Ebury, an OpenSSH backdoor and credential stealer that, according to ESET, has infected around 400,000 servers.

What it meant for the client

Ebury steals the passwords and keys of everyone who logs in via SSH. Over 22 months, administrators, developers and CI logged in through the server, and the server itself held keys with write access to all 158 repositories. We immediately treated all of these credentials as compromised and made rotating them the first item in our recommendations.

For 22 months the rootkit ran unnoticed. From discovery to two caught attacks took 10 days.

15 seconds on the server, and an alert

The attacker came back with the root password stolen by the rootkit and restored the implant in 15 seconds. The password hadn't been changed yet. He wiped the logs on disk, but the Telegram alert had already left the server.

Timeline of the repeat attack
13:01:23Root SSH login from a rented VPS in the USA. Alert in Telegram.
13:01:33The tampered library is restored, a hidden process disguised as a system utility is started.
13:01:38Logout. Before that, login records and 4.5 hours of the system log were wiped.
by 13:20The IP is blocked, root password login is disabled.
20:16–20:21The rootkit is found and removed, the implant stopped. After a reboot, 0 infected processes; websites and services came back up.
21:43–22:05Independent read-only check: clean.

01 Why the search took 7 hours

The infected sshd loaded the rootkit into every SSH session, so standard utilities (ls, cat, ps) showed a clean system. The first hypothesis of a kernel rootkit wasn't confirmed.

02 What worked

A static busybox doesn't load shared libraries, so the rootkit couldn't fool it. With it we found both the tampered link and the rootkit file, removed it and rechecked the server from scratch.

03 Conclusion

The server was a botnet node; the attackers' goal was harvesting credentials, not harming websites. We separately checked for spam mailing, traffic interception, payment form theft and GitHub abuse, including 12,577 commits: nothing was confirmed.

Two real attacks caught in the first week

We built the monitoring in one day on standard Linux mechanisms. Events go to the team's Telegram group and to a log with a year of history. Routine events such as CI deploys and our own VPN logins arrive silently so they don't drown out real alerts.

First week of monitoring
2
real attacks caught in the first week
55K
scanner requests per day from 229 addresses caught by new fail2ban rules
951
WordPress login attempts from 328 addresses
1,318
FTP password brute-force attempts in the logs
Sample alerts in Telegram
PHP files changed
Website: site-1, new file in wp-content, checked every 5 minutes.
sudo by a website user
sudo denied, web server user.
Morning summary
Scanners, password guessing, panel logins over the past 24 hours.

What the monitoring catches

  • SSH logins from unknown addresses, and the login method.
  • Sudo by website users and programs launched from PHP.
  • New and modified PHP files.
  • Changes to SSH keys, cron, sudoers, PAM, systemd.
  • Signs of Ebury returning: a foreign library, hidden processes, LD_PRELOAD.
  • Hosting panel logins, password guessing, attack waves.
Illustration: sample data.

A web shell shut down in 8 minutes

A bot uploaded a web shell to an old WordPress website through a vulnerability in the Ninja Forms File Uploads plugin (CVE-2026-0740). No login required; the hack took one second. All websites of that system user share permissions, so the shell could read database passwords and tokens.

Timeline of shutting down the attack
13:12Shell uploaded, "PHP files changed" alert.
~13:20Website blocked at the nginx level.
13:28The vulnerable plugin is disabled on all three websites where it was installed.
13:30Shell moved to quarantine.
13:40The attacker's IP is blocked.

How it ended

The attacker didn't get to use the shell: no new files, processes, cron jobs or attempts on other websites. Without monitoring, the shell would have sat there until the next visible sign of a breach, just like the SEO spam before it. We investigate false positives down to the root cause: one of the "hidden process" alerts turned out to be a race condition in the check, and we rewrote it.

Challenges and solutions

The difficulties we ran into while solving the problem and how we solved each of them.

01

An invisible rootkit

Problem

The infected sshd loaded the rootkit into every SSH session, so ls, cat and ps showed a clean system.

Solution

We used a static busybox: it doesn't load shared libraries, so the rootkit couldn't fool it.

02

Searching blind

Problem

The first hypothesis of a kernel rootkit wasn't confirmed.

Solution

We rechecked the server from scratch and found the tampered link and the rootkit file.

03

Cleanup without downtime

Problem

Dozens of projects run on the server; reboots and downtime are unacceptable.

Solution

Every change was agreed with the client, with a configuration backup and a rollback plan prepared. There were two short outages on individual websites (5 and 14 minutes) and one reboot for verification.

04

A stolen password

Problem

The attacker came back with it 5 days later, before the password had been changed, and restored the implant in 15 seconds.

Solution

The Telegram alert went out before the logs on disk were wiped. The IP was blocked, and root password login was disabled.

05

A false alarm

Problem

One of the "hidden process" alerts turned out to be a mistake.

Solution

We traced it to the root cause: it was a race condition in the check, and we rewrote it.

A checklist for your server

The visible website hack wasn't the biggest problem. Five actions for anyone running dozens of websites on one server.

22 monthsthe rootkit lived unnoticed

Website hacked: check the whole server

Cleaning up one website wouldn't have found a rootkit that sat in the system for 22 months.

5 daysuntil the attacker returned

Change passwords and keys immediately

The attacker came back 5 days later with a password whose change had been put off "for later".

Keys onlyfor SSH login

Disable password login for SSH

Ebury feeds on intercepted passwords, and key-based login takes away its main resource.

15 secondsto wipe the logs

Alerts must leave the server instantly

In 15 seconds the attacker wiped the logs on disk, but not the message in Telegram.

1 secondto exploit the plugin

Update or remove old software

Both web hacks in this case went through public CVEs, and the plugin exploit took one second.

How it works for you

A good fit if

  • You're an agency or studio hosting client websites on your own server.
  • You have dozens of websites on one server.
  • You've been through a website hack and aren't sure nobody is left on the server.

What we need from you

  • Access to the server. Read-only is enough for an audit.
  • The list of websites and services that can't be stopped or rebooted.
  • A person who will approve changes.

What can be added next

  • Rotating passwords and keys for third-party services stored on the server.
  • Isolating websites from each other so that one hacked website doesn't open up the rest.
  • Removing outdated software, such as PHP 7.4.
  • External uptime checks for the server.
  • Moving to a clean server: our recommendation after two root compromises.

Not sure nobodyis on your server?

We'll start with a read-only audit: we change nothing until you see the full picture.

Discuss a project

Related Projects

ESQRD

Contact us

Please enter your name
Please enter your correct email
Please enter your phone number
Your budget
Please describe your idea here
Choose a source