Friday, August 03, 2007 2:55 PM
cmosby
Symantec Security Response Weblog: WordPress XSS Exploit Solves Problems… and Creates More!
WordPress XSS Exploit Solves Problems… and Creates More!
A proof-of-concept code exploiting newly discovered XSS vulnerabilities for the latest version of Wordpress (2.2.1) was posted today on a security blog.
The researcher unveiled seven vulnerabilities, cross-site scripting (XSS) or SQL injections, whose consequences range from benign to serious, the critical ones potentially leading to blog compromising. In his haste to show his skills, this person also released a proof-of-concept (PoC) code exploiting one of these vulnerabilities.
The PoC in itself, as explained, is supposedly not malicious, and is designed to raise awareness and patch vulnerable versions of the WordPress publishing platform. In a few words, here’s how it works:
- A WordPress administrator browses the “Comments manager” in the administration panel
- She clicks a link, which redirects to the PoC author’s Web page. This page checks the referrer, to see whether it might originate from a logged-on WordPress administrator (the URL would contain “wp-admin”)
- If it does, a JavaScript routine is loaded to notify the user that WordPress has been detected and that the blog might be potentially at risk
- The user can choose to carry on, as the pop-up message offers to hot-patch some vulnerabilities!
- From there, an XSS vulnerability is exploited in upload.php, located under the wp-admin folder. It is used to patch three vulnerable files: link-import.php, options.php and upload.php.
- The author is then asked to link the author’s page in the Blogroll section, in order to encourage more users to do the same.
A patch may look something like the following:
/*
Security Patch added by the xxxx
by xxxx http://...
*/
$style = preg_replace('/[^A-Za-z]/', '', $style);
/* end of patch */
In this example, the patch adds a sanity check for the style variable, used in upload.php. This is the same vulnerability that is used to modify WordPress in the first place.
Though the author’s goal is honorable, the code used to patch the three aforementioned files seems to be buggy itself. The files modified are, in fact, fully overwritten. In doing that, the author forgot to encode the ‘+’ letter, which gets interpreted as a space by the browser. This means that all instances of the ‘+’ character in the three files are replaced by spaces. One bug is then introduced in link-import.php, where ‘$i++’ gets replaced by ‘$i ’ in a loop. I’ll let you draw the consequences... a bug affecting a regular expression filter would also affect options.php.
Be very careful if you consider patching your WordPress system through this ‘obscure’ channel. Holes may be patched, but bugs may be introduced as well.
Posted by Nicolas Falliere on August 1, 2007 08:28 AM
Source: Symantec Security Response Weblog: WordPress XSS Exploit Solves Problems… and Creates More!
Filed under: Security and Anti-Virus, Blogging, Internet Hacks, Internet Applications