Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/latepoint/latepoint.php
+++ b/latepoint/latepoint.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: LatePoint
* Description: Appointment Scheduling Software for WordPress
- * Version: 5.7.10
+ * Version: 5.7.11
* Author: LatePoint
* Author URI: https://latepoint.com
* Plugin URI: https://latepoint.com
@@ -29,7 +29,7 @@
* LatePoint version.
*
*/
- public $version = '5.7.10';
+ public $version = '5.7.11';
public $db_version = '2.3.5';
/**
@@ -1395,12 +1395,12 @@
if ( get_option( 'latepoint_redirect_to_wizard', false ) ) {
delete_option( 'latepoint_redirect_to_wizard' );
if ( ! isset( $_GET['activate-multi'] ) ) {
- wp_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'wizard', 'setup' ) ) );
+ wp_safe_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'wizard', 'setup' ) ) );
}
} elseif ( get_option( 'latepoint_show_version_5_modal', false ) ) {
delete_option( 'latepoint_show_version_5_modal' );
if ( ! isset( $_GET['activate-multi'] ) ) {
- wp_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'settings', 'version_5_intro' ) ) );
+ wp_safe_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'settings', 'version_5_intro' ) ) );
}
}
}
--- a/latepoint/lib/controllers/calendars_controller.php
+++ b/latepoint/lib/controllers/calendars_controller.php
@@ -346,7 +346,7 @@
if ( count( $calendar_settings['show_service_ids'] ) > 1 && $selected_service_for_availability ) {
$booking_request_for_shown_services = clone $booking_request;
$booking_request_for_shown_services->service_id = $calendar_settings['show_service_ids'];
- $resources_for_work_boundaries = OsResourceHelper::get_resources_grouped_by_day( $booking_request_for_shown_services, $calendar_start, $calendar_end );
+ $resources_for_work_boundaries = OsResourceHelper::get_resources_grouped_by_day( $booking_request_for_shown_services, $calendar_start, $calendar_end, [ 'accessed_from_backend' => true ] );
$work_boundaries = OsResourceHelper::get_work_boundaries_for_groups_of_resources( $resources_for_work_boundaries );
} else {
$work_boundaries = OsResourceHelper::get_work_boundaries_for_groups_of_resources( $resources );
--- a/latepoint/lib/controllers/customer_cabinet_controller.php
+++ b/latepoint/lib/controllers/customer_cabinet_controller.php
@@ -373,7 +373,7 @@
public function logout() {
OsAuthHelper::logout_customer();
nocache_headers();
- wp_redirect( OsSettingsHelper::get_customer_dashboard_url(), 302 );
+ wp_safe_redirect( OsSettingsHelper::get_customer_dashboard_url(), 302 );
}
public function login() {
--- a/latepoint/lib/controllers/customers_controller.php
+++ b/latepoint/lib/controllers/customers_controller.php
@@ -193,6 +193,8 @@
$this->check_nonce( 'new_customer' );
$customer = new OsCustomerModel();
$customer_params = is_array( $this->params['customer'] ) ? $this->params['customer'] : [];
+ // create() is an insert: a supplied id makes set_data() load that row and UPDATE it, skipping update()'s ownership check.
+ unset( $customer_params['id'] );
// Only a full admin may mass-assign the WP account link or password. Strip them for agents and
// custom roles: neither is a customer-form field, and the WP link is set via the dedicated connect action.
if ( ! OsAuthHelper::is_admin_logged_in() ) {
--- a/latepoint/lib/controllers/orders_controller.php
+++ b/latepoint/lib/controllers/orders_controller.php
@@ -62,7 +62,7 @@
// step when convert_to_order succeeded, or at the payment step when it didn't (e.g. cancelled Mollie/PayPal
// payment). The "double payment information" issue is fixed at the cart-model layer (see
// OsCartModel::clear) without that fix, the resume lightbox showed every cart item twice.
- wp_redirect( $order_intent->get_page_url_with_intent(), 302 );
+ wp_safe_redirect( $order_intent->get_page_url_with_intent(), 302 );
exit;
}
}
@@ -81,7 +81,7 @@
if ( $transaction_intent ) {
nocache_headers();
- wp_redirect( $transaction_intent->get_page_url_with_intent(), 302 );
+ wp_safe_redirect( $transaction_intent->get_page_url_with_intent(), 302 );
}
}
}
--- a/latepoint/lib/controllers/paypal_connect_controller.php
+++ b/latepoint/lib/controllers/paypal_connect_controller.php
@@ -243,6 +243,7 @@
}
public function disconnect_connect_account() {
+ $this->check_nonce( 'paypal_disconnect_account' );
$env = $this->get_env_from_params();
try {
$path = 'server-tokens/' . OsPaypalConnectHelper::get_server_token( $env ) . '/disconnect/';
--- a/latepoint/lib/helpers/paypal_connect_helper.php
+++ b/latepoint/lib/helpers/paypal_connect_helper.php
@@ -616,7 +616,7 @@
data-os-pass-this="yes"
data-os-before-after="none"
data-os-after-call="latepointPaypalConnectAdmin.reload_connect_status_wrapper"
- data-os-params="' . OsUtilHelper::build_os_params( [ 'env' => $env ] ) . '"
+ data-os-params="' . esc_attr( OsUtilHelper::build_os_params( [ 'env' => $env ], 'paypal_disconnect_account' ) ) . '"
data-os-action="' . OsRouterHelper::build_route_name( 'paypal_connect', 'disconnect_connect_account' ) . '"
><i class="latepoint-icon latepoint-icon-x"></i><span>' . __( 'disconnect', 'latepoint' ) . '</span></a>';
if ( $payments_enabled ) {
@@ -685,6 +685,7 @@
'BE' => 'Belgium',
'BR' => 'Brazil',
'CA' => 'Canada',
+ 'CO' => 'Colombia',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'FI' => 'Finland',
--- a/latepoint/lib/helpers/replacer_helper.php
+++ b/latepoint/lib/helpers/replacer_helper.php
@@ -282,13 +282,13 @@
'{{customer_admin_notes}}',
);
$replacements = array(
- $customer->full_name,
- $customer->first_name,
- $customer->last_name,
- $customer->email,
- $customer->phone,
- $customer->notes,
- $customer->admin_notes,
+ esc_html( $customer->full_name ),
+ esc_html( $customer->first_name ),
+ esc_html( $customer->last_name ),
+ esc_html( $customer->email ),
+ esc_html( $customer->phone ),
+ esc_html( $customer->notes ),
+ esc_html( $customer->admin_notes ),
);
$original_text = $text;
$text = str_replace( $needles, self::escape_replacements( $replacements ), $text );
--- a/latepoint/lib/helpers/stripe_connect_helper.php
+++ b/latepoint/lib/helpers/stripe_connect_helper.php
@@ -96,6 +96,13 @@
$transaction_intent->add_error( 'payment_error', $result['message'] );
break;
}
+ if ( ! self::validate_payment_intent_metadata( $payment_intent_data, 'transaction_intent_key', $transaction_intent->intent_key ) ) {
+ $result['status'] = LATEPOINT_STATUS_ERROR;
+ $result['message'] = __( 'Payment verification failed', 'latepoint' );
+ OsDebugHelper::log( 'Stripe PI transaction_intent_key mismatch for transaction intent ' . $transaction_intent->id, 'stripe_connect_error' );
+ $transaction_intent->add_error( 'payment_error', $result['message'] );
+ break;
+ }
// success
$result['status'] = LATEPOINT_STATUS_SUCCESS;
$result['processor'] = self::$processor_code;
@@ -138,6 +145,14 @@
$order_intent->add_error( 'send_to_step', $result['message'], 'payment' );
break;
}
+ if ( ! self::validate_payment_intent_metadata( $payment_intent_data, 'order_intent_key', $order_intent->intent_key ) ) {
+ $result['status'] = LATEPOINT_STATUS_ERROR;
+ $result['message'] = __( 'Payment verification failed', 'latepoint' );
+ OsDebugHelper::log( 'Stripe PI order_intent_key mismatch for order intent ' . $order_intent->id, 'stripe_connect_error' );
+ $order_intent->add_error( 'payment_error', $result['message'] );
+ $order_intent->add_error( 'send_to_step', $result['message'], 'payment' );
+ break;
+ }
// success
$result['status'] = LATEPOINT_STATUS_SUCCESS;
$result['processor'] = self::$processor_code;
@@ -467,9 +482,10 @@
public static function retrieve_payment_intent( string $payment_intent_id ): array {
$payment_request_data = self::do_account_request( 'payment-intents/' . $payment_intent_id, OsSettingsHelper::get_payments_environment() );
$result = [
- 'id' => $payment_request_data['data']['id'],
- 'status' => $payment_request_data['data']['status'],
- 'total' => $payment_request_data['data']['total'],
+ 'id' => $payment_request_data['data']['id'],
+ 'status' => $payment_request_data['data']['status'],
+ 'total' => $payment_request_data['data']['total'],
+ 'metadata' => ( isset( $payment_request_data['data']['metadata'] ) && is_array( $payment_request_data['data']['metadata'] ) ) ? $payment_request_data['data']['metadata'] : [],
];
return $result;
}
@@ -480,6 +496,20 @@
return abs( $expected_in_specs - $actual_from_stripe ) <= 1;
}
+ // Bind the PaymentIntent to THIS intent. The intent key is stamped into the PaymentIntent metadata
+ // ('order_intent_key' / 'transaction_intent_key') server-side when we create the intent and Stripe echoes
+ // it back on retrieval. An attacker cannot alter a succeeded PaymentIntent's metadata, so a reused/replayed
+ // token resolves to its originating intent and fails this check for any other intent. Fails closed when the
+ // expected key or the metadata value is absent. Mirrors Razorpay's validate_payment_intent_notes().
+ public static function validate_payment_intent_metadata( array $payment_intent_data, string $metadata_key, string $expected_intent_key ): bool {
+ if ( empty( $expected_intent_key ) ) {
+ return false;
+ }
+ $metadata = ( isset( $payment_intent_data['metadata'] ) && is_array( $payment_intent_data['metadata'] ) ) ? $payment_intent_data['metadata'] : [];
+ $actual_intent_key = isset( $metadata[ $metadata_key ] ) ? (string) $metadata[ $metadata_key ] : '';
+ return ! empty( $actual_intent_key ) && hash_equals( $expected_intent_key, $actual_intent_key );
+ }
+
private static function get_properties_allowed_to_update( $roles = 'admin' ) {
return array( 'source', 'email', 'name' );
}
--- a/latepoint/lib/views/settings/import_modal.php
+++ b/latepoint/lib/views/settings/import_modal.php
@@ -14,7 +14,7 @@
<h2><?php esc_html_e('Import LatePoint Data', 'latepoint'); ?></h2>
</div>
<div class="latepoint-lightbox-content">
- <?php echo OsFormHelper::file_upload_field('latepoint_json_data', __('Select JSON file to upload', 'latepoint')); ?>
+ <?php echo OsFormHelper::file_upload_field('latepoint_json_data', __('Select JSON file to upload', 'latepoint'), '', [], [], '.json'); ?>
<?php echo OsFormHelper::checkbox_field('latepoint_data_erase_acknowledgement', __('I understand that this import will replace all of my existing LatePoint data.', 'latepoint'), 'on'); ?>
</div>
<div class="latepoint-lightbox-footer">