Catching WordPress 0-Days on the Fly

Ananda Dhakal (Vulnerability Researcher · Patchstack), Rafie Muhammad (Lead Security Researcher · Patchstack)

BSides Canberra VIII (2025) · Day 2 · Off-Main Track

Overview

In their BSides Canberra talk, "Catching WordPress 0-Days on the Fly," Patchstack security researchers Rafie Muhammad and Ananda Dhakal unveiled a novel approach to proactively identify zero-day vulnerabilities in WordPress plugins and themes. Their methodology leverages continuous monitoring of the WordPress Subversion (SVN) repository for new code commits, specifically targeting the introduction of sensitive functions and suspicious code patterns. This talk provides a deep dive into the architecture of their automated detection tool and presents several real-world zero-day findings that underscore the efficacy of their "on-the-fly" vulnerability discovery process.

Watch on YouTube

Visual summary for Catching WordPress 0-Days on the Fly by Ananda Dhakal, Rafie Muhammad
Visual summary for Catching WordPress 0-Days on the Fly by Ananda Dhakal, Rafie Muhammad

Key moments

  1. 0:40 Why WordPress is a prime target for security research
  2. 4:00 How the SVN change detection tool works
  3. 6:00 Filtering changes by active installs and file types
  4. 12:00 Vulnerability re-introduced: PHP Object Injection example
  5. 14:00 Exploiting arbitrary plugin installation for RCE
  6. 22:00 Challenges: High false positives and future SAS/AI plans
  7. 24:30 Q&A: Why WordPress core team isn't doing this
  8. 27:00 Q&A: Feasibility of scanning past vulnerabilities

Catching WordPress 0-Days on the Fly

Speakers: Ananda Dhakal (Vulnerability Researcher, Patchstack); Rafie Muhammad (Lead Security Researcher, Patchstack)

Conference: BSides Canberra

YouTube: https://www.youtube.com/watch?v=-K5BZGWrtqM

Overview

In their BSides Canberra talk, "Catching WordPress 0-Days on the Fly," Patchstack security researchers Rafie Muhammad and Ananda Dhakal unveiled a novel approach to proactively identify zero-day vulnerabilities in WordPress plugins and themes. Their methodology leverages continuous monitoring of the WordPress Subversion (SVN) repository for new code commits, specifically targeting the introduction of sensitive functions and suspicious code patterns. This talk provides a deep dive into the architecture of their automated detection tool and presents several real-world zero-day findings that underscore the efficacy of their "on-the-fly" vulnerability discovery process.

The significance of this research cannot be overstated, given WordPress's colossal footprint on the internet. Powering 43% of all websites globally and holding a 63% share of the CMS market, WordPress represents a critical attack surface for adversaries. Vulnerabilities within its vast ecosystem of plugins and themes can serve as an initial foothold for attackers, potentially leading to broader compromise of an organization's digital infrastructure. The speakers highlighted the particular concern of hosting companies regarding WordPress security, emphasizing its criticality.

This presentation serves as a compelling demonstration of how active, real-time monitoring of code changes can dramatically shrink the window of opportunity for attackers. By catching vulnerabilities almost immediately after they are committed to the public repository, security researchers can facilitate rapid patching, thereby protecting millions of WordPress sites from exploitation. The insights shared offer valuable lessons for both developers striving for more secure coding practices and defenders seeking to understand the dynamic threat landscape of the WordPress ecosystem.

Background

▶ Watch: Why WordPress is a prime target for security research (0:40)

The WordPress ecosystem is a sprawling and dynamic environment, composed of three primary components: the WordPress core application, and an expansive collection of plugins and themes. The sheer scale is staggering, with over 59,000 free plugins and 12,000 free themes available in the official repository. This vast number of extensions is a primary driver of WordPress's flexibility and popularity, but it also introduces an enormous attack surface. Each plugin and theme represents a potential entry point for attackers, especially given the varying levels of security expertise among developers.

All official WordPress core, plugin, and theme code is hosted on the WordPress SVN repository. SVN, or Subversion, functions as a centralized version control system, akin to Git, allowing developers to manage changes, track revisions, and collaborate on code. The repository is structured with trunk (the main development branch), branches, and tags (specific release versions). WordPress also maintains WordPress Track, a bug tracking and project management system that logs development activities, tickets, and source code changes. For security researchers, the SVN repository is a treasure trove, as it provides a public, version-controlled history of every code modification, including the introduction of potentially vulnerable code.

