Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/automatorwp/automatorwp.php
+++ b/automatorwp/automatorwp.php
@@ -3,7 +3,7 @@
* Plugin Name: AutomatorWP
* Plugin URI: https://automatorwp.com
* Description: Connect your WordPress plugins together and create automated workflows with no code!
- * Version: 5.6.7
+ * Version: 5.6.8
* Author: AutomatorWP
* Author URI: https://automatorwp.com/
* Text Domain: automatorwp
@@ -119,7 +119,7 @@
private function constants() {
// Plugin version
- define( 'AUTOMATORWP_VER', '5.6.7' );
+ define( 'AUTOMATORWP_VER', '5.6.8' );
// Plugin file
define( 'AUTOMATORWP_FILE', __FILE__ );
--- a/automatorwp/integrations/activecampaign/includes/ajax-functions.php
+++ b/automatorwp/integrations/activecampaign/includes/ajax-functions.php
@@ -57,7 +57,7 @@
// Update settings
update_option( 'automatorwp_settings', $settings );
- $admin_url = str_replace( 'http://', 'http://', get_admin_url() ) . 'admin.php?page=automatorwp_settings&tab=opt-tab-activecampaign';
+ $admin_url = admin_url( 'admin.php?page=automatorwp_settings&tab=opt-tab-activecampaign' );
wp_send_json_success( array(
'message' => __( 'Correct data to connect with ActiveCampaign', 'automatorwp' ),
@@ -79,6 +79,11 @@
// Security check
check_ajax_referer( 'automatorwp_admin', 'nonce' );
+ // Permissions check
+ if( ! current_user_can( automatorwp_get_manager_capability() ) ) {
+ wp_send_json_error( __( 'You're not allowed to perform this action.', 'automatorwp' ) );
+ }
+
$prefix = 'automatorwp_activecampaign_';
// Get random characters for slug
--- a/automatorwp/integrations/activecampaign/includes/rest-api.php
+++ b/automatorwp/integrations/activecampaign/includes/rest-api.php
@@ -43,26 +43,32 @@
return new WP_REST_Response( array( 'success' => false, 'message' => __( 'No parameters received', 'automatorwp' ) ), 400 );
}
- $type = sanitize_text_field( $params['type'] );
- $email = sanitize_text_field( $params['contact']['email'] );
+ // Sanitize params array
+ $params = map_deep( $params, 'sanitize_text_field' );
+
+ // Sanitize specific fields
+ if ( isset( $params['contact'] ) && is_array( $params['contact'] ) ) {
+
+ $params['contact']['id'] = absint( $params['contact']['id'] );
+ $params['contact']['email'] = sanitize_email( $params['contact']['email'] );
+
+ if ( isset( $params['contact']['fields'] ) && is_array( $params['contact']['fields'] ) ) {
+ $params['contact']['fields'] = map_deep( $params['contact']['fields'], 'sanitize_text_field' );
+ }
+ }
+
+ $type = $params['type'];
+ $email = $params['contact']['email'];
$user = get_user_by( 'email', $email );
// Actions when a user/contact is subscribed
if ( $type === 'subscribe' ) {
-
- if ( $user ) {
- do_action( 'automatorwp_activecampaign_user_subscribed', $params, $user->ID );
- }
-
+ do_action( 'automatorwp_activecampaign_contact_subscribed', $params, ( $user ? $user->ID : 0 ) );
}
// Actions when a tag is added to user/contact
if ( $type === 'contact_tag_added') {
-
- if ( $user ) {
- do_action( 'automatorwp_activecampaign_user_tag_added', $params, $user->ID );
- }
-
+ do_action( 'automatorwp_activecampaign_contact_tag_added', $params, ( $user ? $user->ID : 0 ) );
}
return new WP_REST_Response( array( 'success' => true ), 200 );
--- a/automatorwp/integrations/activecampaign/includes/triggers/user-added.php
+++ b/automatorwp/integrations/activecampaign/includes/triggers/user-added.php
@@ -27,7 +27,7 @@
'select_option' => __( '<strong>User</strong> added to ActiveCampaign', 'automatorwp' ),
'edit_label' => __( 'User added to ActiveCampaign', 'automatorwp' ),
'log_label' => __( 'User added to ActiveCampaign', 'automatorwp' ),
- 'action' => 'automatorwp_activecampaign_user_subscribed',
+ 'action' => 'automatorwp_activecampaign_contact_subscribed',
'function' => array( $this, 'listener' ),
'priority' => 10,
'accepted_args' => 2,
@@ -56,8 +56,7 @@
return;
}
- $user = get_user_by( 'id', $user_id);
- $email = $user->user_email;
+ $email = sanitize_email ( $params['contact']['email'] );
/* translators: %1$s: Email. */
$this->result = sprintf( __( '%1$s was added to ActiveCampaign', 'automatorwp' ), $email );
@@ -66,7 +65,6 @@
automatorwp_trigger_event( array(
'trigger' => $this->trigger,
'user_id' => $user_id,
- 'webhook_url' => get_site_url() . $params['q'],
'action_type' => $params['type'],
'date_time' => $params['date_time'],
'email' => $params['contact']['email'],
@@ -137,7 +135,6 @@
// Store the action's result
$log_meta['result'] = $this->result;
- $log_meta['webhook_url'] = ( isset( $event['webhook_url'] ) ? $event['webhook_url'] : '' );
$log_meta['action_type'] = ( isset( $event['action_type'] ) ? $event['action_type'] : '' );
$log_meta['date_time'] = ( isset( $event['date_time'] ) ? $event['date_time'] : '' );
$log_meta['email'] = ( isset( $event['email'] ) ? $event['email'] : '' );
@@ -175,10 +172,6 @@
'type' => 'text',
);
- $log_fields['webhook_url'] = array(
- 'name' => __( 'Webhook URL:', 'automatorwp' ),
- 'type' => 'text',
- );
$log_fields['action_type'] = array(
'name' => __( 'Action type:', 'automatorwp' ),
'type' => 'text',
--- a/automatorwp/integrations/activecampaign/includes/triggers/user-tag-added.php
+++ b/automatorwp/integrations/activecampaign/includes/triggers/user-tag-added.php
@@ -29,7 +29,7 @@
'edit_label' => sprintf( __( '%1$s added to user %2$s time(s)', 'automatorwp' ), '{tag}', '{times}' ),
/* translators: %1$s: Tag. */
'log_label' => sprintf( __( '%1$s added to user', 'automatorwp' ), '{tag}' ),
- 'action' => 'automatorwp_activecampaign_user_tag_added',
+ 'action' => 'automatorwp_activecampaign_contact_tag_added',
'function' => array( $this, 'listener' ),
'priority' => 10,
'accepted_args' => 2,
@@ -72,8 +72,8 @@
* @param array $params Data received
* @param int $user_id User ID
*/
- public function listener( $params, $user_id) {
-
+ public function listener( $params, $user_id ) {
+
$this->result = '';
// Bail if no user
@@ -82,8 +82,7 @@
}
// Shorthands
- $user = get_user_by( 'id', $user_id);
- $email = $user->user_email;
+ $email = sanitize_email ( $params['contact']['email'] );
$tag = sanitize_text_field ( $params['tag'] );
/* translators: %1$s: Email. %2$s: Tag .*/
@@ -93,7 +92,6 @@
automatorwp_trigger_event( array(
'trigger' => $this->trigger,
'user_id' => $user_id,
- 'webhook_url' => get_site_url() . $params['q'],
'action_type' => $params['type'],
'date_time' => $params['date_time'],
'email' => $params['contact']['email'],
@@ -199,7 +197,6 @@
// Store the action's result
$log_meta['result'] = $this->result;
- $log_meta['webhook_url'] = ( isset( $event['webhook_url'] ) ? $event['webhook_url'] : '' );
$log_meta['action_type'] = ( isset( $event['action_type'] ) ? $event['action_type'] : '' );
$log_meta['date_time'] = ( isset( $event['date_time'] ) ? $event['date_time'] : '' );
$log_meta['email'] = ( isset( $event['email'] ) ? $event['email'] : '' );
@@ -238,10 +235,6 @@
'type' => 'text',
);
- $log_fields['webhook_url'] = array(
- 'name' => __( 'Webhook URL:', 'automatorwp' ),
- 'type' => 'text',
- );
$log_fields['action_type'] = array(
'name' => __( 'Action type:', 'automatorwp' ),
'type' => 'text',
--- a/automatorwp/integrations/aweber/includes/ajax-functions.php
+++ b/automatorwp/integrations/aweber/includes/ajax-functions.php
@@ -18,6 +18,11 @@
// Security check
check_ajax_referer( 'automatorwp_admin', 'nonce' );
+ // Permissions check
+ if( ! current_user_can( automatorwp_get_manager_capability() ) ) {
+ wp_send_json_error( __( 'You're not allowed to perform this action.', 'automatorwp' ) );
+ }
+
$prefix = 'automatorwp_aweber_';
$client_id = sanitize_text_field( $_POST['client_id'] );
@@ -25,7 +30,7 @@
// Check parameters given
if( empty( $client_id ) || empty( $client_secret ) ) {
- wp_send_json_error( array( 'message' => __( 'All fields are required to connect with AWeber', 'automatorwp-aweber' ) ) );
+ wp_send_json_error( array( 'message' => __( 'All fields are required to connect with AWeber', 'automatorwp' ) ) );
}
$settings = get_option( 'automatorwp_settings' );
@@ -46,7 +51,7 @@
// Return the redirect URL
wp_send_json_success( array(
- 'message' => __( 'Settings saved successfully, redirecting to AWeber...', 'automatorwp-aweber' ),
+ 'message' => __( 'Settings saved successfully, redirecting to AWeber...', 'automatorwp' ),
'redirect_url' => $redirect_url
) );
--- a/automatorwp/integrations/bluesky/includes/ajax-functions.php
+++ b/automatorwp/integrations/bluesky/includes/ajax-functions.php
@@ -19,6 +19,11 @@
// Security check
check_ajax_referer( 'automatorwp_admin', 'nonce' );
+ // Permissions check
+ if( ! current_user_can( automatorwp_get_manager_capability() ) ) {
+ wp_send_json_error( __( 'You're not allowed to perform this action.', 'automatorwp' ) );
+ }
+
$prefix = 'automatorwp_bluesky_';
$user_handle = automatorwp_bluesky_validate_name_account( sanitize_text_field( $_POST["user_handle"] ) );
--- a/automatorwp/integrations/campaign-monitor/includes/ajax-functions.php
+++ b/automatorwp/integrations/campaign-monitor/includes/ajax-functions.php
@@ -19,6 +19,11 @@
// Security check
check_ajax_referer( 'automatorwp_admin', 'nonce' );
+ // Permissions check
+ if( ! current_user_can( automatorwp_get_manager_capability() ) ) {
+ wp_send_json_error( __( 'You're not allowed to perform this action.', 'automatorwp' ) );
+ }
+
$prefix = 'automatorwp_campaign_monitor_';
$url = automatorwp_campaign_monitor_get_url();