May 9, 2016 By Larry Loeb 2 min read

Security researcher John Castro recently found an interesting WordPress hack. His analysis of the malware was published on the Sucuri blog.

It’s All in the Header

In all observed infections, the malware injected 10 to 12 lines of code at the top of the header.php file of the WordPress theme in use. The header code isn’t very complex; it will redirect visitors to a certain malicious site if it is their first visit after the initial infection.

Next, it will set a cookie to track returning visitors for one year and tests for search engine crawlers. If the coast is clear, it checks the user agent header.

The header also performs random redirects to a number of malicious domains. However, when the use of Internet Explorer is detected, the redirect heads to a website that pushes out a fake Flash or Java update, which could actually be a known malware, Sucuri noted.

Quirks in the Malware

The malware code is not perfect. For example, it may test for a certain parameter without making sure that it exists, which causes a PHP error. This is not always shown since servers may have PHP notices turned off, but checking with a simple Google search may show it exists on your server.

According to Sucuri, those same search results could also show errors in the footer file; a previous version of the malware tried the same trick with different code and placed it there. While developers may have updated the malware, the redirects end up sending users to the same pages.

More to the WordPress Hack

The blog was not sanguine about this type of exploit being the only one on a site.

“In most cases, the infected sites had multiple vulnerabilities,” Sucuri said. “The infection itself was part of a number of other infections in the environment (it wasn’t an isolated event). In some cases, the infection was the only infection and found within the active theme’s header.php file. This is a typical infection scenario when attackers have access to WordPress admin interface and can edit the current theme’s files directly from there.”

That brings up another major point: Attackers may have admin credentials for the site and can manually edit the header file to inject the code for the redirect attack. Even if the malware is removed, it’s critical to change all passwords and check for rogue admin accounts that may have been introduced.

More from

Hive0137 and AI-supplemented malware distribution

12 min read - IBM X-Force tracks dozens of threat actor groups. One group in particular, tracked by X-Force as Hive0137, has been a highly active malware distributor since at least October 2023. Nominated by X-Force as having the “Most Complex Infection Chain” in a campaign in 2023, Hive0137 campaigns deliver DarkGate, NetSupport, T34-Loader and Pikabot malware payloads, some of which are likely used for initial access in ransomware attacks. The crypters used in the infection chains also suggest a close relationship with former…

Unveiling the latest banking trojan threats in LATAM

9 min read - This post was made possible through the research contributions of Amir Gendler.In our most recent research in the Latin American (LATAM) region, we at IBM Security Lab have observed a surge in campaigns linked with malicious Chrome extensions. These campaigns primarily target Latin America, with a particular emphasis on its financial institutions.In this blog post, we’ll shed light on the group responsible for disseminating this campaign. We’ll delve into the method of web injects and Man in the Browser, and…

Crisis communication: What NOT to do

4 min read - Read the 1st blog in this series, Cybersecurity crisis communication: What to doWhen an organization experiences a cyberattack, tensions are high, customers are concerned and the business is typically not operating at full capacity. Every move you make at this point makes a difference to your company’s future, and even a seemingly small mistake can cause permanent reputational damage.Because of the stress and many moving parts that are involved, businesses often fall short when it comes to communication in a crisis.…

Topic updates

Get email updates and stay ahead of the latest threats to the security landscape, thought leadership and research.
Subscribe today