Description

Subscribed page email alerts currently place all of the subscribed email addresses into the To: field.

It becomes a simple exercise to harvest these emails by subscribing to a page and then modifying that page whilst not logged in. You are then notified by MoinMoin that a change was made to the page and can retrieve any harvested email addresses from the To: field.

Another problem arises if one of the subscriber's machines contracts a windows emailing virus. (assuming they have subscription alerts in their mail folders) The effect is that all subscribers may have their email addresses donated to a spam list or may have them become the target for viruses.

Details

All versions of MoinMoin tried are vulnerable.

Workaround

def sendmail(request, to, subject, text, **kw):
    import smtplib, socket
    from email.MIMEText import MIMEText
    from email.Utils import formatdate
    
    from MoinMoin import config

    _ = request.getText
    # should not happen, but who knows ...
    if not config.mail_smarthost:
        return (0, _('''This wiki is not enabled for mail processing. '''
                '''Contact the owner of the wiki, who can either enable email, or remove the "Subscribe" icon.'''))
    mail_from = kw.get('mail_from', config.mail_from) or config.mail_from

    # Create a text/plain message
    msg = MIMEText(text, 'plain', config.charset)
    msg['From'] = mail_from
    msg['To'] = mail_from
    msg['Date'] = formatdate()
    try: # only python >= 2.2.2 has this:
        from email.Header import Header
        from email.Utils import make_msgid
        msg['Message-ID'] = make_msgid() 
        msg['Subject'] = Header(subject, config.charset)
    except ImportError:
        msg['Subject'] = subject # this is not standards compliant, but mostly works
        # no message-id. if you still have py 2.2.1, you like it old and broken
        
    try:
        server = smtplib.SMTP(config.mail_smarthost)
        try:
            #server.set_debuglevel(1)
            if config.mail_login:
                user, pwd = config.mail_login.split()
                server.login(user, pwd)
            server.sendmail(mail_from, to, msg.as_string())
        finally:
            try:
                server.quit()
            except AttributeError:
                # in case the connection failed, SMTP has no "sock" attribute
                pass
    except smtplib.SMTPException, e:
        return (0, str(e))
    except (os.error, socket.error), e:
        return (0, _("Connection to mailserver '%(server)s' failed: %(reason)s") % {
            'server': config.mail_smarthost, 
            'reason': str(e)
        })

    return (1, _("Mail sent OK"))

Yes, there are more efficient ways to code this, but the above works -- SimonRyan

It only works if all mails send ok, if the first fails, it won't send the rest. An improved version will be in 1.2.4.

Discussion

Its a very small or non existing problem. You have to subscribe manually, then you have to subscribe to all pages in the wiki with a .+ regular expression, and finally, you have to use a robot that edit all the pages in the wiki. After all this trouble, you end with few email addresses of subscribes.

But I agree that there is no reason to send the addresses of other subscribes in a edit notification message. -- NirSoffer 2004-10-01 03:23:22

Changes need to be made to the sendmail() function in util/mail.py

Two strategies come to mind,

Plan

Although it's a minor issue, its related to personal data of our users and to wiki SoftSecurity, and we have an easy fix. Changed priority to Medium. -- NirSoffer 2004-10-01 09:15:22


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/EmailHarvesting (last edited 2007-10-29 19:11:45 by localhost)