The motivation behind targeting WordPress is multifaceted. Beyond its dominant market share, WordPress's open-source nature and PHP codebase make it relatively accessible for security analysis. The security posture of WordPress sites is a constant concern for hosting providers, who bear the brunt of managing compromised instances. Furthermore, while individual WordPress vulnerabilities might seem isolated, they frequently serve as an initial foothold for attackers to gain elevated privileges or pivot to other systems within a company's network. This context underscores the critical importance of proactive vulnerability discovery within this pervasive CMS.

Key Findings

▶ Watch: Filtering changes by active installs and file types (6:00)

The core contribution of this research is the demonstration of an effective, automated method for identifying zero-day vulnerabilities in WordPress plugins and themes as they are introduced. The tool developed by Patchstack researchers has successfully identified numerous critical vulnerabilities, often within minutes or hours of the code being committed to the public SVN repository. This rapid detection capability significantly reduces the window of exposure for affected websites.

A notable finding was the prevalence of developers introducing sensitive functions into their code without adequate security checks. The tool's ability to flag such introductions immediately allowed the researchers to investigate and confirm exploitable conditions, leading to the discovery of vulnerabilities ranging from account takeovers and arbitrary plugin installations to PHP object injection and arbitrary file uploads. These findings highlight a systemic issue within the WordPress development community, where security best practices are not consistently applied, leading to recurring patterns of vulnerable code.

Beyond just identifying new vulnerabilities, the tool also demonstrated its utility in tracking the lifecycle of security issues. In several instances, it detected not only the introduction of vulnerable code but also its subsequent removal or patching. A particularly concerning discovery was the re-introduction of previously patched vulnerabilities, such as a deserialization flaw in the WP Event Plugin, which resurfaced after developers uncommented the vulnerable code. This phenomenon underscores the ongoing challenge of maintaining security patches and preventing regressions, even after initial fixes have been deployed. The research ultimately showcases that constant vigilance via automated monitoring can effectively surface newly committed flaws, allowing for swift action before widespread exploitation.

Technical Deep Dive

▶ Watch: Exploiting arbitrary plugin installation for RCE (14:00)

The technical architecture of Patchstack's vulnerability detection tool is built around continuous, automated monitoring of the WordPress SVN repository. The process is designed to be efficient, focusing on newly introduced code that is most likely to contain vulnerabilities. The entire system operates under a threading process, executing hourly to keep pace with the frequent code changes in the WordPress ecosystem, which can range from 50 to hundreds of changesets per hour.

The first step in the process involves tracking SVN changes. The tool maintains a local record of the last processed SVN revision for each plugin and theme. Hourly, it compares this stored revision with the latest revision available in the WordPress SVN repository. This comparison is facilitated using the svn log -v command-line interface, which provides detailed commit information, typically in XML format. By tracking revisions, the tool ensures it only processes new or modified code.

Upon detecting new revisions, the tool proceeds to check each SVN revision with a series of filters for efficiency and relevance:

  1. Extract Plugin Slug: A unique identifier string for each plugin or theme is extracted. This is crucial for distinguishing between similarly named components.
  2. Active Installation Count Filter: To prioritize research efforts and minimize false positives, the tool only proceeds with plugins or themes that have 5,000 or more active installations. This significantly narrows down the scope from the tens of thousands of available components, focusing on those with the largest potential impact.
  3. File Path Filtering: The tool specifically targets changes within the /trunk directory of the SVN repository. This ensures that only changes to the latest, main development branch are processed, ignoring modifications to older tags, branches, or non-code assets.
  4. File Type Filtering: Only PHP files are processed. This is because PHP is the primary language for WordPress logic and where most code-execution vulnerabilities reside, filtering out irrelevant file types like JavaScript or HTML.

For each relevant changeset (a compilation of code changes within an SVN revision), the tool meticulously analyzes the modified files. It opens the changeset file and specifically focuses on added lines, identified by a + prefix. This approach targets newly introduced code, which is statistically more likely to contain fresh vulnerabilities, rather than analyzing removed or existing code.

The core of the detection logic lies in searching for WordPress and PHP sensitive functions. The researchers maintain a curated list of functions known to be frequently misused or to pose security risks if not handled correctly. Examples of such functions include:

  • wp_set_auth_cookie(): Used for setting authentication cookies, critical in account takeover scenarios.
  • wp_insert_user(): Capable of creating new users with arbitrary roles.
  • unserialize(): A common source of PHP object injection vulnerabilities, potentially leading to Remote Code Execution (RCE).
  • unlink(): Used for deleting files.
  • file_put_contents(): Used for writing data to files, often exploited in arbitrary file upload or web shell scenarios.
  • include()/require(): Can lead to local or remote file inclusion if paths are user-controlled.

