Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/usc-e-shop/classes/paymentPaidy.class.php
+++ b/usc-e-shop/classes/paymentPaidy.class.php
@@ -1659,9 +1659,9 @@
$items = '';
foreach ( $cart as $cart_row ) {
$items .= "ntttt" . '{' . "n";
- $items .= "ttttt" . '"id": "' . $usces->getItemCode( $cart_row['post_id'] ) . '",' . "n";
+ $items .= "ttttt" . '"id": ' . wp_json_encode( (string) $usces->getItemCode( $cart_row['post_id'] ) ) . ',' . "n";
$items .= "ttttt" . '"quantity": ' . $cart_row['quantity'] . ',' . "n";
- $items .= "ttttt" . '"title": "' . $usces->getItemName( $cart_row['post_id'] ) . '",' . "n";
+ $items .= "ttttt" . '"title": ' . wp_json_encode( (string) $usces->getItemName( $cart_row['post_id'] ) ) . ',' . "n";
$items .= "ttttt" . '"unit_price": ' . $cart_row['price'] . "n";
$items .= "tttt" . '},';
}
--- a/usc-e-shop/classes/paymentPaygent.class.php
+++ b/usc-e-shop/classes/paymentPaygent.class.php
@@ -5618,9 +5618,9 @@
$items = '';
foreach ( $cart as $cart_row ) {
$items .= "ntttt" . '{' . "n";
- $items .= "ttttt" . '"id": "' . $usces->getItemCode( $cart_row['post_id'] ) . '",' . "n";
+ $items .= "ttttt" . '"id": ' . wp_json_encode( (string) $usces->getItemCode( $cart_row['post_id'] ) ) . ',' . "n";
$items .= "ttttt" . '"quantity": ' . $cart_row['quantity'] . ',' . "n";
- $items .= "ttttt" . '"title": "' . $usces->getItemName( $cart_row['post_id'] ) . '",' . "n";
+ $items .= "ttttt" . '"title": ' . wp_json_encode( (string) $usces->getItemName( $cart_row['post_id'] ) ) . ',' . "n";
$items .= "ttttt" . '"unit_price": ' . $cart_row['price'] . "n";
$items .= "tttt" . '},';
}
--- a/usc-e-shop/functions/emails.php
+++ b/usc-e-shop/functions/emails.php
@@ -368,7 +368,7 @@
$sku = urldecode( $cart_row['sku'] );
$quantity = $cart_row['quantity'];
$options = ( ! empty( $cart_row['options'] ) ) ? $cart_row['options'] : array();
- $cart_item_name = $usces->getCartItemName( $post_id, $sku );
+ $cart_item_name = esc_html( $usces->getCartItemName( $post_id, $sku ) );
if ( usces_is_tax_display() && $reduced_taxrate ) {
$applicable_taxrate = $usces_tax->get_sku_applicable_taxrate( $post_id, $sku );
if ( 'reduced' === $applicable_taxrate ) {
@@ -387,14 +387,14 @@
$key = urldecode( $key );
if ( is_array( $value ) ) {
$c = '';
- $optstr .= $key . ' : ';
+ $optstr .= esc_html( $key ) . ' : ';
foreach ( $value as $v ) {
- $optstr .= $c . urldecode( $v );
+ $optstr .= $c . esc_html( urldecode( $v ) );
$c = ', ';
}
$optstr .= '<br>';
} else {
- $optstr .= $key . ' : ' . urldecode( $value ) . '<br>';
+ $optstr .= esc_html( $key ) . ' : ' . esc_html( urldecode( $value ) ) . '<br>';
}
}
}
@@ -850,7 +850,7 @@
$sku = urldecode( $cart_row['sku'] );
$quantity = $cart_row['quantity'];
$options = ( ! empty( $cart_row['options'] ) ) ? $cart_row['options'] : array();
- $cart_item_name = $usces->getCartItemName_byOrder( $cart_row );
+ $cart_item_name = esc_html( $usces->getCartItemName_byOrder( $cart_row ) );
if ( 'activate' === $tax_display && $reduced_taxrate ) {
$applicable_taxrate = $usces_tax->get_ordercart_applicable_taxrate( $cart_row['cart_id'], $post_id, $sku );
if ( 'reduced' === $applicable_taxrate ) {
@@ -871,14 +871,14 @@
$value = maybe_unserialize( $value );
if ( is_array( $value ) ) {
$c = '';
- $optstr .= $key . ' : ';
+ $optstr .= esc_html( $key ) . ' : ';
foreach ( $value as $v ) {
- $optstr .= $c . rawurldecode( $v );
+ $optstr .= $c . esc_html( rawurldecode( $v ) );
$c = ', ';
}
$optstr .= '<br>';
} else {
- $optstr .= $key . ' : ' . rawurldecode( $value ) . '<br>';
+ $optstr .= esc_html( $key ) . ' : ' . esc_html( rawurldecode( $value ) ) . '<br>';
}
}
}
--- a/usc-e-shop/functions/filters.php
+++ b/usc-e-shop/functions/filters.php
@@ -676,9 +676,9 @@
$push[] = "'ecommerce:addItem', {
id: '" . $order_id . "',
- sku: '" . $sku . "',
- name: '" . $itemname . "',
- category: '" . $category . "',
+ sku: '" . esc_js( $sku ) . "',
+ name: '" . esc_js( $itemname ) . "',
+ category: '" . esc_js( $category ) . "',
price: '" . $skuprice . "',
quantity: '" . $quantity . "' }";
}
--- a/usc-e-shop/functions/function.php
+++ b/usc-e-shop/functions/function.php
@@ -2494,7 +2494,7 @@
if ( $total_price < 0 ) {
$total_price = 0;
}
- $push[] = "'_addTrans', '" . $order_id . "', '" . html_entity_decode( get_option( 'blogname' ) ) . "', '" . $total_price . "', '" . $data['order_tax'] . "', '" . $data['order_shipping_charge'] . "', '" . $data['order_address1'].$data['order_address2'] . "', '" . $data['order_pref'] . "', '" . get_locale() . "'";
+ $push[] = "'_addTrans', '" . $order_id . "', '" . esc_js( get_option( 'blogname' ) ) . "', '" . $total_price . "', '" . $data['order_tax'] . "', '" . $data['order_shipping_charge'] . "', '" . esc_js( $data['order_address1'] . $data['order_address2'] ) . "', '" . esc_js( $data['order_pref'] ) . "', '" . get_locale() . "'";
$cart_count = ( $cart && is_array( $cart ) ) ? count( $cart ) : 0;
for ( $i = 0; $i < $cart_count; $i++ ) {
$cart_row = $cart[ $i ];
@@ -2508,7 +2508,7 @@
sort( $cats );
}
$category = ( isset( $cats[0] ) ) ? get_cat_name( $cats[0] ) : '';
- $push[] = "'_addItem', '" . $order_id . "', '" . $sku . "', '" . $itemName . "', '" . $category . "', '" . $skuPrice . "', '" . $quantity . "'";
+ $push[] = "'_addItem', '" . $order_id . "', '" . esc_js( $sku ) . "', '" . esc_js( $itemName ) . "', '" . esc_js( $category ) . "', '" . $skuPrice . "', '" . $quantity . "'";
}
$push[] = "'_trackTrans'";
}
@@ -5605,7 +5605,7 @@
case 'preview_email_order_detail':
$content = isset( $_POST['content'] ) ? $_POST['content'] : '';
$res['status'] = true;
- $res['content'] = wpautop( $content );
+ $res['content'] = wpautop( wp_kses_post( $content ) );
break;
}
wp_send_json( $res );
--- a/usc-e-shop/functions/item_post.php
+++ b/usc-e-shop/functions/item_post.php
@@ -1234,7 +1234,7 @@
$product = wel_get_product( $item->ID );
$item_name = $product['itemName'];
$item_code = $product['itemCode'];
- $option .= '<option value="' . urlencode( $item_code ) . '">' . $item_name . '(' . $item_code . ')</option>' . "n";
+ $option .= '<option value="' . urlencode( $item_code ) . '">' . esc_html( $item_name ) . '(' . esc_html( $item_code ) . ')</option>' . "n";
}
return $option;
}
--- a/usc-e-shop/includes/member_edit_form.php
+++ b/usc-e-shop/includes/member_edit_form.php
@@ -375,7 +375,7 @@
$materials = compact( 'i', 'cart_row', 'post_id', 'sku', 'quantity', 'options', 'advance', 'itemCode', 'itemName', 'cartItemName', 'skuPrice', 'pictid', 'order_id' );
$optstr = apply_filters( 'usces_filter_member_edit_form_row', $optstr, $cart, $materials );
- $cart_item_name = apply_filters( 'usces_filter_admin_cart_item_name', $cartItemName, $materials ) . '<br />' . $optstr;
+ $cart_item_name = apply_filters( 'usces_filter_admin_cart_item_name', esc_html( $cartItemName ), $materials ) . '<br />' . $optstr;
$cart_item_name = apply_filters( 'usces_filter_admin_history_cart_item_name', $cart_item_name, $cartItemName, $optstr, $cart_row, $i );
$cart_thumbnail = ( ! empty( $pictid ) ) ? wp_get_attachment_image( $pictid, array( 60, 60 ), true ) : usces_get_attachment_noimage( array( 60, 60 ), $itemCode );
--- a/usc-e-shop/includes/purchase_button.php
+++ b/usc-e-shop/includes/purchase_button.php
@@ -447,7 +447,7 @@
$html .= '<form id="purchase_form" name="purchase_form" action="' . $send_url . '" method="post" onKeyDown="if (event.keyCode == 13) {return false;}" accept-charset="Shift_JIS">
<input type="hidden" name="IP" value="' . $acting_opts['card_ip'] . '" />
<input type="hidden" name="SID" value="' . $sid . '" />
- <input type="hidden" name="N1" value="' . $item_name . '">
+ <input type="hidden" name="N1" value="' . esc_attr( $item_name ) . '">
<input type="hidden" name="K1" value="' . usces_crform( $usces_entries['order']['total_full_price'], false, false, 'return', false ) . '">
<input type="hidden" name="FUKA" value="' . $fuka . '" />
<input type="hidden" name="KAKUTEI" value="' . $kakutei . '" />
--- a/usc-e-shop/usc-e-shop.php
+++ b/usc-e-shop/usc-e-shop.php
@@ -3,7 +3,7 @@
* Plugin Name: Welcart e-Commerce
* Plugin URI: https://www.welcart.com/
* Description: Welcart builds the management system with a net shop on WordPress.
- * Version: 2.11.33
+ * Version: 2.11.34
* Author: Welcart Inc.
* Author URI: https://www.welcart.com/
* License: GPLv2 or later
@@ -16,7 +16,7 @@
* @package Welcart
*/
-define( 'USCES_VERSION', '2.11.33.2608051' );
+define( 'USCES_VERSION', '2.11.34.2608071' );
define( 'USCES_DB_ACCESS', '1.5' );
define( 'USCES_DB_MEMBER', '1.1' );
define( 'USCES_DB_MEMBER_META', '1.1' );
--- a/usc-e-shop/widgets/usces_featured.php
+++ b/usc-e-shop/widgets/usces_featured.php
@@ -59,7 +59,7 @@
<li class="featured_list<?php echo esc_attr( $class ); ?><?php echo apply_filters( 'usces_filter_featured_list_class', null, $list_index, $num ); ?>">
<?php
$list = '<div class="thumimg"><a href="' . get_permalink( $post_id ) . '">' . usces_the_itemImage( 0, 150, 150, $post, 'return' ) . '</a></div>';
- $list .= '<div class="thumtitle"><a href="' . get_permalink( $post_id ) . '" rel="bookmark">' . $usces->getItemName( $post_id ) . ' (' . $usces->getItemCode( $post_id ) . ')</a></div>';
+ $list .= '<div class="thumtitle"><a href="' . get_permalink( $post_id ) . '" rel="bookmark">' . esc_html( $usces->getItemName( $post_id ) ) . ' (' . esc_html( $usces->getItemCode( $post_id ) ) . ')</a></div>';
echo apply_filters( 'usces_filter_featured_widget', $list, $post, $list_index, $instance );
?>
</li>