Skip to content

Commit a3ddc59

Browse files
committed
Fix - Provide CSRF hardening for Mailchimp List changes.
1 parent 48c2260 commit a3ddc59

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-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.7.0
7+
* Version: 1.7.1
88
* Requires at least: 6.3
99
* Requires PHP: 7.0
1010
* PHP tested up to: 8.3
@@ -67,7 +67,7 @@ function () {
6767
use function Mailchimp\WordPress\Includes\Admin\{admin_notice_error, admin_notice_success};
6868

6969
// Version constant for easy CSS refreshes
70-
define( 'MCSF_VER', '1.7.0' );
70+
define( 'MCSF_VER', '1.7.1' );
7171

7272
// What's our permission (capability) threshold
7373
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 = esc_html__( 'Please choose a valid list', 'mailchimp' );
594602
admin_notice_error( $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: 3 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.7.0
5+
Stable tag: 1.7.1
66
License: GPL-2.0-or-later
77
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
88

@@ -80,6 +80,8 @@ If you are upgrading to version 1.2.1 and you used the widget in your sidebar pr
8080
9. Creating a new Mailchimp account.
8181

8282
== Changelog ==
83+
= 1.7.1 - 2026-01-08 =
84+
* **Fix:** Provide CSRF hardening for Mailchimp List changes.
8385

8486
= 1.7.0 - 2025-04-08 =
8587
* **Changed:** Enhance the Mailchimp List Subscribe Form block to allow for selecting an audience list, reorder fields, toggle field and group visibility, and various other improvements (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#126](https://github.com/mailchimp/wordpress/pull/126)).

views/setup_page.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function ( $ele ) {
8888
</td>
8989
<td>
9090
<input type="hidden" name="mcsf_action" value="update_mc_list_id" />
91+
<?php wp_nonce_field( 'update_mc_list_id_action', 'update_mc_list_id_nonce' ); ?>
9192
<input type="submit" name="Submit" value="<?php esc_attr_e( 'Update List', 'mailchimp' ); ?>" class="button mailchimp-sf-button small" />
9293
</td>
9394
</tr>

0 commit comments

Comments
 (0)