If a match is found against any of these sensitive functions within the newly added lines, the tool generates an alert. This alert includes the changeset link and is immediately triggered via a Slack webhook to the research team. This real-time notification mechanism allows researchers to promptly investigate the flagged code, manually triage the alert, and confirm the presence of a legitimate vulnerability.

The speakers acknowledged that while effective, this approach generates a significant number of false positives – approximately 80% of alerts. This is due to the heuristic nature of simply detecting sensitive functions, which might be used securely within the broader code context. Future work aims to integrate an actual Static Application Security Testing (SAST) tool into the pipeline for deeper code analysis, as well as exploring AI/LLM-based triaging to reduce the manual overhead, though initial attempts with AI for summarization have not yielded desired results.

Demo / Proof of Concept

▶ Watch: Challenges: High false positives and future SAS/AI plans (22:00)

The talk effectively used real-world vulnerability findings as demonstrations of the tool's capabilities. These instances highlight the diverse range of vulnerabilities identified and the speed at which they were caught.

Account Takeover (Password Policy Manager Plugin)

The tool flagged the use of wp_set_auth_cookie and wp_set_current_user in the Password Policy Manager plugin (5,000+ active installs). The alert was received one day after the code was pushed. Analysis revealed an unauthenticated hook (init action) connected to yamop_ppm_pass_to_login_redirect function. Although a nonce check was present, it was found that the nonce could be obtained by a low-privileged logged-in user (e.g., a subscriber). An attacker could then log in as a subscriber, obtain the nonce, and then, using the unauthenticated hook, supply an arbitrary user_id parameter along with the valid nonce to wp_set_current_user, effectively taking over any user account on the WordPress site.

PHP Object Injection (WP Event Plugin)

This case was particularly interesting as it involved a re-introduced vulnerability. The tool detected the unserialize function being added back into the WP Event Plugin. This alert came within 30 minutes of the code push. Previously, a deserialization vulnerability had been reported and patched in version 4.3.7 by commenting out the vulnerable function. However, developers later uncommented and re-introduced the exact same vulnerable code. This was an unauthenticated PHP Object Injection, which, combined with existing gadget chains in WordPress core, could lead to Remote Code Execution (RCE). The researchers had to re-report the issue and convince the developers to fix it again.

Arbitrary Plugin Installation

The scanner initially detected unlink and file_put_contents in a plugin, triggering an alert within 23 minutes. While these functions were detected, the actual vulnerability lay in a different part of the code. The WP_Ajax_install_requirements function was hooked to a wp_ajax_ action, meaning any logged-in user (even a subscriber) could call it. This function took a slug parameter and directly installed the plugin corresponding to that slug from the WordPress repository. While installing a legitimate plugin might seem benign, this allowed attackers to:

  1. Install malicious plugins (malware) that, despite being removed from the public directory by WordPress security, often remain in the SVN repository.
  2. Install vulnerable plugins with very low installation counts, which are easier to find and exploit, thus gaining RCE on the target site. This effectively turned a subscriber-level user into an RCE vector.

Unauthenticated Account Takeover (Complex Chain)

Another instance of wp_set_auth_cookie and wp_set_current_user detection led to a more complex unauthenticated account takeover. The vulnerable code was within an update_card_data function, which was called by handle_value_token, ultimately triggered by a POST /payu/v1/get_shipping_cost REST API endpoint. The logic checked if the user was not logged in, then checked for a user_id parameter. If user_id was not empty, it would set the current user to that ID. By tracing this chain, an attacker could supply an arbitrary user_id in the POST request to the REST API endpoint, achieving an unauthenticated account takeover. Due to time constraints, the full code chain was not presented but was highlighted as a blog post.

Arbitrary File Upload

This vulnerability was found in a custom upload functionality where developers opted not to use built-in, secure WordPress functions. The code, pushed in March 21, was detected on April 3 due to a temporary issue with the tool (it had stopped working for 12 days). The custom upload mechanism lacked any security checks. Exploitation required edit_post permission, which is typically assigned to a contributor or higher role. A contributor-level user could upload a web shell via this vulnerable function, leading to Remote Code Execution (RCE).

The speakers also noted that the tool occasionally detected legitimate patches for existing vulnerabilities, and even observed very short-lived vulnerabilities that were introduced and patched within days, sometimes even hours, before the researchers could fully investigate. This underscores the dynamic nature of the WordPress security landscape and the value of real-time monitoring.

Defensive Implications

▶ Watch: Q&A: Feasibility of scanning past vulnerabilities (27:00)

