[Resolved] o2switch customers targeted by an insidious WordPress hack – UPDATE: The host is handling it in an exemplary way

|

|

Identification & causes: everything you need to know 👇 Last week, I revealed on LinkedIn an apparently widespread hack affecting owners of WordPress sites hosted with o2switch. As a WordPress security expert, and thanks to an investigation with a few colleagues, both affected and unaffected, we were able to learn more. UPDATE 07/31/2024 – Summary…



Identification & causes: everything you need to know 👇

Last week, I revealed on LinkedIn an apparently widespread hack affecting owners of WordPress sites hosted with o2switch. As a WordPress security expert, and thanks to an investigation with a few colleagues, both affected and unaffected, we were able to learn more.

UPDATE 07/31/2024 – Summary

According to an internal source, the host would not be at fault at all. The hypothesis of insufficient maintenance of the hacked sites therefore remains the favored one. Still according to this internal source, the means the host has put in place to determine the precise origin of this issue are remarkable (I was given a few examples, and I approve of the strategy). Finally, even though the number of affected sites may seem high, it needs to be put in perspective with o2switch’s large customer base: the actual impact would remain very limited in proportion, and the vast majority of customers should not be affected by this specific issue.

What’s more, on the evening of 07/30/2024, o2switch made a remarkable gesture, very rare among big web hosts, by cleaning up the hack on the affected sites. It was a courageous reaction that surprised me coming from a host. Indeed, the biggest hosts tend to do the opposite, leaving customers to fend for themselves when the problem comes from the end sites themselves. The host’s commitment here is real and earns my utmost respect.

As a reminder, in security the most important thing is prevention: maintain your site with automatic updates and good backups, and don’t forget to use the latest compatible PHP versions. If you need help with that, it’s my specialty 😉

📄 How the hack works

The hack redirects mobile users to fraudulent sites, notably related to the Ukraine/Russia war, via a URL shortener hosted in the United Arab Emirates.

Technically, it consists of an injection of obfuscated JavaScript code into all of the site’s WordPress posts. It is therefore loaded in pages and articles, and sometimes in other plugins such as cookie plugins, user review plugins, and so on.

Here is a preview of the malicious code after de-obfuscation. Even without speaking this language, you can tell that the action takes place on click and that a random URL is selected based on the “UserAgent”, that is, the browser being used:

Additional info 07/31/2024

The request carrying out the hack could be a simple POST request on the site’s index.php file, as a log suggests, which seems to correspond to an actual hack from a US IP address (IP and site masked):

Jul-2024:213287:199.195.252.[HIDDEN] - - [27/Jul/2024:20:10:59 +0200] "POST /index.php?s=captcha HTTP/1.1" 200 102292 "https://www.[HIDDEN].fr/index.php?s=captcha" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; InfoPath.3; .NET4.0C; .NET4.0E) chromeframe/8.0.552.224"

Here we can see a 102,292-byte request made to the index, which is 100x larger than the usual requests of around 1,000 bytes. Especially since this site has no Captcha… What’s troubling is that the request results in a 200 code, meaning the request is accepted and processed without error, whereas visiting this URL should instead give a 404 (Not Found) error.

🔍 Identification

  • The hack is sometimes inserted incorrectly into posts and displays as plain text in the body of pages instead of executing
  • Most of the time it is invisible. You can check whether your site is affected by searching for “_0x365b”, or “0x3023”, or “function _0x”, using the inspector in your browser’s developer console when visiting the site, or by searching in phpMyAdmin
  • Eset and Avast antivirus programs block access to the affected sites
  • Update 07/31/2024 – One of the affected sites doesn’t show the code in the developer console; you need to use the “curl” command-line tool instead to see the malicious code. This may be due to the site’s cache.

Here is an example of the malicious code as seen from the developer console:

🌐 Spread of the hack

By searching for the hack’s pattern on Google and Bing, I found many infected sites. I contacted all of the site owners to alert them, advise them to contact their provider, and offer my help if needed.

  • Out of 40 affected domains found in France and Belgium, only 2 are not with o2switch – update 07/30/2024: Some sites with OVH, Hostinger and various other hosts are also affected, but are rarer for now.
  • Other foreign server providers are affected too, but I found fewer than in France.
  • This suggests a targeted attack on sites located on o2switch IPs, which the hacker would have found through public lists that catalog them. This type of attack can target any host, which can’t do anything about it. That is why you need to be proactive about your security.

