WordPress是一款免费的论坛Blog系统。 WordPress实现上存在输入验证漏洞,远程攻击者可能利用此漏洞执行SQL注入攻击非授权访问数据库。 WordPress的wp-admin/admin-ajax.php文件没有正确验证对cookie参数的输入。在wp-admin/admin-ajax.php的6行: ------------------[source code]---------------------- define(\'\'DOING_AJAX\'\', true); check_ajax_referer(); if ( !is_user_logged_in() ) die(\'\'-1\'\'); ------------------[/source code]---------------------- 然后在check_ajax_referer()函数中: ------------------[source code]---------------------- function check_ajax_referer() { $cookie = explode(\'\'; \'\', urldecode(empty($_POST[\'\'cookie\'\']) ? $_GET[\'\'cookie\'\'] : $_POST[\'\'cookie\'\'])); // AJAX scripts must pass cookie=document.cookie foreach ( $cookie as $tasty ) { if ( false !== strpos($tasty, USER_COOKIE) ) $user = substr(strstr($tasty, \'\'=\'\'), 1); if ( false !== strpos($tasty, PASS_COOKIE) ) $pass = substr(strstr($tasty, \'\'=\'\'), 1); } if ( !wp_login( $user, $pass, true ) ) die(\'\'-1\'\'); ------------------[/source code]----------------------...
WordPress是一款免费的论坛Blog系统。 WordPress实现上存在输入验证漏洞,远程攻击者可能利用此漏洞执行SQL注入攻击非授权访问数据库。 WordPress的wp-admin/admin-ajax.php文件没有正确验证对cookie参数的输入。在wp-admin/admin-ajax.php的6行: ------------------[source code]---------------------- define(\'\'DOING_AJAX\'\', true); check_ajax_referer(); if ( !is_user_logged_in() ) die(\'\'-1\'\'); ------------------[/source code]---------------------- 然后在check_ajax_referer()函数中: ------------------[source code]---------------------- function check_ajax_referer() { $cookie = explode(\'\'; \'\', urldecode(empty($_POST[\'\'cookie\'\']) ? $_GET[\'\'cookie\'\'] : $_POST[\'\'cookie\'\'])); // AJAX scripts must pass cookie=document.cookie foreach ( $cookie as $tasty ) { if ( false !== strpos($tasty, USER_COOKIE) ) $user = substr(strstr($tasty, \'\'=\'\'), 1); if ( false !== strpos($tasty, PASS_COOKIE) ) $pass = substr(strstr($tasty, \'\'=\'\'), 1); } if ( !wp_login( $user, $pass, true ) ) die(\'\'-1\'\'); ------------------[/source code]---------------------- 可见使用了urldecode(),因此通过\\%2527就可以向wp_login()传送单引号,绕过php的magic_quotes功能。 接下来: ------------------[source code]---------------------- function wp_login($username, $password, $already_md5 = false) { global $wpdb, $error; ... $login = get_userdatabylogin($username); ------------------[/source code]---------------------- 最终: ------------------[source code]---------------------- function get_userdatabylogin($user_login) { global $wpdb; ... if ( !$user = $wpdb->get_row(\"SELECT * FROM $wpdb->users WHERE user_login = \'\'$user_login\'\'\") ) return false; ------------------[/source code]---------------------- 因此攻击者可以执行SQL注入攻击。