Skip to content

Commit 416253e

Browse files
committed
Fix - Provide CSRF hardening for Mailchimp List changes.
1 parent 89e5cca commit 416253e

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.8.0
7+
* Version: 1.8.1
88
* Requires at least: 6.4
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.8.0' );
70+
define( 'MCSF_VER', '1.8.1' );
7171

7272
// What's our permission (capability) threshold
7373
define( 'MCSF_CAP_THRESHOLD', 'manage_options' );
@@ -564,15 +564,20 @@ function mailchimp_sf_change_list_if_necessary() {
564564
return;
565565
}
566566

567+
if (
568+
! current_user_can( MCSF_CAP_THRESHOLD ) ||
569+
! isset( $_POST['update_mc_list_id_nonce'] ) ||
570+
! wp_verify_nonce( sanitize_key( $_POST['update_mc_list_id_nonce'] ), 'update_mc_list_id_action' )
571+
) {
572+
wp_die( 'Security check failed.' );
573+
}
574+
567575
if ( empty( $_POST['mc_list_id'] ) ) {
568576
$msg = esc_html__( 'Please choose a valid list', 'mailchimp' );
569577
admin_notice_error( $msg );
570578
return;
571579
}
572580

573-
// Simple permission check before going through all this
574-
if ( ! current_user_can( MCSF_CAP_THRESHOLD ) ) { return; }
575-
576581
$api = mailchimp_sf_get_api();
577582
if ( ! $api ) { return; }
578583

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.8
5-
Stable tag: 1.8.0
5+
Stable tag: 1.8.1
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.8.1 - 2026-01-08 =
85+
* **Fix:** Provide CSRF hardening for Mailchimp List changes.
86+
8487
= 1.8.0 - 2025-05-08 =
8588
**Note that this release bumps the WordPress minimum version from 6.3 to 6.4.**
8689

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)