Hackers Weaponise WordPress Websites

WordPress is a very widely-used, free, open-source content management system (CMS) used to create and manage websites without needing to code. It allows users to build a wide range of sites, from simple blogs to complex online stores, by using customizable themes for design and plugins for added functionality.

This ubiquity means that  WordPress websites long been  a prime target for threat actors seeking to monetise traffic and compromise visitor security. Now, a new malvertising campaign has emerged, exploiting silent PHP code injections within theme files to serve malicious third-party scripts.

The attack seamlessly blends with legitimate site operations, delivering JavaScript that redirects visitors, displays pop-ups, and evades security tools without raising suspicion.

The initial discovery was made by a site owner who noticed unexplained script loads on their website. The intrusion originated from a small block of PHP code appended to the active theme’s file. This injection did not alter any visible page content but executed behind the scenes on every request. The infection was traced back to vulnerabilities in website configurations, mainly involving weak file permissions and outdated themes. Attackers often gain access through compromised credentials or vulnerable plugins, allowing them to insert a seemingly benign function that contacts a command-and-control server.

Once triggered via the wp_head hook, the malicious function fetches a dynamic JavaScript payload and inserts it into the page’s <head> section. This ensures the code is executed before the rest of the page loads, enabling forced redirects, pop-ups, and malicious activity that can bypass security scanners by mimicking legitimate CDN operations.

The malware often embeds itself within hidden iframes, which helps it evade detection and persist until manually removed. The injected code can silently reside on the site, executing malicious scripts on every visitor’s session.

This demonstrates how attackers abuse small modifications in theme files - such as a few extra lines in functions.php - to hijack a website’s front end and infect visitors.

Cleaning an infected WordPress site involves removing the malicious code, checking for other backdoors, and implementing measures to prevent re-infection. Regular updates, strong credentials, and vigilant monitoring are essential to defend against these types of malware campaigns. Ensuring themes and plugins are kept current and configuring permissions securely can significantly reduce the risk.

This campaign demonstrates the importance of cybersecurity best practices for WordPress users, reminding site owners to remain vigilant against evolving threats that exploit common vulnerabilities.

BitDefender  |  CyberPress  |   Cybersecurity News |  Sucuri  |  GBHackers  |  Hacker News  

Image: Ideogram

You Might Also Read: 

The Future Of Digital Leadership Starts With The Website:


If you like this website and use the comprehensive 8,000-plus service supplier Directory, you can get unrestricted access, including the exclusive in-depth Directors Report series, by signing up for a Premium Subscription.

  • Individual £5 per month or £50 per year. Sign Up
  • Multi-User, Corporate & Library Accounts Available on Request

Cyber Security Intelligence: Captured Organised & Accessible


 

« North Korea's Cyber Operations - Designed To Evade Sanctions
Britain Is Facing A Cyber Onslaught »

ManageEngine
CyberSecurity Jobsite
Check Point

Directory of Suppliers

Keygraph

Keygraph

Keygraph builds AI penetration testing for application security teams. Keygraph also builds Shannon, a leading open-source AI pentester

ManageEngine

ManageEngine

As the IT management division of Zoho Corporation, ManageEngine prioritizes flexible solutions that work for all businesses, regardless of size or budget.

Jooble

Jooble

Jooble is a job search aggregator operating in 71 countries worldwide. We simplify the job search process by displaying active job ads from major job boards and career sites across the internet.

IT Governance

IT Governance

IT Governance is a leading global provider of information security solutions. Download our free guide and find out how ISO 27001 can help protect your organisation's information.

CSI Consulting Services

CSI Consulting Services

Get Advice From The Experts: * Training * Penetration Testing * Data Governance * GDPR Compliance. Connecting you to the best in the business.

Verisec International

Verisec International

Verisec International AB is a Swedish Tech company focused since inception in enabling Trust in Digital Transactions, through the development of proprietary cutting-edge technologies and services.

Secure Code Warrior

Secure Code Warrior

Secure your code from the start with gamified, scalable online secure coding training for software developers.

Japan Cybersecurity Innovation Committee (JCIC)

Japan Cybersecurity Innovation Committee (JCIC)

JCIC is an independent and not-for-profit thinktank to establish a secure and safe digital society.

TekSynap

TekSynap

TekSynap is a full spectrum Information Technology services provider to federal government agencies.

Dataships

Dataships

We help companies automate their privacy compliance while building healthy, transparent data relationships with their customers.

Pathway Communications

Pathway Communications

Established in 1995, Pathway Communications – is part of the Pathway Group of Companies, a Canadian IT Managed Services organization.

European Union Agency for Network and Information Security (ENISA)

European Union Agency for Network and Information Security (ENISA)

The European Union Agency for Cybersecurity, ENISA, is the Union’s agency dedicated to achieving a high common level of cybersecurity across Europe.

Stacklok

Stacklok

Stacklok are an Open Source first security company enabling safe Open Source Software consumption.

NETAND

NETAND

NETAND privileged access and identity management solutions will secure your business from cyber threats.

ABM Technology Group

ABM Technology Group

ABM Technology Group (formerly True IT) provide business information technology services, solutions, and consulting for small to mid-sized organizations.

SEALSQ

SEALSQ

For the last 25 years, SEALSQ have been developing secure semiconductor chips, secure embedded firmware, and tested hardware provisioning services to serve the vision of a safer connected world.

Washington Technology Solutions (WaTech)

Washington Technology Solutions (WaTech)

WaTech operates the state’s core technology infrastructure – the central network and data center, provides strategic direction for cybersecurity and protects state networks from growing cyber threats.

Twinstate Technologies

Twinstate Technologies

Twinstate Technologies specializes in cybersecurity, proactive IT, and hosted and on-premise voice solutions.

Ensec

Ensec

Ensec is a Swiss company specialized in information security. We offer a range of consulting and managed security services.

Arrakis Security

Arrakis Security

Bring order to the chaos of AI agents. Arrakis gives security teams full behavioral visibility into every agent in the organization — both the ones IT approved and the ones nobody did.

National Cybersecurity Strategy - Spain

National Cybersecurity Strategy - Spain

National Cybersecurity Strategy statement for Spain.