Bug 7888

Summary: SpamAssassin flag 'RAND_MKTG_HEADER' is unclear in what it means
Product: Spamassassin Reporter: Byron Kleingeld <byron>
Component: spamassassinAssignee: SpamAssassin Developer Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: apache, byron, giovanni, jhardin, lwilton, me, rwmaillists
Priority: P2    
Version: unspecified   
Target Milestone: Undefined   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Byron Kleingeld 2021-03-09 09:43:36 UTC
I'm managing a bulk email service for the company I work at and a recent change to SpamAssassin has started flagging emails sent by our bulk-email solution with 'RAND_MKTG_HEADER'. I can't find much about this on the internet other than 'Has partially-randomized marketing/tracking header(s)'. The thing is, the software doesn't randomize any of the marketing headers for the campaigns sent with it, so I'm a bit confused as to the hows and whys and what I can do to fix this issue.

Naturally campaigns IDs are randomized UIDs, that's the nature of indentifying things uniquely. If anyone has any insight as to what this particular flag entails and what I can do to fix the issue it would be GREATLY appreciated as it's starting to impact our legitimate customers with delivery issues.

I just need an understanding of how this rule is implemented that I can understand what it is I need to do on our software to prevent our mails from getting flagged for now reason.

The headers as generated by the software for a test email was as follows:
Return-Path	<bounce@reactivemail.co.za>
Received	from node01.rdsmtp.co.za (node05.rdsmtp.co.za [102.222.20.123]) by inbound-smtp.eu-west-1.amazonaws.com with SMTP id 4uonu4k25fer8posk54lfdrj2rrr6a8t4chr7381 for allanb@glockapps.awsapps.com; Tue, 09 Mar 2021 07:59:08 +0000 (UTC)
Received-SPF	pass (spfCheck: domain of reactivemail.co.za designates 102.222.20.123 as permitted sender) client-ip=102.222.20.123; envelope-from=bounce@reactivemail.co.za; helo=node05.rdsmtp.co.za;
Authentication-Results	amazonses.com; spf=pass (spfCheck: domain of reactivemail.co.za designates 102.222.20.123 as permitted sender) client-ip=102.222.20.123; envelope-from=bounce@reactivemail.co.za; helo=node05.rdsmtp.co.za; dmarc=none header.from=zoomedia.co.za;
X-SES-RECEIPT	AEFBQUFBQUFBQUFGU0w2T2pLeEEvRmM0bzVkTjQzTTNlZ2NQZHpFMTcxNE0zM252d0lQS09xdGlDeWxoNmZ0TUx2SWJIczJONC9URHpOcjF6eE9jSnRaRmJhWUl6aU1QN2ZvQWR5RUtDczB3N3VaTWgzS05KVDh2UHZLMmRMZ3F4MUVyc1ZKMGM5YURLRG9mVnpYTGRCOXNSM0ZyWVlOcGVCN2txTCtqSGZyZHFzL1BqeVVMSWpxWE81MkoyRzBMNXB6ZEhyYXRyaEh3VDVDZWQyZHZ1ZmNQL0J6N1ZmUGp4VzF2M2JXS1VEMko3RXBqN0tPZmI5WlNtcHBzU01JbUQzNjdhYUZ3Vmc2M3ZHZUxLcCsvK2UrUlY2T1FPTjFGbStkZnRQbjFqMEs0S2o3SU5HWEZCbVE9PQ==
X-SES-DKIM-SIGNATURE	a=rsa-sha256; q=dns/txt; b=VXZhV4TYl1Qyaqw8fAWSV+lrpJkukBYYrRg2ZHmTwk6Q9OECnIt/TqRwp+9wAmfd25KFu2TIUfSe7zVEX+ZSpv79qh84+wTEh8eYWXS31sxsAR5JCyD8IJUKo1Qt0bS16QqAzmx5UXoGn+6obmMltz7GABl/6hSkLED5u1f7KuE=; c=relaxed/simple; s=shh3fegwg5fppqsuzphvschd53n6ihuv; d=amazonses.com; t=1615276751; v=1; bh=Mg5rJb3Fw4sZjqtrjW3+e/pHHQz+A3QFmtArIn+aRJs=; h=From:To:Cc:Bcc:Subject:Date:Message-ID:MIME-Version:Content-Type:X-SES-RECEIPT;
Received	from app.reactivemail.co.za (unknown [129.232.154.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: a22sv6v) by node01.rdsmtp.co.za (Postfix) with ESMTPSA id 1E6F2406AFAD for <allanb@glockapps.awsapps.com>; Tue, 9 Mar 2021 09:59:04 +0200 (SAST)
Message-ID	<885c54ed47493503486cea2da232b24b@reactivemail.co.za>
Date	Tue, 09 Mar 2021 07:59:03 +0000
Subject	This is Reactive Mail!
From	ZooMedia (Pty) Ltd <support@zoomedia.co.za>
Reply-To	ZooMedia (Pty) Ltd <support@zoomedia.co.za>
To	"allanb@glockapps.awsapps.com" <allanb@glockapps.awsapps.com>
MIME-Version	1.0
Content-Type	multipart/alternative; boundary="_=_swift_v4_1615276743_fa4eae3ba1192a96121b5cee055ac2ca_=_"
X-Sender	bounce@reactivemail.co.za
X-Report-Abuse	Please report abuse for this campaign here: https://app.reactivemail.co.za/campaigns/eb698rlbz4057/report-abuse/kp906nfw2f946/qg5453nyx604b
X-Receiver	allanb@glockapps.awsapps.com
X-Edjv-Tracking-Did	0
X-Edjv-Subscriber-Uid	qg5453nyx604b
X-Edjv-Mailer	SwiftMailer - 5.4.x
X-Edjv-EBS	https://app.reactivemail.co.za/lists/block-address
X-Edjv-Delivery-Sid	2
X-Edjv-Customer-Uid	qs001gtye8f14
X-Edjv-Customer-Gid	6
X-Edjv-Campaign-Uid	eb698rlbz4057
Precedence	bulk
List-Unsubscribe	<https://app.reactivemail.co.za/lists/kp906nfw2f946/unsubscribe/qg5453nyx604b/eb698rlbz4057/unsubscribe-direct?source=email-client-unsubscribe-button>, <mailto:support@zoomedia.co.za?subject=Campaign-Uid:eb698rlbz4057 / Subscriber-Uid:qg5453nyx604b - Unsubscribe request&body=Please unsubscribe me!>
List-Id	kp906nfw2f946 <TEST ONLY>
Feedback-ID	eb698rlbz4057:qg5453nyx604b:kp906nfw2f946:qs001gtye8f14
Content-Location	https://app.reactivemail.co.za/campaigns/eb698rlbz4057/web-version/qg5453nyx604b

Thanks in advance!
Comment 1 RW 2021-03-09 13:04:44 UTC
This is a bug tracker. You should take this question to the user mailing list.
Comment 2 Byron Kleingeld 2021-03-09 13:07:48 UTC
(In reply to RW from comment #1)
> This is a bug tracker. You should take this question to the user mailing
> list.

Thanks, I will do so, I was specifically told to post my question here, but feel free to delete it.
Comment 3 Giovanni Bechis 2021-03-09 13:33:32 UTC
For the records:
I told him to ask on users@ or post here because it could be a bug in our rules.
Comment 4 Byron Kleingeld 2021-03-09 13:37:04 UTC
(In reply to Giovanni Bechis from comment #3)
> For the records:
> I told him to ask on users@ or post here because it could be a bug in our
> rules.

I have asked on both so far, I've got a ton of people eating me alive right now, so I really just want to know what I can do to at least mitigate the issue for the time being. Our customers' mails are backing up and I've got an angry mob I need to settle
Comment 5 RW 2021-03-09 14:08:47 UTC
3 points does seem a bit extreme for a tracker.

The rule is 


ALL =~ /^X-(?:[a-z]{2}){1,2}-(?:EBS|(?:Tracking|Subscriber|Delivery|Customer|Campaign)-[DSU]?id):/ism

Which matches the names  of these header:

X-Edjv-Customer-Uid, X-Edjv-Campaign-Uid, X-Edjv-EBS, X-Edjv-Tracking-Did, X-Edjv-Subscriber-Uid
Comment 6 Byron Kleingeld 2021-03-09 14:22:36 UTC
(In reply to RW from comment #5)
> 3 points does seem a bit extreme for a tracker.
> 
> The rule is 
> 
> 
> ALL =~
> /^X-(?:[a-z]{2}){1,2}-(?:EBS|(?:
> Tracking|Subscriber|Delivery|Customer|Campaign)-[DSU]?id):/ism
> 
> Which matches the names  of these header:
> 
> X-Edjv-Customer-Uid, X-Edjv-Campaign-Uid, X-Edjv-EBS, X-Edjv-Tracking-Did,
> X-Edjv-Subscriber-Uid

I have temporary editing the code responsible for the tracking headers and removed then entirely, hopefully this clears up the score a little, since we're otherwise fine. Just getting hit hard by that one rule.
Comment 7 John Hardin 2021-03-09 15:35:45 UTC
(In reply to Byron Kleingeld from comment #4)
> (In reply to Giovanni Bechis from comment #3)
> > For the records:
> > I told him to ask on users@ or post here because it could be a bug in our
> > rules.
> 
> I have asked on both so far

I have seen no posts regarding this on the SpamAssassin Users mailing list, so I'll respond here.

(In reply to RW from comment #5)
> 3 points does seem a bit extreme for a tracker.

That's based on such headers appearing in very little ham in our corpus. If the bulk mailer doing this was a widely-used legitimate service I'd expect to see more hammy instances of it. The scored rule does have exclusions for signs in the ham we do have, and is not hitting any ham, and hits on otherwise-very-low-scoring spam, so the rule's score is fairly high. It's not, however, a poison pill.

> the software doesn't randomize any of the marketing headers for the campaigns sent with it

Such headers were fairly prevalent in a recent forged-sender-backscatter spam campaign that impacted one of my domains. Across spams from different sources, the headers *were* (apparently) random. That is historically the kind of tactic used by spammers to avoid static pattern and checksum detection tools and to pollute spam signature databases, and does not come across as something a legitimate mass mailer would do.

X-Cjqp-Delivery-Sid: 1
X-Dsyh-Delivery-Sid: 1
X-Etxr-Delivery-Sid: 1
X-Fxyn-Delivery-Sid: 1
X-Hqve-Delivery-Sid: 85
X-Kqoy-Delivery-Sid: 1
X-Lkcl-Delivery-Sid: 1
X-Lonj-Delivery-Sid: 6
X-Mw-Delivery-Sid: 18
X-Mw-Delivery-Sid: 2
X-Mw-Delivery-Sid: 37
X-Mw-Delivery-Sid: 4
X-Mw-Delivery-Sid: 698
X-toys-en-Delivery-Sid: 41
X-Vtaf-Delivery-Sid: 2
X-Zvjg-Delivery-Sid: 23

They may instead be something like a key for the bulk service client's account. If so, they chose a poor way to do it.

So part of the answer is: Byron, you're apparently using a bulk mailer service that is being actively abused by spammers, and that's having a negative impact on the reputation of your legitimate email. Work with your provider on that part of the problem.

> Just getting hit hard by that one rule.

I have reduced the score limit to 2 points, and added some further exclusions to the scored rule (which may not help in your case, it doesn't look like you are doing any of the "hammy" things our ham samples do). These changes will probably take overnight to take effect.
Comment 8 Byron Kleingeld 2021-03-09 15:46:39 UTC
(In reply to John Hardin from comment #7)
> (In reply to Byron Kleingeld from comment #4)
> > (In reply to Giovanni Bechis from comment #3)
> > > For the records:
> > > I told him to ask on users@ or post here because it could be a bug in our
> > > rules.
> > 
> > I have asked on both so far
> 
> I have seen no posts regarding this on the SpamAssassin Users mailing list,
> so I'll respond here.
> 
> (In reply to RW from comment #5)
> > 3 points does seem a bit extreme for a tracker.
> 
> That's based on such headers appearing in very little ham in our corpus. If
> the bulk mailer doing this was a widely-used legitimate service I'd expect
> to see more hammy instances of it. The scored rule does have exclusions for
> signs in the ham we do have, and is not hitting any ham, and hits on
> otherwise-very-low-scoring spam, so the rule's score is fairly high. It's
> not, however, a poison pill.
> 
> > the software doesn't randomize any of the marketing headers for the campaigns sent with it
> 
> Such headers were fairly prevalent in a recent forged-sender-backscatter
> spam campaign that impacted one of my domains. Across spams from different
> sources, the headers *were* (apparently) random. That is historically the
> kind of tactic used by spammers to avoid static pattern and checksum
> detection tools and to pollute spam signature databases, and does not come
> across as something a legitimate mass mailer would do.
> 
> X-Cjqp-Delivery-Sid: 1
> X-Dsyh-Delivery-Sid: 1
> X-Etxr-Delivery-Sid: 1
> X-Fxyn-Delivery-Sid: 1
> X-Hqve-Delivery-Sid: 85
> X-Kqoy-Delivery-Sid: 1
> X-Lkcl-Delivery-Sid: 1
> X-Lonj-Delivery-Sid: 6
> X-Mw-Delivery-Sid: 18
> X-Mw-Delivery-Sid: 2
> X-Mw-Delivery-Sid: 37
> X-Mw-Delivery-Sid: 4
> X-Mw-Delivery-Sid: 698
> X-toys-en-Delivery-Sid: 41
> X-Vtaf-Delivery-Sid: 2
> X-Zvjg-Delivery-Sid: 23
> 
> They may instead be something like a key for the bulk service client's
> account. If so, they chose a poor way to do it.
> 
> So part of the answer is: Byron, you're apparently using a bulk mailer
> service that is being actively abused by spammers, and that's having a
> negative impact on the reputation of your legitimate email. Work with your
> provider on that part of the problem.
> 
> > Just getting hit hard by that one rule.
> 
> I have reduced the score limit to 2 points, and added some further
> exclusions to the scored rule (which may not help in your case, it doesn't
> look like you are doing any of the "hammy" things our ham samples do). These
> changes will probably take overnight to take effect.

I appreciate the response, I might have fudged up the sending to the mailing list, I'm not often exposing to fancy systems such as that. In the case of the mailing provider, that would be the company I work for. I assume the bulk mailing software we're using (albeit heavily modified from the original base software) could potentially be used for illicit mailing. I had manually removed those headers from the mailer code, but I am worried if there are other parts of the software that might use those headers, like bounce handling and box monitoring, regardless, knowing how the rules work now I can, if all else fails, attempt to modify how those aspects of the software work and try to get around the rules getting our mails falsely flagged. It's shame though, this software is pretty damn good at what it does, but I can absolutely see it being abused due to it's low upfront cost.
Comment 9 Byron Kleingeld 2021-03-09 15:47:35 UTC
pardom my spelling and grammer, it has been a horridly long day and my brain is fried...
Comment 10 RW 2021-03-09 16:02:42 UTC
(In reply to John Hardin from comment #7)

> (In reply to RW from comment #5)
> > 3 points does seem a bit extreme for a tracker.
> 
> That's based on such headers appearing in very little ham in our corpus. If
> the bulk mailer doing this was a widely-used legitimate service I'd expect
> to see more hammy instances of it. The scored rule does have exclusions for
> signs in the ham we do have, 

The only exclusion is "&& !__HAVE_BOUNCE_RELAYS".  __HAVE_BOUNCE_RELAYS is test for whether any bounce relays are configured in the VBounce plug. In most set-ups it's unconditionally false. 


>  That is historically the
> kind of tactic used by spammers to avoid static pattern and checksum
> detection tools and to pollute spam signature databases,

That's more to do with the body. I don't think there's anything of that sort that would be affected by non-standard headers.
Comment 11 Byron Kleingeld 2021-03-09 17:02:55 UTC
(In reply to RW from comment #10)
> (In reply to John Hardin from comment #7)
> 
> > (In reply to RW from comment #5)
> > > 3 points does seem a bit extreme for a tracker.
> > 
> > That's based on such headers appearing in very little ham in our corpus. If
> > the bulk mailer doing this was a widely-used legitimate service I'd expect
> > to see more hammy instances of it. The scored rule does have exclusions for
> > signs in the ham we do have, 
> 
> The only exclusion is "&& !__HAVE_BOUNCE_RELAYS".  __HAVE_BOUNCE_RELAYS is
> test for whether any bounce relays are configured in the VBounce plug. In
> most set-ups it's unconditionally false. 
> 
> 
> >  That is historically the
> > kind of tactic used by spammers to avoid static pattern and checksum
> > detection tools and to pollute spam signature databases,
> 
> That's more to do with the body. I don't think there's anything of that sort
> that would be affected by non-standard headers.

I'll have to agree with this, while the software is being used maliciously, it is commercial software (https://www.mailwizz.com) and this rule would punish everyone who bought the software, legitimate or otherwise. I am forced to return those headers because the software's bounce handling and box monitoring features require them to function as it reads the values to automatically unsubscribe bouncing mails, or deadmail boxes, etc etc.

I'm at a bit of an empasse now, we've taken the time to build the reputation of our servers, set up SPF and valid DKIM records and all the DNS fluff that goes around running an email marketing platform only to get punished because it's a "spammy platform" that we've heavily modified over the course of 2 years of development.

I'm open to suggestions though, while -2 spam score isn't a death sentence for our mailers and we're working with postmasters to get our mails properly routed and whilelisted and all that jazz (Effort I seriously doubt a group of spammers would go through). It just feels a bit depressing getting punished for using off-the-shelf commercial mass mailing software as a basis.
Comment 12 Byron Kleingeld 2021-03-09 17:15:27 UTC
(In reply to Byron Kleingeld from comment #11)
> (In reply to RW from comment #10)
> > (In reply to John Hardin from comment #7)
> > 
> > > (In reply to RW from comment #5)
> > > > 3 points does seem a bit extreme for a tracker.
> > > 
> > > That's based on such headers appearing in very little ham in our corpus. If
> > > the bulk mailer doing this was a widely-used legitimate service I'd expect
> > > to see more hammy instances of it. The scored rule does have exclusions for
> > > signs in the ham we do have, 
> > 
> > The only exclusion is "&& !__HAVE_BOUNCE_RELAYS".  __HAVE_BOUNCE_RELAYS is
> > test for whether any bounce relays are configured in the VBounce plug. In
> > most set-ups it's unconditionally false. 
> > 
> > 
> > >  That is historically the
> > > kind of tactic used by spammers to avoid static pattern and checksum
> > > detection tools and to pollute spam signature databases,
> > 
> > That's more to do with the body. I don't think there's anything of that sort
> > that would be affected by non-standard headers.
> 
> I'll have to agree with this, while the software is being used maliciously,
> it is commercial software (https://www.mailwizz.com) and this rule would
> punish everyone who bought the software, legitimate or otherwise. I am
> forced to return those headers because the software's bounce handling and
> box monitoring features require them to function as it reads the values to
> automatically unsubscribe bouncing mails, or deadmail boxes, etc etc.
> 
> I'm at a bit of an empasse now, we've taken the time to build the reputation
> of our servers, set up SPF and valid DKIM records and all the DNS fluff that
> goes around running an email marketing platform only to get punished because
> it's a "spammy platform" that we've heavily modified over the course of 2
> years of development.
> 
> I'm open to suggestions though, while -2 spam score isn't a death sentence
> for our mailers and we're working with postmasters to get our mails properly
> routed and whilelisted and all that jazz (Effort I seriously doubt a group
> of spammers would go through). It just feels a bit depressing getting
> punished for using off-the-shelf commercial mass mailing software as a basis.

MailWizz has finally replied to my support request with a link to the following: https://kb.mailwizz.com/articles/low-score-in-spamassassin-because-of-the-rand_mktg_header-rule

It simple suggests making the rules "non-keyed" i.e using just X- and not X-xxx- I'm curious to know if this would work as they suggest though.
Comment 13 Benny Pedersen 2021-03-09 18:04:31 UTC
its funny suggestions say user@ when debate from bugzilla goes to dev@ :=)
Comment 14 Loren Wilton 2021-03-09 23:01:20 UTC
>The rule is 
>
>ALL =~
>/^X-(?:[a-z]{2}){1,2}-(?:EBS|(?:Tracking|Subscriber|Delivery|Customer|Campaign)->[DSU]?id):/ism
>
>Which matches the names  of these header:
>
>X-Edjv-Customer-Uid, X-Edjv-Campaign-Uid, X-Edjv-EBS, X-Edjv-Tracking-Did,
>X-Edjv-Subscriber-Uid

Note the match part /(?:[a-z]{2}){1,2}/. This will match 2 or 4 letters surrounded by dashes. If you have control over the header formatting, Change Edjv to Edgvi or Edg or Ed1v or something like that, to break the 2 or 4 character pattern. Assuming those header formats are defined in a single place in the software, they should continue to link in all the places used (unless you need to fix some scanning patterns in the software also), so should continue to perform their function, while avoiding this hit due to spammers using the software.
Comment 15 John Hardin 2021-03-10 02:32:46 UTC
> while the software is being used maliciously, it is commercial software
> (https://www.mailwizz.com) and this rule would punish everyone who bought
> the software, legitimate or otherwise.

I was not aware of that, I'd assumed this was a service-based situation. Thanks for that information.

> It simple suggests making the rules "non-keyed" i.e using just X- and
> not X-xxx- I'm curious to know if this would work as they suggest though.

That seems to me the best suggestion. Why they thought using randomly-named headers was a good idea is beyond me.

Rather than taking the random bit completely out, though, I suggest changing the prefix to something usefully unique but not random, like "X-Reactivemail-" (your company name). If the software depends on those headers being unique to properly process bounces et. al., that should be sufficient.

> The only exclusion is ...

There are more now.
Comment 16 Henrik Krohns 2022-04-02 08:17:55 UTC
Closing stale and apparently resolved bug.