Skip to content

Commit 6c73dcd

Browse files
committed
Fix - Provide CSRF hardening for Mailchimp List changes.
1 parent 1e2b888 commit 6c73dcd

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

mailchimp.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/
55
* Description: Add a Mailchimp signup form block, widget or shortcode to your WordPress site.
66
* Text Domain: mailchimp
7-
* Version: 1.6.3
7+
* Version: 1.6.4
88
* Requires at least: 6.3
99
* Requires PHP: 7.0
1010
* PHP tested up to: 8.3
@@ -65,7 +65,7 @@ function () {
6565
}
6666

6767
// Version constant for easy CSS refreshes
68-
define( 'MCSF_VER', '1.6.3' );
68+
define( 'MCSF_VER', '1.6.4' );
6969

7070
// What's our permission (capability) threshold
7171
define( 'MCSF_CAP_THRESHOLD', 'manage_options' );
@@ -589,15 +589,20 @@ function mailchimp_sf_change_list_if_necessary() {
589589
return;
590590
}
591591

592+
if (
593+
! current_user_can( MCSF_CAP_THRESHOLD ) ||
594+
! isset( $_POST['update_mc_list_id_nonce'] ) ||
595+
! wp_verify_nonce( sanitize_key( $_POST['update_mc_list_id_nonce'] ), 'update_mc_list_id_action' )
596+
) {
597+
wp_die( 'Security check failed.' );
598+
}
599+
592600
if ( empty( $_POST['mc_list_id'] ) ) {
593601
$msg = '<p class="error_msg">' . esc_html__( 'Please choose a valid list', 'mailchimp' ) . '</p>';
594602
mailchimp_sf_global_msg( $msg );
595603
return;
596604
}
597605

598-
// Simple permission check before going through all this
599-
if ( ! current_user_can( MCSF_CAP_THRESHOLD ) ) { return; }
600-
601606
$api = mailchimp_sf_get_api();
602607
if ( ! $api ) { return; }
603608

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Contributors: Mailchimp
33
Tags: mailchimp, email, newsletter, signup, marketing
44
Tested up to: 6.7
5-
Stable tag: 1.6.3
5+
Stable tag: 1.6.4
66
License: GPL-2.0-or-later
77
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
88

@@ -81,6 +81,9 @@ If you are upgrading to version 1.2.1 and you used the widget in your sidebar pr
8181

8282
== Changelog ==
8383

84+
= 1.6.4 - 2026-01-08 =
85+
* **Fix:** Provide CSRF hardening for Mailchimp List changes.
86+
8487
= 1.6.3 - 2025-01-30 =
8588
* **Added:** Transform the `mailchimp_sf_shortcode` shortcode to the Mailchimp List Subscribe Form block (props [@MaxwellGarceau](https://github.com/qasumitbagthariya), [@jeffpaul](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#84](https://github.com/mailchimp/wordpress/pull/84)).
8689
* **Removed:** Deprecated Sopresto code (props [@MaxwellGarceau](https://github.com/qasumitbagthariya), [@jeffpaul](https://github.com/vikrampm1), [@dkotter](https://github.com/dkotter) via [#98](https://github.com/mailchimp/wordpress/pull/98)).

views/setup_page.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function ( $ele ) {
104104
</td>
105105
<td>
106106
<input type="hidden" name="mcsf_action" value="update_mc_list_id" />
107+
<?php wp_nonce_field( 'update_mc_list_id_action', 'update_mc_list_id_nonce' ); ?>
107108
<input type="submit" name="Submit" value="<?php esc_attr_e( 'Update List', 'mailchimp' ); ?>" class="button mailchimp-sf-button small" />
108109
</td>
109110
</tr>

0 commit comments

Comments
 (0)