Security experts disclosed a critical remote code execution vulnerability in versions of WordPress prior 5.0.3, that remained uncovered for 6 years.
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 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.
Next Read, 5 HTTP Headers You Muts have on Your Site