Published : August 6, 2026

CVE-2026-66705: Meta pixel for WordPress <= 5.2.1 Unauthenticated Stored Cross-Site Scripting PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 5.2.1
Patched Version 5.2.2
Disclosed July 30, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-66705:

This vulnerability is a Stored Cross-Site Scripting (XSS) flaw in the Meta Pixel for WordPress plugin, all versions up to and including 5.2.1. The issue is triggered by a missing sanitization on user-input that is later rendered onto an administrative page. The technical root cause is found in the `class-facebookwordpresssettingspage.php` file, specifically the `dismiss` button rendering in the administrative notice. An attacker can inject malicious web scripts via crafted GET parameters, which are then stored and executed whenever an administrator accesses the affected page. Atomic Edge analysis confirms this vulnerability allows for an unauthenticated stored XSS attack with a CVSS score of 7.2.

The root cause exists in the `official-facebook-pixel/core/class-facebookwordpresssettingspage.php` file. In the vulnerable version, the plugin code at lines 1081-1091 constructs an HTML dismiss button for an admin notice. The button’s `onClick` attribute is populated using user-controlled data passed through the `$link` variable, which itself is processed by `wp_kses_post`. This function allows certain HTML tags and attributes but does not completely sanitize JavaScript event handlers when the `$link` variable contains a URL with the `data` parameter. An attacker can inject a payload into the `data` parameter, which is reflected into the `$link` variable. The code then uses `sprintf` to embed the variable into the `onClick` event, which executes arbitrary JavaScript. Specifically, the attacker can craft a URL such as `data:text/html,alert(1)`, which after `wp_kses_post` passes through, is rendered without proper output escaping in the `onClick` context.

An attacker can exploit this without authentication by sending a crafted request to the WordPress admin page. The vector involves sending a GET request to `/wp-admin/admin.php?page=facebook_pixel_options` or the specific settings page with a specially crafted `data` parameter. The payload is a URL-encoded string representing a `data:` URI that contains JavaScript, such as `data:text/html,alert(1)`. Because the plugin does not validate or sanitize this parameter and because `wp_kses_post` allows the `href` attribute to contain `data:` URIs, the content is injected into the page’s source. When an administrator views the affected admin page, the malicious script executes, leading to session hijacking, privilege escalation, or other malicious actions.

