Skip to content
RCE Disclosed report Intermediate

WordPress Plugin Update Confusion at trafficfactory.com

A WordPress plugin used by the site is not in the official directory, so an attacker could upload a plugin with the same slug and then push a malicious update. If the site owner updates, the attacker's code could run, leading to compromise.

Kamil Vavra Follow

Originally disclosed on HackerOne

Bounty$200incl. $150 bonus Low View original
  • Triaged in 3 days
  • Fixed in 5 days
  • Paid in 5 days
  • Disclosed after 46 days

Hi,

I'm currently researching a "novel" supply chain attack affecting WordPress plugins, and I believe your website might be vulnerable.

The way it works is similar to a recent Dependency Confusion attack, where a malicious actor can take over internal packages unclaimed on PyPI / npm registry.

If you use an internally developed WordPress plugin not present in WordPress Plugin Directory, an attacker might upload it there. That would introduce the "Confused deputy problem" attack scenario, where the privileged user, instructed to update all plugins regularly, inadvertently infects the instance with malware.

I wrote a custom scanner, which passively detects plugins on a front page (JS/CSS assets), and searches the slug name in the WP SVN registry. It found "tf-elementor" plugin installed at "trafficfactory.com":

https://www.trafficfactory.com/wp-content/plugins/tf-elementor/assets/css/tf9d3a.css?ver=5.6.5

currently not present in:

https://plugins.svn.wordpress.org/tf-elementor

Steps To Reproduce:

The WordPress approval process for new plugins is automated and open-source, so it's possible to see which checks needs to pass:

  • Slug must only contain lowercase alphanumeric characters and dash.
  • Slug can't have a reserved name like wp-admin (has_reserved_slug())
  • Slug can't be on a list of protected trademarks (has_trademarked_slug())
  • Slug can't be installed on more than 100 websites (wporg_stats_get_plugin_name_install_count)

The whole flow looks like this:

  1. An attacker submits a plugin with the same name you use for a review
  2. It will pass the review process, and the attacker gets access to the SVN repository
  3. The attacker uploads the plugin files, and it's added to the WordPress Plugin Directory for anyone to use
  4. The attacker adds a backdoor and bumps the plugin version
  5. You will get a notification that a new update is available; when you update, your website gets compromised

I did not attempt to claim your plugin, as the update would inadvertently break the website (old plugin files will get deleted), but I simulated the attack with my custom plugin, and it works.

How to mitigate

There is no easy way to defend yourself because it's by design, and WordPress doesn't allow you to upload a "dummy" version of your plugin. You can either add the plugin you use in the WordPress Plugin Directory or change the plugin name to prevent the review process from succeeding. The plugin slug can only contain lower case alphanumeric characters and dash as a delimiter. Some of the keywords are prohibited as well, which could help us in this case. That means that you can rename your custom plugins in the following ways:

  • internal_plugin_name
  • InternalPluginName
  • wp-internal-plugin-name

It is also possible to leverage a hook and write a custom update function, blocking the internal WP API call and replacing it with your own, similar to how a paid plugin offers custom updates from their servers.

Some plugins do that for you, for example, Easy Updates Manager, which allows you to block updates for specific plugins.

Supporting Material/References:

I wrote a custom scanner in Python, a WordPress Docker container to simulate the Plugin update process, a custom plugin to pass the review for the SVN registry, and an extensive write-up describing everything in more detail.

I plan to publish everything soon, but let me know, and I will share a draft with you beforehand. Feel free to requests any additional info from me, as I understand it sounds more like a theoretical vulnerability without a valid PoC.

Thank you!

Kind regards, @vavkamil

Impact

An attacker can hijack your plugin, currently not available in the WordPress Plugin Directory (SVN registry). If that happens and you update the plugin, it can introduce a backdoor or RCE, essentially giving keys to the kingdom to the attacker.

The original report as published on HackerOne, by vavkamil. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the WordPress plugin update system trusts the plugin directory by slug name, so an unclaimed slug can be registered by anyone and then served as an update.

Impact

If the site owner updates the plugin, the attacker's code could run, potentially leading to full site compromise or remote code execution.

What the attacker needed

Target uses a custom plugin not in WP directory; attacker can submit a plugin with same slug; site owner performs plugin update

The fix

The site should either publish its internal plugin in the WordPress Plugin Directory or rename the plugin slug to include characters that are not allowed in the directory (such as underscores or uppercase letters), or block updates for that plugin.

How it was found

  1. An attacker submits a plugin with the same name as the target's internal plugin.
  2. The submission passes the automated review and the attacker gets access to the plugin's code repository.
  3. The attacker uploads plugin files, making the plugin available in the WordPress Plugin Directory.
  4. The attacker adds a backdoor and increases the plugin version number.
  5. The site owner sees an update notification and updates, which installs the attacker's code.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

WordPress plugins are add-ons that give a site extra features. If a plugin isn't in the official WordPress plugin store, someone else could claim its name there and publish a fake update. When the site owner clicks 'update', they install the attacker's code instead of a safe update.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Kamil Vavra

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.