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

How generative AI Is expanding the insider threat attack surface

3 min read - As the adoption of generative AI (GenAI) soars, so too does the risk of insider threats. This puts even more pressure on businesses to rethink security and confidentiality policies.In just a few years, artificial intelligence (AI) has radically changed the world of work. 61% of knowledge workers now use GenAI tools — particularly OpenAI’s ChatGPT — in their daily routines. At the same time, business leaders, often partly driven by a fear of missing out, are investing billions in tools…

Water facilities warned to improve cybersecurity

3 min read - United States water facilities, which include 150,000 public water systems, have become an increasingly high-risk target for cyber criminals in recent years. This rising threat has demanded more attention and policies focused on improving cybersecurity.Water and wastewater systems are one of the 16 critical infrastructures in the U.S. The definition for inclusion in this category is that the industry must be so crucial to the United States that “the incapacity or destruction of such systems and assets would have a…

New ransomware over browser threat targets uploaded files

3 min read - We all have a mental checklist of things not to do while online: click on unknown links, use public networks and randomly download files sent over email. In the past, most ransomware was deployed on your network or computer when you downloaded a file that contained malware. But now it’s time to add a new item to our high-risk activity checklist: use caution when uploading files. What is ransomware over browsers? Researchers at Florida International University worked with Google to…

Topic updates

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