The findings from Patchstack's research offer critical insights for both WordPress plugin/theme developers and site administrators/defenders. The primary implication is the undeniable necessity for proactive and continuous security monitoring within the WordPress ecosystem.

For WordPress site administrators and hosting providers:

  • Patch Promptly: The rapid discovery of zero-days means the window for exploitation can be extremely short. Administrators must implement robust patching strategies, applying updates to plugins, themes, and WordPress core as soon as they are released. Automated update mechanisms, carefully managed, can help.
  • Minimize Attack Surface: Regularly audit installed plugins and themes. Remove any that are not actively maintained, unused, or have low installation counts if they are not critical. Be wary of installing plugins from unofficial sources.
  • Understand Risk of Abandoned Plugins: The discussion on CVEs for abandoned plugins highlights that even if a developer stops maintaining a plugin, vulnerabilities within it still pose a risk. Site administrators should prioritize removing such plugins.
  • Monitor for Compromise: While proactive measures are key, no system is entirely impenetrable. Implement Web Application Firewalls (WAFs), intrusion detection systems, and regular security scans to detect anomalous activity that might indicate a successful exploitation of a zero-day.

For WordPress plugin and theme developers:

  • Secure Coding Practices: Developers must prioritize security from the outset. This includes using WordPress's built-in, secure functions and APIs (e.g., for file uploads, user authentication, nonce verification) rather than implementing custom, unvetted solutions.
  • Input Validation and Sanitization: All user-supplied input should be rigorously validated and sanitized to prevent common attack vectors like SQL injection, XSS, and arbitrary file uploads.
  • Authentication and Authorization: Implement robust checks for user capabilities and roles before executing sensitive actions, preventing low-privileged users from triggering high-impact functionalities.
  • Security Reviews: Conduct peer code reviews with a security focus and consider incorporating automated static analysis (SAST) tools into their CI/CD pipelines to catch common vulnerabilities before code is committed.
  • Prevent Regressions: Be extremely cautious when modifying or uncommenting previously patched code. The re-introduction of vulnerabilities is a significant risk that can be mitigated by thorough testing and understanding of past security fixes.

The talk also highlighted the challenges faced by the WordPress core security team, who are already resource-constrained and primarily focused on core development. This means the responsibility for plugin and theme security largely falls on individual developers and the broader security community. The 80% false positive rate of the presented tool, while a challenge, underscores the complexity of automated analysis and the ongoing need for human expertise in vulnerability assessment. Ultimately, the research serves as a stark reminder that the security of the WordPress ecosystem is a shared responsibility, requiring vigilance from all stakeholders.

Key Takeaways

  • WordPress's Vast Attack Surface: With 43% of all websites and over 70,000 plugins/themes, WordPress presents an enormous and dynamic target for attackers.
  • Effectiveness of Real-time SVN Monitoring: Continuously tracking code commits in the WordPress SVN repository allows for the rapid detection of newly introduced zero-day vulnerabilities, significantly reducing exposure time.
  • Prevalence of Sensitive Function Misuse: Many vulnerabilities stem from developers introducing sensitive PHP or WordPress functions (e.g., unserialize, wp_set_auth_cookie, file_put_contents) without adequate security checks.
  • Vulnerability Re-introduction is a Risk: Previously patched vulnerabilities can reappear if developers are not vigilant, highlighting the need for robust regression testing and historical awareness of security fixes.
  • High False Positive Rate in Heuristic Scanning: While effective, simple pattern matching for sensitive functions can lead to a high volume of false positives (around 80%), indicating a need for more sophisticated SAST or AI-driven analysis.
  • Criticality of Prompt Patching: The "on-the-fly" discovery of zero-days means the window for exploitation is minimal. Site administrators must prioritize and automate patching to protect their installations.

About the Speaker(s)

Rafie Muhammad is a Lead Security Researcher at Patchstack, specializing in vulnerability research for open-source Content Management Systems (CMSs). His work primarily focuses on WordPress, Joomla, and Drupal.

Ananda Dhakal is a Vulnerability Researcher at Patchstack, working alongside Rafie Muhammad to identify and analyze security flaws in popular open-source CMS platforms, with a particular emphasis on the extensive WordPress ecosystem.

Both speakers are integral members of the Patchstack team, a company dedicated to enhancing the security of open-source software by providing vulnerability intelligence and protection services. Their research contributes to the broader understanding of CMS security and helps in proactively safeguarding millions of websites worldwide.

Reviews

→ Top-rated talks at BSides Canberra VIII (2025)

All talks from BSides Canberra VIII (2025)