WP Statistics Bug Allows Attackers to Lift Data from WordPress Sites

Wordpress plugin vulnerability

The plugin, installed on hundreds of thousands of sites, allows anyone to filch database info without having to be logged in.

WP Statistics, a plugin installed on more than 600,000 WordPress websites, has an SQL-injection security vulnerability that could let site visitors make off with all kinds of sensitive information from web databases, including emails, credit-card data, passwords and more.

WP Statistics, as its name suggests, is a plugin that delivers analytics for site owners, including how many people visit the site, where they’re coming from, what browsers and search engines they use, and which pages, categories and tags have the most visits. It also delivers anonymized data around IP addresses, referring sites, and country- and city-level details for visitors, all presented in the form of charts and graphs.

Wordfence researchers found the high-severity bug (tracked as CVE-2021-24340, rating 7.5 out of 10 on the CVSS scale) in the “Pages” function, which lets administrators see which pages have received the most traffic. It returns this data using SQL queries to a back-end database – but it turns out that unauthenticated attackers can hijack the function to perform their own queries, in order to purloin sensitive information.

“While the ‘Pages’ page was intended for administrators only and would not display information to non-admin users, it was possible to start loading this page’s constructor by sending a request to wp-admin/admin.php with the page parameter set to wps_pages_page,” said Wordfence researchers in a posting this week. “Since the SQL query ran in the constructor for the ‘Pages’ page, this meant that any site visitor, even those without a login, could cause this SQL query to run. A malicious actor could then supply malicious values for the ID or type parameters.”

The specific vulnerability is a time-based blind SQL injection, according to researchers at Wordfence. This technique involves sending requests to the database that “guess” at the content of a database table and instruct the database to delay the response or “sleep” if that guess is correct.

For instance, an attacker could ask the database if the first letter of the admin user’s email address starts with the letter “A,” and instruct it to delay the response by five seconds if this is true.

“Exfiltrating information would be a relatively slow process, and it would be impractical to use it to extract bulk records, but high-value information such as user emails, password hashes, and encryption keys and salts could be extracted in a matter of hours with the help of automated tools such as sqlmap,” according to Wordfence. “In a targeted attack, this vulnerability could be used to extract personally identifiable information from commerce sites containing customer information. This underscores the importance of having security protections with an endpoint firewall in place wherever sensitive data is stored.”

The only reliable method of preventing SQL injection is to prepare all SQL statements before executing them, researchers added. Prepared statements isolate each query parameter so that an adversary would not be able to see the entire scope of the data that’s returned.

“Unfortunately, while this SQL query used esc_sql to attempt to escape the ID and type input parameters, it did not use a prepared statement,” explained the researchers. “Since the ID input parameter was not quoted, it was trivial to bypass the esc_sql function and generate queries which could be used to extract sensitive information from the site.”

VeronaLabs, the plugin’s developer, has released a patch with version 13.0.8, so site administrators should update as quickly as possible.

A similar bug was found earlier in May, which impacted the “Spam protection, AntiSpam, FireWall by CleanTalk” plugin, which is installed on more than 100,000 sites. It too allowed adversaries to use the time-based bling SQL approach, also without having to be logged on to mount an attack.

Download our exclusive FREE Threatpost Insider eBook, 2021: The Evolution of Ransomware,” to help hone your cyber-defense strategies against this growing scourge. We go beyond the status quo to uncover what’s next for ransomware and the related emerging risks. Get the whole story and DOWNLOAD the eBook now – on us!

Suggested articles