Most popular WordPress versions are currently affected

Apr 27, 2015 10:58 GMT  ·  By

A stored cross-site scripting (XSS) vulnerability available in the recently released WordPress 4.2 and earlier versions can be exploited by an unauthenticated party to run arbitrary code on the server; the security glitch is currently unpatched and proof-of-concept code is publicly available.

An attacker taking advantage of the flaw could take control of the targeted website by creating new admin accounts. Aside from the current WordPress versions, build 4.1.2, 4.1.1 and 3.9.3 are also affected.

Comment text truncation issue still not fully fixed

Discovered by Jouko Pynnönen, from vulnerability research firm Klikki Oy in Finland, the flaw is similar to the one patched in WordPress 4.1.2, after having been disclosed to the developer by researcher Cedric Van Bockhaven about 14 months ago, on February 23, 2014.

Bockhaven’s approach consisted in introducing a character in the message that truncates the text at a specific point, turning it into a script that executes malicious code on the server upon a certain action, such as “mouseover.”

Pynnönen’s method differs only in the way truncation of the text is achieved, which occurs when the comment is stored in the website’s database.

Comments that are larger than 64kb are truncated via MySQL. One way to reach the limit is to paste random characters after the malicious part has been included.

Truncating the messages results in malformed HTML code being generated on the page, which can be leveraged by an attacker to add any attributes in the supported HTML tags and submit malicious JavaScript that delivers a payload.

Communication with Wordpress mantainers is difficult

Just like Bockhaven, Pynnönen managed to drop an exploit on the targeted website when the administrator viewed submitted comments. The researcher tested the glitch with MySQL versions 5.1.53 and 5.5.41.

Until a patch becomes available, admins of websites running WordPress are advised not to approve any comments, Pynnönen says.

The vulnerability researcher did not inform WordPress of the new way to exploit the flaw, motivating his choice to fully disclose the weakness by saying that this course should rush the release of a fix.

“Communication with WordPress developers has been difficult. During the past months I've been trying to find out what they are doing about my previous (yet unreleased) bug. I haven't got any communication from them since November despite trying to ask them directly, via HackerOne staff, and even with help from our national authority (CERT-FI). There has been no explanation as to why the bug is still not fixed. It was supposed to happen in November. All WordPress versions are still vulnerable,” he said via email.

According to data from W3Techs, 69.2% of the WordPress sites they monitor run version 4.0 and above. Official statistics for version 4.2 of the content management system show that it has been downloaded almost 2.6 million times.

Details are available both on Klikki Oy website and on Full Disclosure mailing list.

A video demonstrating the flaw has been created by the researcher:

[UPDATE, April 28]: WordPress 4.2.1 is out, fixing the XSS bug reported by ​Jouko Pynnönen.