Fake jQuery files infect WordPress sites with malware


Security researchers have spotted counterfeit versions of the jQuery Migrate plugin injected on dozens of websites which contains obfuscated code to load malware.

These files are named jquery-migrate.js and jquery-migrate.min.js and present at the exact locations where JavaScript files are normally present on WordPress sites but are in fact malicious.

As of today, over 7.2 million websites use the jQuery Migrate plugin, which explains why attackers would disguise their malware under this popular plugin’s name.

Researchers spot fake jQuery files which are malware

This week security researchers Denis Sinegubko and Adrian Stoian spotted counterfeit jQuery files impersonating the jQuery Migrate plugin on dozens of websites.

To make detection challenging, these malicious files replace the original, legitimate files present at ./wp-includes/js/jquery/ on these websites, which is the directory where WordPress keeps jQuery files.

These files named jquery-migrate.js and jquery-migrate.min.js have obfuscated code further loading a mysterious analytics.js file with malicious code within.

Although the full scale of this attack is yet to be determined, Sinegubko shared a search query that shows over three dozen pages currently infected with the malicious analytics script.

Contrary to its name, however, the analytics file does not have anything to do with gathering website metrics:

fake jquery analytics malware
Malicious “analytics.js” contains more obfuscated code
Source: BleepingComputer

BleepingComputer analyzed some of the obfuscated code present in the file.

The code has references to “/wp-admin/user-new.php” which is WordPress administration page for creating new users. Moreover, the code accesses the _wpnonce_create-user variable which WordPress uses to enforce Cross-Site Request Forgery (CSRF) protections.

Generally speaking, being able to obtain or set CSRF tokens would give attackers the ability to make forged requests on behalf of users. 

Injecting scripts like these on a WordPress site lets attackers conduct a variety of malicious activities including anything from Magecart scams for credit card skimming to redirecting users to scam sites.

Users may be directed to fake surveys, tech support scams, be asked to subscribe to spam notification or download unwanted browser extensions.

But, more specifically in this case, the checkme() function attempts to redirect the user’s browser window to a malicious URL identified by BleepingComputer.

Particularly, line 15 of the analytics script (shown above) contains an encoded URL with its characters represented as ASCII numbers.

When decoded by BleepingComputer, the URL was identified to be:


NOTE: Readers are advised out of caution to refrain from navigating to the URL above.

The analytics.js script first redirects the user to this URL, which further takes the user through series of redirects to spam URLs.

malicious URL redirects further
Malicious analytics.js file further redirects the user to malicious URLs of prompting the allow notifications
Source: BleepingComputer

In examples seen by BleepingComputer, the pages repeatedly prompted the user to “Allow” browser notifications to verify they were not a robot, or led to fake surveys aimed at collecting user data.

Until the user clicks “Allow,” the redirect sequence keeps hopping them through different domains and webpages showing the user the same message in more creative ways.

An example spam survey that the user is led to by this URL is shown below:

fake survey
Fake survey enticing the user under pretense they have won a Samsung Galaxy S10 smartphone
Source: BleepingComputer

A search for this newly identified URL by BleepingComputer further revealed over two dozen websites which were infected with it.

The network of spam URLs used in the redirect sequence is also vast with multiple domains at play. BleepingComputer has not analyzed each one of these domains yet.

Low VirusTotal detection rate

As seen by BleepingComputer, at the time of writing the malicious analytics.js file in question, and the URL identified by us would fly under the radar of over 90% of antivirus engines, given low VirusTotal detection rates.

Therefore, performing security scans of your websites by relying on signature-based scanning alone may not be sufficient to detect counterfeit code lurking in your WordPress instances. 

low virustotal score
Low detection rate for malicious “analytics.js”
Source: VirusTotal

It is not yet known how are these scripts injected or make their way into the webpages of compromised servers.

If your website uses WordPress or popular JavaScript plugins such as jQuery Migrate, it is a good idea to regularly perform thorough security audits and check for anomalies that may indicate signs of malicious activity.

Thanks to Mark Roze from Spyse for providing data on 7.2 million websites running the legitimate jQuery Migrate plugin.