Experts found a Remote Code Execution flaw in WordPress 5.0.0

WordPress 5 RCE

Security experts at RIPS Technologies GmbH disclosed a critical remote code execution vulnerability in versions of WordPress prior
5.0.3, that remained uncovered for 6 years.

The experts discovered that the flaw could be exploited by an attacker who gains access to an account with at least ‘author‘ privileges on a WordPress install to execute arbitrary PHP code on the underlying server.

The flaw is the chain of a Path Traversal and Local File Inclusion vulnerability that lead to Remote Code Execution in the WordPress core and full remote takeover.

The experts reported the issue to WordPress developers, but the bug is still unpatched.

“An attacker who gains access to an account with at least author privileges on a target WordPress site can execute arbitrary PHP code on the underlying server, leading to a full remote takeover,” reads the analysis published by the researchers.

“We sent the WordPress security team details about another vulnerability in the WordPress core that can give attackers exactly such access to any WordPress site, which is currently unfixed. “

According to the download page of WordPress, 33%1 of all websites online uses the vulnerable software.

The attack relies on the way WordPress image management system handles Post Meta entries that stores information like description, size, creator, and other meta information of uploaded images.

Experts also published a video PoC of the attack.

The experts discovered that an attacker with at least ‘author‘ privileges on a WordPress install can modify entries associated with an image to trigger the Path Traversal vulnerability.

“The idea is to set _wp_attached_file to evil.jpg?shell.php, which would lead to a HTTP request being made to the following URL: https://targetserver.com/wp-content/uploads/evil.jpg?shell.php. This request would return a valid image file, since everything after the ? is ignored in this context. The resulting filename would be evil.jpg?shell.php.” continues the analysis.

“However, it is still possible to plant the resulting image into any directory by using a payload such as evil.jpg?/../../evil.jpg.”

Chaining The Path Traversal vulnerability with a local file inclusion flaw in theme directory could allow the attacker to execute arbitrary code on the targeted server.

The implementation of a security measure in WordPress versions 5.0.1 and 4.9.9 prevented the exploitation of the flaw because it made impossible for unauthorized users to set arbitrary Post Meta entries.

Experts pointed out that the Path Traversal issue is still unpatched even in the latest WordPress version, it can also be exploited in presence of installed 3rd-party plugins that incorrectly handles Post Meta entries.

“However, the Path Traversal is still possible and can be exploited if a plugin is installed that still allows overwriting of arbitrary Post Data. Since certain authentication to a target WordPress site is needed for exploitation, we decided to make the vulnerability public after 4 months of initially reporting the vulnerabilities.” concludes the experts.

WordPress would address the vulnerability with the next release.

Source: securityaffairs.co