1. Configure site with "Visitors can register accounts"
  2. Create a anon subscription with email XX
  3. Anon user creates an account with the same email address XX
  4. BUG: Subscription XX is deactivated
  5. BUG: If the newsletter setting "Subscribe new account" is anything except "- None -" then the anon user can alter the existing subscriptions for XX.

NB Whilst fixing this bug note that simplenews_user_insert has a hard-coded reference to permission 'administer users'. This code is wrong because it disregards entity access hooks plus also we may be running from the command line called by drush.

This bug could get "sort off" fixed by #2937251: Prevent duplicate subscribers which could disallow step 3 entirely. However possibly a better fix is to allow step 3, but take care not to overwrite any existing settings until after the email address has been verified.

Comments

AdamPS created an issue. See original summary.

adamps’s picture

Priority: Major » Critical
jonathanshaw’s picture

Looks like this is only a bug if email verification is not required when new users register; it's a feature otherwise.

adamps’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

I think you accidentally wrote it backwards. Too many nots and onlys!

If email verification is required then it seems clearly a bug. Anonymous users should not be trusted until they prove their email address, so mustn't be able to alter state until then.

If email verification is not required then presumably it is the intention of the site owner that users can join the site freely. If logged in users are allowed to edit subscriptions then users can also subscribe to newsletters without verification - and hence the site might as well turn off the email verification in simplenews too. However this scenario is illegal for public websites in many countries now and it's not something I feel we should prioritise for maintaining this module.

So I think 90% of the time it's a bug. But even if it's only a security bug in 10% of cases it's still a critical security bug

jonathanshaw’s picture

Ah. So even if verification is required and the new user cannot login, 4 and 5 still happen (prematurely). Got it now.

pixelrainbow’s picture

Hi,

my use case: a webshop using Commerce module, where visitors may only create an account after they successfully submitted their first order.

Registering an account triggers bug #4 ('BUG: Subscription XX is deactivated' - well, to be precise the active status flag is turned off for the given email address in Simplenews). No matter what option combinations I tried, this is always triggered somehow, effectively losing any previous newsletter subscribers who register an account later.

Is there a workaround to reset a given email's Simplenews status to "active", if it was active before the creation of the account?

This bug sadly breaks the whole email marketing setup for the webshop.

adamps’s picture

Sorry, I don't know of any easy workaround. @pixelrainbow if you are willing to support a proportion of the cost of fixing then please get in touch. Otherwise we need to wait and hope someone creates a patch.

drupal.ninja03’s picture

adamps’s picture

Version: 8.x-2.x-dev » 3.x-dev
adamps’s picture

Status: Active » Needs review
StatusFileSize
new4.37 KB

Here is a slightly hacky fix for this problem.

The subscriptions during user registration are marked as unconfirmed and a confirmation email is sent. This solves the security bug but it's a bit untidy. However it's probably the best we can do until #3035367: Track history of subscribe/unsubscribe and proof of consent.

adamps’s picture

Issue tags: +Plan to commit

  • AdamPS committed 690bfeb on 3.x
    Issue #3049356 by AdamPS: Anon user can alter any anonymous subscription
    
adamps’s picture

Status: Needs review » Fixed
Issue tags: -Plan to commit

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.