When a user is pre-authorized their e-mail address has not yet been validated. This allows to register accounts using e-mailadresses that belong to other people. To prevent possible abuse no e-mails should ever be sent out to pre-authorized users, except ones that are needed to recover a lost account, such as the 'user registration' messages and 'password reset' messages.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen’s picture

Status: Active » Needs review
FileSize
2.11 KB
ppelgrims’s picture

Issue summary: View changes

After applying the patch and testing I ran into the following messages:

Unable to send e-mail. Contact the site administrator if the problem persists.

A validation e-mail has been sent to your e-mail address. In order to gain full access to the site, you will need to follow the instructions in that message.

This sounds contradictory but I didn't receive the e-mail (Yay!) I reckon this patch needs a little bit more work in order to prevent said messages from being displayed.

edit: Ignore this, it's probably related to my set up.

ppelgrims’s picture

Sorry it took me so long to get back to this. This works but I still got a message saying the e-mail was sent. I used disable_messages to get rid of it.
On the settings page I entered this:

A validation e-mail has been sent to your e-mail address. In order to gain full access to the site, you will need to follow the instructions in that message.

Don't forget the punctuation!

ppelgrims’s picture

Status: Needs review » Reviewed & tested by the community

Maybe some more people need to test this?

pfrenssen’s picture

Priority: Normal » Major

Thanks for testing! I totally forgot about this issue. It's possible you get the message, but that is then probably a bug in core, this patch just sets the 'send' flag in hook_mail_alter() as documented:

'send': Set to FALSE to abort sending this email message.

I wonder if this is not a minor security risk? I can imagine some scenarios in which users can trigger mails to be sent (for example when a mail is sent out to users whenever a news article is posted) and they could technically set up a spam service by maliciously registering hundreds of email addresses and then posting an article.

I'm going to raise the priority on this to catch the attention of the maintainers.

ppelgrims’s picture

You reckon they'd use Drupal for that? I guess that's outside the scope of this issue anyway, haha

pfrenssen’s picture

No I mean you could abuse an existing Drupal site for that, for example a forum could have a feature to notify all users when a sticky is posted. It's quite an unlikely scenario though :)

ppelgrims’s picture

Can we get this in the new dev version and eventually in the next release? Thanks!

stevecowie’s picture

Assigned: Unassigned » stevecowie

This makes sense to me so I'll do some tests and confirm it works as expected.

dooug’s picture

@Stevecowie, you still on this?

stevecowie’s picture

Yep. Will get an update on this within the next 48 hours.

sibopa’s picture

I know this is almost a year old.
I think we can create a simple rule to block user with "pre-authorized" role?

stevecowie’s picture

Status: Reviewed & tested by the community » Fixed
FileSize
1.89 KB

I tested the patch at #1 and it applies and does the job. The problem of misleading messages still exists so I added a watchdog message to the patch, which would hopefully alert the site admin to the problem.
I also did some digging into the possibility of hiding misleading messages but it's not easily achievable with the core contact form because the sent message is generated after drupal_mail has been called. Also, even if there's a workaround for that use case, mails can be sent by any number of contrib modules so it would be impossible to catch every case. Nevertheless, I think it's worth applying the patch as it stands because there is a monor security risk here that matters more than the misleading status message.

  • stevecowie authored fc28a7e on 7.x-1.x
    Issue #1901964 by pfrenssen, stevecowie: Prevent sending emails to pre-...
stevecowie’s picture

Status: Fixed » Closed (fixed)