]> git.proxmox.com Git - proxmox-spamassassin.git/blob - sa-updates/20_head_tests.cf
update SpamAssassin signatures
[proxmox-spamassassin.git] / sa-updates / 20_head_tests.cf
1 # SpamAssassin rules file: header tests
2 #
3 # Please don't modify this file as your changes will be overwritten with
4 # the next update. Use /etc/mail/spamassassin/local.cf instead.
5 # See 'perldoc Mail::SpamAssassin::Conf' for details.
6 #
7 # <@LICENSE>
8 # Licensed to the Apache Software Foundation (ASF) under one or more
9 # contributor license agreements. See the NOTICE file distributed with
10 # this work for additional information regarding copyright ownership.
11 # The ASF licenses this file to you under the Apache License, Version 2.0
12 # (the "License"); you may not use this file except in compliance with
13 # the License. You may obtain a copy of the License at:
14 #
15 # http://www.apache.org/licenses/LICENSE-2.0
16 #
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22 # </@LICENSE>
23 #
24 ###########################################################################
25
26 require_version 3.004006
27
28 ###########################################################################
29
30 # partial messages; currently-theoretical attack
31 # unsurprisingly this hits 0/0 right now.
32 header FRAGMENTED_MESSAGE Content-Type =~ /\bmessage\/partial/i
33 describe FRAGMENTED_MESSAGE Partial message
34 tflags FRAGMENTED_MESSAGE userconf
35
36 ###########################################################################
37
38 header FROM_BLANK_NAME From =~ /(?:\s|^)"" <\S+>/i
39 describe FROM_BLANK_NAME From: contains empty name
40
41 ###########################################################################
42 # numeric address rules, these are written to avoid overlap with each other
43
44 header __FROM_ENDS_IN_NUMS From:addr =~ /\D\d{8,}\@/i
45
46 header FROM_STARTS_WITH_NUMS From:addr =~ /^\d{3,50}[^0-9\@]/
47 describe FROM_STARTS_WITH_NUMS From: starts with several numbers
48
49 # don't match US/Canada phone numbers: 10 digits optionally preceded by a "1"
50 header __FROM_ALL_NUMS From:addr =~ /^(?:\d{1,9}|[02-9]\d{10}|\d{12,})@/
51
52 ###########################################################################
53
54 header FROM_OFFERS From:addr =~ /\@\S*offers(?![eo]n\b)/i
55 describe FROM_OFFERS From address is "at something-offers"
56
57 header FROM_NO_USER From =~ /(?:^\@|<\@| \@[^\)<]*$|<>)/ [if-unset: unset@unset.unset]
58 describe FROM_NO_USER From: has no local-part before @ sign
59
60 # also 100% valid
61 # bug 6149: avoid common .jp false positives
62 header __PLING_QUERY Subject =~ /\?.*!|!.*\?/
63 meta PLING_QUERY (__PLING_QUERY && !__ISO_2022_JP_DELIM)
64 describe PLING_QUERY Subject has exclamation mark and question mark
65
66
67
68
69 header MSGID_SPAM_CAPS Message-ID =~ /^\s*<?[A-Z]+\@(?!(?:mailcity|whowhere)\.com)/
70 describe MSGID_SPAM_CAPS Spam tool Message-Id: (caps variant)
71
72 header MSGID_SPAM_LETTERS Message-Id =~ /<[a-z]{5,}\@(\S+\.)+\S+>/
73 describe MSGID_SPAM_LETTERS Spam tool Message-Id: (letters variant)
74
75
76
77 # negative lookahead exempts this MUA from circa 1997-2000
78 # X-Mailer: Microsoft Outlook Express 4.71.1712.3
79 # Message-ID: <01bd45da$2649cdc0$LocalHost@andrew>
80 header __MSGID_DOLLARS_OK MESSAGEID =~ /<[0-9a-f]{4,}\$[0-9a-f]{4,}\$[0-9a-f]{4,}\@\S+>/
81 header __MSGID_DOLLARS_MAYBE MESSAGEID =~ /<\w{4,}\$\w{4,}\$(?!localhost)\w{4,}\@\S+>/i
82 meta MSGID_DOLLARS_RANDOM __MSGID_DOLLARS_MAYBE && !__MSGID_DOLLARS_OK
83
84 # bit of a ratware rule, but catches a bit more than just the one ratware
85 header __MSGID_RANDY Message-ID =~ /<[a-z\d][a-z\d\$-]{10,29}[a-z\d]\@[a-z\d][a-z\d.]{3,12}[a-z\d]>/
86 # heuristic to eliminate most good Message-ID formats
87 header __MSGID_OK_HEX Message-ID =~ /\b[a-f\d]{8}\b/
88 header __MSGID_OK_DIGITS Message-ID =~ /\d{10}/
89 header __MSGID_OK_HOST Message-ID =~ /\@(?:\D{2,}|(?:\d{1,3}\.){3}\d{1,3})>/
90 meta MSGID_RANDY (__MSGID_RANDY && !(__MSGID_OK_HEX || __MSGID_OK_DIGITS || __MSGID_OK_HOST))
91 describe MSGID_RANDY Message-Id has pattern used in spam
92
93 # bug 3395
94 header MSGID_YAHOO_CAPS Message-ID =~ /<[A-Z]+\@yahoo.com>/
95 describe MSGID_YAHOO_CAPS Message-ID has ALLCAPS@yahoo.com
96
97 ###########################################################################
98
99 header __AT_AOL_MSGID MESSAGEID =~ /\@aol\.com\b/i
100 header __FROM_AOL_COM From =~ /\@aol\.com\b/i
101 meta FORGED_MSGID_AOL (__AT_AOL_MSGID && !__FROM_AOL_COM)
102 describe FORGED_MSGID_AOL Message-ID is forged, (aol.com)
103
104 header __AT_EXCITE_MSGID MESSAGEID =~ /\@excite\.com\b/i
105 header __MY_RCVD_EXCITE Received =~ /\.excite\.com\b/i
106 meta FORGED_MSGID_EXCITE (__AT_EXCITE_MSGID && !__MY_RCVD_EXCITE)
107 describe FORGED_MSGID_EXCITE Message-ID is forged, (excite.com)
108
109 header __AT_HOTMAIL_MSGID MESSAGEID =~ /\@hotmail\.com\b/i
110 header __FROM_HOTMAIL_COM From =~ /\@hotmail\.com\b/i
111 meta FORGED_MSGID_HOTMAIL (__AT_HOTMAIL_MSGID && (!__FROM_HOTMAIL_COM && !__FROM_MSN_COM && !__FROM_YAHOO_COM))
112 describe FORGED_MSGID_HOTMAIL Message-ID is forged, (hotmail.com)
113
114 header __AT_MSN_MSGID MESSAGEID =~ /\@msn\.com\b/i
115 header __FROM_MSN_COM From =~ /\@msn\.com\b/i
116 meta FORGED_MSGID_MSN (__AT_MSN_MSGID && (!__FROM_MSN_COM && !__FROM_HOTMAIL_COM && !__FROM_YAHOO_COM))
117 describe FORGED_MSGID_MSN Message-ID is forged, (msn.com)
118
119 header __AT_YAHOO_MSGID MESSAGEID =~ /\@yahoo\.com\b/i
120 header __FROM_YAHOO_COM From =~ /\@yahoo\.com\b/i
121 meta FORGED_MSGID_YAHOO (__AT_YAHOO_MSGID && !__FROM_YAHOO_COM)
122 describe FORGED_MSGID_YAHOO Message-ID is forged, (yahoo.com)
123
124 ###########################################################################
125
126 header __MSGID_BEFORE_RECEIVED ALL =~ /^Message-Id:.*?^Received:/msi
127 header __MSGID_BEFORE_OKAY Message-Id =~ /\@[a-z0-9.-]+\.(?:yahoo|wanadoo)(?:\.[a-z]{2,3}){1,2}>/
128
129 meta MSGID_FROM_MTA_HEADER (__MSGID_BEFORE_RECEIVED && !__MSGID_BEFORE_OKAY && !__FROM_HOTMAIL_COM)
130 describe MSGID_FROM_MTA_HEADER Message-Id was added by a relay
131
132
133
134 header MSGID_SHORT MESSAGEID =~ /^.{1,15}$|<.{0,4}\@/
135 describe MSGID_SHORT Message-ID is unusually short
136
137 #DEMOTED TO SANDBOX - 2012-03-21
138 #header MSGID_MULTIPLE_AT MESSAGEID =~ /<[^>]*\@[^>]*\@/
139 #describe MSGID_MULTIPLE_AT Message-ID contains multiple '@' characters
140
141 ###########################################################################
142
143 header DATE_SPAMWARE_Y2K Date =~ /^[A-Z][a-z]{2}, \d\d [A-Z][a-z]{2} [0-6]\d \d\d:\d\d:\d\d [A-Z]{3}$/
144 describe DATE_SPAMWARE_Y2K Date header uses unusual Y2K formatting
145
146 # as noted on the dev@ list, ":60" is valid for seconds when there's a leap
147 # second (12/31/2005 for instance), so let's accept that as valid. ISO 8601
148 # apparently allows for it.
149 # there were a few whitespace issues in the original RE, and I wanted to avoid my
150 # two common, but yes invalid, date headers. specifically / \(GMT\)$/ and
151 # / 0000 GMT$/. dos has / "GMT"$/ - tvd
152 # 2.229 2.7267 0.0517 0.981 0.86 0.00 INVALID_DATE
153 # 2.263 2.7486 0.1368 0.953 0.78 0.00 INVALID_DATE_OLD
154 #
155 # WRT the tests, remember that ok and fail are reversed -- so valid dates
156 # should be "fail" and invalid dates should be "ok".
157 header INVALID_DATE Date !~ /^\s*(?:(?i:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?\s*(?:[12]\d|3[01]|0?[1-9])\s+(?i:Jan|Feb|Ma[ry]|Apr|Ju[nl]|Aug|Sep|Oct|Nov|Dec)\s+(?:19[7-9]\d|2\d{3})\s+(?:[01]?\d|2[0-3])\:[0-5]\d(?::(?:[0-5]\d|60))?(?:\s+[AP]M)?(?:\s+(?:[+-][0-9]{4}|UT|[A-Z]{2,3}T|0000 GMT|"GMT"))?(?:\s*\(.*\))?\s*$/ [if-unset: Wed, 31 Jul 2002 16:41:57 +0200]
158 describe INVALID_DATE Invalid Date: header (not RFC 2822)
159 test INVALID_DATE fail Sat, 31 Dec 2005 23:59:60 -0500
160 test INVALID_DATE fail Wed, 31 Jul 2002 16:41:57 +0200
161 test INVALID_DATE fail Sat, 31 Dec 2005 23:00:00
162 test INVALID_DATE ok Sat, 31 Dec 2005 24:00:00 -0500
163 test INVALID_DATE ok Thurs, 31 Jul 2002 16:41:57 +0200
164
165 # allow +1300, NZ timezone
166 header INVALID_DATE_TZ_ABSURD Date =~ /[-+](?!(?:0\d|1[0-4])(?:[03]0|[14]5))\d{4}$/
167 describe INVALID_DATE_TZ_ABSURD Invalid Date: header (timezone does not exist)
168
169 header INVALID_TZ_CST ALL =~ /[+-]\d\d[30]0(?<!-0600|-0500|\+0800|\+0930|\+1030)\s+(?:\bCST\b|\(CST\))/
170 describe INVALID_TZ_CST Invalid date in header (wrong CST timezone)
171
172 header INVALID_TZ_EST ALL =~ /[+-]\d\d[30]0(?<!-0500|-0300|\+1000|\+1100)\s+(?:\bEST\b|\(EST\))/
173 describe INVALID_TZ_EST Invalid date in header (wrong EST timezone)
174
175
176 ###########################################################################
177 # MIME encoding with spam characteristics
178
179 ifplugin Mail::SpamAssassin::Plugin::HeaderEval
180 meta __SUBJECT_NEEDS_MIME __SUBJ_ILLEGAL_CHARS
181 endif
182
183 header __SUBJECT_ENCODED_QP Subject:raw =~ /=\?\S+\?Q\?/i
184 header __SUBJECT_ENCODED_B64 Subject:raw =~ /=\?\S+\?B\?/i
185
186
187
188 header __FROM_NEEDS_MIME From:name:raw =~ /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/
189 header __FROM_NEEDS_MIME2 From:name =~ /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff]/
190 header __FROM_ENCODED_QP From:raw =~ /=\?\S+\?Q\?/i
191 header __FROM_ENCODED_B64 From:raw =~ /=\?\S+\?B\?/i
192
193
194 meta FROM_EXCESS_BASE64 __FROM_ENCODED_B64 && !__FROM_NEEDS_MIME2
195 describe FROM_EXCESS_BASE64 From: base64 encoded unnecessarily
196
197
198 ###########################################################################
199 # ADV tags in various languages
200
201 header ENGLISH_UCE_SUBJECT Subject =~ /^[^0-9a-z]*adv(?:ert)?\b/i
202 describe ENGLISH_UCE_SUBJECT Subject contains an English UCE tag
203
204 # alan premselaar <alien@12inch.com>, see SpamAssassin-talk list 2003-03
205 # quinlan: 2003-03-23 here are more generic Japanese iso-2022-jp codes
206 # ("not yet acceptance" or "email") + "announcement"
207 # FWIW, according to Peter Evans, this should be sufficient to catch the
208 # UCE tag and a common attempt at evasion (using the "sue" instead of
209 # "mi" Chinese character). 2006-10-12: updated by bug 4021.
210 header JAPANESE_UCE_SUBJECT Subject =~ /\e\$B.*(?:L\$>5Bz|EE;R%a!<%k)(?:8x|9-)9p/
211 describe JAPANESE_UCE_SUBJECT Subject contains a Japanese UCE tag
212
213 # check body for "shou nin daku kou koku" UCE tag (bug 4021)
214 body __JAPANESE_UCE_BODY /(?:L\$>5Bz|EE;R%a!<%k)(?:8x|9-)9p/
215
216 meta JAPANESE_UCE_BODY (__ISO_2022_JP_DELIM && __JAPANESE_UCE_BODY)
217 describe JAPANESE_UCE_BODY Body contains Japanese UCE tag
218
219 # quinlan: "advertisement" in Russian KOI8-R
220 # (no longer common, but worth noting in future)
221 #header RUSSIAN_UCE_SUBJECT Subject =~ /\xf0\xe5\xea\xeb\xe0\xec\xf3/
222 #describe RUSSIAN_UCE_SUBJECT Subject contains a Russian UCE tag
223
224 # Korean UCE Subject: lines are usually 8-bit, but are occasionally encoded
225 # with quoted-printable or base64.
226 #
227 # \xbc\xba\xc0\xce means "adult"
228 # \xb1\xa4\xb0\xed means "advertisement"
229 # \xc1\xa4\xba\xb8 means "information"
230 # \xc8\xab\xba\xb8 means "publicity"
231 #
232 # Each two byte sequence is one Korean letter; the spaces and periods are
233 # sometimes used to obscure the words. \xb1\xa4\xb0\xed is the most common
234 # tag and is sometimes very obscured so we look harder.
235 #
236 header KOREAN_UCE_SUBJECT Subject =~ /[({[<][. ]*(?-i:\xbc\xba[. ]*\xc0\xce[. ]*)?(?-i:\xb1\xa4(?:[. ]*|[\x00-\x7f]{0,3})\xb0\xed|\xc1\xa4[. ]*\xba\xb8|\xc8\xab[. ]*\xba\xb8)[. ]*[)}\]>]/
237 describe KOREAN_UCE_SUBJECT Subject: contains Korean unsolicited email tag
238
239 ###########################################################################
240
241 # two reliable signatures
242 header __DOUBLE_IP_SPAM_1 Received =~ /from \[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\] by \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} with/
243 header __DOUBLE_IP_SPAM_2 Received =~ /from\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s+by\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3};/
244 # loose match
245 header __DOUBLE_IP_LOOSE Received =~ /(?:\b(?:from|by)\b.{1,4}\b\d{1,3}[._-]\d{1,3}[._-]\d{1,3}[._-]\d{1,3}(?<!127\.0\.0\.1)\b.{0,4}){2}/i
246 # spam signature
247 meta RCVD_DOUBLE_IP_SPAM (__DOUBLE_IP_SPAM_1 || __DOUBLE_IP_SPAM_2)
248 describe RCVD_DOUBLE_IP_SPAM Bulk email fingerprint (double IP) found
249 # other matches
250 meta RCVD_DOUBLE_IP_LOOSE (__DOUBLE_IP_LOOSE && !RCVD_DOUBLE_IP_SPAM)
251 describe RCVD_DOUBLE_IP_LOOSE Received: by and from look like IP addresses
252
253 header FORGED_TELESP_RCVD Received =~ /\.(?!br).. \(\d+-\d+-\d+-\d+\.dsl\.telesp\.net\.br /
254 describe FORGED_TELESP_RCVD Contains forged hostname for a DSL IP in Brazil
255
256 # forgery meta-rules: more reliable than their inputs
257 meta CONFIRMED_FORGED (__FORGED_RCVD_TRAIL && (__FORGED_AOL_RCVD || __FORGED_HOTMAIL_RCVD || __FORGED_EUDORAMAIL_RCVD || FORGED_YAHOO_RCVD || __FORGED_JUNO_RCVD || FORGED_GMAIL_RCVD))
258 describe CONFIRMED_FORGED Received headers are forged
259
260 meta MULTI_FORGED ((__FORGED_AOL_RCVD + __FORGED_HOTMAIL_RCVD + __FORGED_EUDORAMAIL_RCVD + FORGED_YAHOO_RCVD + __FORGED_JUNO_RCVD + FORGED_GMAIL_RCVD) > 1)
261 describe MULTI_FORGED Received headers indicate multiple forgeries
262
263 header NONEXISTENT_CHARSET Content-Type =~ /charset=.?DEFAULT/
264 describe NONEXISTENT_CHARSET Character set doesn't exist
265
266 header __HAS_MESSAGE_ID exists:Message-Id
267 meta MISSING_MID !__HAS_MESSAGE_ID
268 describe MISSING_MID Missing Message-Id: header
269
270 header __HAS_DATE exists:Date
271 meta MISSING_DATE !__HAS_DATE
272 describe MISSING_DATE Missing Date: header
273
274 header __HAS_SUBJECT exists:Subject
275 meta MISSING_SUBJECT !__HAS_SUBJECT
276 describe MISSING_SUBJECT Missing Subject: header
277
278 # bug 6353
279 header __HAS_FROM exists:From
280 meta MISSING_FROM !__HAS_FROM
281 describe MISSING_FROM Missing From: header
282
283 # bug 6149: avoid common .jp false positives
284 header __GAPPY_SUBJECT Subject =~ /\b(?:[a-z]([-_. =~\/:,*!\@\#\$\%\^&+;\"\'<>\\])\1{0,2}){4}/i
285 meta GAPPY_SUBJECT (__GAPPY_SUBJECT && !__ISO_2022_JP_DELIM)
286 describe GAPPY_SUBJECT Subject: contains G.a.p.p.y-T.e.x.t
287
288 ### header existence tests (description is added automatically)
289
290 # X-Fix example: NTMail fixed non RFC822 compliant EMail message
291 #
292 # X-PMFLAGS is all caps
293 #
294 # Headers that seem to only be used by a single spamming software and
295 # are found together in the same message:
296 # 1. X-MailingID and X-ServerHost
297 # 2. X-Stormpost-To and X-List-Unsubscribe
298 #
299 # not spammish: X-EM-Registration, X-EM-Version, X-Antiabuse, X-List-Host,
300 # X-Message-Id
301 # bad FP rate: Comment, Date-warning
302
303 header PREVENT_NONDELIVERY exists:Prevent-NonDelivery-Report
304 describe PREVENT_NONDELIVERY Message has Prevent-NonDelivery-Report header
305
306 header X_IP exists:X-IP
307 describe X_IP Message has X-IP header
308
309 header __HAS_MIMEOLE exists:X-MimeOLE
310 header __HAS_MSMAIL_PRI exists:X-MSMail-Priority
311 header __HAS_SQUIRRELMAIL_IN_MAILER X-Mailer =~ /SquirrelMail\b/
312 # Ever growing Office version list without X-MimeOLE, bug 6346, 7122, 7463.
313 header __HAS_OFFICE1214_IN_MAILER X-Mailer =~ /^Microsoft (?:Office )?Outlook 1[2456]\.0/
314 # CGP MAPI module fingerprint, to protect from MISSING_MIMEOLE
315 header __HAS_CGP_MAPI_IN_MAILER X-Mailer =~ /CommuniGate Pro MAPI/
316 meta MISSING_MIMEOLE (__HAS_MSMAIL_PRI && !__HAS_MIMEOLE && !__HAS_SQUIRRELMAIL_IN_MAILER && !__HAS_OFFICE1214_IN_MAILER && !__HAS_CGP_MAPI_IN_MAILER && !__HDR_RCVD_TONLINEDE && !__MIME_BASE64 && !__DKIM_EXISTS)
317 describe MISSING_MIMEOLE Message has X-MSMail-Priority, but no X-MimeOLE
318
319 header __HAS_X_MAILER exists:X-Mailer
320
321 header __IS_EXCH X-MimeOLE =~ /Produced By Microsoft Exchange V/
322
323 header SUBJ_AS_SEEN Subject =~ /\bAs Seen/i
324 describe SUBJ_AS_SEEN Subject contains "As Seen"
325
326 header SUBJ_DOLLARS Subject =~ /^\$[0-9.,]+\b/
327 describe SUBJ_DOLLARS Subject starts with dollar amount
328
329
330
331
332
333
334 #DISABLING DUE TO POOR S/O 2012-09-27
335 #header SUBJ_YOUR_DEBT Subject =~ /Your (?:Bills|Debt|Credit)/i
336 #describe SUBJ_YOUR_DEBT Subject contains "Your Bills" or similar
337
338 header SUBJ_YOUR_FAMILY Subject =~ /Your Family/i
339 describe SUBJ_YOUR_FAMILY Subject contains "Your Family"
340
341
342 # the real services never HELO as 'foo.com', instead 'mail.foo.com' or
343 # something like that. Note: be careful when expanding this... legit dotcom
344 # HELOers include: hotmail.com, drizzle.com, lockergnome.com.
345 header RCVD_FAKE_HELO_DOTCOM Received =~ /^from (?:msn|yahoo|yourwebsite|lycos|excite|cs|aol|localhost|koreanmail|allexecs|mydomain|juno|eudoramail|compuserve|desertmail|excite|caramail)\.com \(/m
346 describe RCVD_FAKE_HELO_DOTCOM Received contains a faked HELO hostname
347
348 header SUBJECT_DIET Subject =~ /\bLose .*(?:pounds|lbs|weight)/i
349 describe SUBJECT_DIET Subject talks about losing pounds
350
351
352 # MIME boundary tests; spam tools use distinctive patterns.
353 header MIME_BOUND_DD_DIGITS Content-Type =~ /boundary=\"--\d+\"/
354 describe MIME_BOUND_DD_DIGITS Spam tool pattern in MIME boundary
355 header MIME_BOUND_DIGITS_15 Content-Type =~ /boundary=\"\d{15,}\"/
356 describe MIME_BOUND_DIGITS_15 Spam tool pattern in MIME boundary
357 header MIME_BOUND_MANY_HEX Content-Type =~ /boundary="[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}"/
358 describe MIME_BOUND_MANY_HEX Spam tool pattern in MIME boundary
359
360 # note: the first alternation is anchored for speed
361 header TO_MALFORMED To !~ /(?:^|[^\S"])(?:(?:\"[^\"]+\"|\S+)\@\S+\.\S+|^\s*.+:\s*;|^\s*\"[^\"]+\":\s*;|^\s*\([^\)]*\)\s*$|<\S+(?:\!\S+){1,}>|^\s*$)/ [if-unset: unset@unset.unset]
362 describe TO_MALFORMED To: has a malformed address
363
364 header __CD exists:Content-Disposition
365 header __CT exists:Content-Type
366 header __CTE exists:Content-Transfer-Encoding
367 header __MIME_VERSION exists:MIME-Version
368 header __CT_TEXT_PLAIN Content-Type =~ /^text\/plain\b/i
369 meta MIME_HEADER_CTYPE_ONLY (!__CD && !__CTE && __CT && !__MIME_VERSION && !__CT_TEXT_PLAIN)
370 describe MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME headers
371
372 header WITH_LC_SMTP Received =~ /\swith\ssmtp;\s/
373 describe WITH_LC_SMTP Received line contains spam-sign (lowercase smtp)
374
375
376 header SUBJ_BUY Subject =~ /^buy/i
377 describe SUBJ_BUY Subject line starts with Buy or Buying
378
379 # seems to be ratware
380 header RCVD_AM_PM Received =~ /; [A-Z][a-z][a-z], \d{1,2} \d{4} \d{1,2}:\d\d:\d\d [AP]M [+-]\d{4}/
381 describe RCVD_AM_PM Received headers forged (AM/PM)
382
383 header __USER_AGENT_MSN X-Mailer =~ /^MSN Explorer /
384
385 # host no longer exists according to administrator
386 header FAKE_OUTBLAZE_RCVD Received =~ /\.mr\.outblaze\.com/
387 describe FAKE_OUTBLAZE_RCVD Received header contains faked 'mr.outblaze.com'
388
389
390 # thanks to David Ritz for passing this on
391 header UNCLOSED_BRACKET ALL =~ /\[\d+\r?\n/s
392 describe UNCLOSED_BRACKET Headers contain an unclosed bracket
393
394 header FROM_DOMAIN_NOVOWEL From =~ /\@\S*[bcdfgjklmnpqrstvwxz]{7}/i
395 describe FROM_DOMAIN_NOVOWEL From: domain has series of non-vowel letters
396 tflags FROM_DOMAIN_NOVOWEL userconf # lock scores low
397
398 header FROM_LOCAL_NOVOWEL From =~ /[bcdfgjklmnpqrstvwxz]{7}\S*\@/i
399 describe FROM_LOCAL_NOVOWEL From: localpart has series of non-vowel letters
400 tflags FROM_LOCAL_NOVOWEL userconf # lock scores low
401
402 header FROM_LOCAL_HEX From =~ /[0-9a-f]{11}\S*\@/i
403 describe FROM_LOCAL_HEX From: localpart has long hexadecimal sequence
404
405 header FROM_LOCAL_DIGITS From =~ /\d{11}\S*\@/i
406 describe FROM_LOCAL_DIGITS From: localpart has long digit sequence
407
408 header __TOCC_EXISTS exists:ToCc
409
410 header X_PRIORITY_CC ALL =~ /^X-Priority:[^\n]{0,80}^Cc:/msi
411 describe X_PRIORITY_CC Cc: after X-Priority: (bulk email fingerprint)
412
413 # catch non-RFC2047 compliant messages
414 # Apple Mail has a bug where headers will have whitespace around the encoded
415 # text, so try to ignore that
416 header BAD_ENC_HEADER ALL:raw =~ /=\?[^?\s]+\?[^?\s]\?\s*[^?]+\s(?!\?=)/
417 describe BAD_ENC_HEADER Message has bad MIME encoding in the header
418
419
420 header __ML1 Precedence =~ m{\b(list|bulk)\b}i
421 header __ML2 exists:List-Id
422 header __ML3 exists:List-Post
423 header __ML4 exists:Mailing-List
424 header __ML5 Return-Path:addr =~ m{^([^\@]+-(request|bounces|admin|owner)|owner-[^\@]+)(\@|\z)}i
425 meta __VIA_ML __ML1 || __ML2 || __ML3 || __ML4 || __ML5
426 describe __VIA_ML Mail from a mailing list
427
428
429 # some clueless mailing lists (like zmailer with an RFC822TABS option on)
430 # are replacing a leading space by a TAB in header fields From, To,
431 # Cc, Date (Bug 6429)
432 header __ML_TURNS_SP_TO_TAB Received =~ /\(ORCPT <rfc822;/
433 describe __ML_TURNS_SP_TO_TAB A mailing list changing a space to a TAB
434
435
436 # must keep it in sync with https://www.iana.org/assignments/ipv4-address-space/
437 header RCVD_ILLEGAL_IP X-Spam-Relays-Untrusted =~ / (?:by|ip)=(?=\d+\.\d+\.\d+\.\d+ )(?:(?:0|2(?:2[4-9]|[3-5]\d)|192\.0\.2|198\.51\.100|203\.0\.113)\.|(?:\d+\.){0,3}(?!(?:2(?:[0-4]\d|5[0-5])|[01]?\d\d?)\b))/
438 describe RCVD_ILLEGAL_IP Received: contains illegal IP address
439
440
441 ###########################################################################
442
443 ifplugin Mail::SpamAssassin::Plugin::HeaderEval
444
445 header __FORGED_AOL_RCVD eval:check_for_fake_aol_relay_in_rcvd()
446
447 header CHARSET_FARAWAY_HEADER eval:check_for_faraway_charset_in_headers()
448 describe CHARSET_FARAWAY_HEADER A foreign language charset used in headers
449 tflags CHARSET_FARAWAY_HEADER userconf
450
451 ###################################################################
452
453 # illegal characters that should be MIME encoded
454 # might want to exempt users using languages that don't use Latin
455 # alphabets, but do it in the eval
456
457 header __SUBJ_ILLEGAL_CHARS eval:check_illegal_chars('Subject','0.00','2')
458 meta SUBJ_ILLEGAL_CHARS (__SUBJ_ILLEGAL_CHARS && !__FROM_YAHOO_COM)
459 describe SUBJ_ILLEGAL_CHARS Subject: has too many raw illegal characters
460
461 header FROM_ILLEGAL_CHARS eval:check_illegal_chars('From','0.20','2')
462 describe FROM_ILLEGAL_CHARS From: has too many raw illegal characters
463
464 header __HEAD_ILLEGAL_CHARS eval:check_illegal_chars('ALL','0.010','2')
465 meta HEAD_ILLEGAL_CHARS __HEAD_ILLEGAL_CHARS && !__SUBJ_ILLEGAL_CHARS && !FROM_ILLEGAL_CHARS
466 describe HEAD_ILLEGAL_CHARS Headers have too many raw illegal characters
467
468 ###################################################################
469
470 # a forged Hotmail message; host HELO'd as hotmail.com, but it wasn't
471 header __FORGED_HOTMAIL_RCVD eval:check_for_forged_hotmail_received_headers()
472
473 # this, by comparison is more common: from was @hotmail.com, but it wasn't
474 header FORGED_HOTMAIL_RCVD2 eval:check_for_no_hotmail_received_headers()
475 describe FORGED_HOTMAIL_RCVD2 hotmail.com 'From' address, but no 'Received:'
476
477 header __FORGED_EUDORAMAIL_RCVD eval:check_for_forged_eudoramail_received_headers()
478
479 header FORGED_YAHOO_RCVD eval:check_for_forged_yahoo_received_headers()
480 describe FORGED_YAHOO_RCVD 'From' yahoo.com does not match 'Received' headers
481
482 if (version >= 3.004002)
483 header FORGED_GMAIL_RCVD eval:check_for_forged_gmail_received_headers()
484 describe FORGED_GMAIL_RCVD 'From' gmail.com does not match 'Received' headers
485 endif
486
487 header __FORGED_JUNO_RCVD eval:check_for_forged_juno_received_headers()
488
489
490
491 header SORTED_RECIPS eval:sorted_recipients()
492 describe SORTED_RECIPS Recipient list is sorted by address
493
494 header SUSPICIOUS_RECIPS eval:similar_recipients('0.65','undef')
495 describe SUSPICIOUS_RECIPS Similar addresses in recipient list
496
497 # this is a quite common false positive, as it's legal to remove a To but leave
498 # a CC. so don't score it high.
499 header MISSING_HEADERS eval:check_for_missing_to_header()
500 describe MISSING_HEADERS Missing To: header
501
502 header DATE_IN_PAST_03_06 eval:check_for_shifted_date('-6', '-3')
503 describe DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date
504
505 header DATE_IN_PAST_06_12 eval:check_for_shifted_date('-12', '-6')
506 describe DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date
507
508 header DATE_IN_PAST_12_24 eval:check_for_shifted_date('-24', '-12')
509 describe DATE_IN_PAST_12_24 Date: is 12 to 24 hours before Received: date
510
511 header DATE_IN_PAST_24_48 eval:check_for_shifted_date('-48', '-24')
512 describe DATE_IN_PAST_24_48 Date: is 24 to 48 hours before Received: date
513
514
515 header DATE_IN_PAST_96_XX eval:check_for_shifted_date('undef', '-96')
516 describe DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
517
518 header DATE_IN_FUTURE_03_06 eval:check_for_shifted_date('3', '6')
519 describe DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date
520
521 header DATE_IN_FUTURE_06_12 eval:check_for_shifted_date('6', '12')
522 describe DATE_IN_FUTURE_06_12 Date: is 6 to 12 hours after Received: date
523
524 header DATE_IN_FUTURE_12_24 eval:check_for_shifted_date('12', '24')
525 describe DATE_IN_FUTURE_12_24 Date: is 12 to 24 hours after Received: date
526
527 header DATE_IN_FUTURE_24_48 eval:check_for_shifted_date('24', '48')
528 describe DATE_IN_FUTURE_24_48 Date: is 24 to 48 hours after Received: date
529
530 header DATE_IN_FUTURE_48_96 eval:check_for_shifted_date('48', '96')
531 describe DATE_IN_FUTURE_48_96 Date: is 48 to 96 hours after Received: date
532
533 #header DATE_IN_FUTURE_96_XX eval:check_for_shifted_date('96', 'undef')
534 meta DATE_IN_FUTURE_96_XX (0)
535 describe DATE_IN_FUTURE_96_XX Date: is 96 hours or more after Received: date
536
537 header UNRESOLVED_TEMPLATE eval:check_unresolved_template()
538 describe UNRESOLVED_TEMPLATE Headers contain an unresolved template
539
540 header SUBJ_ALL_CAPS eval:subject_is_all_caps()
541 describe SUBJ_ALL_CAPS Subject is all capitals
542
543
544 header LOCALPART_IN_SUBJECT eval:check_for_to_in_subject('user')
545 describe LOCALPART_IN_SUBJECT Local part of To: address appears in Subject
546
547 header MSGID_OUTLOOK_INVALID eval:check_outlook_message_id()
548 describe MSGID_OUTLOOK_INVALID Message-Id is fake (in Outlook Express format)
549
550 header HEADER_COUNT_CTYPE eval:check_header_count_range('Content-Type','2','999')
551 describe HEADER_COUNT_CTYPE Multiple Content-Type headers found
552
553 endif
554
555 ###########################################################################
556
557 ifplugin Mail::SpamAssassin::Plugin::MIMEEval
558
559 # this is also mostly-theoretical, so allow 0 hits
560 header HEAD_LONG eval:check_msg_parse_flags('truncated_header')
561 describe HEAD_LONG Message headers are very long
562 tflags HEAD_LONG userconf
563
564 header MISSING_HB_SEP eval:check_msg_parse_flags('missing_head_body_separator')
565 describe MISSING_HB_SEP Missing blank line between message header and body
566 tflags MISSING_HB_SEP userconf
567
568 endif
569
570 ###########################################################################
571
572 ifplugin Mail::SpamAssassin::Plugin::RelayEval
573
574 header __UNPARSEABLE_RELAY_COUNT eval:check_relays_unparseable()
575 tflags __UNPARSEABLE_RELAY_COUNT userconf
576
577 meta UNPARSEABLE_RELAY (__UNPARSEABLE_RELAY_COUNT >= 1)
578 tflags UNPARSEABLE_RELAY userconf
579 describe UNPARSEABLE_RELAY Informational: message has unparseable relay lines
580
581
582 header RCVD_HELO_IP_MISMATCH eval:helo_ip_mismatch()
583 describe RCVD_HELO_IP_MISMATCH Received: HELO and IP do not match, but should
584
585 # not used directly right now due to FPs; but CONFIRMED_FORGED turns it
586 # into a 1.0 S/O rule anyway, so that's not a problem ;)
587 # 2.626 3.6340 1.5251 0.704 0.34 1.44 FORGED_RCVD_TRAIL
588 # 0.956 3.3890 0.0000 1.000 0.98 4.30 CONFIRMED_FORGED
589 header __FORGED_RCVD_TRAIL eval:check_for_forged_received_trail()
590
591 header NO_RDNS_DOTCOM_HELO eval:check_for_no_rdns_dotcom_helo()
592 describe NO_RDNS_DOTCOM_HELO Host HELO'd as a big ISP, but had no rDNS
593
594 endif
595
596 ifplugin Mail::SpamAssassin::Plugin::HeaderEval
597
598 header __ENV_AND_HDR_FROM_MATCH eval:check_for_matching_env_and_hdr_from()
599
600 endif
601