Malware that comes back: why cleaning the site does not fix it

The infection returns days later because the cleanup treated the symptom. Finding the way in is a different job from removing the malicious file, and it is the one that decides whether the problem ends.

There is a sequence that keeps repeating. The site gets flagged as unsafe, someone removes the strange files, everything looks normal again. A week later, the same redirects, the same browser warning, the same indexed spam.

When that happens, it was not bad luck. It was a cleanup that never reached the cause.

Removing the file is the easy part

A scanner finds what it already knows: a malicious code signature, a file modified at an odd hour, an obfuscated string. That takes care of the visible part. What it does not do is answer the question that matters: how did it get in.

Until that answer exists, the door stays open. And the attacker tends to come back the same way, because that is the way that worked.

Where the door usually is

In most of the environments we take over, the vector is in one of these places:

  • An outdated dependency. A plugin or theme with a known vulnerability and a published exploit. The attacker needed nothing sophisticated.
  • A leaked credential. A password reused from another service, an old FTP account nobody revoked, an API key in a public repository.
  • A wrong file permission. A directory with write access where there should be no writing at all.
  • A backdoor left behind. Not the original vector, but the one that guarantees a way back in even after the cleanup.

The last one is the most deceptive. A webshell of a few lines, hidden inside a legitimate plugin or in the middle of the uploads folder, survives any surface-level scan, and hands the access back the next day.

What changes when you investigate

Investigating an incident means looking at what the environment recorded:

  • Access logs, to find the request that precedes the first suspicious change.
  • File modification dates, which give the order of events and separate what the attacker changed from what was already there.
  • Users and sessions, to spot accounts created outside the normal flow.
  • The database, where injected content and altered options tend to remain after the files are cleaned.

There is not always enough of a record: a server with no log retention is common, and in that case the reconstruction is partial. Saying so openly is worth more than presenting a conclusion the data does not support.

Without logs, you can still close the environment

When the history does not exist, the strategy changes: instead of finding the exact path, you close the set of possible paths. In practice:

  • Rebuild core, plugins and themes from trusted sources, rather than trying to repair file by file.
  • Rotate every credential and key, including the ones that seem unrelated.
  • Review users, permissions and integrations that hold write access.
  • Update the dependencies with known vulnerabilities, with staging before anything goes live.

It is more work than deleting the infected file. It is also what makes the problem stop coming back.

After the site is back

A freshly recovered environment is a fragile one: a lot changed at once. The days that follow call for file integrity monitoring, a backup that has been restored at least once to count as a backup, and a review request to Google when the domain was flagged. Without that, the deceptive site warning stays up even after the site is clean.

If the cleanup has already been done twice and the infection came back, the next step is not to clean it again. It is to find out what nobody looked at.

The point

Malware removal and incident response look like the same thing and are not. The first puts the site back online. The second finds out why it went down, and it is the only one that closes the matter.

If your environment is stuck in that cycle, talk to us: the first step is to contain it and get the site back online in a safe state; investigating the origin comes next.

Deixe um comentário