PHP Code Execution Attack Puts WordPress Sites at Risk

in #wordpress6 years ago


Sam Thomas, a security researcher from Secarma, has discovered a new exploitation technique that could make it easier for hackers to trigger critical deserialization vulnerabilities in PHP programming language using previously low-risk considered functions.

The new technique leaves hundreds of thousands of web applications open to remote code execution attacks, vulnerable sites powered on  WordPress and Typo3.

PHP unserialization or object injection vulnerabilities were initially documented in 2009, which could allow an attacker to perform different kinds of attacks by supplying malicious inputs to the unserialize() PHP function.


Phar files, an archive format in PHP, stores metadata in a serialized format, which gets unserialized whenever a file operation function (fopen, file_exists, file_get_contents, etc.) tries to access the archive file.


In a detailed paper released at Black Hat conference last week, Thomas demonstrated how this attack can be executed against Wordpress sites using an author account to take full control over the web server.


For successful exploitation of the flaw, all an attacker needs to do is upload a valid Phar archive containing the malicious payload object onto the target's local file system and make the file operation function access it using the "phar://" stream wrapper.


Thomas also revealed that an attacker can even exploit this vulnerability using a JPEG image, originally a Phar archive converted into valid JPEG by modifying its first 100 bytes.


    "The way certain thumbnail functionality within the application [WordPress] works enables an attacker with the privileges to upload and modify media items to gain sufficient control of the parameter used in a "file_exists" call to cause unserialization to occur," the researcher said.


Once the crafted thumbnail uploaded on the targeted WordPress server, the attacker can use another function to call the same image file as a Phar archive using the "phar://" stream wrapper, eventually executing the arbitrary code when the program deserializes the metadata.


"The vulnerability exists due to insecure deserialization of data passed as an image file and then executed via the 'phar://' stream wrapper within the 'wp_get_attachment_thumb_file' function in '/wpincludes/post.php' script," an advisory reads.


"A remote authenticated attacker with the ability to create/edit posts can upload a malicious image and execute arbitrary PHP code on vulnerable system."


Thomas reported this vulnerability to the WordPress security team earlier last year, and the company acknowledged the issue. However, the patch released by the company did not address the problem completely.




Sort:  

Congratulations @alanna27! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

You published 4 posts in one day

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 58664.80
ETH 2569.75
USDT 1.00
SBD 2.42