Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/sms-alert/SMSAlert-wc-order-sms.php
+++ b/sms-alert/SMSAlert-wc-order-sms.php
@@ -11,11 +11,11 @@
* Plugin Name: SMSAlert - WooCommerce
* Plugin URI: https://wordpress.org/plugins/sms-alert/
* Description: This is a WooCommerce add-on. By Using this plugin admin and buyer can get notification after placing order via sms using SMS Alert.
- * Version: 3.9.5
+ * Version: 3.9.6
* Author: Cozy Vision Technologies Pvt. Ltd.
* Author URI: https://www.smsalert.co.in
* WC requires at least: 4.6
- * WC tested up to: 10.5
+ * WC tested up to: 10.9
* Text Domain: sms-alert
* License: GPLv2
*/
--- a/sms-alert/handler/forms/class-ultimatemember.php
+++ b/sms-alert/handler/forms/class-ultimatemember.php
@@ -84,8 +84,8 @@
add_action('um_after_form', array( $this, 'umFormAddShortcode' ), 10, 1);
add_action('um_after_form_fields', array( $this, 'addCountryCode' ), 10, 1);
-
- if (! empty($_REQUEST['option']) && sanitize_text_field(wp_unslash($_REQUEST['option'])) === 'smsalert-um-reset-pwd-action' ) {
+ SmsAlertUtility::checkSession();
+ if (! empty($_REQUEST['option']) && (sanitize_text_field(wp_unslash($_REQUEST['option'])) === 'smsalert-um-reset-pwd-action') && isset($_SESSION[ $this->form_session_var2 ]) && strcasecmp($_SESSION[ $this->form_session_var2 ], 'validated') === 0 ) {
$this->handleSmsalertChangedPwd($_POST);
wp_enqueue_style('wpv_sa_common_style', SA_MOV_CSS_URL, array(), SmsAlertConstants::SA_VERSION, false);
}
@@ -493,6 +493,7 @@
}
if (isset($_SESSION[ $this->form_session_var2 ]) ) {
+ $_SESSION[ $this->form_session_var2 ] = 'validated';
smsalertAskForResetPassword($_SESSION['user_login'], $_SESSION['phone_number_mo'], __('Please change Your password', 'sms-alert'), 'phone', false, 'smsalert-um-reset-pwd-action');
}
}
--- a/sms-alert/handler/forms/class-wplogin.php
+++ b/sms-alert/handler/forms/class-wplogin.php
@@ -171,13 +171,15 @@
$user = wp_authenticate($username, $password);
}
//added for new user approve plugin
- $user = apply_filters('wp_authenticate_user', $user, $password);
- if (is_wp_error($user) ) {
- $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
- wp_send_json($msg);
- exit();
- }
+ if (is_plugin_active('new-user-approve/new-user-approve.php') ) {
+ $user = apply_filters('wp_authenticate_user', $user, $password);
+ }
//-added for new user approve plugin
+ if (is_wp_error($user) ) {
+ $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
+ wp_send_json($msg);
+ exit();
+ }
$user_meta = get_userdata($user->data->ID);
$user_role = $user_meta->roles;
$phone_number = get_user_meta($user->data->ID, $this->phone_number_key, true);
@@ -227,15 +229,18 @@
$user_info = $this->getUserFromPhoneNumber($billing_phone, $this->phone_number_key);
$user_login = ( $user_info ) ? $user_info->data->user_login : '';
$user = get_user_by('login', $user_login);
- $password='';
//added for new user approve plugin
- $user = apply_filters('wp_authenticate_user', $user, $password);
- if (is_wp_error($user) ) {
- $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
- wp_send_json($msg);
- exit();
- }
+ if (is_plugin_active('new-user-approve/new-user-approve.php') ) {
+ $password='';
+ $user = apply_filters('wp_authenticate_user', $user, $password);
+ }
//-added for new user approve plugin
+
+ if (is_wp_error($user) ) {
+ $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
+ wp_send_json($msg);
+ exit();
+ }
if (! empty($user_login) ) {
SmsAlertUtility::initialize_transaction($this->form_session_var3);
@@ -333,7 +338,7 @@
}
});
</script>';
- echo do_shortcode('[sa_verify user_selector="#username" pwd_selector="#password" submit_selector=".'.$unique_class.'.login :submit:not(.show-password-input)"]');
+ echo do_shortcode('[sa_verify user_selector="#username" pwd_selector="#password" submit_selector=".'.$unique_class.'.login :submit:not(.show-password-input,.btn-line)"]');
}
}
/**
@@ -498,6 +503,7 @@
{
SmsAlertUtility::checkSession();
$login_with_otp_enabled = ( smsalert_get_option('login_with_otp', 'smsalert_general') === 'on' ) ? true : false;
+ $phone_number = '';
if (empty($password) ) {
if (! empty($_REQUEST['username']) ) {
$phone_number = ! empty($_REQUEST['username']) ? sanitize_text_field(wp_unslash($_REQUEST['username'])) : '';
--- a/sms-alert/handler/forms/class-wpresetpassword.php
+++ b/sms-alert/handler/forms/class-wpresetpassword.php
@@ -65,7 +65,8 @@
*/
public function routeData()
{
- if (! empty($_REQUEST['option']) && sanitize_text_field(wp_unslash($_REQUEST['option'])) === 'smsalert-change-password-form' ) {
+ SmsAlertUtility::checkSession();
+ if (! empty($_REQUEST['option']) && (sanitize_text_field(wp_unslash($_REQUEST['option'])) === 'smsalert-change-password-form') && isset($_SESSION[ $this->form_session_var ]) && strcasecmp($_SESSION[ $this->form_session_var ], 'validated') === 0 ) {
$this->handleSmsalertChangedPwd($_POST);
}
}
@@ -210,6 +211,7 @@
if (! isset($_SESSION[ $this->form_session_var ]) ) {
return;
}
+ $_SESSION[ $this->form_session_var ] = 'validated';
smsalertAskForResetPassword(
sanitize_text_field($_SESSION['user_login']),
sanitize_text_field($_SESSION['phone_number_mo']),
--- a/sms-alert/handler/forms/woocommerce/wc-registration.php
+++ b/sms-alert/handler/forms/woocommerce/wc-registration.php
@@ -292,15 +292,17 @@
$user_info = WPLogin::getUserFromPhoneNumber($billing_phone, 'billing_phone');
$user_login = ( $user_info ) ? $user_info->data->user_login : '';
$user = get_user_by('login', $user_login);
- $password='';
//added for new user approve plugin
- $user = apply_filters('wp_authenticate_user', $user, $password);
- if (is_wp_error($user) ) {
- $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
- wp_send_json($msg);
- exit();
- }
+ if (is_plugin_active('new-user-approve/new-user-approve.php') ) {
+ $password='';
+ $user = apply_filters('wp_authenticate_user', $user, $password);
+ }
//-added for new user approve plugin
+ if (is_wp_error($user) ) {
+ $msg = SmsAlertUtility::_create_json_response(current($user->errors), 'error');
+ wp_send_json($msg);
+ exit();
+ }
SmsAlertUtility::initialize_transaction($this->form_session_var3);
smsalert_site_challenge_otp(null, null, null, $billing_phone, 'phone', null, SmsAlertUtility::currentPageUrl(), true);
}
@@ -344,7 +346,7 @@
}
});
</script>';
- echo do_shortcode('[sa_verify phone_selector="#reg_billing_phone" submit_selector= ".'.$unique_class.'.register .woocommerce-Button"]');
+ echo do_shortcode('[sa_verify phone_selector="#reg_billing_phone" submit_selector= ".'.$unique_class.'.register .woocommerce-Button,.'.$unique_class.'.register :is(.woocommerce-Button, .btn.submit-btn)"]');
}
--- a/sms-alert/helper/constants.php
+++ b/sms-alert/helper/constants.php
@@ -33,7 +33,7 @@
const ERROR_JSON_TYPE = 'error';
const SUCCESS_JSON_TYPE = 'success';
const USERPRO_VER_FIELD_META = 'verification_form';
- const SA_VERSION = '3.9.5';
+ const SA_VERSION = '3.9.6';
--- a/sms-alert/helper/curl.php
+++ b/sms-alert/helper/curl.php
@@ -169,7 +169,7 @@
return $response;
}
- $url = 'http://www.smsalert.co.in/api/push.json';
+ $url = 'https://www.smsalert.co.in/api/push.json';
$fields = array(
'user' => $username,
'pwd' => $password,
@@ -272,7 +272,7 @@
$data['description']['desc'] = __('Wrong SMSAlert credentials', 'sms-alert');
return json_encode($data);
}
- $url = 'http://www.smsalert.co.in/api/mverify.json';
+ $url = 'https://www.smsalert.co.in/api/mverify.json';
$fields = array(
'user' => $username,
@@ -333,7 +333,7 @@
if (empty($username) || empty($password) || empty($senderid) ) {
return $response;
}
- $url = 'http://www.smsalert.co.in/api/mverify.json';
+ $url = 'https://www.smsalert.co.in/api/mverify.json';
$fields = array(
'user' => $username,
@@ -369,7 +369,7 @@
return '';
}
- $url = 'http://www.smsalert.co.in/api/senderlist.json';
+ $url = 'https://www.smsalert.co.in/api/senderlist.json';
$fields = array(
'user' => $username,
@@ -393,7 +393,7 @@
if (empty($username) || empty($password) ) {
return '';
}
- $url = 'http://www.smsalert.co.in/api/templatelist.json';
+ $url = 'https://www.smsalert.co.in/api/templatelist.json';
$fields = array(
'user' => $username,
@@ -423,7 +423,7 @@
return $response;
}
- $url = 'http://www.smsalert.co.in/api/creditstatus.json';
+ $url = 'https://www.smsalert.co.in/api/creditstatus.json';
$fields = array(
'user' => $username,
@@ -447,7 +447,7 @@
return '';
}
- $url = 'http://www.smsalert.co.in/api/grouplist.json';
+ $url = 'https://www.smsalert.co.in/api/grouplist.json';
$fields = array(
'user' => $username,
@@ -468,7 +468,7 @@
if (SmsAlertUtility::isPlayground()) {
return true;
}
- $url = 'http://www.smsalert.co.in/api/countrylist.json';
+ $url = 'https://www.smsalert.co.in/api/countrylist.json';
$response = self::callAPI($url, null, null);
return $response;
}
@@ -487,7 +487,7 @@
return '';
}
- $url = 'http://www.smsalert.co.in/api/creategroup.json';
+ $url = 'https://www.smsalert.co.in/api/creategroup.json';
$fields = array(
'user' => $username,
@@ -630,7 +630,7 @@
}
$xmldata = $msg->asXML();
- $url = 'http://www.smsalert.co.in/api/xmlpush.json?';
+ $url = 'https://www.smsalert.co.in/api/xmlpush.json?';
$fields = array( 'data' => $xmldata );
if ($cnt > 0 ) {
$response = self::callAPI($url, $fields, null);
--- a/sms-alert/template/register-otp-template.php
+++ b/sms-alert/template/register-otp-template.php
@@ -91,7 +91,7 @@
input[type="text"].sa_customer_validation-textbox {background: #FBFBFB none repeat scroll 0% 0%;font-family: "Open Sans",sans-serif;font-size: 24px;width: 100%;border: 1px solid #DDD;padding: 3px;margin: 2px 6px 16px 0px;}
</style>
<script>
- document.addEventListener("DOMContentLoaded", function() {
+ //document.addEventListener("DOMContentLoaded", function() {
jQuery("#sa-form").on("submit", function () {
jQuery("#smsalert_otp_token_submit").attr("disabled", "disabled");
});
@@ -129,7 +129,7 @@
document.getElementById("verify_otp").style.cssText = cssString;
}
}, 1000);
- });
+ //});
</script>
</body>
</html>';