PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | classes/usceshop.class.php +124 -144 2.11.322.12.4 View file →
@@ -2021,13 +2021,13 @@
2021 2021 @session_name( $options['usces_key'] );
2022 2022 }
2023 2023 }
2024 2024
2025 - if ( isset( $_GET['uscesid'] ) && ! WCUtils::is_blank( $_GET['uscesid'] ) ) {
2026 - $sessid = $_GET['uscesid'];
2027 - $sessid = $this->uscesdc( $sessid );
2028 - session_id( $sessid );
2029 - }
2025 + // A1 (Layer 3 / uscesid removal): uscesid によるセッションID設定を撤廃。
2026 + // かつては GET uscesid を uscesdc() で復号し session_id() に渡していたが、これがセッション
2027 + // 固定の温床だった(会員乗っ取り・Mantis #0005562)。決済通知のセッション復元は取引キーの
2028 + // DBストア(A3)/同一オリジンの uk cookie 再開(A2/A5/A6)へ移行済みのため撤廃する。
2029 + // See .docs/welcart2.x/security-remediation_uscesid-layer3-a1c-teardown-design.md .
2030 2030
2031 2031 do_action( 'usces_action_session_start' );
2032 2032
2033 2033 $httponly = true;
@@ -2070,92 +2070,26 @@
2070 2070 if ( is_admin() ) {
2071 2071 return;
2072 2072 }
2073 2073
2074 - $actionflag = false;
2075 - $sess = null;
2076 - $addr = null;
2077 - $rckid = null;
2078 - $none = null;
2079 - $cookie = $this->get_cookie();
2080 -
2081 - if ( isset( $_GET['uscesid'] ) && ! WCUtils::is_blank( $_GET['uscesid'] ) ) {
2082 - $sessid = base64_decode( urldecode( $_GET['uscesid'] ) );
2083 - list( $sess, $addr, $rckid, $none ) = explode( '_', $sessid, 4 );
2084 - }
2085 - if ( 'acting' == $addr ) {
2086 - return;
2087 - }
2074 + // A1/C (Layer 3 / uscesid removal): 旧「GET uscesid を復号して addr='acting' を判定」ブロックを撤廃。
2075 + // uscesid 機構撤廃に伴い addr 判定は成立しない。以降は旧SSL同期デッドコード(A7 で撤去済)で return.
2088 2076 if ( apply_filters( 'usces_filter_cookie', false ) ) {
2089 2077 return;
2090 2078 }
2091 2079
2092 - // We need to consider.
2080 + // NOTE (Layer 3 / uscesid removal, A7): the legacy "common domain + separate SSL domain"
2081 + // cookie-sync block that used to follow here was already unreachable (an unconditional
2082 + // return above) and relied on the old SSL/uscesid scheme. Removed during the uscesid
2083 + // mechanism teardown. See .docs/welcart2.x/security-remediation_uscesid-session-fixation.md 4.3.A A7.
2093 2084 return;
2094 -
2095 - if ( $this->use_ssl && ( $this->is_cart_or_member_page( $_SERVER['REQUEST_URI'] ) || $this->is_inquiry_page( $_SERVER['REQUEST_URI'] ) ) ) {
2096 -
2097 - $refer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null;
2098 - $sslid = isset( $cookie['sslid'] ) ? $cookie['sslid'] : null;
2099 - $option = get_option( 'usces' );
2100 - $parsed = parse_url( get_option( 'home' ) );
2101 - $home = $parsed['host'] . ( isset( $parsed['path'] ) ? $parsed['path'] : '' );
2102 - $parsed = parse_url( $option['ssl_url'] );
2103 - $sslhome = $parsed['host'] . ( isset( $parsed['path'] ) ? $parsed['path'] : '' );
2104 -
2105 - if ( empty( $refer ) || ( false === strpos( $refer, $home ) && false === strpos( $refer, $sslhome ) ) ) {
2106 - if ( ! empty( $sslid ) && ! empty( $rckid ) && $sslid === $rckid ) {
2107 - $actionflag = true;
2108 - } else {
2109 - $actionflag = false;
2110 - }
2111 - } else {
2112 - if ( ! empty( $sslid ) && $sslid !== $rckid ) {
2113 - $actionflag = false;
2114 - } else {
2115 - $actionflag = true;
2116 - }
2117 - }
2118 -
2119 - if ( $actionflag ) {
2120 - $values = array(
2121 - 'id' => $rckid,
2122 - 'sslid' => $rckid,
2123 - 'name' => '',
2124 - 'rme' => '',
2125 - );
2126 - if ( 'acting' !== $rckid ) {
2127 - $this->set_cookie( $values );
2128 - }
2129 - } else {
2130 - if ( 'acting' !== $rckid ) {
2131 - unset( $_SESSION['usces_member'], $_SESSION['usces_cart'], $_SESSION['usces_entry'] );
2132 - wp_redirect( 'http://' . $home );
2133 - }
2134 - }
2135 - } else {
2136 - if ( ! isset( $cookie['id'] ) || WCUtils::is_blank( $cookie['id'] ) ) {
2137 - $values = array(
2138 - 'id' => md5( uniqid( rand(), true ) ),
2139 - 'name' => '',
2140 - 'rme' => '',
2141 - );
2142 - $this->set_cookie( $values );
2143 - $_SESSION['usces_cookieid'] = $values['id'];
2144 - } else {
2145 - if ( ! isset( $_SESSION['usces_cookieid'] ) || $_SESSION['usces_cookieid'] != $cookie['id'] ) {
2146 - $_SESSION['usces_cookieid'] = $cookie['id'];
2147 - }
2148 - }
2149 -
2150 - $actionflag = true;
2151 - }
2152 2085 }
2153 2086
2154 2087 public function set_cookie( $values, $key = 'usces_cookie' ) {
2155 - if ( ! isset( $_GET['uscesid'] ) || WCUtils::is_blank( $_GET['uscesid'] ) ) {
2156 - session_regenerate_id( true );
2157 - }
2088 + // A1/C (Layer 3 / uscesid removal): 旧実装は uscesid 付きリクエストで再生成をスキップしていたが、
2089 + // uscesid 機構を撤廃したため常に再生成する(=uscesid 以前のオーガニック挙動に一致)。
2090 + // 決済のセッション継続は取引キーDBストア(A3)/uk cookie(A2/A5/A6)で担保.
2091 + session_regenerate_id( true );
2158 2092 $value = usces_serialize( $values );
2159 2093 $timeout = time()+7*86400;
2160 2094 $timeout = apply_filters( 'usces_filter_set_cookie_timeout', $timeout, $values, $key );
2161 2095 $domain = $_SERVER['SERVER_NAME'];
@@ -2199,9 +2133,9 @@
2199 2133 $value = $wpdb->get_var( $query );
2200 2134 if ( ! $value ) {
2201 2135 $res = null;
2202 2136 } else {
2203 - $res = @unserialize( $value );
2137 + $res = wel_safe_unserialize( $value );
2204 2138 }
2205 2139
2206 2140 return $res;
2207 2141 }
@@ -2229,8 +2163,14 @@
2229 2163 $wpdb->query( $query );
2230 2164 }
2231 2165 }
2232 2166
2167 + /**
2168 + * @deprecated A1/C (Layer 3 / uscesid removal). uscesid 機構は撤廃済み(A1)。本体はこの関数を
2169 + * セッション設定にもURL/nonce生成にも使わない。現状 acting_data の acc_str1 マーカー(save_order_acting_data)
2170 + * と、未移行の拡張・クライアントの後方互換のためだけに残置している。**全拡張・全クライアント移行後に
2171 + * uscescv()/uscesdc() ともども削除する**(最終クリーンアップ)。
2172 + */
2233 2173 public function get_uscesid( $flag = true ) {
2234 2174 $sessname = session_name();
2235 2175 $sessid = session_id();
2236 2176 $sessid = $this->uscescv( $sessid, $flag );
@@ -2236,8 +2176,49 @@
2236 2176 $sessid = $this->uscescv( $sessid, $flag );
2237 2177 return $sessid;
2238 2178 }
2239 2179
2180 + /**
2181 + * Session-bound nonce action key for shop-member forms (uscesid-free).
2182 + *
2183 + * Welcart shop members are not WordPress users (uid=0, empty WP session token), so a
2184 + * per-session component is mixed into the nonce action string to keep nonces scoped to
2185 + * the individual shop session. This replaces the legacy `$action . get_uscesid(false)`
2186 + * (which encoded the same session id via the uscesid obfuscation). The session id is
2187 + * used only as a server-side hash input — it is never output to the client or a URL.
2188 + *
2189 + * @param string $action Base action (e.g. 'post_member' / 'use_point' / 'wc_purchase_nonce').
2190 + * @return string
2191 + */
2192 + public function member_nonce_key( $action ) {
2193 + return $action . session_id();
2194 + }
2195 +
2196 + /**
2197 + * Create a shop-member nonce bound to the current session.
2198 + *
2199 + * @param string $action Base action.
2200 + * @return string
2201 + */
2202 + public function create_member_nonce( $action ) {
2203 + return wp_create_nonce( $this->member_nonce_key( $action ) );
2204 + }
2205 +
2206 + /**
2207 + * Verify a shop-member nonce.
2208 + *
2209 + * A1/C (Layer 3 / uscesid removal): 移行期の後方互換だった「旧 uscesid ベースキーの二重受理」を撤廃。
2210 + * 以降はセッション束縛の新方式キー(member_nonce_key)のみ受理する。未移行の拡張・テーマの
2211 + * フォーム(旧キー生成)は新方式へ移行するまで nonce 不一致になる(協調リリースで同時展開)。
2212 + *
2213 + * @param string $nonce Nonce value from the request.
2214 + * @param string $action Base action.
2215 + * @return int|false 1|2 on success, false on failure.
2216 + */
2217 + public function verify_member_nonce( $nonce, $action ) {
2218 + return wp_verify_nonce( $nonce, $this->member_nonce_key( $action ) );
2219 + }
2220 +
2240 2221 public function shop_head() {
2241 2222 global $post;
2242 2223 $this->item = $post;
2243 2224 if ( $this->is_cart_or_member_page( $_SERVER['REQUEST_URI'] ) ) {
@@ -2332,9 +2313,9 @@
2332 2313 'previous_url': "<?php echo esc_url( $this->previous_url ); ?>",
2333 2314 'itemRestriction': "<?php echo esc_js( $itemRestriction ); ?>",
2334 2315 'itemOrderAcceptable': "<?php echo esc_js( $itemOrderAcceptable ); ?>",
2335 2316 'uscespage': "<?php echo esc_js( $wcpage ); ?>",
2336 - 'uscesid': "<?php echo esc_js( $this->get_uscesid( false ) ); ?>",
2317 + <?php // A1/C (Layer 3 / uscesid removal): JS グローバル uscesL10n.uscesid の供給を撤廃。消費側は uk cookie 依存へ移行. ?>
2337 2318 'wc_nonce': "<?php echo wp_create_nonce( $nonce_action ); ?>"
2338 2319 }
2339 2320 </script>
2340 2321 <script type='text/javascript' src='<?php echo esc_url( $javascript_url ); ?>'></script>
@@ -2676,9 +2657,8 @@
2676 2657 <?php echo apply_filters( 'usces_filter_admin_uscesL10n', null ); ?>
2677 2658 'requestFile': "<?php echo site_url(); ?>/wp-admin/admin-ajax.php",
2678 2659 'USCES_PLUGIN_URL': "<?php echo USCES_PLUGIN_URL; ?>",
2679 2660 'version': "<?php echo USCES_VERSION; ?>",
2680 - 'wcid': "<?php echo get_option( 'usces_wcid' ); ?>",
2681 2661 'locale': '<?php echo get_locale(); ?>',
2682 2662 'cart_number': "<?php echo get_option( 'usces_cart_number' ); ?>",
2683 2663 'purchase_limit': "<?php echo esc_js( $this->options['purchase_limit'] ); ?>",
2684 2664 'point_rate': "<?php echo esc_js( $this->options['point_rate'] ); ?>",
@@ -3088,29 +3068,29 @@
3088 3068 $ssl_perse_path = isset( $ssl_perse['path'] ) ? $ssl_perse['path'] : '';
3089 3069 $ssl_path = $ssl_perse['host'] . $ssl_perse_path;
3090 3070 if ( $home_perse_path != $ssl_perse_path ) {
3091 3071 if ( ! defined( 'USCES_CUSTOMER_URL' ) ) {
3092 - define( 'USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&customerinfo=1&uscesid=' . $this->get_uscesid() );
3072 + define( 'USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&customerinfo=1' );
3093 3073 }
3094 3074 if ( ! defined( 'USCES_CART_URL' ) ) {
3095 - define( 'USCES_CART_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&uscesid=' . $this->get_uscesid() );
3075 + define( 'USCES_CART_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER );
3096 3076 }
3097 3077 if ( ! defined( 'USCES_LOSTMEMBERPASSWORD_URL' ) ) {
3098 - define( 'USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=lostmemberpassword' );
3078 + define( 'USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=lostmemberpassword' );
3099 3079 }
3100 3080 if ( ! defined( 'USCES_NEWMEMBER_URL' ) ) {
3101 - define( 'USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=newmember' );
3081 + define( 'USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=newmember' );
3102 3082 }
3103 3083 if ( ! defined( 'USCES_LOGIN_URL' ) ) {
3104 - define( 'USCES_LOGIN_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=login' );
3084 + define( 'USCES_LOGIN_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=login' );
3105 3085 }
3106 3086 if ( ! defined( 'USCES_LOGOUT_URL' ) ) {
3107 - define( 'USCES_LOGOUT_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=logout' );
3087 + define( 'USCES_LOGOUT_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=logout' );
3108 3088 }
3109 3089 if ( ! defined( 'USCES_MEMBER_URL' ) ) {
3110 - define( 'USCES_MEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() );
3090 + define( 'USCES_MEMBER_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_MEMBER_NUMBER );
3111 3091 }
3112 - $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/index.php?page_id=' . $this->options['inquiry_id'] . '&uscesid=' . $this->get_uscesid();
3092 + $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/index.php?page_id=' . $this->options['inquiry_id'];
3113 3093 if ( ! defined( 'USCES_INQUIRY_URL' ) ) {
3114 3094 define( 'USCES_INQUIRY_URL', $inquiry_url );
3115 3095 }
3116 3096 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
@@ -3116,39 +3096,39 @@
3116 3096 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
3117 3097 define( 'USCES_CART_NONSESSION_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER );
3118 3098 }
3119 3099 if ( ! defined( 'USCES_PAYPAL_NOTIFY_URL' ) ) {
3120 - define( 'USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid( false ) );
3100 + define( 'USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/index.php?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn' );
3121 3101 }
3122 3102 } else {
3123 3103 $ssl_plink_cart = str_replace( 'http://','https://', str_replace( $home_path, $ssl_path, get_page_link( USCES_CART_NUMBER ) ) );
3124 3104 $ssl_plink_member = str_replace( 'http://','https://', str_replace( $home_path, $ssl_path, get_page_link( USCES_MEMBER_NUMBER ) ) );
3125 3105 if ( ! defined( 'USCES_CUSTOMER_URL' ) ) {
3126 - define( 'USCES_CUSTOMER_URL', $ssl_plink_cart . '?uscesid=' . $this->get_uscesid() . '&customerinfo=1' );
3106 + define( 'USCES_CUSTOMER_URL', $ssl_plink_cart . '?customerinfo=1' );
3127 3107 }
3128 3108 if ( ! defined( 'USCES_CART_URL' ) ) {
3129 - define( 'USCES_CART_URL', $ssl_plink_cart . '?uscesid=' . $this->get_uscesid() );
3109 + define( 'USCES_CART_URL', $ssl_plink_cart );
3130 3110 }
3131 3111 if ( ! defined( 'USCES_LOSTMEMBERPASSWORD_URL' ) ) {
3132 - define( 'USCES_LOSTMEMBERPASSWORD_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&usces_page=lostmemberpassword' );
3112 + define( 'USCES_LOSTMEMBERPASSWORD_URL', $ssl_plink_member . '?usces_page=lostmemberpassword' );
3133 3113 }
3134 3114 if ( ! defined( 'USCES_NEWMEMBER_URL' ) ) {
3135 - define( 'USCES_NEWMEMBER_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&usces_page=newmember' );
3115 + define( 'USCES_NEWMEMBER_URL', $ssl_plink_member . '?usces_page=newmember' );
3136 3116 }
3137 3117 if ( ! defined( 'USCES_LOGIN_URL' ) ) {
3138 - define( 'USCES_LOGIN_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&usces_page=login' );
3118 + define( 'USCES_LOGIN_URL', $ssl_plink_member . '?usces_page=login' );
3139 3119 }
3140 3120 if ( ! defined( 'USCES_LOGOUT_URL' ) ) {
3141 - define( 'USCES_LOGOUT_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() . '&usces_page=logout' );
3121 + define( 'USCES_LOGOUT_URL', $ssl_plink_member . '?usces_page=logout' );
3142 3122 }
3143 3123 if ( ! defined( 'USCES_MEMBER_URL' ) ) {
3144 - define( 'USCES_MEMBER_URL', $ssl_plink_member . '?uscesid=' . $this->get_uscesid() );
3124 + define( 'USCES_MEMBER_URL', $ssl_plink_member );
3145 3125 }
3146 3126 if ( ! isset( $this->options['inquiry_id'] ) || ! ( (int) $this->options['inquiry_id'] ) ) {
3147 3127 $inquiry_url = get_home_url();
3148 3128 } else {
3149 3129 $ssl_plink_inquiry = str_replace( 'http://', 'https://', str_replace( $home_path, $ssl_path, get_page_link( $this->options['inquiry_id'] ) ) );
3150 - $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $ssl_plink_inquiry . '?uscesid=' . $this->get_uscesid();
3130 + $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $ssl_plink_inquiry;
3151 3131 }
3152 3132 if ( ! defined( 'USCES_INQUIRY_URL' ) ) {
3153 3133 define( 'USCES_INQUIRY_URL', $inquiry_url );
3154 3134 }
@@ -3155,35 +3135,35 @@
3155 3135 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
3156 3136 define( 'USCES_CART_NONSESSION_URL', $ssl_plink_cart );
3157 3137 }
3158 3138 if ( ! defined( 'USCES_PAYPAL_NOTIFY_URL' ) ) {
3159 - define( 'USCES_PAYPAL_NOTIFY_URL', $ssl_plink_cart . '?acting=paypal_ipn&uscesid=' . $this->get_uscesid( false ) );
3139 + define( 'USCES_PAYPAL_NOTIFY_URL', $ssl_plink_cart . '?acting=paypal_ipn' );
3160 3140 }
3161 3141 }
3162 3142 } else {
3163 3143 $this->delim = '&';
3164 3144 if ( ! defined( 'USCES_CUSTOMER_URL' ) ) {
3165 - define( 'USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&customerinfo=1&uscesid=' . $this->get_uscesid() );
3145 + define( 'USCES_CUSTOMER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&customerinfo=1' );
3166 3146 }
3167 3147 if ( ! defined( 'USCES_CART_URL' ) ) {
3168 - define( 'USCES_CART_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&uscesid=' . $this->get_uscesid() );
3148 + define( 'USCES_CART_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER );
3169 3149 }
3170 3150 if ( ! defined( 'USCES_LOSTMEMBERPASSWORD_URL' ) ) {
3171 - define( 'USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=lostmemberpassword' );
3151 + define( 'USCES_LOSTMEMBERPASSWORD_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=lostmemberpassword' );
3172 3152 }
3173 3153 if ( ! defined( 'USCES_NEWMEMBER_URL' ) ) {
3174 - define( 'USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=newmember' );
3154 + define( 'USCES_NEWMEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=newmember' );
3175 3155 }
3176 3156 if ( ! defined( 'USCES_LOGIN_URL' ) ) {
3177 - define( 'USCES_LOGIN_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=login' );
3157 + define( 'USCES_LOGIN_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=login' );
3178 3158 }
3179 3159 if ( ! defined( 'USCES_LOGOUT_URL' ) ) {
3180 - define( 'USCES_LOGOUT_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() . '&usces_page=logout' );
3160 + define( 'USCES_LOGOUT_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&usces_page=logout' );
3181 3161 }
3182 3162 if ( ! defined( 'USCES_MEMBER_URL' ) ) {
3183 - define( 'USCES_MEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER . '&uscesid=' . $this->get_uscesid() );
3163 + define( 'USCES_MEMBER_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_MEMBER_NUMBER );
3184 3164 }
3185 - $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/?page_id=' . $this->options['inquiry_id'] . '&uscesid=' . $this->get_uscesid();
3165 + $inquiry_url = empty( $this->options['inquiry_id'] ) ? '' : $this->options['ssl_url'] . '/?page_id=' . $this->options['inquiry_id'];
3186 3166 if ( ! defined( 'USCES_INQUIRY_URL' ) ) {
3187 3167 define( 'USCES_INQUIRY_URL', $inquiry_url );
3188 3168 }
3189 3169 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
@@ -3189,9 +3169,9 @@
3189 3169 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
3190 3170 define( 'USCES_CART_NONSESSION_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER );
3191 3171 }
3192 3172 if ( ! defined( 'USCES_PAYPAL_NOTIFY_URL' ) ) {
3193 - define( 'USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid( false ) );
3173 + define( 'USCES_PAYPAL_NOTIFY_URL', $this->options['ssl_url'] . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn' );
3194 3174 }
3195 3175 }
3196 3176 if ( ! is_admin() ) {
3197 3177 add_filter( 'home_url', array( $this, 'usces_ssl_page_link' ) );
@@ -3233,9 +3213,9 @@
3233 3213 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
3234 3214 define( 'USCES_CART_NONSESSION_URL', get_page_link( USCES_CART_NUMBER ) );
3235 3215 }
3236 3216 if ( ! defined( 'USCES_PAYPAL_NOTIFY_URL' ) ) {
3237 - define( 'USCES_PAYPAL_NOTIFY_URL', get_page_link( USCES_CART_NUMBER ) . '?acting=paypal_ipn&uscesid=' . $this->get_uscesid( false ) );
3217 + define( 'USCES_PAYPAL_NOTIFY_URL', get_page_link( USCES_CART_NUMBER ) . '?acting=paypal_ipn' );
3238 3218 }
3239 3219 } else {
3240 3220 $this->delim = '&';
3241 3221 if ( ! defined( 'USCES_CUSTOMER_URL' ) ) {
@@ -3269,9 +3249,9 @@
3269 3249 if ( ! defined( 'USCES_CART_NONSESSION_URL' ) ) {
3270 3250 define( 'USCES_CART_NONSESSION_URL', get_option( 'home' ) . '/?page_id=' . USCES_CART_NUMBER );
3271 3251 }
3272 3252 if ( ! defined( 'USCES_PAYPAL_NOTIFY_URL' ) ) {
3273 - define( 'USCES_PAYPAL_NOTIFY_URL', get_option( 'home' ) . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn&uscesid=' . $this->get_uscesid( false ) );
3253 + define( 'USCES_PAYPAL_NOTIFY_URL', get_option( 'home' ) . '/?page_id=' . USCES_CART_NUMBER . '&acting=paypal_ipn' );
3274 3254 }
3275 3255 }
3276 3256 }
3277 3257 }
@@ -3537,10 +3517,9 @@
3537 3517 exit;
3538 3518 }
3539 3519
3540 3520 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3541 - $noncekey = 'post_member' . $this->get_uscesid( false );
3542 - if ( ! wp_verify_nonce( $nonce, $noncekey ) && ! $this->is_member_logged_in() ) {
3521 + if ( ! $this->verify_member_nonce( $nonce, 'post_member' ) && ! $this->is_member_logged_in() ) {
3543 3522 die( 'Security check2' );
3544 3523 }
3545 3524 $check_verify_recaptcha = $this->verifyGoogleRecapcha();
3546 3525 if ( $check_verify_recaptcha ) {
@@ -3666,11 +3645,9 @@
3666 3645 }
3667 3646
3668 3647 public function use_point() {
3669 3648 global $wp_query, $usces;
3670 - $noncekey = 'use_point' . $usces->get_uscesid( false );
3671 -
3672 - if ( ! isset( $_REQUEST['wc_nonce'] ) || ! wp_verify_nonce( $_REQUEST['wc_nonce'], $noncekey ) ) {
3649 + if ( ! isset( $_REQUEST['wc_nonce'] ) || ! $usces->verify_member_nonce( $_REQUEST['wc_nonce'], 'use_point' ) ) {
3673 3650 die( 'Security check1' );
3674 3651 }
3675 3652
3676 3653 $this->error_message = $this->point_check( $this->cart->get_entry() );
@@ -3864,10 +3841,9 @@
3864 3841 }
3865 3842
3866 3843 public function regmember() {
3867 3844 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3868 - $noncekey = 'post_member' . $this->get_uscesid( false );
3869 - if ( ! wp_verify_nonce( $nonce, $noncekey ) ) {
3845 + if ( ! $this->verify_member_nonce( $nonce, 'post_member' ) ) {
3870 3846 die( 'Security check2' );
3871 3847 }
3872 3848
3873 3849 $check_verify_recaptcha = $this->verifyGoogleRecapcha();
@@ -3895,10 +3871,9 @@
3895 3871 }
3896 3872
3897 3873 public function editmember() {
3898 3874 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3899 - $noncekey = 'post_member' . $this->get_uscesid( false );
3900 - if ( ! wp_verify_nonce( $nonce, $noncekey ) ) {
3875 + if ( ! $this->verify_member_nonce( $nonce, 'post_member' ) ) {
3901 3876 die( 'Security check3' );
3902 3877 }
3903 3878
3904 3879 global $wp_query;
@@ -3919,10 +3894,9 @@
3919 3894 }
3920 3895
3921 3896 public function deletemember() {
3922 3897 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3923 - $noncekey = 'post_member' . $this->get_uscesid( false );
3924 - if ( ! wp_verify_nonce( $nonce, $noncekey ) ) {
3898 + if ( ! $this->verify_member_nonce( $nonce, 'post_member' ) ) {
3925 3899 die( 'Security check4' );
3926 3900 }
3927 3901
3928 3902 $res = $this->delete_member();
@@ -3953,10 +3927,9 @@
3953 3927 public function lostpassword() {
3954 3928 global $usces, $wp_query;
3955 3929
3956 3930 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3957 - $noncekey = 'post_member' . $usces->get_uscesid( false );
3958 - if ( ! wp_verify_nonce( $nonce, $noncekey ) ) {
3931 + if ( ! $usces->verify_member_nonce( $nonce, 'post_member' ) ) {
3959 3932 $wp_query->set_403();
3960 3933 status_header( 403 );
3961 3934 exit();
3962 3935 }
@@ -3994,10 +3967,9 @@
3994 3967 public function changepassword_page() {
3995 3968 global $usces;
3996 3969
3997 3970 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
3998 - $noncekey = 'post_member' . $usces->get_uscesid( false );
3999 - if ( ! wp_verify_nonce( $nonce, $noncekey ) ) {
3971 + if ( ! $usces->verify_member_nonce( $nonce, 'post_member' ) ) {
4000 3972 die( 'Security check6' );
4001 3973 }
4002 3974
4003 3975 $lostmail = $_POST['mem'];
@@ -4867,9 +4839,9 @@
4867 4839 $_SESSION['usces_member']['address3'] = $member['mem_address3'];
4868 4840 $_SESSION['usces_member']['tel'] = $member['mem_tel'];
4869 4841 $_SESSION['usces_member']['fax'] = $member['mem_fax'];
4870 4842 $_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag'];
4871 - $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? unserialize( $member['mem_delivery'] ) : '';
4843 + $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? wel_safe_unserialize( $member['mem_delivery'] ) : '';
4872 4844 $_SESSION['usces_member']['registered'] = $member['mem_registered'];
4873 4845 $_SESSION['usces_member']['nicename'] = $member['mem_nicename'];
4874 4846 $_SESSION['usces_member']['country'] = $this->get_member_meta_value( 'customer_country', $member['ID'] );
4875 4847 $_SESSION['usces_member']['status'] = $member['mem_status'];
@@ -4902,10 +4874,9 @@
4902 4874 $nonce = isset( $_REQUEST['wel_nonce'] ) ? $_REQUEST['wel_nonce'] : '';
4903 4875 if ( ! $nonce ) {
4904 4876 $nonce = isset( $_REQUEST['wc_nonce'] ) ? $_REQUEST['wc_nonce'] : '';
4905 4877 }
4906 - $noncekey = 'post_member' . $this->get_uscesid( false );
4907 - if ( ! wp_verify_nonce( $nonce, $noncekey ) && ! $this->is_member_logged_in() ) {
4878 + if ( ! $this->verify_member_nonce( $nonce, 'post_member' ) && ! $this->is_member_logged_in() ) {
4908 4879 $rateLimiter->saveLoginFailed();
4909 4880 do_action( 'usces_action_member_login_failed', trim( $_POST['loginmail'] ), 'invalid_nonce' );
4910 4881 die( 'Security check4' );
4911 4882 }
@@ -4956,9 +4927,9 @@
4956 4927 $_SESSION['usces_member']['address3'] = $member['mem_address3'];
4957 4928 $_SESSION['usces_member']['tel'] = $member['mem_tel'];
4958 4929 $_SESSION['usces_member']['fax'] = $member['mem_fax'];
4959 4930 $_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag'];
4960 - $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? unserialize( $member['mem_delivery'] ) : '';
4931 + $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? wel_safe_unserialize( $member['mem_delivery'] ) : '';
4961 4932 $_SESSION['usces_member']['registered'] = $member['mem_registered'];
4962 4933 $_SESSION['usces_member']['nicename'] = $member['mem_nicename'];
4963 4934 $_SESSION['usces_member']['country'] = $this->get_member_meta_value( 'customer_country', $member['ID'] );
4964 4935 $_SESSION['usces_member']['status'] = $member['mem_status'];
@@ -5015,9 +4986,9 @@
5015 4986 $_SESSION['usces_member']['address3'] = $member['mem_address3'];
5016 4987 $_SESSION['usces_member']['tel'] = $member['mem_tel'];
5017 4988 $_SESSION['usces_member']['fax'] = $member['mem_fax'];
5018 4989 $_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag'];
5019 - $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? unserialize( $member['mem_delivery'] ) : '';
4990 + $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? wel_safe_unserialize( $member['mem_delivery'] ) : '';
5020 4991 $_SESSION['usces_member']['registered'] = $member['mem_registered'];
5021 4992 $_SESSION['usces_member']['nicename'] = $member['mem_nicename'];
5022 4993 $_SESSION['usces_member']['country'] = $this->get_member_meta_value( 'customer_country', $member['ID'] );
5023 4994 $_SESSION['usces_member']['status'] = $member['mem_status'];
@@ -5056,9 +5027,9 @@
5056 5027 $_SESSION['usces_member']['address3'] = $member['mem_address3'];
5057 5028 $_SESSION['usces_member']['tel'] = $member['mem_tel'];
5058 5029 $_SESSION['usces_member']['fax'] = $member['mem_fax'];
5059 5030 $_SESSION['usces_member']['delivery_flag'] = $member['mem_delivery_flag'];
5060 - $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? unserialize( $member['mem_delivery'] ) : '';
5031 + $_SESSION['usces_member']['delivery'] = ! empty( $member['mem_delivery'] ) ? wel_safe_unserialize( $member['mem_delivery'] ) : '';
5061 5032 $_SESSION['usces_member']['registered'] = $member['mem_registered'];
5062 5033 $_SESSION['usces_member']['nicename'] = $member['mem_nicename'];
5063 5034 $_SESSION['usces_member']['country'] = $this->get_member_meta_value( 'customer_country', $member['ID'] );
5064 5035 $_SESSION['usces_member']['status'] = $member['mem_status'];
@@ -5143,9 +5114,9 @@
5143 5114 $query = $wpdb->prepare( "SELECT meta_key, meta_value FROM $table WHERE member_id = %d", $mid );
5144 5115 $metas = $wpdb->get_results( $query, ARRAY_A );
5145 5116
5146 5117 foreach ( $metas as $meta ) {
5147 - $infos[ $meta['meta_key'] ] = maybe_unserialize( $meta['meta_value'] );
5118 + $infos[ $meta['meta_key'] ] = wel_safe_maybe_unserialize( $meta['meta_value'] );
5148 5119 }
5149 5120 }
5150 5121 return $infos;
5151 5122 }
@@ -5280,10 +5251,10 @@
5280 5251 }
5281 5252 $res = array(
5282 5253 'ID' => $value->ID,
5283 5254 'mem_id' => $value->mem_id,
5284 - 'cart' => unserialize( $value->order_cart ),
5285 - 'condition' => unserialize( $value->order_condition ),
5255 + 'cart' => wel_safe_unserialize( $value->order_cart ),
5256 + 'condition' => wel_safe_unserialize( $value->order_condition ),
5286 5257 'getpoint' => $value->order_getpoint,
5287 5258 'usedpoint' => $value->order_usedpoint,
5288 5259 'discount' => $value->order_discount,
5289 5260 'payment_name' => $value->order_payment_name,
@@ -5312,9 +5283,9 @@
5312 5283 foreach ( $rows as $row ) {
5313 5284 if ( strpos( $row['order_status'], 'cancel' ) !== false || strpos( $row['order_status'], 'estimate' ) !== false ) {
5314 5285 continue;
5315 5286 } else {
5316 - $carts = unserialize( $row['order_cart'] );
5287 + $carts = wel_safe_unserialize( $row['order_cart'] );
5317 5288 foreach ( $carts as $cart ) {
5318 5289 if ( $post_id == $cart['post_id'] ) {
5319 5290 $res[] = $row['ID'];
5320 5291 break;
@@ -7455,9 +7426,9 @@
7455 7426 if ( empty( $cart['advance'] ) ) {
7456 7427 $type = 'once';
7457 7428 } else {
7458 7429 if ( is_array( $cart['advance'] ) && array_key_exists( 'regular', $cart['advance'] ) ) {
7459 - $regular = maybe_unserialize( $cart['advance']['regular'] );
7430 + $regular = wel_safe_maybe_unserialize( $cart['advance']['regular'] );
7460 7431 } else {
7461 7432 $advance = $this->cart->wc_unserialize( $cart['advance'] );
7462 7433 $sku = urldecode( $cart['sku'] );
7463 7434 $sku_encoded = $cart['sku'];
@@ -8753,9 +8724,9 @@
8753 8724
8754 8725 $data = array(
8755 8726 'ID' => $value->ID,
8756 8727 'cart' => $cart,
8757 - 'condition' => unserialize( $value->order_condition ),
8728 + 'condition' => wel_safe_unserialize( $value->order_condition ),
8758 8729 'getpoint' => $value->order_getpoint,
8759 8730 'usedpoint' => $value->order_usedpoint,
8760 8731 'discount' => $value->order_discount,
8761 8732 'shipping_charge' => $value->order_shipping_charge,
@@ -8822,8 +8793,12 @@
8822 8793
8823 8794 return $id;
8824 8795 }
8825 8796
8797 + /**
8798 + * @deprecated A1/C (Layer 3 / uscesid removal). uscesid 難読化生成。本体は不使用。未移行の拡張・
8799 + * クライアント後方互換のためのみ残置。全消費側移行後に get_uscesid()/uscesdc() ともども削除する。
8800 + */
8826 8801 public function uscescv( $sessid, $flag ) {
8827 8802 $chars = '';
8828 8803 $i = 0;
8829 8804 $h = 0;
@@ -8855,8 +8830,13 @@
8855 8830
8856 8831 return $sessid;
8857 8832 }
8858 8833
8834 + /**
8835 + * @deprecated A1/C (Layer 3 / uscesid removal). uscesid 復号。本体は不使用(A1 で唯一の呼び出しを撤去)。
8836 + * 未移行の拡張・クライアント(直接 uscesdc()→session_id() する nopriv AJAX)後方互換のためのみ残置。
8837 + * 全消費側移行後に get_uscesid()/uscescv() ともども削除する。
8838 + */
8859 8839 public function uscesdc( $sessid ) {
8860 8840 $sessid = base64_decode( urldecode( $sessid ) );
8861 8841 list( $sess, $addr, $cookieid, $none ) = explode( '_', $sessid, 4 );
8862 8842 $postfix = ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ) ? $_SERVER['REMOTE_ADDR'] : 'REMOTE_ADDR';
@@ -9085,9 +9065,9 @@
9085 9065 return false;
9086 9066 }
9087 9067
9088 9068 foreach ( (array) $dbres as $carts ) {
9089 - $rows = unserialize( $carts );
9069 + $rows = wel_safe_unserialize( $carts );
9090 9070 foreach ( (array) $rows as $carts ) {
9091 9071 if ( 'publish' != get_post_status( $carts['post_id'] ) ) {
9092 9072 continue;
9093 9073 }
@@ -9414,9 +9394,9 @@
9414 9394 if ( is_array( $meta ) ) {
9415 9395 $keys = array_keys( $meta );
9416 9396 foreach ( $keys as $key ) {
9417 9397 $csmb_key = 'csmb_' . $key;
9418 - $_SESSION['usces_member']['custom_member'][ $key ] = maybe_unserialize( $this->get_member_meta_value( $csmb_key, $member_id ) );
9398 + $_SESSION['usces_member']['custom_member'][ $key ] = wel_safe_maybe_unserialize( $this->get_member_meta_value( $csmb_key, $member_id ) );
9419 9399 }
9420 9400 }
9421 9401 }
9422 9402
@@ -9550,9 +9530,9 @@
9550 9530 foreach ( $res as $value ) {
9551 9531 if ( in_array( $value['meta_key'], $meta_keys ) ) {
9552 9532 $meta_key = $value['meta_key'];
9553 9533 if ( 'settlement_id' == $meta_key ) {
9554 - $meta_values = maybe_unserialize( $value['meta_value'] );
9534 + $meta_values = wel_safe_maybe_unserialize( $value['meta_value'] );
9555 9535 if ( is_array( $meta_values ) ) {
9556 9536 foreach ( $meta_values as $key => $meta_value ) {
9557 9537 $fields[ $key ] = $meta_value;
9558 9538 }
@@ -9568,9 +9548,9 @@
9568 9548 foreach ( $meta_values as $key => $meta_value ) {
9569 9549 $fields[ $key ] = $meta_value;
9570 9550 }
9571 9551 } else {
9572 - $meta_values = maybe_unserialize( $value['meta_value'] );
9552 + $meta_values = wel_safe_maybe_unserialize( $value['meta_value'] );
9573 9553 if ( is_array( $meta_values ) ) {
9574 9554 foreach ( $meta_values as $key => $meta_value ) {
9575 9555 $fields[ $key ] = $meta_value;
9576 9556 }