Nytro Posted April 27, 2015 Report Posted April 27, 2015 WordPress 4.2 stored XSSFrom: Jouko Pynnonen <jouko () iki fi>Date: Mon, 27 Apr 2015 05:15:46 +0300OVERVIEW==========Current versions of WordPress are vulnerable to a stored XSS. Anunauthenticated attacker can inject JavaScript in WordPress comments.The script is triggered when the comment is viewed.If triggered by a logged-in administrator, under default settings theattacker can leverage the vulnerability to execute arbitrary code onthe server via the plugin and theme editors.Alternatively the attacker could change the administrator’s password,create new administrator accounts, or do whatever else the currentlylogged-in administrator can do on the target system.DETAILS========If the comment text is long enough, it will be truncated when insertedin the database. The MySQL TEXT type size limit is 64 kilobytes so thecomment has to be quite long.The truncation results in malformed HTML generated on the page. Theattacker can supply any attributes in the allowed HTML tags, in thesame way as with the two other recently published stored XSSvulnerabilities affecting the WordPress core.The vulnerability bears a similarity to the one reported by Cedric VanBockhaven in 2014 (patched this week, after 14 months). Instead ofusing an invalid UTF-8 character to truncate the comment, this time anexcessively long comment text is used for the same effect.In these two cases the injected JavaScript apparently can't betriggered in the administrative Dashboard, so these exploits requiregetting around comment moderation e.g. by posting one harmless commentfirst.PROOF OF CONCEPT==================Enter the following as a comment:<a title='x onmouseover=alert(unescape(/hello%20world/.source))style=position:absolute;left:0;top:0;width:5000px;height:5000pxAAAAAAAAAAAA [64 kb] ...'></a>This was tested on WordPress 4.2, 4.1.2, and 4.1.1, MySQL versions5.1.53 and 5.5.41.SOLUTION=========Disable comments (Dashboard, Settings/Discussion, select asrestrictive options as possible). Do not approve any comments.CREDITS========The vulnerability was discovered by Jouko Pynnönen of Klikki Oy.An up-to-date version of this document: http://klikki.fi/adv/wordpress2.html-- Jouko Pynnönen <jouko () iki fi>Klikki Oy - http://klikki.fi - @klikkioySursa: Bugtraq: WordPress 4.2 stored XSS 1 Quote