Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/shortcodes-ultimate/freemius/includes/class-freemius.php
+++ b/shortcodes-ultimate/freemius/includes/class-freemius.php
@@ -4540,28 +4540,6 @@
}
if ( $this->is_user_in_admin() ) {
- if ( $this->is_registered() && fs_request_has( 'purchase_completed' ) ) {
- $this->_admin_notices->add_sticky(
- sprintf(
- /* translators: %s: License type (e.g. you have a professional license) */
- $this->get_text_inline( 'You have purchased a %s license.', 'you-have-x-license' ),
- fs_request_get( 'purchased_plan' )
- ) .
- sprintf(
- $this->get_text_inline(" The %s's %sdownload link%s, license key, and installation instructions have been sent to %s. If you can't find the email after 5 min, please check your spam box.", 'post-purchase-email-sent-message' ),
- $this->get_module_label( true ),
- ( FS_Plugin::is_valid_id( $this->get_bundle_id() ) ? "products' " : '' ),
- ( FS_Plugin::is_valid_id( $this->get_bundle_id() ) ? 's' : '' ),
- sprintf(
- '<strong>%s</strong>',
- fs_request_get( 'purchase_email' )
- )
- ),
- 'plan_purchased',
- $this->get_text_x_inline( 'Yee-haw', 'interjection expressing joy or exuberance', 'yee-haw' ) . '!'
- );
- }
-
if ( $this->is_addon() ) {
if ( ! $this->is_parent_plugin_installed() ) {
$parent_name = $this->get_option( $plugin_info, 'parent_name', null );
@@ -4863,9 +4841,10 @@
) {
$code = empty( $result->error->code ) ? '' : " Code: {$result->error->code}";
- $error_message .= "<b>{$result->error->message}{$code}</b>";
+ // We do not send HTML from exceptions from Freemius servers, but we escape it nonetheless.
+ $error_message .= "<b>" . esc_html( $result->error->message . $code ) . "</b>";
} else {
- $error_message .= var_export( $result, true );
+ $error_message .= esc_html( var_export( $result, true ) );
}
return $error_message;
@@ -6797,9 +6776,11 @@
$email_address = $current_user->user_email;
}
+ $escaped_email_address = esc_html( $email_address );
+
$formatted_message_args = array(
"<b>{$this->get_plugin_name()}</b>",
- "<b>{$email_address}</b>",
+ "<b>{$escaped_email_address}</b>",
);
if ( ! $has_upgrade_context || ! fs_is_network_admin() ) {
@@ -6844,7 +6825,7 @@
}
$formatted_message_args[] = ( ! empty( $support_email_address ) ) ?
- ( "<b>{$support_email_address}</b>" ) :
+ ( "<b>" . esc_html( $support_email_address ) . "</b>" ) :
$this->get_text_x_inline(
"the product's support email address",
'Part of the message that tells the user to check their spam folder for a specific email.',
@@ -17564,6 +17545,11 @@
return;
}
+ // Only site administrators who can activate plugins may opt-in.
+ if ( ! $this->is_user_admin() ) {
+ return;
+ }
+
$has_pending_activation_confirmation_param = fs_request_has( 'pending_activation' );
$this->update_license_required_permissions_if_anonymous();
@@ -18143,7 +18129,7 @@
if ( ! $silent ) {
$this->_admin_notices->add(
sprintf( $this->get_text_inline( 'Couldn't activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
- $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $result->error->message . '</b>',
+ $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . esc_html( $result->error->message ) . '</b>',
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
'error'
);
@@ -18263,7 +18249,7 @@
$this->_admin_notices->add(
sprintf( $this->get_text_inline( 'Couldn't activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
- $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $error_message . '</b>',
+ $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . esc_html( $error_message ) . '</b>',
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
'error'
);
@@ -18440,7 +18426,7 @@
if ( isset( $parent_install->error ) ) {
$this->_admin_notices->add(
sprintf( $this->get_text_inline( 'Couldn't activate %s.', 'could-not-activate-x' ), $this->get_plugin_name() ) . ' ' .
- $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . $parent_install->error->message . '</b>',
+ $this->get_text_inline( 'Please contact us with the following message:', 'contact-us-with-error-message' ) . ' ' . '<b>' . esc_html( $parent_install->error->message ) . '</b>',
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
'error'
);
@@ -21158,7 +21144,7 @@
} else if ( is_object( $result ) ) {
// Authentication params are broken.
$this->_admin_notices->add(
- $this->get_text_inline( 'It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again.', 'wrong-authentication-param-message' ) . '<br> ' . $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . var_export( $result->error, true ),
+ $this->get_text_inline( 'It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again.', 'wrong-authentication-param-message' ) . '<br> ' . $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . esc_html( var_export( $result->error, true ) ),
'',
'error'
);
@@ -21479,7 +21465,7 @@
$this->get_text_inline( 'Your license has been cancelled. If you think it's a mistake, please contact support.', 'license-cancelled' ) . ' ' .
sprintf(
'<a href="%s">%s</a>',
- $this->contact_url( 'bug' ),
+ esc_url( $this->contact_url( 'bug' ) ),
$this->get_text_inline( 'Please contact us here', 'contact-us-here' )
),
$hmm_text,
@@ -21572,7 +21558,7 @@
"<div>{$error_message}</div>" .
'<div class="fs-api-request-error-details" style="display: none">' .
'<strong>' . $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . '</strong><br>' .
- $result->error->message .
+ esc_html( $result->error->message ) .
'</div>';
return $error_message;
@@ -21677,10 +21663,10 @@
'%s %s',
$this->get_text_inline( 'It looks like the license could not be activated.', 'license-activation-failed-message' ),
( is_object( $license ) && isset( $license->error ) ?
- $license->error->message :
+ esc_html( $license->error->message ) :
sprintf( '%s<br><code>%s</code>',
$this->get_text_inline( 'Error received from the server:', 'server-error-message' ),
- var_export( $license, true )
+ esc_html( var_export( $license, true ) )
)
)
),
@@ -21768,7 +21754,7 @@
if ( isset( $license->error ) ) {
$this->_admin_notices->add(
$this->get_text_inline( 'It looks like the license deactivation failed.', 'license-deactivation-failed-message' ) . '<br> ' .
- $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . ' ' . var_export( $license->error, true ),
+ $this->get_text_inline( 'Error received from the server:', 'server-error-message' ) . ' ' . esc_html( var_export( $license->error, true ) ),
$hmm_text,
'error'
);
@@ -22417,7 +22403,7 @@
$update->version,
sprintf(
'<a href="%s" target="_blank" rel="noopener">%s</a>',
- $this->get_account_url( 'download_latest' ),
+ esc_url( $this->get_account_url( 'download_latest' ) ),
sprintf(
/* translators: %s: plan name (e.g. latest "Professional" version) */
$this->get_text_inline( 'the latest %s version here', 'latest-x-version' ),
@@ -22835,7 +22821,7 @@
if ( ! isset( $result->error ) ) {
$this->_admin_notices->add( sprintf(
$this->get_text_inline( 'Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box.', 'verification-email-sent-message' ),
- sprintf( '<a href="mailto:%1$s">%2$s</a>', esc_url( $this->_user->email ), $this->_user->email )
+ sprintf( '<a href="mailto:%1$s">%2$s</a>', esc_url( $this->_user->email ), esc_html( $this->_user->email ) )
) );
} else {
// handle different error cases.
@@ -23159,9 +23145,9 @@
if ( $this->init_change_owner( $candidate_email, $transfer_type ) ) {
if ( 'transfer' === $transfer_type ) {
- $this->_admin_notices->add( sprintf( $this->get_text_inline( 'A confirmation email was just sent to %s. The email owner must confirm the update within the next 4 hours.', 'change-owner-request-sent-x-transfer' ), '<b>' . $this->_user->email . '</b>' ) );
+ $this->_admin_notices->add( sprintf( $this->get_text_inline( 'A confirmation email was just sent to %s. The email owner must confirm the update within the next 4 hours.', 'change-owner-request-sent-x-transfer' ), '<b>' . esc_html( $this->_user->email ) . '</b>' ) );
} else {
- $this->_admin_notices->add( sprintf( $this->get_text_inline( 'A confirmation email was just sent to %s. You must confirm the update within the next 4 hours. If you cannot find the email, please check your spam folder.', 'change-owner-request-sent-x' ), '<b>' . $this->_user->email . '</b>' ) );
+ $this->_admin_notices->add( sprintf( $this->get_text_inline( 'A confirmation email was just sent to %s. You must confirm the update within the next 4 hours. If you cannot find the email, please check your spam folder.', 'change-owner-request-sent-x' ), '<b>' . esc_html( $this->_user->email ) . '</b>' ) );
}
}
break;
@@ -23173,13 +23159,13 @@
return;
}
- $this->_admin_notices->add( sprintf( $this->get_text_inline( 'Thanks for confirming the ownership change. An email was just sent to %s for final approval.', 'change-owner-request_owner-confirmed' ), '<b>' . $candidate_email . '</b>' ) );
+ $this->_admin_notices->add( sprintf( $this->get_text_inline( 'Thanks for confirming the ownership change. An email was just sent to %s for final approval.', 'change-owner-request_owner-confirmed' ), '<b>' . esc_html( $candidate_email ) . '</b>' ) );
break;
case 'candidate_confirmed':
// We do not need to validate the authenticity of this request here, because the `complete_change_owner` does that for us through API calls.
if ( $this->complete_change_owner() ) {
$this->_admin_notices->add_sticky(
- sprintf( $this->get_text_inline( '%s is the new owner of the account.', 'change-owner-request_candidate-confirmed' ), '<b>' . $this->_user->email . '</b>' ),
+ sprintf( $this->get_text_inline( '%s is the new owner of the account.', 'change-owner-request_candidate-confirmed' ), '<b>' . esc_html( $this->_user->email ) . '</b>' ),
'ownership_changed',
$this->get_text_x_inline( 'Congrats', 'as congratulations', 'congrats' ) . '!'
);
--- a/shortcodes-ultimate/freemius/includes/managers/class-fs-clone-manager.php
+++ b/shortcodes-ultimate/freemius/includes/managers/class-fs-clone-manager.php
@@ -1223,7 +1223,7 @@
);
foreach ( $product_titles as $product_title ) {
- $products_list .= sprintf( '<li>%s</li>', $product_title );
+ $products_list .= sprintf( '<li>%s</li>', esc_html( $product_title ) );
}
$products_list = '<ol>' . $products_list . '</ol>';
@@ -1231,8 +1231,8 @@
foreach ( $site_urls as $site_url ) {
$sites_list .= sprintf(
'<li><a href="%s" target="_blank">%s</a></li>',
- $site_url,
- fs_strip_url_protocol( $site_url )
+ esc_url( $site_url ),
+ esc_html( fs_strip_url_protocol( $site_url ) )
);
}
@@ -1242,15 +1242,15 @@
$remote_site_link = '<b>' . (1 === $total_sites ?
sprintf(
'<a href="%s" target="_blank">%s</a>',
- $site_urls[0],
- fs_strip_url_protocol( $site_urls[0] )
+ esc_url( $site_urls[0] ),
+ esc_html( fs_strip_url_protocol( $site_urls[0] ) )
) :
fs_text_inline( 'the above-mentioned sites', 'above-mentioned-sites' )) . '</b>';
$current_site_link = sprintf(
'<b><a href="%s" target="_blank">%s</a></b>',
- $current_url,
- fs_strip_url_protocol( $current_url )
+ esc_url( $current_url ),
+ esc_html( fs_strip_url_protocol( $current_url ) )
);
$button_template = '<button class="button" data-clone-action="%s">%s</button>';
@@ -1323,7 +1323,7 @@
sprintf( '<div class="fs-clone-documentation-container">Unsure what to do? <a href="%s" target="_blank">Read more here</a>.</div>', $doc_url ),
// %1$s
( 1 === $total_products ?
- sprintf( '<b>%s</b>', $product_titles[0] ) :
+ sprintf( '<b>%s</b>', esc_html( $product_titles[0] ) ) :
( 1 === $total_sites ?
sprintf( '<div>%s</div>', $products_list ) :
sprintf( '<div><p><strong>%s</strong>:</p>%s</div>', fs_esc_html_x_inline( 'Products', 'Clone resolution admin notice products list label', 'products' ), $products_list ) )
--- a/shortcodes-ultimate/freemius/start.php
+++ b/shortcodes-ultimate/freemius/start.php
@@ -15,7 +15,7 @@
*
* @var string
*/
- $this_sdk_version = '2.13.4';
+ $this_sdk_version = '2.13.5';
#region SDK Selection Logic --------------------------------------------------------------------
--- a/shortcodes-ultimate/freemius/templates/add-ons.php
+++ b/shortcodes-ultimate/freemius/templates/add-ons.php
@@ -122,8 +122,9 @@
$open_addon = ( $open_addon || ( $open_addon_slug === $addon->slug ) );
- $price = 0;
- $has_trial = false;
+ $price = 0;
+ $min_price = 999999;
+ $has_trial = false;
$has_free_plan = false;
$has_paid_plan = false;
@@ -141,11 +142,9 @@
continue;
}
-
$has_paid_plan = true;
$has_trial = $has_trial || ( is_numeric( $plan->trial_period ) && ( $plan->trial_period > 0 ) );
- $min_price = 999999;
foreach ( $plan->pricing as $pricing ) {
$pricing = new FS_Pricing( $pricing );
@@ -163,13 +162,14 @@
$min_price = min( $min_price, $pricing->annual_price );
} else if ( $pricing->has_monthly() ) {
$min_price = min( $min_price, 12 * $pricing->monthly_price );
- }
+ } else if ( $pricing->has_lifetime() ) {
+ $min_price = min( $min_price, $pricing->lifetime_price );
+ }
}
if ( $min_price < 999999 ) {
$price = $min_price;
}
-
}
}
--- a/shortcodes-ultimate/freemius/templates/pricing.php
+++ b/shortcodes-ultimate/freemius/templates/pricing.php
@@ -24,9 +24,30 @@
$timestamp = time();
$context_params = array(
+ // Plugin information
'plugin_id' => $fs->get_id(),
'plugin_public_key' => $fs->get_public_key(),
'plugin_version' => $fs->get_plugin_version(),
+
+ // React pricing app context
+ 'contact_url' => $fs->contact_url(),
+ 'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
+ 'menu_slug' => $fs->get_menu_slug(),
+ 'mode' => 'dashboard',
+ 'fs_wp_endpoint_url' => WP_FS__ADDRESS,
+ 'request_handler_url' => admin_url(
+ 'admin-ajax.php?' . http_build_query( array(
+ 'module_id' => $fs->get_id(),
+ 'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
+ 'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
+ ) )
+ ),
+ 'selector' => '#fs_pricing_wrapper',
+ 'unique_affix' => $fs->get_unique_affix(),
+ 'show_annual_in_monthly' => $fs->apply_filters( 'pricing/show_annual_in_monthly', true ),
+ 'license' => $fs->has_active_valid_license() ? $fs->_get_license() : null,
+ 'plugin_icon' => $fs->get_local_icon_url(),
+ 'disable_single_package' => $fs->apply_filters( 'pricing/disable_single_package', false ),
);
$bundle_id = $fs->get_bundle_id();
@@ -54,9 +75,8 @@
);
}
- $query_params = array_merge( $context_params, $_GET, array(
+ $query_params = array_merge( $_GET, array(
'next' => $fs->_get_sync_license_url( false, false ),
- 'plugin_version' => $fs->get_plugin_version(),
// Billing cycle.
'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
@@ -64,6 +84,14 @@
'discounts_model' => $fs->apply_filters( 'pricing/discounts_model', 'absolute' ),
) );
+ $has_tabs = $fs->_add_tabs_before_content();
+
+ if ( $has_tabs ) {
+ $query_params['tabs'] = 'true';
+ }
+
+ $pricing_config = array_merge( $query_params, $context_params );
+
$pricing_js_url = fs_asset_url( $fs->get_pricing_js_path() );
wp_enqueue_script( 'freemius-pricing', $pricing_js_url );
@@ -72,39 +100,10 @@
if ( is_string( $pricing_css_path ) ) {
wp_enqueue_style( 'freemius-pricing', fs_asset_url( $pricing_css_path ) );
}
-
- $has_tabs = $fs->_add_tabs_before_content();
-
- if ( $has_tabs ) {
- $query_params['tabs'] = 'true';
- }
?>
<div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
<div id="fs_pricing_wrapper" data-public-url="<?php echo trailingslashit( dirname( $pricing_js_url ) ) ?>"></div>
- <?php
- $pricing_config = array_merge( array(
- 'contact_url' => $fs->contact_url(),
- 'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
- 'menu_slug' => $fs->get_menu_slug(),
- 'mode' => 'dashboard',
- 'fs_wp_endpoint_url' => WP_FS__ADDRESS,
- 'request_handler_url' => admin_url(
- 'admin-ajax.php?' . http_build_query( array(
- 'module_id' => $fs->get_id(),
- 'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
- 'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
- ) )
- ),
- 'selector' => '#fs_pricing_wrapper',
- 'unique_affix' => $fs->get_unique_affix(),
- 'show_annual_in_monthly' => $fs->apply_filters( 'pricing/show_annual_in_monthly', true ),
- 'license' => $fs->has_active_valid_license() ? $fs->_get_license() : null,
- 'plugin_icon' => $fs->get_local_icon_url(),
- 'disable_single_package' => $fs->apply_filters( 'pricing/disable_single_package', false ),
- ), $query_params );
-
- wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' );
- ?>
+ <?php wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' ); ?>
</div>
<?php
if ( $has_tabs ) {
--- a/shortcodes-ultimate/includes/functions-helpers.php
+++ b/shortcodes-ultimate/includes/functions-helpers.php
@@ -424,9 +424,17 @@
*/
function su_get_current_url() {
- $protocol = is_ssl() ? 'https' : 'http';
+ $home = wp_parse_url( home_url() );
+ $url = $home['scheme'] . '://' . $home['host'];
- return esc_url( "{$protocol}://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" );
+ if ( isset( $home['port'] ) ) {
+ $url .= ':' . $home['port'];
+ }
+
+ // REQUEST_URI already includes the home path on subdirectory installations.
+ $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '/';
+
+ return esc_url( $url . $request_uri );
}
--- a/shortcodes-ultimate/includes/shortcodes/qrcode.php
+++ b/shortcodes-ultimate/includes/shortcodes/qrcode.php
@@ -117,14 +117,16 @@
return su_error_message('QR code', __('please specify the data', 'shortcodes-ultimate'));
}
+ $atts['data'] = sanitize_text_field($atts['data']);
+ $atts['data'] = su_do_attribute($atts['data'], true);
+
+ // Substitute URLs after shortcode processing so request data cannot execute shortcodes.
$atts['data'] = str_replace(
array('%CURRENT_URL%', '%PERMALINK%'),
array(su_get_current_url(), get_permalink()),
$atts['data']
);
- $atts['data'] = sanitize_text_field($atts['data']);
- $atts['data'] = su_do_attribute($atts['data'], true);
// https://core.trac.wordpress.org/ticket/11311
$atts['data'] = str_replace('&', '&', $atts['data']);
--- a/shortcodes-ultimate/shortcodes-ultimate.php
+++ b/shortcodes-ultimate/shortcodes-ultimate.php
@@ -9,7 +9,7 @@
* Text Domain: shortcodes-ultimate
* Domain Path: /languages
* License: GPLv3
- * Version: 7.9.1
+ * Version: 7.9.2
* Requires PHP: 7.0
* Requires at least: 6.0
* Tested up to: 7.1
@@ -65,6 +65,6 @@
}
}
define( 'SU_PLUGIN_FILE', __FILE__ );
- define( 'SU_PLUGIN_VERSION', '7.9.1' );
+ define( 'SU_PLUGIN_VERSION', '7.9.2' );
require_once dirname( __FILE__ ) . '/plugin.php';
}
No newline at end of file