August 6th, 2024

Exploiting authorization by nonce in WordPress plugins

Vulnerabilities in WordPress plugins arise from nonce misuse, leading to privilege escalation. Critical issues include RCE in Advanced File Manager and Filester, and SQL injection in Squirrly SEO plugin.

Read original articleLink Icon
Exploiting authorization by nonce in WordPress plugins

The article discusses vulnerabilities in WordPress plugins, particularly focusing on the misuse of nonces for authorization, which can lead to privilege escalation. Nonces are intended to secure AJAX and REST requests, but many plugins rely solely on them for authorization, creating exploitable weaknesses. The author identifies three critical vulnerabilities in popular plugins: Advanced File Manager, Filester, and the SEO Plugin by Squirrly. The Advanced File Manager is susceptible to Remote Code Execution (RCE) through arbitrary file uploads, allowing unauthorized users to upload malicious files. Filester also has a similar vulnerability, where any user can manipulate settings without proper authorization checks. Lastly, the Squirrly SEO plugin is vulnerable to semi-blind SQL injection due to improper sanitization of input parameters, enabling attackers to extract sensitive database information. The article emphasizes the importance of proper security practices in plugin development to mitigate these risks.

- Many WordPress plugins misuse nonces for authorization, leading to security vulnerabilities.

- Critical vulnerabilities identified include RCE in Advanced File Manager and Filester, and SQL injection in Squirrly SEO plugin.

- Unauthorized users can exploit these vulnerabilities to gain access to sensitive functionalities and data.

- Proper authorization checks are often missing in AJAX and REST API implementations in plugins.

- The article highlights the need for improved security practices among WordPress plugin developers.

Link Icon 6 comments
By @nightpool - 5 months
I'm not sure I really understand the weight this article gives to "nonces"—from an outside perspective, it seems like writing an titled "Exploiting authorization via cookie on Google.com" when you've found a simple XSS. In each case, the problem isn't the nonce itself, but rather the fact that developers are 1) allowing arbitrary file uploads with insecure sanitization, 2) embedding a secret value in frontend JSON blobs that any user can read, or 3) a completely unrelated SQL injection vulnerability.

For #3 especially, it's pretty confusing to single out nonces as especially vulnerable. Any secret defined in wp_config would have been similarly exposed by this exploitation method. For example, the SECURE_AUTH_KEY or the LOGIN_KEY. If you had found an installation that put those values in the database (probably common for multiuser installs), would you have instead written an article that claimed "Wordpress logged in sessions should never be used for authentication"? Or that wordpress auth sessions are "often misused by developers"? Similarly with #2, you make a haphazard effort to tie the improperly sanitized uploaded files back to nonces by saying "a nonce is required to acces the uploaded file", but that really doesn't have anything to do with the vulnerability itself—many users on wordpress installs are required / expected to upload publicly visible files, or files visible to their own user. Or even files visible to the administrator! The method of authenticating access to the files has nothing to do with the vulnerability itself, it was only a small piece of trivia required to properly exploit it in this specific plugin in some cases.

By @dawnerd - 5 months
The problem isn’t with Wordpress, it’s with it being so accessible that the lowest bar dev shops spit out code as quick and cheaply as possible. Best way to avoid security issues is to not use third party plugins or themes without auditing them.

Even popular plugins don’t do the bare minimum like escaping output.

By @bubblebeard - 5 months
This reminds me of an article in which brute forcing the WP admin panel was discussed. The problem was that when supplying inaccurate user credentials you would get an error message telling you which was wrong. Their dev stated this was a design choice, that you needed to balance security and user friendlyness.

Security in WP seems more like an afterthought to me, which is a shame to say the least.

By @francis-io - 5 months
By @ecjhdnc2025 - 5 months
There is imprecision and conceptual forcing and there are sketchy constructs in this post that are annoying given its subject area. It is also shoehorning in other known vulnerability issues to pad out the article, when it is a pretty concise topic.

I am not sure how widespread this specific nonce problem is.

It definitely is a problem -- I am not disputing that.

(Just as it's a problem that people have tended to assume that is_admin() or admin-ajax implies that by the time your hook runs, there's already a valid administrator session, when there isn't. But this is covered in the documentation.)

But the concept here is actually pretty obscure to WP developers so I would imagine they tend to consult the documentation, where they will encounter this at the end of the process:

https://developer.wordpress.org/reference/functions/wp_verif...

Nonces should never be relied on for authentication or authorization, access control. Protect your functions using current_user_can(), always assume Nonces can be compromised.

--

As to the rest of the article, I wish it were written less lazily:

> Unfortunately, as history shows, most WordPress plugins, even popular ones, often contain security vulnerabilities.

Most of them often do?

Not so. Definitely some often do, and there are repeat offenders, and many have, but by volume most WordPress plugins are small and do pretty simple things.

> So far this year, 280 critical (CVSS score 9.0+) vulnerabilities have been found in WordPress and its plugins.

This is disingenuously phrased, to my mind: "WordPress and its plugins" suggests a single authorship and conflates WP with the plugins.

WordPress itself has had no 9+ vulnerabilities this year (or indeed since 2021).

https://www.cvedetails.com/vulnerability-list/vendor_id-2337...

(Not to mention that the post is talking about 280 9.0+ vulnerabilities in seventy thousand plugins, the long tail of which have maybe dozens of activations at most.)

> There are dozens of SQL queries in every WP plugin.

Overreach again. Sure, many (perhaps the majority) of plugins cause additional SQL queries through the posts and options APIs, but most plugins contain little to no custom SQL.