Farooq Dad Khan

29 Oct 2026 · 4 min read

A site I look after got hacked, and nobody noticed for 7 months

The site looked fine.

That's what I kept thinking at 3 am, with one file open on my screen and my tea gone cold next to the keyboard. The homepage loaded. The form worked. Leads were coming in like any other night.

And yet, inside one of the framework's own files, a file nobody on our side ever touches, there were about twenty lines that didn't belong there.

They had been sitting there since the 20th of March.

It was the 22nd of October.

How I found it

I wasn't looking for a hack. I was doing the boring job everyone postpones: going through a list of old packages across our sites and updating the ones with known security problems.

One of them was a library called Livewire. Our version had a bug that let anyone on the internet send the site a specially built message and make it run their code. No password. No login. Just one request. The same kind of hole as php2shell, only this time in a library instead of PHP itself.

So I checked the logs, just to be sure nobody had used it.

Somebody had. Back in January, someone tried fifteen times to write a file onto the server and failed, because of folder permissions. In March, someone else tried to read the site's secret settings file. Then, on the 20th of March at 13:33, they got in properly. Thirty-five minutes later, they did exactly the same thing to a second site.

Why nobody noticed

This is the part that still bothers me.

The backdoor didn't break anything. It didn't deface the homepage. It didn't send spam from our server. It looked at who was visiting, and chose what to show them:

  • If you were Google's crawler, it showed Google a page of gambling spam instead of our page.
  • If you were on a phone with Thai as your language, it quietly sent you to a gambling site.
  • Everyone else got the normal site.

We aren't Google. We aren't using phones in Thai. So every time we opened the site, it looked perfect. The people it was attacking were the two audiences we never see from our side.

Later, the spam server it pulled from went down, so Google started getting a "Server Error" on every page instead. We still saw a perfect site.

But here's the thing:

A website isn't one website. It's a different page for every visitor, and you only ever see your own.

What made it possible

Two small decisions, both completely normal:

  1. An old package nobody updated. The fix for that Livewire bug had been out for months. Nothing told us we needed it, so we never installed it.
  2. Testing tools left on the live server. One of the tools the attackers used to run their code was a library that only exists for testing. It does nothing useful on a live site. But it was installed there, so they could use it.

It's like leaving the builders' master key inside the house after the work is finished. Nobody uses it. Nobody remembers it's there. Except the person who comes looking.

How we cleaned it

We downloaded a fresh, official copy of the framework and replaced the infected one. We changed the site's secret key, the one that protects everything else. Then I compared every single file against a clean install, 11,879 files, until all of them matched.

Then I visited the site again. This time pretending to be Google. Then pretending to be a phone in Thailand.

Both got the real page.

Three checks you can do today

You don't need to be a security person for any of these:

  1. Search site:yourdomain.com on Google. If you see titles or pages you never made, especially in another language, something is wrong.
  2. Open Search Console, then Pages and Security issues. Google often notices before you do. Look for strange new URLs or a sudden rise in errors.
  3. Update anything you installed more than a year ago, and don't ship your testing tools to the live server.

The scary part of this hack wasn't how clever it was. It was how quiet it was.

Your site can look perfect to you
and be broken for everyone else.
So once in a while,
look at it the way a stranger would.

— Farooq