SA Bugzilla – Bug 7896
Seeming counting error with tflags multiple
Last modified: 2021-03-30 22:43:35 UTC
I have the following rule in user_prefs: header __DUP_LIST_UNSUBSCRIBE List-Unsubscribe =~ /./ tflags __DUP_LIST_UNSUBSCRIBE multiple meta LW_DUP_LIST_UNSUBSCRIBE (__DUP_LIST_UNSUBSCRIBE > 1) score LW_DUP_LIST_UNSUBSCRIBE 1 describe LW_DUP_LIST_UNSUBSCRIBE Two or more List-Unsubscribe headers I received a spam that hit (among many others) this rule: 1.0 LW_DUP_LIST_UNSUBSCRIBE Two or more List-Unsubscribe headers The problem is there is only one List-Unsubscribe header in the message. I think that the header detection may have been fooled by the formatting of the DKIM-Signature header: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=dkim; d=product-bills.com; h=Message-ID:Date:Subject:From:Reply-To:To:MIME-Version:Content-Type: List-Unsubscribe:List-Id; bh=j+nGf5OHKxHxXjPQ+72DSHdl8grj1qHvjk8tfDj3sa4=; b=gE60zOF5GYxkCSCqMmkSfBz4m0Vt6dwCxW9C4hqQdVK3dEOvc3UeRW/YREKlUXmqVSe9f1aHviYI 0rpcUTG0D7HYJmyjJFSxqladmipwlBqGg9XceK/2MXmA7iCoNCXm78Ag/gPnzwzzbjBhUwRoQ+C/ K+vmtIzKXdYTlw8azYM= List-Unsubscribe: <http://ehk74.com/index.php/lists/tx608bw2ye27b/unsubscribe/mq0498zn4qe56/wq618tykbad15/unsubscribe-direct?source=email-client-unsubscribe-button>, <mailto:noreply@awscell.com?subject=Campaign-Uid:wq618tykbad15 / Subscriber-Uid:mq0498zn4qe56 - Unsubscribe request&body=Please unsubscribe me!> Note the " List-Unsubscribe:" in the DKIM-Signature multiline text. I can supply the original spam if the above is not enough to track the problem down.
Without anchoring, I believe that rule will match as many times as there are characters in the List-Unsubscribe header. To debug, use the '-D rules' option for spamassassin and look in the output for the matches to your rule. Or just put a '^' in front of the '.' in the regex.
(In reply to Bill Cole from comment #1) > Without anchoring, I believe that rule will match as many times as there are > characters in the List-Unsubscribe header. > > To debug, use the '-D rules' option for spamassassin and look in the output > for the matches to your rule. Or just put a '^' in front of the '.' in the > regex. I have confirmed that with the rules provided and mail with this header: List-Unsubscribe: 123 A check by 'spamassassin -D rules' shows these matches: Mar 30 16:56:17.093 [8735] dbg: rules: ran header rule __DUP_LIST_UNSUBSCRIBE ======> got hit: "1" Mar 30 16:56:17.094 [8735] dbg: rules: ran header rule __DUP_LIST_UNSUBSCRIBE ======> got hit: "2" Mar 30 16:56:17.094 [8735] dbg: rules: ran header rule __DUP_LIST_UNSUBSCRIBE ======> got hit: "3" Changing the regex to '/^./' solves the problem. Works as designed.
Thanks Bill!
(In reply to Bill Cole from comment #2) > Changing the regex to '/^./' solves the problem. The regex needs to be '/^./m'