Fun with a baffling WP security issue

One of the secret joys of being a techie is when you have a problem that baffles the experts in a field. It doesn't happen often, and it's frequently an aggravating experience, but in retrospect it can be shared as a war story and as a way of boosting your geek cred.

Earlier today I got an email from the web security experts at Sucuri, and it reminded me about a baffling security issue which I had never shared publicly. Since the problem has long since gone away (or at least I think it has) I thought it would be interesting to share a problem which I was unable to resolve even after I hired security experts.

In February of this year I discovered, quite by accident, that my blog had picked up a new ad. Anyone visiting my blog from an Android device got to see an ad for White Castles overlayed across the bottom of the screen. It looked like this:

Fun with a baffling WP security issue blog maintenance
click to embiggen

I first saw that advert while I was on a trip while using the Wifi network at a conference center, so I initially thought that the center had injected the advert. But then I saw the ad in my hotel room, and after I got confirmation on twitter that others could see it I realized that I had a more serious problem.

That is not my advert, which very likely means that someone hacked my website somehow. (If you run a website you can probably understand the overwhelming sense of panic which accompanied that conclusion.)

I immediately set out to solve the problem. Here's what didn't help:

  • To start, I checked Google Webmaster Tools. This isn't strictly a security tool but it does keep an eye out for malware and sometimes it will flag an issue. No such luck.
  • Next, I went through my blog's theme and looked for any code which didn't belong. Nada.
  • Then, I double-checked that none of my plugins were misbehaving or tied to reports of malware. Zip.
  • Also, I checked to see if I could find a suspicious file uploaded to my site without my knowledge. Bupkus.
  • Finally, I installed a couple different security scanning plugins (one at a time) and had them look for issues. Zilch.

That is all the security troubleshooting I could think of, so I decided to hire an expert and tell them to fix it.

Fun with a baffling WP security issue blog maintenance

On the advice of a friend, I signed up for a year's service with Sucuri. This company provides website monitoring and malware cleanup. They cost $100 a year (for a single site), a price I was willing to pay to get this fixed.

After Sucuri's regularly scheduled scans failed to find anything wrong, I filed a support ticket and pointed them at the problem. I gave them the screenshot, explained how to recreate the issue, and gave Sucuri FTP access to my blog.

They couldn't find it.

Oh, Sucuri found all sorts of non-issues, including code for inactive websites which I had never bothered to delete, but they couldn't find what was injecting the advert into my blog. On the plus side they also didn't find any evidence of malware which could threaten my visitors, but that is a small consolation.

I was never able to solve this problem, so what I should have done next was to publicly ask for help (or, if i wanted to throw money at the issue, perhaps hire a second expert). I honestly can't tell you why I didn't, but that's neither here nor there.

The problem has since gone away. I can't tell you how, but somewhere in the process of switching webhosts, changing my blog theme, and the general cleanup maintenance I performed in July, that advert went away.

Or at least I think it has.

If you see that advert, let me know so I can try to fix the issue - again. You might also forward it to any web security experts you know; I bet they would be interested.

And if you know what was causing the problem, please leave a comment. Even at this late of a date, I would love to know how this happened.

images by IntelFreePressAZRainman

Nate Hoffelder

View posts by Nate Hoffelder
Nate Hoffelder is the founder and editor of The Digital Reader: He's here to chew bubble gum and fix broken websites, and he is all out of bubble gum. He has been blogging about indie authors since 2010 while learning new tech skills at the drop of a hat. He fixes author sites, and shares what he learns on The Digital Reader's blog. In his spare time, he fosters dogs for A Forever Home, a local rescue group.

9 Comments

  1. John Christian Hager7 December, 2014

    Did you contact White Castle? Maybe it’s a known issue for them. Good luck and thanks for all the hard work you do on this blog.

    Reply
    1. Nate Hoffelder7 December, 2014

      Yes. I didn’t get a response.

      Reply
  2. John Heckendorn7 December, 2014

    I’d bet the “switching webhosts” is the key event. Did you contact your webhost at the time to ask about this? Remember that your landlord has a key to your apartment, and all kinds of shenanigans can ensue if they’re trying to make some bucks on the side.

    Reply
    1. Nate Hoffelder7 December, 2014

      I honestly didn’t try; I would have been given the run around by tech support, which wasn’t very competent in the first place. It wasn’t worth the frustration.

      Reply
  3. NoNeedForAName7 December, 2014

    Hypothesis/conjecture: A SQL injection attack may have allowed a hostile party to embed offsite ad server URLs. When you preformed WP maintenance, those associated (tables? fields?, etc.) {sh/w}ould have been automatically culled by the WP update script (eg: deleted the invalid records).

    An interesting case. I would have enjoyed running some regex against a DB dump. Ah well.

    Unsolicited advice: I assume your host uses some version of GNU/Linux. If so, setup(/ask them to provide) automatic daily backups of: your database, WP system files & uploaded content (eg: images) as three individual “tarballs” scheduled thru cron. Apologies I have nothing more specific ATM; I’m a Drupal man, myself.

    Reply
    1. Nate Hoffelder7 December, 2014

      An SQL injection attack is a possibility. I have the remnants of several “posts” sitting in my DB that I didn’t create and can’t delete. I only found them in the past month or so. Do you think they could be related?

      And I have cleaned up the database a couple times since I found that advert.

      Reply
  4. sum guy8 December, 2014

    Did you even bother to perform a wget to download a copy of the web-code that was being served to you, so you could analyze every URL and see which one was the source of the rogue advertizement?

    When I browse the web, I can look at the outgoing traffic log my router keeps – this tells me the various hosts that my machine is looking up during the course of browsing. From this, I add TONS of entries to my HOSTS file – so my computer becomes incapable of contacting these garbage servers (serving ads, tracking me in various ways, etc). If you had done this, you would have been able to at least identify the host machine or domain that was serving your rogue white castle ad.

    Reply
    1. Nate Hoffelder8 December, 2014

      The ad only showed up on Android, which made debugging difficult.

      I have the URL which the advert sent me to, but I wasn’t able to identify the owner or ad network.

      Reply
  5. […] put it simply, Lenovo was doing to their customers what someone (my previous webhost, I think) did to my blog. In this case the adverts were being injected by a piece of adware called Superfish, which […]

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top
%d bloggers like this: