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

Remote access risks on the rise with CVE-2024-1708 and CVE-2024-1709

4 min read - On February 19, ConnectWise reported two vulnerabilities in its ScreenConnect product, CVE-2024-1708 and 1709. The first is an authentication bypass vulnerability, and the second is a path traversal vulnerability. Both made it possible for attackers to bypass authentication processes and execute remote code.While ConnectWise initially reported that the vulnerabilities had proof-of-concept but hadn’t been spotted in the wild, reports from customers quickly made it clear that hackers were actively exploring both flaws. As a result, the company created patches for…

Evolving red teaming for AI environments

2 min read - As AI becomes more ingrained in businesses and daily life, the importance of security grows more paramount. In fact, according to the IBM Institute for Business Value, 96% of executives say adopting generative AI (GenAI) makes a security breach likely in their organization in the next three years. Whether it’s a model performing unintended actions, generating misleading or harmful responses or revealing sensitive information, in the AI era security can no longer be an afterthought to innovation.AI red teaming is emerging…

What we can learn from the best collegiate cyber defenders

3 min read - This year marked the 19th season of the National Collegiate Cyber Defense Competition (NCCDC). For those unfamiliar, CCDC is a competition that puts student teams in charge of managing IT for a fictitious company as the network is undergoing a fundamental transformation. This year the challenge involved a common scenario: a merger. Ten finalist teams were tasked with managing IT infrastructure during this migrational period and, as an added bonus, the networks were simultaneously attacked by a group of red…

Topic updates

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