💡 Causes still uncertain

Here is what we were able to observe and deduce by cross-checking information among colleagues:

  • Since the hack is insidious, many sites are not diagnosed and detected quickly, but the oldest occurrence appears to date from May – update 07/30/2024: potentially July instead
  • It does not affect a specific plugin or theme
  • o2switch’s Tiger plugin therefore doesn’t seem to be the cause of the problem either, since sites without this plugin are affected
  • The affected sites generally seem to be less well maintained than others, but that’s true of most sites; and fairly well-maintained sites (perhaps not well enough) are affected too
  • The exploited vulnerability may have come from WordPress core when it wasn’t updated quickly enough
  • It may come from the use of an outdated PHP version set by the hosting account’s manager (the end customer)
  • It’s possible that a second WordPress instance (a dev instance, for example) on the same hosting account, one that isn’t up to date, could affect the main instance due to a lack of isolation (it’s the same hosting account, the same system user, the same permissions, and there doesn’t seem to be an open_basedir rule to restrict the directory at the PHP level at o2switch)
  • It doesn’t affect the customers of one specific o2switch server; they are spread across several shared servers, and some servers aren’t affected at all, which points to a marginal issue (so no server-wide or host-wide intrusion)
  • There is a tiny probability that a broader intrusion or host-level vulnerability occurred (for example a flaw in a system package that enables the hack), but we have no evidence to verify it, and since o2switch hasn’t reported anything, it is more reasonable to think the problem comes from the end application (WordPress) or from the PHP version used by the end customer.
  • – Update 07/29/2024 Finally, it’s possible that an Apache web server vulnerability was exploited, either before it had been properly patched, or because o2switch took too long to update its software versions. The dates seem to match for the most recent hacks. Here again, there’s no certainty without an official announcement from the host.
  • – Update 07/31/2024 Vulnerabilities in PHP minor versions, notably in certain revisions of PHP 8.0, could explain the hack. This matches the observed requests, which could cause a buffer overflow and allow code injection. If the host’s PHP 8.0 minor versions are not up to date, that explains how the hack was possible. In any case, the customer is at fault if this is the cause, because PHP 8.0 is obsolete either way and should no longer be used at all. It is also no longer available for selection on LRob hosting plans.
  • No hacks to report on LRob hosting.

🔨 Fixing the hack

The fix consists of cleaning the database by deleting the rows matching the hack’s pattern. Before any operation, back up your database. The website files don’t seem to be affected by this hack, but a full manual check is always recommended, as with any hack. Also remember to clear the various caches so the malicious code is removed from them as well.

Need help fixing your sites and staying secure in the future? Check out my WordPress repair and security services as well as my secure WordPress hosting.

If you have more info, share it in the comments or by private message!


