Last week I found casino spam on my own website. Not on a forgotten test site, but on the About page of neps.in, the page that is supposed to describe who I am. Nobody had noticed for months, including me, because it was never visible. This post walks through what the attack looked like, how I cleaned it up, and what I would tell anyone running WordPress to check today.
The spam you cannot see
Open the About page in a browser and it looked completely normal. Open the raw HTML stored in the database and the first thing in it was this:
<div class="so-news-block"
style="position:absolute; left:-9999px; top:-9999px; visibility:hidden;"
data-batch="20260729_150753_rotation_neps_in">
<h3>Actualités récentes</h3>
<ul>
<li><a href="https://neps.in/...-casino-...">21</a></li>
... 59 more links ...
</ul>
</div>
A block of 60 links, pushed nine thousand pixels off the left edge of the screen and hidden on top of that. That was only the first layer. By the time I was done, I had found three different hiding techniques on the same page:
- Off-screen positioning: elements at
left:-9999px, and one wrapper div atleft:-48592pxholding roughly 40 full casino “articles” in Greek, German, French, Italian, Czech, Kazakh and English, complete with tables about gambling law in Liechtenstein. - Collapsed boxes:
<div style="overflow:hidden; height:1px">around a single link. On screen, a one-pixel line nobody notices. - Beacon markers: divs with classes like
cw-manager-wp-frontlinking totest.com. These look like tracking markers the campaign uses to check which sites still carry its links.
Around 120 spam links in total, plus a few hundred lines of machine-translated gambling copy, all sitting under my contact details.
This is a classic SEO spam injection. The attacker does not care about your visitors at all. They care about search engine crawlers, which read the HTML, see a link from an established, legitimate-looking site, and pass along a little bit of ranking credibility to the casino domain. Your site’s reputation is the product being stolen.
Two details made me smile, in a grim way:
- The
data-batchattribute contained a timestamp and the word rotation. This was not a person typing into my editor. It was an automated campaign that tags each site it touches so the links can be swapped out later. - The 60 internal links pointed to casino articles on my own domain that did not exist. The plan was presumably to create those pages later, or the campaign simply got the template wrong. Either way, they were dead links, which is about the only lucky break in this story.
The noise in the database
The page was not the only thing touched. The wp_posts table contained 482 rows that had no business being there:
- 241
customize_changesetrows: the post type WordPress uses to store unsaved Customizer drafts. - 241 rows of a post type called simply
request, with the unusual statusparse. This is not a core WordPress type. Core usesuser_requestfor privacy requests.
Every one of them was backdated to between 2018 and 2020, years before the content they sat next to. Backdating is a common trick: anyone glancing at recent activity will not see them, and they look like ancient leftovers nobody wants to touch.
That second post type caught me out at first. My first query looked for user_request, found nothing, and gave me half the expected count. Only grouping every pre-2026 row by post_type revealed the second batch. Lesson: before deleting anything, count it in a way that cannot hide surprises.
How it got in
The site was running an outdated WordPress core release with a known security hole, and an update was waiting. That is the uncomfortable, unglamorous truth behind most WordPress compromises. It is rarely a zero-day. It is an update that sat in the dashboard for a while.
The cleanup, step by step
Here is the order I worked in. The order matters more than any single command.
0. Back up before the first write
A full database export plus an archive of the files, taken before anything was changed. Cleaning up a compromise involves deleting things, and you want to be able to undo a mistake, or go back later for evidence.
wp db export backup.sql
tar czf files.tgz --exclude=./wp-content/uploads .
1. Patch first
Closing the hole comes before cleaning up, otherwise you are mopping the floor with the tap still running. I chose the latest minor release on the same branch rather than jumping a major version, because it is the smallest change that fixes the problem.
wp core update --minor
wp core verify-checksums
verify-checksums compares every core file against the official release. It is a quick way to make sure nothing in wp-admin or wp-includes has been quietly modified.
2. Remove the spam (and how I got this wrong twice)
This is the part of the story I am least proud of, and the part most worth sharing.
Pass one: I parsed the page HTML and removed the so-news-block div. Done, I thought.
Pass two: I searched for links positioned at -9999px and found eleven more. I had first reported only two, because I skimmed a filtered diff that hid lines it considered “unchanged”. Lesson one: filters that hide noise can also hide exactly what you are looking for.
Pass three: a day later I opened the home page source and spotted a height:1px div linking to a casino. My -9999px search had never been able to find it, because it used a different trick. And my search only looked at <a> tags, so it walked straight past a <div> at -48592px wrapping forty paragraphs of spam.
The fix was to stop hunting for spam and start defining what is not spam:
- List every external link on the page, however it is styled.
- Mark the ones I recognise: LinkedIn, GitHub, my email. Everything else is suspect.
- Find the point where my real content ends. On my About page it ended cleanly at the contact block, and everything after it was injected.
- Keep my content byte for byte, cut the rest, and verify the live page.
That approach found everything in one step, where three rounds of pattern matching had not.
3. Remove the revisions
WordPress keeps revisions of every page. All six revisions of the About page contained the spam, so restoring an old version was not an option, and leaving them would leave the links sitting in the database. They went.
4. Delete the attack rows
DELETE FROM wp_posts
WHERE post_type IN ('customize_changeset', 'request')
AND post_date < '2026-01-01';
The date filter was deliberate. There were also recent Customizer changesets, but those were my own edits. Wiping an entire post type because some of it is malicious is how cleanups cause new problems.
5. Sweep the rest of the site, and look for the injector
A search across all published content for the same off-screen trick found two matches, and both were false positives: lessons in my own web design course that teach position: absolute; left: -9999px as a CSS technique, including the perfectly legitimate accessibility “skip link”.
The bigger question was whether something on the server was still writing the spam. If an infected plugin or a backdoor file keeps injecting links, cleaning the page is pointless. So I searched themes, plugins, must-use plugins and options for the campaign’s fingerprints (so-news-block, data-wp-poster, cw-manager-wp-front), checked for PHP files hidden in the uploads folder, and listed recently modified code. Nothing turned up. The spam had been written straight into the database through the core vulnerability, which the update had now closed.
The same CSS, two very different intentions
That last finding is the most interesting part of the whole incident, for me. The exact same line of CSS is:
- Good practice when it hides a “Skip to main content” link that appears on keyboard focus and helps screen reader and keyboard users.
- Spam when it hides a list of outbound links that no human is meant to see.
The difference is not the technique. It is who the hidden content is for. Content hidden to help some users is accessibility. Content hidden from all users but shown to search engines is cloaking, one of the black-hat SEO tactics that get sites penalised by Google. And the penalty usually lands on the site that hosts the spam, not the attacker who planted it.
Your five-minute checklist
If you run a WordPress site, here is what I would check today:
- Update core, plugins and themes. Then run
wp core verify-checksumsif you have WP-CLI. - List every external link in your key pages’ source, not the rendered page, and question every one you do not recognise. Do not just search for
-9999pxordisplay:none. Attackers have more hiding tricks than you have search terms. Start with your home page. - Count your post types.
SELECT post_type, COUNT(*) FROM wp_posts GROUP BY post_type;Anything you do not recognise deserves a closer look. - Review your administrator accounts. Make sure every one belongs to someone you know.
- Keep a recent backup somewhere other than the server. You will not appreciate it until the day you need it.
The spam on my About page, which is also my home page, was invisible for months. That is the whole point of it. The only way to find this kind of problem is to look at what your site says to machines, not just what it shows to people. And when you look, decide what belongs there, rather than trying to guess every way something might be hiding.

