SpiderLabs Blog

TWSL2012-002: Multiple Vulnerabilities in WordPress

Written by Robert Foggia | Jan 24, 2012 11:44:00 AM

Trustwave SpiderLabs has published a new advisory today for multiple vulnerabilities discovered in the WordPress 'setup-config.php' page. These include PHP code execution/persistent cross site scripting (XSS) vulnerabilities and a MySQL server username/password disclosure weakness. All of these vulnerabilities were discovered by Jonathan Claudius who is a member of the Trustwave SpiderLabs Research team.

The WordPress team has confirmed that an official fix will not be released for these issues based on that the the component in question is an installation script and the attack surface is too small to warrant a fix. We have received the following response from the vendor:

"We give priority to a better user experience at the install process. It is unlikely a user would go to the trouble of installing a copy of WordPress and then not finishing the setup process more-or-less immediately. The window of opportunity for exploiting such a vulnerability is very small."

However, Trustwave SpiderLabs urges caution in situations where the WordPress 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 practice to ensure that no installation scripts are exposed to outsiders, and these vulnerabilities reinforce the importance of this step.

For further protection, SpiderLabs has added rules to the commercial rules feed for ModSecurity to mitigate these issues and our TrustKeeper scanning solution is updated to detect exposed installation scripts. The following are the ModSecurity commercial rules developed to identify these malicious payloads:

PHP Code Execution and Persistent Cross Site Scripting Vulnerabilities via 'setup-config.php' page

SecRule REQUEST_FILENAME "@streq /wp-admin/setup-config.php" "chain,phase:2,t:none,log,block,id:'2100004',msg:'SLR: WordPress is being configured with a remote IP address for the Database.',logdata:'%{matched_var}',tag:'CVE-2011-4899'" SecRule ARGS_GET:step "@streq 2" "chain"  SecRule ARGS_POST:dbhost "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$" "chain"   SecRule MATCHED_VAR "!@streq %{server_addr}"

PHP Code Execution and Persistent Cross Site Scripting Vulnerabilities via 'setup-config.php' page

SecRule REQUEST_FILENAME "@streq /wp-admin/setup-config.php" "chain,phase:2,t:none,log,block,id:'2100005',msg:'SLR: WordPress is being configured with a remote server name for the Database.',logdata:'%{matched_var}',tag:'SVE-2011-4899'" SecRule ARGS_GET:step "@streq 2" "chain"  SecRule ARGS_POST:dbhost ".*" "chain"   SecRule MATCHED_VAR "!@streq %{server_name}"

MySQL Server Username/Password Disclosure Vulnerability via 'setup-config.php' page

SecRule REQUEST_FILENAME "@streq /wp-admin/setup-config.php" "chain,phase:2,t:none,log,block,id:'2100006',msg:'SLR: Request is missing required parameters.',tag:'CVE-2011-4898'" SecRule ARGS_GET:step "@streq 2" "chain"  SecRule &ARGS_POST:dbhost|&ARGS_POST:dbname|&ARGS_POST:uname|&ARGS_POST:pwd|&ARGS_POST:prefix|&ARGS_POST:submit "!@eq 1" 

Multiple Cross Site Scripting Vulnerabilities in 'setup-config.php' page

SecRule REQUEST_FILENAME "@streq /wp-admin/setup-config.php" "chain,phase:2,t:none,log,block,id:'2100007',msg:'SLR: Multiple Cross Site Scripting Vulnerabilities in \'setup-config.php\' page',logdata:'%{matched_var}',tag:'CVE-2012-0782'"        SecRule ARGS_GET:step "@streq 2" "chain"                SecRule ARGS_POST:dbhost|ARGS_POST:dbname|ARGS_POST:uname "@pm < > \" ( ) : = ;" "ctl:auditLogParts=+E,multiMatch,t:none,t:htmlEntityDecode,t:jsDecode,t:cssDecode"

MySQL Server Username/Password Disclosure Vulnerability via 'setup-config.php' page

SecRule REQUEST_FILENAME "@streq /wp-admin/setup-config.php" "chain,phase:4,t:none,log,block,id:'2100008',msg:'SLR: MySQL Server Username/Password Disclosure Vulnerability via \'setup-config.php\' page.',tag:'CVE-2011-4898'"        SecRule ARGS_GET:step "@streq 2" "chain"                SecRule RESPONSE_BODY "We were able to connect to the database server \(which means your username and password is okay\) but not able to select the database|This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at"

We would also like to give a special thanks to Ryan Barnett for writing the ModSecurity commercial rules and the Research team for developing the detection rules for TrustKeeper.