首页 网络安全 正文
  • 本文约779字,阅读需4分钟
  • 221
  • 0

WordPress User Meta插件敏感信息泄露漏洞CVE-2024-9262

摘要

栋科技漏洞库关注到WordPress的User Meta-User Profile Builder和User management plugin存在不安全直接对象引用导致敏感信息泄露。

User Meta是一款WordPress中的可用于前端注册登录与编辑资料插件,这些操作均在在前端页面进行,当然还带有额外字段的用户注册。

WordPress User Meta插件是一款增值插件,提供收费版和免费版两个版本,收费版提供个人资料/注册小工具、注册后自动登录等功能。

一、基本情况

WordPress的User Meta-User Profile Builder和User management plugin插件在所有版本(含3.1)中容易受到不安全直接对象引用攻击。

WordPress User Meta插件敏感信息泄露漏洞CVE-2024-9262

栋科技漏洞库关注到WordPress的User Meta-User Profile Builder和User management plugin存在不安全直接对象引用导致敏感信息泄露。

二、漏洞分析

CVE-2024-9262是WordPress的User Meta-User Profile Builder和User management plugin插件中的敏感信息泄露漏洞,CVSS评分6.8。

该漏洞源于getUser()中缺少对用户控制的密钥验证,拥有贡献者级别及以上访问权限的认证攻击者能够获取表单字段中的用户元数据值。

但需要注意的是,该漏洞被利用的前提是需要使用WordPress站点的管理员首先需要创建一个显示潜在敏感信息(如密码哈希)的表单。

当然,如果如果WordPress站点不安全地使用了“user-meta-public-profile”短代码,那么未经身份验证的用户也可能会成功利用这一漏洞。

该漏洞被正式披露后,WordPress官网已2024年11月06日关闭了该插件官方下载渠道,等待全面审核或发布新版插件后会重新予以开放。

漏洞代码参考如下:

source:user-meta/trunk/models/classes/generate/PublicProfile.php

<?php
namespace UserMeta;
/**
 * Generate public form data
 *
 * @author Sourov Amin
 * @since 3.0
 */
class PublicProfile
{
    protected $formName;
    protected $style;
    protected $call;
    protected $user;
    protected $form;
    function __construct($formName, $call = 'id', $style = 'table')
    {
        $this->formName = $formName;
        $this->style = $style;
        $this->call = $call;
        $this->user = $this->getUser();
        $this->form = !$this->user ? false : $this->formBuilder();
    }
    private function getUser()
    {
        if($this->call == 'email') {
            $user_email = !empty($_REQUEST['user_email']) ? esc_attr($_REQUEST['user_email']) : '';
            return get_user_by('email', $user_email);
        }
        elseif ($this->call == 'username') {
            $username = !empty($_REQUEST['user_login']) ? esc_attr($_REQUEST['user_login']) : '';
            return get_user_by('login', $username);
        }
        else {
            $user_id = !empty($_REQUEST['user_id']) ? esc_attr($_REQUEST['user_id']) : '';
            return get_user_by('id', $user_id);
        }
    }
    private function formBuilder()
    {
        return (new FormGenerate($this->formName, 'profile', $this->user->ID));
    }
    private function getData()
    {
        $data = [];
        $form = $this->form->getForm();
        $fields = $form['fields'];
        foreach ($fields as $key => $field){
            if(in_array($field['field_type'], ['html', 'captcha', 'page_heading', 'section_heading']))
                continue;
            $metaKey = !empty($field['meta_key']) || !empty($field['field_type']) ? (!empty($field['meta_key']) ? $field['meta_key'] : $field['field_type'] ): '';
            $title = !empty($field['field_title']) ? esc_html($field['field_title']): esc_html($metaKey);
            $defaultValue = !empty($field['default_value']) ? $field['default_value'] : '';
            if($field['field_type'] == 'user_avatar') {
                $value = get_avatar($this->user->ID);
            } else {
                $value = !empty($field['field_value']) ? $field['field_value'] : $defaultValue;
                $value = is_array($value) ? esc_html(implode(', ', $value)) : esc_html($value);
            }
            $data[$title] = $value;
        }
        return $data;
    }
    function generate()
    {
        global $userMeta;
        if(!$this->user) {
            return $userMeta->showError(__('User not found!', $userMeta->name));
        }
        if (!$this->form->isFound()) {
            return $userMeta->ShowError(sprintf(__('Form "%s" is not found!', $userMeta->name), $this->formName));
        }
        $fields = $this->getData();
        $html = '<div class="um_public_profile_display">';
        if($this->style == 'table') {
            $html .= '<table>';
            foreach ($fields as $title => $value) {
                $html .= '<tr><td>' . $title . '</td><td>' . $value .'</td></tr>' ;
            }
            $html .= '</table>';
        } elseif ($this->style == 'line') {
            foreach ($fields as $title => $value) {
                $html .= '<strong>' . $title . '</strong>';
                $html .= '<hr>'. $value .'<br>';
            }
        } else {
            foreach ($fields as $title => $value) {
                $html .= '<strong>' . $title . ' : ' . '</strong>' . $value;
                $html .= '<br>';
            }
        }
        $html .= '</div>';
        return $html;
    }
}

三、影响范围

WordPress User Meta-User Profile Builder和User management plugin <= 3.1 

四、修复建议

WordPress User Meta-User Profile Builder和User management plugin > 3.1

五、参考链接

文章回复-路羽博客.png此处内容已隐藏,评论后刷新即可查看!

评论
更换验证码
友情链接