The website works and orders keep coming in. Yet code is running on the server that none of you put there. Typically a tool for sending spam. We describe what we found during an audit of an older e-shop and how to check your own website.
What we found
At the end of March we audited an e-shop that has run for many years on its own PHP code without updates. Among other things, the server held four files that didn't belong to the e-shop's code:
- two copies of an off-the-shelf mass-mailing tool that attackers use to spread spam and that also serves them as a backdoor
- two small scripts that download more malicious code from the internet on command
Their names were inconspicuous, two of them just a random combination of letters. The owner didn't know about them and the e-shop kept running with no visible change. An attacker can fake file modification dates, so they can't reliably tell when the compromise began.
We found the unknown files on the old server and also on the new one the e-shop was just moving to. So the move alone would not have solved the problem.
How they got there
Old code usually has more than one way in, and the audit found a whole range of them. A publicly accessible database management tool. A file upload form that didn't check all dangerous file extensions. An old text editor with known vulnerabilities. On top of that, customer passwords stored in readable form, so an attacker with access to the database would get all of them. Code that hasn't had a security update in over ten years can't be secured with a single fix.
What matters for the owner is this: the attacker doesn't need to take the e-shop down. It pays them better to use the server quietly. They send spam from it, and when the domain and IP address end up on a blacklist, customers stop receiving even order confirmations.
Symptoms you may notice
- bounce messages arrive in your inbox for emails you didn't send
- customers report they didn't receive an order confirmation
- your hosting provider sends warnings about the volume of outgoing mail or server load
- the website folders contain files with random names, or with modification dates when nobody was working on the website
What to do if you suspect something
- Don't delete everything right away. First download a copy of the whole website and database. Without it you won't be able to find out later how the attacker got in and what else they changed.
- Find recently changed files. On a server with SSH access,
find . -name "*.php" -mtime -90is enough. On an old website where the code hasn't changed for years, every new file stands out. - Change all passwords: FTP, database, admin, hosting control panel. Do it only after removing the unknown files, otherwise the attacker may read the new passwords.
- Remove tools that don't belong in production, such as a database manager or test scripts.
- Before you move the website, check what you are moving. Otherwise you'll take the compromise with you to the new server.
Removing the files doesn't end the job. If the way the attacker came in stays open, they will come back. For a website that hasn't had updates for a long time, the long-term solution is therefore to replace or rewrite the platform, not another patch.
When to bring in an expert
If you find a single suspicious file, treat the website as compromised. A security audit shows what else is on the server, how the attacker got in and what to fix first. The output is a list of findings sorted by severity and concrete steps for the first week. From it, the owner can see what takes one afternoon to solve and what needs a bigger decision.