Changeset 3772665
- Timestamp:
- 10/29/2026 10:44:25 AM (6 hours ago)
- Location:
- ithemeland-free-gifts-for-woo/trunk
- Files:
-
- 3 edited
-
frontend/classes/shortcodes.php (modified) (5 diffs)
-
ithemeland-free-gifts-for-woo.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ithemeland-free-gifts-for-woo/trunk/frontend/classes/shortcodes.php
r3729325 r3772665 161 161 ); 162 162 163 $atts_shortcode['type'] = $this->normalize_gift_layout($atts_shortcode['type']); 164 163 165 $flag = true; 164 166 $gift_items = $this->check_rule_condition->pw_get_gift_for_cart_checkout(); … … 197 199 } 198 200 199 echo wp_kses('<span class="itg-shortoces-products" data-type="' . $atts['type']. '" >', Sanitizer::allowed_html());201 echo wp_kses('<span class="itg-shortoces-products" data-type="' . esc_attr($atts_shortcode['type']) . '" >', Sanitizer::allowed_html()); 200 202 201 203 if ($flag) { … … 212 214 $rule_products = [ 213 215 'data_args' => itfreegift_get_gift_products_data_multilevel($args_data), 214 'template' => $atts ['type']216 'template' => $atts_shortcode['type'] 215 217 ]; 216 218 … … 221 223 } 222 224 225 /** 226 * Only registered gift layouts may reach template selection. 227 */ 228 private function normalize_gift_layout($type) 229 { 230 $type = is_string($type) ? sanitize_key($type) : ''; 231 return in_array($type, ['carousel', 'grid', 'datatable', 'dropdown'], true) ? $type : 'dropdown'; 232 } 233 223 234 public function shortcode_show_popup() 224 235 { 225 $type = sanitize_text_field(wp_unslash($_POST['type'])); //phpcs:ignore 226 echo do_shortcode('[itg_gift_products type="' . $type . '"]'); 236 $raw_type = isset($_POST['type']) && is_string($_POST['type']) ? wp_unslash($_POST['type']) : ''; 237 $type = $this->normalize_gift_layout($raw_type); 238 // Invoke our renderer directly; never parse request input as shortcode source. 239 $this->shortcode_gift_products(['type' => $type], ''); 227 240 wp_die(); 228 241 } … … 235 248 check_ajax_referer('jkhKJSdd4576d234Z', 'itg_security'); 236 249 237 $type = isset($_POST['type']) ? sanitize_key(wp_unslash($_POST['type'])) : 'dropdown'; //phpcs:ignore 238 if (!in_array($type, ['carousel', 'grid', 'datatable', 'dropdown'], true)) { 239 $type = 'dropdown'; 240 } 250 $raw_type = isset($_POST['type']) && is_string($_POST['type']) ? wp_unslash($_POST['type']) : ''; 251 $type = $this->normalize_gift_layout($raw_type); 241 252 242 253 $this->rendering_checkout = true; 243 echo do_shortcode('[itg_gift_products type="' . $type . '"]');254 $this->shortcode_gift_products(['type' => $type], ''); 244 255 $this->rendering_checkout = false; 245 256 wp_die(); -
ithemeland-free-gifts-for-woo/trunk/ithemeland-free-gifts-for-woo.php
r3767915 r3772665 5 5 Description: Free Gifts for WooCommerce allows you to offer Free Gifts to your customers whenever they make a purchase on your site. 6 6 Author: iThemelandco 7 Version: 4. 57 Version: 4.6 8 8 Tags: woocommerce,woocommerce gift 9 9 Text Domain: ithemeland-free-gifts-for-woo … … 55 55 //define('WGBL_WP_TESTED', '6.6'); 56 56 define('WGBL_WP_REQUIRE', '5.0.0'); 57 define('WGBL_VERSION', '4. 5');57 define('WGBL_VERSION', '4.6'); 58 58 59 59 register_activation_hook(__FILE__, ['ITFreeGift\classes\bootstrap\WGBL', 'activate']); -
ithemeland-free-gifts-for-woo/trunk/readme.txt
r3767915 r3772665 5 5 Requires at least: 5.0 6 6 Tested up to: 7.1 7 Stable tag: 4. 57 Stable tag: 4.6 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 609 609 610 610 == Changelog == 611 4.6 612 * Security: Fixed an unauthenticated arbitrary shortcode execution vulnerability in the gift popup AJAX handler. 613 * Security: Restricted gift layouts to supported values and improved shortcode attribute validation and escaping. 614 Credits: Thanks to Nguyen Quang Tan and Patchstack for responsibly reporting this vulnerability. 611 615 = 4.5 = 612 616 * Fixed: Duplicate gift additions caused by repeated clicks, overlapping requests, or slow AJAX responses.
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)