The patch, implemented in version 5.2.2, changes the HTML structure of the dismiss button in `class-facebookwordpresssettingspage.php`. The vulnerable code uses a `

Differential between vulnerable and patched code

Below is a differential between the unpatched vulnerable code and the patched update, for reference.

Code Diff
--- a/official-facebook-pixel/FacebookAds/ApiRequest.php
+++ b/official-facebook-pixel/FacebookAds/ApiRequest.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/CrashReporter.php
+++ b/official-facebook-pixel/FacebookAds/CrashReporter.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Cursor.php
+++ b/official-facebook-pixel/FacebookAds/Cursor.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Enum/AbstractEnum.php
+++ b/official-facebook-pixel/FacebookAds/Enum/AbstractEnum.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/AbstractCurl.php
+++ b/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/AbstractCurl.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/Curl.php
+++ b/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/Curl.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/Curl55.php
+++ b/official-facebook-pixel/FacebookAds/Http/Adapter/Curl/Curl55.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Http/Adapter/CurlAdapter.php
+++ b/official-facebook-pixel/FacebookAds/Http/Adapter/CurlAdapter.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Http/Client.php
+++ b/official-facebook-pixel/FacebookAds/Http/Client.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Logger/CurlLogger.php
+++ b/official-facebook-pixel/FacebookAds/Logger/CurlLogger.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Logger/CurlLogger/JsonNode.php
+++ b/official-facebook-pixel/FacebookAds/Logger/CurlLogger/JsonNode.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/AbstractCrudObject.php
+++ b/official-facebook-pixel/FacebookAds/Object/AbstractCrudObject.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Object/AbstractObject.php
+++ b/official-facebook-pixel/FacebookAds/Object/AbstractObject.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Object/AdImage.php
+++ b/official-facebook-pixel/FacebookAds/Object/AdImage.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Object/CustomAudience.php
+++ b/official-facebook-pixel/FacebookAds/Object/CustomAudience.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Object/CustomAudienceMultiKey.php
+++ b/official-facebook-pixel/FacebookAds/Object/CustomAudienceMultiKey.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/FacebookAds/Object/ServerSide/CAPIGatewayEndpoint.php
+++ b/official-facebook-pixel/FacebookAds/Object/ServerSide/CAPIGatewayEndpoint.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/ServerSide/CustomData.php
+++ b/official-facebook-pixel/FacebookAds/Object/ServerSide/CustomData.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/ServerSide/Normalizer.php
+++ b/official-facebook-pixel/FacebookAds/Object/ServerSide/Normalizer.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/ServerSide/UserData.php
+++ b/official-facebook-pixel/FacebookAds/Object/ServerSide/UserData.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/ServerSide/Util.php
+++ b/official-facebook-pixel/FacebookAds/Object/ServerSide/Util.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
 /**
  * Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
  *
--- a/official-facebook-pixel/FacebookAds/Object/Traits/FieldValidation.php
+++ b/official-facebook-pixel/FacebookAds/Object/Traits/FieldValidation.php
@@ -1,4 +1,5 @@
 <?php
+// phpcs:ignoreFile — third-party Meta Business SDK (vendored); excluded from linting.
  /*
  * Copyright (c) Meta Platforms, Inc. and affiliates.
  * All rights reserved.
--- a/official-facebook-pixel/core/class-facebookpluginconfig.php
+++ b/official-facebook-pixel/core/class-facebookpluginconfig.php
@@ -33,7 +33,7 @@
  * Class FacebookPluginConfig
  */
 class FacebookPluginConfig {
-    const PLUGIN_VERSION     = '5.2.1';
+    const PLUGIN_VERSION     = '5.2.2';
     const SOURCE             = 'wordpress';
     const TEXT_DOMAIN        = 'official-facebook-pixel';
     const PLUGIN_NAME        = 'Meta Pixel for WordPress';
--- a/official-facebook-pixel/core/class-facebookwordpresssettingspage.php
+++ b/official-facebook-pixel/core/class-facebookwordpresssettingspage.php
@@ -1081,17 +1081,17 @@
             '
 <div class="notice notice-%s is-dismissible">
   <p>%s</p>
-  <button
-    type="button"
+  <a
+    href="%s"
     class="notice-dismiss"
-    onClick="location.href='%s'">
+    style="text-decoration: none;">
     <span class="screen-reader-text">%s</span>
-  </button>
+  </a>
 </div>
       ',
             esc_html( $notice_type ),
             wp_kses_post( $link ),
-            esc_url( add_query_arg( $dismiss_config, '' ) ),
+            esc_url( add_query_arg( $dismiss_config, '1', admin_url() ) ),
             esc_html__(
                 'Dismiss this notice.',
                 'official-facebook-pixel'
--- a/official-facebook-pixel/facebook-for-wordpress.php
+++ b/official-facebook-pixel/facebook-for-wordpress.php
@@ -6,7 +6,9 @@
  * Description: <strong><em>***ATTENTION: After upgrade the plugin may be deactivated due to a known issue, to workaround please refresh this page and activate plugin.***</em></strong> The Facebook pixel is an analytics tool that helps you measure the effectiveness of your advertising. You can use the Facebook pixel to understand the actions people are taking on your website and reach audiences you care about.
  * Author: Facebook
  * Author URI: https://www.facebook.com/
- * Version: 5.2.1
+ * Version: 5.2.2
+ * License: GPLv2
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
  * Text Domain: official-facebook-pixel
  *
  * @package FacebookPixelPlugin
--- a/official-facebook-pixel/integration/class-facebookwordpresswoocommerce.php
+++ b/official-facebook-pixel/integration/class-facebookwordpresswoocommerce.php
@@ -290,6 +290,10 @@

         foreach ( $order->get_items() as $item ) {
             $product = wc_get_product( $item->get_product_id() );
+            if ( ! is_object( $product ) || ! method_exists( $product, 'get_id' ) ) {
+                continue;
+            }
+
             if ( 'product_group' !== $content_type
             && $product->is_type( 'variable' ) ) {
             $content_type = 'product_group';
@@ -352,7 +356,7 @@
         $server_event = ServerEventFactory::safe_create_event(
             'AddToCart',
             array( __CLASS__, 'createAddToCartEvent' ),
-            array( $cart_item_key, $product_id, $quantity ),
+            array( $cart_item_key, $product_id, $quantity, $variation_id ),
             self::TRACKING_NAME
         );

@@ -412,6 +416,7 @@
      * @param string $cart_item_key The cart item key.
      * @param int    $product_id    The product ID.
      * @param int    $quantity      The quantity.
+     * @param int    $variation_id  The variation ID.
      *
      * @return array The event data.
      *
@@ -420,14 +425,15 @@
     public static function createAddToCartEvent(
         $cart_item_key,
         $product_id,
-        $quantity
+        $quantity,
+        $variation_id = null
     ) {
         $event_data                 = self::getPIIFromSession();
         $event_data['content_type'] = 'product';
         $event_data['currency']     = get_woocommerce_currency();

         $cart_item = self::getCartItem( $cart_item_key );
-        if ( ! empty( $cart_item_key ) ) {
+        if ( ! empty( $cart_item ) && ! empty( $cart_item['data'] ) ) {
             $event_data['content_ids'] = array(
                 self::getProductId(
                     $cart_item['data']
@@ -437,6 +443,22 @@
                 $cart_item,
                 $quantity
             );
+
+            return $event_data;
+        }
+
+        // Fallback for integrations that call Woo add_to_cart() on a
+        // temporary/private cart (e.g. subscription cloning flows).
+        $product_lookup_id = ! empty( $variation_id ) ? $variation_id : $product_id;
+        $product           = wc_get_product( $product_lookup_id );
+        $product_fb_id     = self::getProductId( $product );
+
+        if ( ! empty( $product_fb_id ) ) {
+            $event_data['content_ids'] = array( $product_fb_id );
+
+            if ( is_object( $product ) && method_exists( $product, 'get_price' ) ) {
+                $event_data['value'] = (float) $quantity * (float) $product->get_price();
+            }
         }

         return $event_data;
@@ -649,6 +671,10 @@
      * @since 1.0.0
      */
     private static function getProductId( $product ) {
+        if ( ! is_object( $product ) || ! method_exists( $product, 'get_id' ) ) {
+            return null;
+        }
+
         $woo_id = $product->get_id();

         return $product->get_sku() ? $product->get_sku() . '_' .
--- a/official-facebook-pixel/local-config-sample.php
+++ b/official-facebook-pixel/local-config-sample.php
@@ -1,5 +1,15 @@
 <?php
 /**
+ * Copyright (C) 2017-present, Meta, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
  * Local development overrides (copy to local-config.php).
  *
  * This file is loaded by facebook-for-wordpress.php before anything else.
--- a/official-facebook-pixel/vendor/composer/installed.php
+++ b/official-facebook-pixel/vendor/composer/installed.php
@@ -1,8 +1,8 @@
 <?php return array(
     'root' => array(
         'name' => 'facebook/pixel-for-wordpress',
-        'pretty_version' => '5.2.1',
-        'version' => '5.2.1.0',
+        'pretty_version' => '5.2.2',
+        'version' => '5.2.2.0',
         'reference' => null,
         'type' => 'project',
         'install_path' => __DIR__ . '/../../',
@@ -20,8 +20,8 @@
             'dev_requirement' => false,
         ),
         'facebook/pixel-for-wordpress' => array(
-            'pretty_version' => '5.2.1',
-            'version' => '5.2.1.0',
+            'pretty_version' => '5.2.2',
+            'version' => '5.2.2.0',
             'reference' => null,
             'type' => 'project',
             'install_path' => __DIR__ . '/../../',

Frequently Asked Questions

Atomic Edge WAF security layer inspecting website traffic.

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Black & McDonald logo representing Enterprise tier security and support for Atomic Edge WAF.Covenant House Toronto logo featuring a dove and text for Atomic Edge Enterprise planAlzheimer Society Canada logo representing trusted organizations and security partners.University of Toronto logo representing trusted organizations using Atomic Edge WAFSpecsavvers logo, trusted developers and organizations using Atomic Edge securityHarvard Medical School logo representing trusted organizations using Atomic Edge WAF.