6 responses to “[Resolved] o2switch customers targeted by an insidious WordPress hack – UPDATE: The host is handling it in an exemplary way”

  1. Merci Robin pour ton enquête approfondie !

    Il est temps de prier les dieux du “numérique” :
    Ô grand Zeus, maître des clouds, toi qui contrôles nos données depuis tes serveurs célestes, nous te prions de ne pas laisser nos précieux selfies et documents compromettants tomber entre de mauvaises mains. Que ton trône en titane garde à jamais nos secrets bien au chaud et nos chats bien mignons.

    1. Haha, merci à toi aussi pour l’aide apportée et les infos très utiles !
      Si tu souhaites être crédité dans l’article ce sera avec plaisir. 👍

  2. Odile Avatar

    Merci Robin pour ton aide sur mef74.fr
    l”antivirus avast a bloqué très efficacement le malware.
    Apparemment certains ont eu des pop-up de pubs indésirables.
    Sur IPAD(safari) j’ai pu ouvrir le site mais je n’ai rien remarqué de particulier.
    Quant à la version PHP, il semble que Romain ait la version 8.1.29
    faut-il passer à la 8.3.9 ? Si WordPress est compatible?
    Si le hack vient d’un POST sur index.php, est-ce que un ou des comptes sont compromis
    et faut-il changer les passwords ?
    En tout cas j’ai découvert ton site et l’ai trouvé très intéressant.
    Odile

    1. Avec plaisir Odile, remercie surtout ton prestataire qui a été exemplaire dans sa prise en charge. Extrêmement sympa et intéressant qui plus est.

      Merci pour l’info d’Avast, je vais l’ajouter à l’article.

      Je n’ai pas vu de popups de mon côté mais des redirections. L’effet est quasiment le même (du contenu indésirable s’affiche), mais la terminologie est importante : dans le cas d’un popup, c’est dans une nouvelle fenêtre ou un nouvel onglet, dans le cas d’une redirection, c’est la fenêtre actuelle qui change de site en arrivant sur le site de destination indésirable. Donc pour être 100% exact, on parle ici de redirection.

      Le hack vérifiait s’il était sur smartphone (plutôt iPhone à priori, mais potentiellement aussi Android), donc l’iPad n’est pas concerné car c’est une tablette. Là aussi cela peut sembler subtile mais la différence compte.

      PHP 8.1 est encore supporté en termes de sécurité. Pour sûr si ton site est parfaitement à jour avec uniquement des scripts bien supportés, vous devriez pouvoir passer à PHP 8.2 ou 8.3 sans problème. Les différences sont relativement minimes et la plupart des scripts sont compatibles. Attention simplement en cas de e-commerce, il faut vérifier plus en détails, et plutôt passer de version en version et vérifier calmement si tout est OK (en examinant notamment les logs du site et en testant les fonctionnalités). N’hésite pas à faire le changement, et en cas de souci quelconque il est facile de revenir en arrière, au pire vous aurez une page ou un plugin qui ne fonctionnera pas mais pas d’impact long terme sur une version de PHP trop récente, je n’ai jamais vu ça en 10 ans d’hébergement.

      Enfin, de ce que je sais, le hack précis n’a du tout compromis les données des sites ou leurs compte utilisateurs (et administrateurs). Il a simplement ajouté un vilain bout de code qui faisait cette redirection lors de la visite via un smartphone. Par bonne mesure, le seul mot de passe à changer serait le mot de passe MySQL (intervention technique). Car potentiellement le hacker peut le connaître, celui-ci semblant nécessaire pour prodiguer le hack. Le risque est limité car o2switch ne permet pas la connexion distante aux bases de données, mais cela permet quand même d’exploiter des failles si le hacker le connaît et le garde en mémoire.

      Au plaisir d’échanger.

  3. Cécile Avatar

    Bonjour Robin,
    Super boulot !
    J’ai moi-même été impactée et pas trop aidée par o2. Je me suis un peu débrouillée toute seule d’autant que j’étais dans les premières avec une version PHP à jour (depuis longtemps) et un site régulièrement mis à jour, protégé par Wordfence, avec des mp très forts… J’ai fait appel à un dev de ma connaissance (mais pas fan de WP) qui avait effectivement réussi à trouver ce bout de code mal inséré puisque visible en dur sur les pages semble-t-il. J’ai restauré le site a une version assez ancienne pour être sûr de ne rien embarquer dans la restauration mais j’avoue que c’est assez stressant. Aujourd’hui un comportement étrange sur un autre de mes sites sur un autre serveur me fait craindre un nouveau piratage (mon site était à la poubelle !!!!). Je suis en train de tout vérifier à nouveau mais je ne sais pas comment ils ont fait les première fois pour entrer donc difficile de faire plus surtout que je ne suis vraiment pas tech.
    Voilà, je partage mon expérience pour d’autres si jamais et je suis dispo si tu souhaitais des infos complémentaires sur ce qui s’est passé de mon côté.

    1. Hello Cécile,
      Merci pour ton commentaire.
      Le code était parfois visible, parfois non (il fallait ouvrir la console développeur).
      Pour le 2e site, il faut voir si le souci est le même ou différent.
      Je t’envoie un email pour en discuter en privé

Leave a Reply

Categories

Web Hosting

Succeed on the web

Security, performance, simplicity.
The best tools to serve you.

Nextcloud Hosting

Nextcloud

The best open source collaboration suite

Maintenance Included

WordPress Specialist Webmaster

WordPress website management

WordPress specialist webmaster in Orléans

Entrust your site to a WordPress security and maintenance expert

Hacked WordPress Site Repair

angry-hacker-pirate

Is your WordPress site hacked?

Repair and lasting security for your WordPress site.