home *** CD-ROM | disk | FTP | other *** search
/ ftp.f-secure.com / 2014.06.ftp.f-secure.com.tar / ftp.f-secure.com / support / hotfix / fsis / IS-SpamControl.fsfix / iufssc / rules / 96_fs-suspect.cf < prev    next >
Text File  |  2006-11-29  |  37KB  |  1,011 lines

  1. # 96_fs-suspect.cf -- era Thu Nov 25 15:27:28 2004
  2. # Copyright (C) 2004-2006 F-Secure Corporation
  3. # $Id: 96_fs-suspect.cf 4093 2006-11-02 12:22:52Z eriker $
  4.  
  5. ifplugin FS::MsgStructure
  6.  
  7.  
  8. # rule: MSGSTRUCT_RATWARE_GET_CAPABLE
  9. # created 2004-11-18 or thereabouts
  10. # edit 2005-01-25: allow multipart/related as well as multipart/alternative
  11. # edit 2005-01-25: MIME separator can be Java [sic!] instead of ----=_NextPart_
  12. # edit 2005-05-16: permit any allowable MIME boundary separator string
  13. # test: spam-2005-01-25/-3288733836-1106534578.V802I3c2d2.localhost.localdomain
  14. # test: spam-2005-01-25/-3288707794-1106592792.V802I3dbff.localhost.localdomain
  15. # test: spam-2005-05-16/df-2005-05-16-006062.txt
  16. # tracker: ratware-get-capable
  17.  
  18. define_structure MSGSTRUCT_RATWARE_GET_CAPABLE
  19. structure ^This is a multi-part message in MIME format\.\n\n
  20. structure -{2}[-=_.0-9A-Za-z]{7,64}\n
  21. structure Content-Type: multipart/(?:related|alternative);\n
  22. structure (?: ){8}boundary="([-=_.0-9A-Za-z]{7,64})"\n\n
  23. structure -{2}\1\n
  24. structure Content-Type: text/plain;\n
  25. structure (?: ){8}charset="us-ascii"\n
  26. structure Content-Transfer-Encoding: 7bit\n\n
  27. structure Get a capable html e-mailer\n\n\n
  28. structure -{2}\1\n
  29. describe MSGSTRUCT_RATWARE_GET_CAPABLE Ratware "Get a capable html e-mailer"
  30. score     MSGSTRUCT_RATWARE_GET_CAPABLE 20
  31.  
  32.  
  33.  
  34. # rule: MSGSTRUCT_ASCII_BASE64
  35. # added 2005-05-18
  36. # test: spam-2005-05-18/df-2005-05-18-001520.txt
  37.  
  38. define_structure MSGSTRUCT_ASCII_BASE64
  39. structure (?:^)
  40. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  41. structure MIME-Version: 1\.0\n
  42. structure Content-Type: text/plain\n
  43. structure Content-Transfer-Encoding: base64\n
  44.  
  45. describe MSGSTRUCT_ASCII_BASE64 MIME lacks explicit charset, uses base64 text
  46. score     MSGSTRUCT_ASCII_BASE64 3
  47.  
  48.  
  49.  
  50. # rule: MIME_BOUNDARY_SQ
  51. # added 2005-05-18
  52. # test: spam-2005-05-18/df-2005-05-18-001932.txt
  53.  
  54. define_structure MIME_BOUNDARY_SQ
  55. structure (?:^)
  56. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  57. structure MIME-Version: 1\.0\n
  58. structure Content-Type: multipart/(?:related|alternative);\n
  59. structure     \tboundary="--(?:[-0-9]{3,15}\[[0-9]\]){3}"\n
  60.  
  61. describe MIME_BOUNDARY_SQ Nonstandard MIME boundary with square brackets in it
  62. score     MIME_BOUNDARY_SQ 3
  63.  
  64.  
  65. # rule: MIME_BOUNDARY_MASSIVELY_ILLEGAL
  66. # added 2005-05-19
  67. # test: spam-2005-05-19/df-2005-05-19-000763.txt
  68.  
  69. define_structure MIME_BOUNDARY_MASSIVELY_ILLEGAL
  70. structure (?:^)
  71. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  72. structure MIME-Version: 1\.0\n
  73. structure Content-Type: multipart/(?:related|alternative);\n
  74. structure     \tboundary="--(?:[-=0-9A-Za-z.]{0,20}[^-=0-9A-Za-z.\"]){4,20}"
  75.  
  76. describe MIME_BOUNDARY_MASSIVELY_ILLEGAL Multple disallowed characters
  77. score     MIME_BOUNDARY_MASSIVELY_ILLEGAL 7
  78.  
  79.  
  80.  
  81. # rule: MSGSTRUCT_MIME_ASCII_8BIT_REL
  82. # added 2005-05-13
  83. # edit 2005-05-16: rename to distinguish sigle-part from multipart/related
  84. # test: spam-2005-05-13/df-2005-05-13-001185.txt
  85. # test: spam-2005-05-13/df-2005-05-13-005515.txt
  86. # test: spam-2005-05-13/df-2005-05-13-005503.txt
  87.  
  88. define_structure MSGSTRUCT_MIME_ASCII_8BIT_REL
  89. structure (?:^)
  90. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  91. structure MIME-Version: 1\.0\n
  92. # telltale sign #1: X-MimeOLE between Mime-Version and Content-Type
  93. structure X-MimeOLE: Produced By Microsoft (?:Exchange|MimeOLE)
  94. structure     (?: )V[1-9][0-9]?\.[0-9]{1,2}\.[0-9]{4}\.[0-9]{1,4}\n
  95. # telltale sign #2: multipart/related
  96. structure Content-Type: multipart/related;\n
  97. structure  \tboundary="(--[-A-Za-z0-9._]{5,65})"\n
  98. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  99. # telltale sign #3: no MIME preamble
  100. structure \n--\1\n
  101. # telltale sign #4: Content is text/plain us-ascii 8bit (sic)
  102. structure Content-Type: text/plain; charset=us-ascii\n
  103. structure Content-Transfer-Encoding: 8bit\n\n
  104.  
  105. describe MSGSTRUCT_MIME_ASCII_8BIT_REL Multipart/related, first is ASCII/8bit
  106. score     MSGSTRUCT_MIME_ASCII_8BIT_REL 4
  107.  
  108.  
  109. # rule: MSGSTRUCT_MIME_ASCII_8BIT
  110. # added 2005-05-16
  111. # test: spam-2005-05-16/df-2005-05-16-004390.txt
  112. # test: spam-2005-05-16/df-2005-05-16-007205.txt
  113. # test: spam-2005-05-16/df-2005-05-16-007166.txt
  114. # test: spam-2005-05-16/df-2005-05-16-007192.txt
  115. # test: spam-2005-05-16/df-2005-05-16-007198.txt
  116.  
  117. define_structure MSGSTRUCT_MIME_ASCII_8BIT
  118. structure (?:^)
  119. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  120. # telltale sign #1: From, To, Subject, Date before MIME-Version
  121. structure From: "([^\"]{0,64})"
  122. structure  (?: )<([-A-Za-z0-9._%=]{1,50}\@[-A-Za-z0-9.]{5,64})>\n
  123. structure To: .{1,300}(\n[ \t].{1,300}){0,200}\n
  124. # telltale sign #1.5: base64-encoded Subject (not acting on that here)
  125. structure Subject: .{1,300}(\n[ \t].{1,300}){0,200}\n
  126. structure Date:
  127. structure  (?: )(?:Mon|T(?:ue|hu)|Wed|Fri|S(?:at|un)), [ 0-3][0-9]
  128. structure  (?: )(?:J(?:an|u[nl])|Feb|Ma[ry]|A(?:pr|ug)|Sep|Oct|Nov|Dec)
  129. structure  (?: )[12][0-9]{3} [012][0-9](?::[0-5][0-9]){2}
  130. # weird forgery: time zone +310000
  131. #          #(?: )[+-][01][0-9][0-5]0\n
  132. structure  (?: )[-+][0-9]{4,6}\n
  133. # so here's the MIME-Version header
  134. structure MIME-Version: 1\.0\n
  135. # telltale sign #2: X-headers between Mime-Version and Content-Type
  136. structure X-Sender: <\2>\n
  137. structure Sender: <\2>\n
  138. # variation: with or without Reply-To:
  139. structure (?:Reply-To: "\1" <\2>\n)?
  140. # telltale sign #2.5: slightly weird In-Reply-To: (not acting on that here)
  141. structure In-Reply-To: <[-.=_0-9A-Za-z\$]{5,64}\@[-A-Za-z0-9.]{3,64}>\n
  142. # some variations observed here ...
  143. structure (?:
  144. structure    (?:X-Priority: 3 \(Normal\)\n
  145. structure       X-MSMail-Priority: Normal\n)?
  146. # order of these may vary; mimole may be missing (for simplicity, allow either)
  147. structure    (?:X-Mailer: Microsoft Outlook(?: IMO)?,
  148. structure                 (?: )Build [1-9][0-9]?(?:\.[0-9]{1,4}){1,2}
  149. structure                 (?: \([1-9]\.[0-9]{1,2}(?:\.[0-9]{1,4}){1,2}\))?\n|
  150. structure       X-M[Ii][Mm][Ee]OLE: Produced By Microsoft (?:MimeOLE|Exchange)
  151. structure               (?: )V[5-9]\.[0-9]{1,2}\.[0-9]{1,4}\.[0-9]{1,4}\n){1,2}
  152. structure  |
  153. structure    X-Mailer: .{1,64}\n)
  154. # telltale sign #2: text/plain; charset=us-ascii, CTE 8bit
  155. structure Content-Type: text/plain;\n
  156. structure  \tcharset="us-ascii"\n
  157. structure Content-Transfer-Encoding: 8bit\n
  158.  
  159. describe MSGSTRUCT_MIME_ASCII_8BIT MIME single body part US-ASCII/8bit
  160. score     MSGSTRUCT_MIME_ASCII_8BIT 4
  161.  
  162.  
  163. # rule: SUBJ_BASE64_GRATUITOUS
  164. # added 2005-05-16
  165. # test: spam-2005-05-16/df-2005-05-16-007192.txt
  166.  
  167. header __SUBJ_BASE64 Subject:raw =~ /^=\?(?:[Ii][Ss][Oo]-8859-15?|[Uu][Ss]-[Aa][Ss][Cc][Ii][Ii])\?[Bb]\?/
  168. header __SUBJ_8BIT Subject =~ /[\x80-\xFF]/
  169. # Do not trigger on a final control character (\0, \n, whatever)
  170. header __SUBJ_CTRL Subject =~ /[\x00-\x1F]./
  171. meta     SUBJ_BASE64_GRATUITOUS (__SUBJ_BASE64 && !__SUBJ_8BIT && !__SUBJ_CTRL)
  172. describe SUBJ_BASE64_GRATUITOUS Subject needlessly base64-encoded
  173. score     SUBJ_BASE64_GRATUITOUS 4
  174.  
  175.  
  176.  
  177. # rule: MSGSTRUCT_DATE_IN_BODY
  178. # added 2005-05-16
  179. # test: spam-2005-05-16/df-2005-05-16-003356.txt
  180. # target: semi-rare
  181.  
  182. define_structure MSGSTRUCT_DATE_IN_BODY
  183. structure (?:^)
  184. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  185. # Here's the Date: header
  186. structure Date: (
  187. structure       (?:Mon|T(?:ue|hu)|Wed|Fri|S(?:at|un)), [ 0-3][0-9]
  188. structure  (?: )(?:J(?:an|u[nl])|Feb|Ma[ry]|A(?:pr|ug)|Sep|Oct|Nov|Dec)
  189. structure  (?: )[12][0-9]{3} [012][0-9](?::[0-5][0-9]){2} [-+][01][0-9][0-5]0)
  190. ######## TODO: maybe (TZZ) too?
  191. structure  \n
  192. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  193. structure \n
  194. structure (?:.{0,1023}\n){0,50}
  195. structure .{0,999}\1\n
  196.  
  197. describe MSGSTRUCT_DATE_IN_BODY Contents of Date header repeated in body
  198. score     MSGSTRUCT_DATE_IN_BODY 4
  199.  
  200.  
  201.  
  202. # rule: MSGSTRUCT_HTTP_HEADERS
  203. # added 2005-05-19
  204. # test: spam-2005-05-19/df-2005-05-19-000344.txt
  205. # test: spam-2005-05-19/df-2005-05-19-002153.txt
  206. # test: spam-2005-05-19/df-2005-05-19-000246.txt
  207.  
  208. define_structure MSGSTRUCT_HTTP_HEADERS
  209. structure (?:^)
  210. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  211. structure From: .{1,1019}\n
  212. # telltale sign #1: HTTP-type headers after From:
  213. structure (?:(?:User-Agent|(?:X-)?Accept-Language): .{1,999}\n
  214. structure    (?:[ \t].{0,1023}\n){0,50}){1,5}
  215. # skip up to MIME-Version just in case we missed some ...
  216. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  217. structure MIME-Version: 1\.0\n
  218. # telltale sign #2: To: and Cc: and Subject: before Content-*
  219. structure To: .{1,1024}\n
  220. # telltale sign #3: Cc: always present, with >= two addresses, <= two per line
  221. structure Cc: [^,]{5,64}(?:, [^,]{5,64})?
  222. structure    (?:(?:,\n\t[^,]{5,64}(?:, [^,]{5,64})?){0,20}
  223. structure       ,\n\t[^,]{5,64}(, [^,]{5,64})?)?\n
  224. structure Subject: .{1,1024}\n
  225. structure    (?:[ \t].{0,1023}\n){0,50}
  226. structure Content-Type:
  227.  
  228. describe MSGSTRUCT_HTTP_HEADERS HTTP headers between From and MIME-Version
  229. score     MSGSTRUCT_HTTP_HEADERS 7
  230.  
  231.  
  232. # rule: URI_RAW_CR
  233. # added 2005-05-19
  234. # test: spam-2005-05-19/df-2005-05-19-009927.txt
  235.  
  236. uri     URI_RAW_CR /\r/
  237. describe URI_RAW_CR URI contains raw carriage return
  238. score     URI_RAW_CR 7
  239.  
  240.  
  241.  
  242. # rule: MSGSTRUCT_PLAINTEXT_QUOTATIONS
  243. # added 2005-05-10
  244. # test: spam-2005-05-10/df-2005-05-10-000325.txt
  245. # test: spam-2005-05-10/df-2005-05-10-000358.txt
  246. # test: spam-2005-05-10/df-2005-05-10-000571.txt
  247. # test: spam-2005-05-10/df-2005-05-10-002958.txt
  248. # test: spam-2005-05-10/df-2005-05-10-005705.txt
  249.  
  250. define_structure MSGSTRUCT_PLAINTEXT_QUOTATIONS
  251. # Headers
  252. structure (?:^)
  253. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  254. # MIME headers
  255. structure MIME-Version: 1\.0\n
  256. structure Content-Type: multipart/alternative;\n
  257. structure    \tboundary="(----=_NextPart_[_0-9A-F]{17}\.[0-9A-F]{8})"\n
  258. structure X-Priority: 3\n
  259. structure X-MSMail-Priority: Normal\n
  260. structure X-Mailer: Microsoft Outlook Express 6\.00(?:\.[0-9]{4}){2}\n
  261. structure X-MimeOLE: Produced By Microsoft MimeOLE V6\.00\.[0-9]{4}\.[0-9]{3}\n
  262. # Allow for more headers
  263. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  264. # Neck
  265. structure \n
  266. # Body
  267. structure This is a multi-part message in MIME format\.\n\n
  268. # text/plain part
  269. structure --\1\n
  270. structure Content-Type: text/plain;\n
  271. structure    \tcharset="(?:
  272. structure     [Ii][Ss][Oo]-8859-[1-9][0-5]?|[Uu][Ss]-[Aa][Ss][Cc][Ii][Ii]
  273. structure    )"\n
  274. structure Content-Transfer-Encoding: (?:quoted-printable|7bit)\n\n
  275. # Now, a long sequence of comma-separated quotations
  276. structure (?:".{1,1022}",\n){5,60}\n{1,5}
  277. # HTML part
  278. structure --\1\n
  279. structure Content-Type: text/html
  280.  
  281. describe MSGSTRUCT_PLAINTEXT_QUOTATIONS Text part with comma-separated quotes
  282. score     MSGSTRUCT_PLAINTEXT_QUOTATIONS 7
  283.  
  284.  
  285. # rule: MSGSTRUCT_BOGUS_ISO_CHARSET
  286. # added 2004-07-14
  287. # edit 2005-05-11: reimplemented as MSGSTRUCT rule
  288. # test: spam-2005-05-11/df-2005-05-11-000082.txt
  289.  
  290. define_structure MSGSTRUCT_BOGUS_ISO_CHARSET
  291. structure (?:^)
  292. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  293. structure MIME-Version: 1\.0\n
  294. structure Content-Type: multipart/alternative;\n
  295. structure    \tboundary="(--[-A-Za-z0-9]{5,70})"\n
  296. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  297. structure \n
  298. structure --\1\n
  299. structure Content-Type: text/plain;\n
  300. structure     \tcharset="iso-(?!8859|2202)[0-9A-F]{4}-[0-9A-F]?"\n
  301.  
  302. describe MSGSTRUCT_BOGUS_ISO_CHARSET Bogus iso-xxxx-y charset designator
  303. score MSGSTRUCT_BOGUS_ISO_CHARSET 5
  304.  
  305.  
  306. # rule: MSGSTRUCT_RATWARE_MIME_CHARSET_OPENSQ
  307. # added 2005-01-07
  308. # test: spam-2005-01-07/1772148336-1105016916.V802I3cdbb.localhost.localdomain
  309. # test: spam-2005-01-07/1772148340-1105016918.V802I3cdbc.localhost.localdomain
  310.  
  311. define_structure MSGSTRUCT_RATWARE_MIME_CHARSET_OPENSQ
  312. structure \n
  313. structure --[-=_A-Za-z0-9]{14,60}\n
  314. structure Content-[Tt]ype: text/(?:plain|html);(?:\n?[ \t]{1,7})
  315. structure [Cc][Hh][Aa][Rr][Ss][Ee][Tt]="?[Ii][Ss][Oo]-[-0-9]{0,12}
  316. structure \[
  317.  
  318. describe MSGSTRUCT_RATWARE_MIME_CHARSET_OPENSQ Non-MIME charset with "[" in it
  319. score MSGSTRUCT_RATWARE_MIME_CHARSET_OPENSQ 7
  320.  
  321.  
  322. # rule: MSGSTRUCT_HEADER_BLEED
  323. # added 2005-01-25
  324. # test: spam-2005-01-25/-3288731599-1106539307.V802I3c50e.localhost.localdomain
  325. # test: spam-2005-01-25/-3288706991-1106594468.V802I3dcc6.localhost.localdomain
  326. # target: semi-rare
  327.  
  328. define_structure MSGSTRUCT_HEADER_BLEED
  329. structure ^(?:.{4,90}\n)?
  330. structure (?:(?:Received|From|To|Subject|Date|
  331. structure    Mime-Version|Content-Type|Content-Transfer-Encoding|
  332. structure    X-[-A-Za-z0-9]{1,50}):.{1,300}\n
  333. structure (?:[ \t].{4,90}\n){0,3}){4}
  334.  
  335. describe MSGSTRUCT_HEADER_BLEED Headers spilling into beginning of body
  336. score MSGSTRUCT_HEADER_BLEED 3
  337.  
  338. # rule: MSGSTRUCT_FORGED_FROM_IP_PAREN_PORT_HELO
  339. # added 2005-05-12
  340. # edit 2005-05-13: allow longer and case variations in helo=[string]
  341. # test: spam-2005-05-12/df-2005-05-12-001462.txt
  342. # test: spam-2005-05-13/df-2005-05-13-006295.txt
  343. # test: spam-2005-05-13/df-2005-05-13-006296.txt
  344. # test: spam-2005-05-13/df-2005-05-13-006298.txt
  345.  
  346. define_structure MSGSTRUCT_FORGED_FROM_IP_PAREN_PORT_HELO
  347. structure (?:^)
  348. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  349. # telltale sign #1: from [IP] (port=\d+ helo=[weird])<nl>
  350. structure Received: from \[[1-9][.0-9]{6,14}\] \(port=\d{1,5}
  351. structure    (?: )helo=\[[A-Za-z0-9.]{1,60}\]\)\n
  352. # telltale sign #2: space after lowercase "with esmtp"
  353. structure   (?:    )by [-A-Za-z0-9.]{5,64} with esmtp(?: )\n
  354. # telltale sign #3: weird queue id (first sample has "guerrilla" in it)
  355. structure   (?:    )id \d{5,12}[A-Za-z0-9]{10,64}\n
  356. # telltale sign #4: no <brokets> around "for" address
  357. structure   (?:    )for [-A-Za-z0-9._%=]{1,50}\@[-A-Za-z0-9.]{5,64};
  358. structure  (?: )(?:Mon|T(?:ue|hu)|Wed|Fri|S(?:at|un)), [ 0-3][0-9]
  359. structure  (?: )(?:J(?:an|u[nl])|Feb|Ma[ry]|A(?:pr|ug)|Sep|Oct|Nov|Dec)
  360. structure  (?: )[12][0-9]{3} [012][0-9](?::[0-5][0-9]){2} [+-][01][0-9][0-5]0\n
  361. structure (?:(?!Received:)[A-Za-z0-9].{0,1023}\n
  362. structure    (?:[ \t].{0,1023}\n){0,50}){0,50}
  363. structure \n
  364.  
  365. describe MSGSTRUCT_FORGED_FROM_IP_PAREN_PORT_HELO Clumsy forged Received header
  366. score     MSGSTRUCT_FORGED_FROM_IP_PAREN_PORT_HELO 4
  367.  
  368.  
  369. # rule: MSGSTRUCT_HELO_VICTIM_IP
  370. # added 2005-01-28
  371. # test: spam-2005-01-28/-3029589561-1106835902.V802I3d6d9.localhost.localdomain
  372. # This handles a special case which makes do without any DNS whatsoever.
  373. # It requires that the receiving host is a relay which stamps in a sensible
  374. # header with Received: information which includes its own IP address.
  375. ######## TODO: handle general case where DNS access is required
  376. ######## TODO: extend to handle Exim etc headers
  377.  
  378. define_structure MSGSTRUCT_HELO_VICTIM_IP
  379. structure \nReceived: from .{1,70}[[(]
  380. structure (
  381. structure (?:1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)\.
  382. structure (?:0|1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-5]?|[6-9])?|[3-9][0-9]?)\.
  383. structure (?:0|1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-5]?|[6-9])?|[3-9][0-9]?)\.
  384. structure (?:1[0-9]{0,2}|2(?:[0-4][0-9]?|5[0-4]?|[6-9])?|[3-9][0-9]?)
  385. structure )[])].{0,200}\n
  386. structure (?:.{1,300}\n){0,64}
  387. structure Received: (?:from \1)
  388. ######## TODO: handle Exim Received: format
  389.  
  390. describe MSGSTRUCT_HELO_VICTIM_IP HELOs with IP address of victim host
  391. score MSGSTRUCT_HELO_VICTIM_IP 3
  392.  
  393.  
  394. # rule: FS_HELO_VICTIM_DOMAIN
  395. # added 2005-09-13
  396. # edit 2006-02-17: tweak down score significantly
  397. # test: ######## TODO: provide sample
  398. # temp: silly/00026.msg
  399.  
  400. header     __FS_HELO_VICTIM_DOMAIN X-Spam-Relays-Untrusted =~ / helo=([^ ]+) by=(?:[^ ]+\.)?\1 [^\]]*\]\s*$/
  401. header     __FS_HELO_SAME_DOMAIN    X-Spam-Relays-Untrusted =~ / rdns=(?:[^ ]+\.)?([^ ]+) helo=\1 by=(?:[^ ]+\.)?\1 [^\]]*\]\s*$/
  402.  
  403. meta     FS_HELO_VICTIM_DOMAIN (__FS_HELO_VICTIM_DOMAIN && ! __FS_HELO_SAME_DOMAIN)
  404. describe FS_HELO_VICTIM_DOMAIN HELOs with domain name of victim
  405. score     FS_HELO_VICTIM_DOMAIN 0.5
  406.  
  407.  
  408.  
  409. # rule: FS_URL_IMAGE_DIR_NONIMAGE
  410. # added 2006-04-20
  411. # test: phishing-samples@fs/d-fence/virus-gT20n+eyCWAM.msg
  412.  
  413. uri     FS_URL_IMAGE_DIR_NONIMAGE m{/(?:images|pics?|img|gif)/+(?:[^/]+/+)+[^/]+\.html$}
  414. describe FS_URL_IMAGE_DIR_NONIMAGE Suspect link to HTML in subdir of image dir
  415. score     FS_URL_IMAGE_DIR_NONIMAGE 0.5
  416.  
  417.  
  418.  
  419. # rule: FS_PHP_MAIL
  420. # added 2006-04-20
  421. # edit 2006-11-01: protect against regex recursion
  422. # test: phishing-samples@fs/d-fence/virus-9GDL4yaY7EqL.msg
  423. # test: phishing-samples@fs/d-fence/virus-gT20n+eyCWAM.msg
  424.  
  425. header     __FS_PHP_X_SCRIPT exists:X-PHP-Script
  426.  
  427. define_structure __FS_STRUCT_PHP_MAIL
  428. structure (?:^)
  429. structure (?:(?!X-AntiAbuse:).{1,1023}\n)+
  430. structure X-AntiAbuse: This header was added to track abuse,[ ]
  431. structure  please include it with any abuse report\n
  432. structure X-AntiAbuse: Primary Hostname - .{1,120}\n
  433. structure X-AntiAbuse: Original Domain - .{1,120}\n
  434. structure X-AntiAbuse: Originator/Caller UID/GID - .{1,120}\n
  435. structure X-AntiAbuse: Sender Address Domain -
  436.  
  437. meta     FS_PHP_MAIL (__FS_PHP_X_SCRIPT || __FS_STRUCT_PHP_MAIL)
  438. describe FS_PHP_MAIL Message was sent via PHPmail (open webmail form?)
  439. score     FS_PHP_MAIL 0.1
  440.  
  441.  
  442.  
  443.  
  444. # rule: FS_RATWARE_RECEIVED_IP_BIGINT
  445. # added 2006-04-25
  446. # test: phishing-samples@fs/d-fence/virus-L4f6i-I6ZYNU.msg
  447. # test: phishing-samples@fs/d-fence/virus-sCMSOp7E7K1Q.msg
  448.  
  449. define_structure FS_RATWARE_RECEIVED_IP_BIGINT
  450. structure (?:^)
  451. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  452. structure Received: from [-\@:A-Za-z0-9_.]{1,70}
  453. # The beef: spoofed reverse DNS and IP are a big (optionally negative) integer
  454. structure  [ ]\(-?[0-9]{8,20} \[-?[0-9]{8,20}\]\)\n
  455. # Received: header is continued over several lines
  456. structure  (?:[ \t].{0,1023}\n){1,50}
  457. # Permit additional headers, as long as they are not Received: headers
  458. structure (?:(?!Received:)[A-Za-z0-9].{0,1023}\n
  459. structure    (?:[ \t].{0,1023}\n){0,50}){0,50}
  460. structure \n
  461.  
  462. describe FS_RATWARE_RECEIVED_IP_BIGINT Received: from 12345678 ([23456789])
  463. score     FS_RATWARE_RECEIVED_IP_BIGINT 9
  464.  
  465.  
  466.  
  467. # rule: FS_RATWARE_THEBAT_X15
  468. # added 2006-05-18
  469. # edit 2006-05-19: additional variations in unreg key; rename rule accordingly
  470. # test: df-2006-05-18-007226.txt
  471. # test: df-2006-05-19-007793.txt
  472. # test: df-2006-05-19-004255.txt
  473. # test: df-2006-05-19-004651.txt
  474. # fail: reference-ham/0004the-bat-365pro.eml
  475. # fail: reference-ham/0005the-bat-211unreg.eml
  476. # fail: reference-ham/0006the-bat-200unreg.eml
  477.  
  478. header     FS_RATWARE_THEBAT_X15 X-Mailer =~ m{^The Bat! \(v\d\.\d+\.\d+(?:\.\d+)?\) [A-Za-z0-9]{15,18}$}
  479. describe FS_RATWARE_THEBAT_X15 Forged The Bat! -- invalid unreg. key
  480. score     FS_RATWARE_THEBAT_X15 5
  481.  
  482.  
  483.  
  484. # rule: FS_RATWARE_X_MAILER_EMPTY_X15
  485. # added 2006-05-19
  486. # test: df-2006-05-19-002852.txt
  487. # test: df-2006-05-19-004257.txt
  488.  
  489. header     FS_RATWARE_X_MAILER_EMPTY_X15 X-Mailer =~ m{^\(v\d\.\d+\.\d+(?:\.\d+)?\) [A-Za-z0-9]{15,18}$}
  490. describe FS_RATWARE_X_MAILER_EMPTY_X15 X-Mailer with only (vn.n.n) KEYFN0RDD
  491. score     FS_RATWARE_X_MAILER_EMPTY_X15 5
  492.  
  493.  
  494.  
  495. # rule: FS_MSGSTRUCT_HTML_NESTED_A_HREF
  496. # added 2006-05-22
  497. # edit 2006-05-31: tighten up regex
  498. # test: d-fence/virus-0TJiYpzmLasU.msg
  499. # fail: hard_ham/00015.ada83ed8f5e09b7dd5b268dafb0d7e8d
  500. # fail: hard_ham/00082.a405e76faf9463d464229306b1e0c93f
  501.  
  502. define_structure FS_MSGSTRUCT_HTML_NESTED_A_HREF
  503. structure <[Aa]\s+[Hh][Rr][Ee][Ff]=[^<>]+>
  504. structure (?:[^<]|<[^/\s]|<\s*/[^Aa\s]|<\s*/\s*[Aa][^\s>]){0,99}
  505. structure <[Aa]\s+[Hh][Rr][Ee][Ff]=
  506.  
  507. describe FS_MSGSTRUCT_HTML_NESTED_A_HREF Nested <a href> tags in HTML
  508. score     FS_MSGSTRUCT_HTML_NESTED_A_HREF 5
  509.  
  510.  
  511.  
  512. # rule: FS_HTML_JS_OBFU
  513. # added 2006-05-22
  514. # edit 2006-09-18: tighten regex slightly; samples were wrong
  515. # test: d-fence/virus-4mJ68OLM+Ax8.msg
  516. # test: d-fence/virus-P7Fn5j1Grjgf.msg
  517.  
  518. full     FS_HTML_JS_OBFU m{<\s*(?:(?!script|type=)[^<>]*)\s(?:type=("?)text/_javascript\1|language=("?)_javascript\2)[^<>]*>\s*<\s*/\s*script\s*>}i
  519. describe FS_HTML_JS_OBFU JavaScript with invalid <script> tag
  520. score     FS_HTML_JS_OBFU 9
  521.  
  522.  
  523.  
  524. # rule: MSGSTRUCT_SUBJECT_DATE_BLEED
  525. # added 2005-01-26
  526. # test: spam-2005-01-26/-3202406723-1106620521.V802I3c1e0.localhost.localdomain
  527.  
  528. define_structure MSGSTRUCT_SUBJECT_DATE_BLEED
  529. structure \nSubject:.{1,200}
  530. # RFC822 date stamp, starting with day of week
  531. structure ((?:Mon|T(?:ue|hu)|Wed|Fri|S(?:at|un)),
  532. # day of month and month
  533. structure (?: )[ 0-3][0-9] (?:Jan|Feb|Ma[ry]|Apr|Ju[nl]|Aug|Sep|Oct|Nov|Dec)
  534. # year
  535. structure (?: (?:19[7-9]|2[01][0-9])[0-9] )
  536. # time
  537. structure [0-2][0-9]:[0-5][0-9]:[0-5][0-9]
  538. # optional time zone
  539. structure (?: [+-][01][0-9][013][05]
  540. # Optional time zone name.
  541. # <http://www.worldtimezone.com/wtz-names/timezonenames.html> lists a zillion
  542. # but only a few are actually in common use.
  543. # Anyway, accept any 2-3 uppercase chars followed by "T"
  544. structure (?: \([A-Z]{2,3}T\))?)?\n)
  545. # And now a Date: header immediately after, containing the same date stamp
  546. structure Date: \1
  547.  
  548. describe MSGSTRUCT_SUBJECT_DATE_BLEED Subject contains Date:
  549. score MSGSTRUCT_SUBJECT_DATE_BLEED 10
  550.  
  551.  
  552. # rule: MSGSTRUCT_CP1252_7BIT_BOGUS
  553. # added 2005-05-13
  554. # test: spam-2005-05-13/df-2005-05-13-002617.txt
  555.  
  556. define_structure MSGSTRUCT_CP1252_7BIT_BOGUS
  557. structure ^This is a multi-part message in MIME format\.\n\n
  558. structure (--[-=_A-Za-z0-9.]{2,78}\n)
  559. structure Content-Type: text/plain;\n
  560. # telltale sign #1: Windows-1252 in proper case
  561. structure    \tcharset="Windows-1252"\n
  562. # telltale sign #2: CTE 7bit (sic)
  563. structure Content-Transfer-Encoding: 7bit\n\n
  564. # telltale sign #3: actually being neither
  565. structure (?:(?!\1)[ -~\n]{0,5}[\x80-\xFF]){9}
  566.  
  567. describe MSGSTRUCT_CP1252_7BIT_BOGUS Claims Windows-1252 / 7bit but is neither
  568. score MSGSTRUCT_CP1252_7BIT_BOGUS 3
  569.  
  570. # rule: MSGSTRUCT_CP1252_7BIT_EMPTY
  571. # added 2005-05-13
  572. # test: spam-2005-05-13/df-2005-05-13-002650.txt
  573.  
  574. define_structure MSGSTRUCT_CP1252_7BIT_EMPTY
  575. structure ^This is a multi-part message in MIME format\.\n\n
  576. structure (--[-=_A-Za-z0-9.]{2,78}\n)
  577. structure Content-Type: text/plain;\n
  578. # telltale sign #1: Windows-1252 in proper case
  579. structure    \tcharset="Windows-1252"\n
  580. # telltale sign #2: CTE 7bit (sic)
  581. structure Content-Transfer-Encoding: 7bit\n\n
  582. # telltale sign #3: the body part is empty
  583. structure \n{0,50}\1
  584.  
  585. describe MSGSTRUCT_CP1252_7BIT_EMPTY Empty Windows-1252 / 7bit (sic) body part
  586. score MSGSTRUCT_CP1252_7BIT_EMPTY 2
  587.  
  588. # rule: MSGSTRUCT_CP1252_7BIT
  589. # added 2005-05-13
  590. # test: spam-2005-05-13/df-2005-05-13-002617.txt
  591.  
  592. define_structure MSGSTRUCT_CP1252_7BIT
  593. structure ^This is a multi-part message in MIME format\.\n\n
  594. structure (--[-=_A-Za-z0-9.]{2,78}\n)
  595. structure Content-Type: text/plain;\n
  596. # telltale sign #1: Windows-1252 in proper case
  597. structure    \tcharset="Windows-1252"\n
  598. # telltale sign #2: CTE 7bit (sic)
  599. structure Content-Transfer-Encoding: 7bit\n\n
  600.  
  601. describe MSGSTRUCT_CP1252_7BIT Windows-1252 / 7bit (sic) body part
  602. score     MSGSTRUCT_CP1252_7BIT 1
  603.  
  604.  
  605. # rule: MSGSTRUCT_RATWARE_LAST_NULL
  606. # added 2005-01-26
  607. # edit 2005-05-26: single newline before null is sufficient
  608. # test: spam-2005-01-24/3241406157-1106441111.V802I3befd.localhost.localdomain
  609. # test: spam-2005-05-26/df-2005-05-26-000602.txt
  610.  
  611. define_structure MSGSTRUCT_RATWARE_LAST_NULL
  612. structure \n\000$
  613.  
  614. describe MSGSTRUCT_RATWARE_LAST_NULL Last character of message is ASCII NUL
  615. score     MSGSTRUCT_RATWARE_LAST_NULL 4.5
  616.  
  617.  
  618. # rule: MSGSTRUCT_CT_CONTD_EMPTY
  619. # added 2005-02-14
  620. # test: spam-2005-02-13/287154983-1108179865.V802I3c32e.localhost.localdomain
  621. # target: semi-rare
  622.  
  623. define_structure MSGSTRUCT_CT_CONTD_EMPTY
  624. # Workaround to get proper anchor to beginning of message headers
  625. structure (?:^)
  626. # Skip any intermediate headers
  627. structure (?:[ \tA-Z].{5,300}\n){0,50}
  628. # Up to Content-Type
  629. structure Content-[Tt]ype: [a-z/]+;[ \t]{0,20}charset="?[-a-z0-9]{5,15}"?
  630. # Here's the rub: an empty continuation on a new header line
  631. structure \n[ \t]{1,64}\n
  632.  
  633. describe MSGSTRUCT_CT_CONTD_EMPTY Content-Type: header has empty continuation
  634. score MSGSTRUCT_CT_CONTD_EMPTY 5
  635.  
  636.  
  637. # rule: MSGSTRUCT_RATWARE_MIME_PERSON_COMMA
  638. # added 2005-01-18
  639. # test: spam-2005-01-18/2722742460-1106005202.V802I3da74.localhost.localdomain
  640. # target: rare
  641.  
  642. define_structure MSGSTRUCT_RATWARE_MIME_PERSON_COMMA
  643. structure ^--[A-Za-z.0-9]{7,90}\n
  644. structure Content-[Tt]ype: text/plain;[ \t]{0,4}(?:\n[ \t]{1,19})?
  645. structure [A-Z][a-z]{2,17},\n\n
  646.  
  647. describe MSGSTRUCT_RATWARE_MIME_PERSON_COMMA MIME header bleeds into greeting
  648. score MSGSTRUCT_RATWARE_MIME_PERSON_COMMA 7
  649.  
  650.  
  651. # rule: FS_REPEATED_URL
  652. # added 2005-05-25
  653. # edit 2005-11-11: tweak down score from 5
  654. # edit 2006-09-28: regex recursion fix
  655. # test: spam-2005-05-24/df-2005-05-24-009323.txt
  656.  
  657. define_structure FS_REPEATED_URL
  658. structure \n
  659. structure (https?://[-A-Za-z0-9._]{5,200}/(?:[-A-Za-z0-9._/\?%+;]{0,200}))\n
  660. structure (?:.{0,1024}\n){0,200}
  661. structure \1
  662.  
  663. describe FS_REPEATED_URL The same URL alone on a line twice
  664. score     FS_REPEATED_URL 1
  665.  
  666.  
  667.  
  668. # rule: FS_HTML_TEXTAREAxN_IMG
  669. # added 2006-10-23
  670. # test: reference-spam/textarea/2006-10-16_00-49-55_352
  671. # test: reference-spam/textarea/2006-10-16_06-03-40_163
  672. # test: reference-spam/textarea/2006-10-16_14-14-52_453
  673. # test: reference-spam/textarea/2006-10-16_15-34-32_106
  674. # test: reference-spam/textarea/2006-10-16_16-06-43_116
  675. # test: reference-spam/textarea/2006-10-16_16-26-43_036
  676. # test: reference-spam/textarea/2006-10-16_18-34-06_038
  677. # test: reference-spam/textarea/2006-10-16_23-04-35_316
  678. # test: reference-spam/textarea/2006-10-16_05-40-01_237
  679. # test: reference-spam/textarea/2006-10-16_23-59-58_512
  680. # test: reference-spam/textarea/2006-10-16_05-15-44_992
  681. # fail: reference-spam/textarea 2006-10-16_10-04-52_615 (mangled)
  682. # fail: reference-spam/textarea 2006-10-16_10-04-31_387 (mangled)
  683. # fail: reference-spam/textarea/2006-10-16_13-12-52_831
  684. # fail: reference-spam/textarea/2006-10-16_19-24-05_471
  685.  
  686. define_structure FS_HTML_TEXTAREAxN_IMG
  687. structure \n
  688. structure (?:<TEXTAREA>[^\n<>]{1,99}</TEXTAREA>\n){10}
  689. structure (?:<TEXTAREA>[^\n<>]{1,99}</TEXTAREA>
  690. structure    <TEXTAREA>[^\n<>]{1,99}</TEXTAREA>\n)?
  691. structure (?:<TEXTAREA>[^\n<>]{1,99}</TEXTAREA>\n){10,40}
  692. structure \n?</(?i:body)>\n?</(?i:html)>\n\n
  693. # capture predictable part of MIME separator into \1
  694. structure ------=_NextPart_001_000E_([0-9A-F]{8})\.[0-9A-F]{8}--\n\n
  695. # recurs here
  696. structure ------=_NextPart_000_0001_\1\.[0-9A-F]{8}\n
  697. structure Content-Type: image/jpeg;\n
  698.  
  699.  
  700. describe FS_HTML_TEXTAREAxN_IMG HTML spam, multiple TEXTAREAs + image
  701. score     FS_HTML_TEXTAREAxN_IMG 9
  702.  
  703.  
  704. # rule: MSGSTRUCT_STOX_OPTOUT
  705. # added 2005-02-24
  706. # edit 2005-03-08: generalized to just the peculiar address format
  707. # edit 2005-03-08: permit space before @
  708. # edit 2005-03-08: anchor to end of message, optional single line in between
  709. # test: spam-2005-02-24/1237624726-1109132397.V802I3c349.localhost.localdomain
  710. # test: spam-2005-03-08/2274592574-1110159471.V802I3c051.localhost.localdomain
  711.  
  712. define_structure MSGSTRUCT_STOX_OPTOUT
  713. structure (?:[ \t])\(([-~])
  714. structure [a-zA-Z+=0-9._]{2,17}
  715. structure (?: )?
  716. structure \@([A-Za-z0-9][-_A-Za-z0-9]{0,17}\.){1,5}[A-Za-z]{2,5}
  717. structure \1\)\n{1,15}
  718. structure (?:.{1,20}\n{1,15})?
  719. structure $
  720.  
  721. describe MSGSTRUCT_STOX_OPTOUT Opt-out template "opt-out language (-addr-)"
  722. score MSGSTRUCT_STOX_OPTOUT 3
  723.  
  724.  
  725. # rule: MSGSTRUCT_RATWARE_DM_HEADERS
  726. # added 2005-03-09
  727. # test: spam-2005-03-15/2879611028-1110758229.V802I3be30.localhost.localdomain
  728. #
  729. # Based on screen shot from <http://www.dark-mailer.com/dark/screenshots.asp>
  730. #
  731. # DM apparently randomizes the order of headers, so we could try to
  732. # look for random order, i.e. any order outside of the known good ones.
  733. # (Hmm, I guess actually you can configure multiple sets and it will rotate
  734. # through those sets. Yes, that's probably what rotating headers means.)
  735. #
  736. # For now, just testing for a static list in a given order, though.
  737. # This is probably configurable, but many users seem to use the default.
  738. #
  739. # (Ignoring the Received: header for now, although that would be really
  740. # telltale.)
  741.  
  742. define_structure MSGSTRUCT_RATWARE_DM_HEADERS
  743. structure (?:^)
  744. structure (?:[-A-Za-z0-9_]{1,55}:.{1,300}\n
  745. structure   (?:[ \t].{1,200}\n){0,40}
  746. structure ){0,40}
  747. structure Message-ID:.{1,120}\n
  748. structure (?:[-A-Za-z0-9_]{1,55}:.{1,300}\n){0,40}
  749. structure From:( "[^"]{1,200}" <[^<>\@"']{1,70}\@[^<>\@"']{1,70}>\n)
  750. structure Reply-To:\1
  751. structure To:.{1,200}\n
  752. structure  (?:[ \t].{1,200}\n){0,40}
  753. structure (?:Cc:.{1,200}\n
  754. structure  (?:[ \t].{1,200}\n){0,40}
  755. structure ){0,40}
  756. structure Subject:.{1,200}\n
  757. structure  (?:[ \t].{1,200}\n){0,40}
  758. structure Date:.{1,90}\n
  759. structure X-Mailer:.{1,200}\n
  760. structure MIME-Version: 1\.0\n
  761. structure Content-Type: multipart/alternative;\n
  762. ######## TODO: fixed number of spaces here? How many?
  763. structure [ \t]{1,12}boundary="([^"]{1,70})"\n
  764. structure X-Priority:.{1,90}\n
  765. structure X-MSMail-Priority:.{1,90}\n
  766. structure (?:[-A-Za-z0-9_]{1,55}:.{1,300}\n
  767. structure   (?:[ \t].{1,200}\n){0,40}
  768. structure ){0,40}
  769. structure \n{1,2}
  770. structure --\2\n
  771.  
  772. describe MSGSTRUCT_RATWARE_DM_HEADERS Headers from Dark Mailer 2.00 ratware
  773. score MSGSTRUCT_RATWARE_DM_HEADERS 9
  774.  
  775.  
  776. # rule: MSGSTRUCT_DUMP_ADDRESS_MIME
  777. # added 2005-02-14
  778. # test: spam-2005-02-13/287159407-1108188501.V802I3c788.localhost.localdomain
  779. # tracker: address-at-end 2005-02-14
  780. ######## TODO: audit for false positives
  781. ######## TODO: figure out scientific score
  782. # target: semi-rare
  783.  
  784. define_structure MSGSTRUCT_DUMP_ADDRESS_MIME
  785. # Lots of empty lines (prolly more than five, but we're liberal)
  786. structure \n{5}
  787. # Removal instruction
  788. structure (?!http)[-a-z ']{4,15}: ?
  789. # with URL (lacking http:// part)
  790. structure [A-Za-z][a-z_0-9]{1,20}(?:\.[A-Za-z0-9]{3,20}){0,4}\.[A-Za-z]{2,4}
  791. structure (/[A-Za-z0-9_]{1,19}){1,9}/?
  792. structure \n{2,4}
  793. # Followed by a massive word salad where full stops are preceded by space
  794. structure    [A-Z][-a-z']{0,19}(?: (?:[A-Za-z][-a-z']{0,19}|\.)){2,12}\n
  795. structure (?:
  796. # (Anomaly: accept full stop as first character of internal word as well)
  797. structure [A-Za-z][-a-z']{0,19}(?: (?:[.A-Za-z][-a-z']{0,19}|\.)){2,12}\n
  798. structure ){1,32}
  799. # Followed by empty line and an email address
  800. structure \n{1,3}
  801. structure [A-Za-z0-9._]{4,44}\@
  802. structure [A-Za-z][a-z_0-9]{1,20}(?:\.[A-Za-z0-9]{3,20}){0,4}\.[A-Za-z]{2,4}
  803. # Followed by optional empty line and the closing MIME boundary
  804. structure \n{0,3}
  805. structure --
  806. structure [-A-Za-z0-9_]{14,50}--
  807. structure \n{1,5}$
  808.  
  809. describe MSGSTRUCT_DUMP_ADDRESS_MIME Removal URL followed by word salad
  810. score MSGSTRUCT_DUMP_ADDRESS_MIME 7
  811.  
  812.  
  813.  
  814. # rule: FS_RATWARE_FCC_XID
  815. # added 2006-02-15
  816. # test: spam-2006-02-01/df-2006-02-01-001514.txt
  817. # test: spam-2006-02-01/df-2006-02-01-005360.txt
  818.  
  819. define_structure FS_RATWARE_FCC_XID
  820. structure (?:^)
  821. structure (?:[A-Za-z0-9].{0,1023}\n(?:[ \t].{0,1023}\n){0,50}){0,50}
  822. # telltale sign #1: FCC: header of a peculiar format
  823. structure FCC: mailbox://
  824. # grab email address into \1
  825. structure ([-_A-Za-z0-9]{1,64}
  826. structure \@(?:[A-Za-z0-9][-_A-Za-z0-9]{0,17}\.){1,5}[A-Za-z]{2,5})
  827. structure /[Ss]ent\n
  828. # immediately followed by this
  829. structure X-Identity-Key:[ \t]{1,12}[-_A-Za-z0-9]{1,90}\n
  830. structure Date:
  831. structure  (?: )(?:Mon|T(?:ue|hu)|Wed|Fri|S(?:at|un)), [ 0-3][0-9]
  832. structure  (?: )(?:J(?:an|u[nl])|Feb|Ma[ry]|A(?:pr|ug)|Sep|Oct|Nov|Dec)
  833. structure  (?: )[12][0-9]{3} [012][0-9](?::[0-5][0-9]){2}
  834. structure  (?: [+-][01][0-9][013][05]
  835. structure  (?: \([A-Z]{2,3}T\))?)?\n
  836. structure From: .{1,99} <
  837. # here's the rub -- the mailbox name again
  838. structure \1
  839. structure >\n
  840.  
  841. describe FS_RATWARE_FCC_XID Ratware with FCC: and X-Identity-Key: headers
  842. score     FS_RATWARE_FCC_XID 6
  843.  
  844.  
  845.  
  846. # rule: FS_RATWARE_MIME_PREAMBLE_SPACED_OUT
  847. # added 2006-02-15
  848. # test: spam-2006-02-01/df-2006-02-01-001514.txt
  849.  
  850. define_structure __FS_RATWARE_MIME_PREAMBLE_SPACED_OUT
  851. structure ^
  852. structure This[ ]{1,40}
  853. structure is[ ]{1,40}
  854. structure a[ ]{1,40}
  855. structure multi-part[ ]{1,40}
  856. structure message[ ]{1,40}
  857. structure in[ ]{1,40}
  858. structure MIME[ ]{1,40}
  859. structure format\.\n
  860.  
  861. define_structure __FS_RATWARE_MIME_PREAMBLE_SPACED_NOT
  862. structure ^
  863. structure This[ ]
  864. structure is[ ]
  865. structure a[ ]
  866. structure multi-part[ ]
  867. structure message[ ]
  868. structure in[ ]
  869. structure MIME[ ]
  870. structure format\.\n
  871.  
  872. meta     FS_RATWARE_MIME_PREAMBLE_SPACED_OUT (! __FS_RATWARE_MIME_PREAMBLE_SPACED_NOT && __FS_RATWARE_MIME_PREAMBLE_SPACED_OUT)
  873. describe FS_RATWARE_MIME_PREAMBLE_SPACED_OUT Spaced-out MIME preamble text
  874. score     FS_RATWARE_MIME_PREAMBLE_SPACED_OUT 6
  875.  
  876.  
  877.  
  878. # rule: MSGSTRUCT_RATWARE_BASE64_BLEED
  879. # added 2005-01-18
  880. # test: spam-2005-01-18/2722734622-1105983182.V802I3d2fe.localhost.localdomain
  881. # target: rare
  882.  
  883. define_structure MSGSTRUCT_RATWARE_BASE64_BLEED
  884. structure ^[ \t]{1,7}[A-Za-z0-9+/]{18,90}\nReceived:
  885.  
  886. describe MSGSTRUCT_RATWARE_BASE64_BLEED Headers with base64 spill into body
  887. score MSGSTRUCT_RATWARE_BASE64_BLEED 7
  888.  
  889.  
  890. # rule: MSGSTRUCT_GOURANGA
  891. # added 2005-01-28
  892. # test: reference-spam/0001gouranga.eml
  893. # target: rare
  894. # tracker: gouranga / 2005-01-28
  895.  
  896. define_structure MSGSTRUCT_GOURANGA
  897. structure ^Call out Gouranga be happy!!!\n
  898. structure Gouranga Gouranga Gouranga \.\.\.\.\n
  899. structure That which brings the highest happiness!!\n{0,6}$
  900.  
  901. describe MSGSTRUCT_GOURANGA Hare Krishna Gouranga spam template
  902. score MSGSTRUCT_GOURANGA 4.5
  903.  
  904.  
  905. endif
  906.  
  907.  
  908. # rule: URI_HTTP_HTTP
  909. # added 2005-03-02
  910. # edit 2005-03-15: shorter more focused regex; add comma to disallowed chars
  911. # test: spam-2005-03-10/2447413657-1110383392.V802I3d049.localhost.localdomain
  912. # tracker: http-redir-maybe 2005-02-23; update 2005-03-02 2005-03-08 2005-03-15
  913. # target: semi-rare
  914.  
  915. uri URI_HTTP_HTTP /(%[0-9A-F]{2}|[^A-Za-z0-9"'<>,])https?[%:]/
  916. describe URI_HTTP_HTTP URI appears to contain a http redirect
  917. score URI_HTTP_HTTP 1.0
  918.  
  919.  
  920. # rule: SUBJECT_FULL_STOP
  921. # added 2005-03-08
  922. # test: spam-2005-03-06/2101801134-1110000206.V802I3c5d2.localhost.localdomain
  923. ######## TODO: audit for false positives
  924. ######## TODO: figure out scientific score
  925. # tracker: subject-full-stop 2005-03-02 (shared with SUBJECT_FULL_STOP_SP)
  926.  
  927. header     SUBJECT_FULL_STOP    Subject =~ /\.$/
  928. describe SUBJECT_FULL_STOP    Subject ends in full stop
  929. score     SUBJECT_FULL_STOP     1.0
  930.  
  931.  
  932. # rule: SUBJECT_FULL_STOP_SP
  933. # added 2005-03-08
  934. # test: spam-2005-03-06/2101798498-1109992525.V802I3c34b.localhost.localdomain
  935. ######## TODO: audit for false positives
  936. ######## TODO: figure out scientific score
  937. # tracker: subject-full-stop 2005-03-02 (shared with SUBJECT_FULL_STOP)
  938.  
  939. header     SUBJECT_FULL_STOP_SP    Subject =~ /\.[ \t]+$/
  940. describe SUBJECT_FULL_STOP_SP    Subject ends in full stop and whitespace
  941. score     SUBJECT_FULL_STOP_SP    1.5
  942.  
  943.  
  944. # rule: OPERATION_SYSTEM
  945. # added 2005-03-09
  946. # test: spam-2005-03-08/2274591222-1110155608.V802I3beff.localhost.localdomain
  947. ######## TODO: schedule for 2005-03-15
  948. ######## TODO: audit for false positives
  949. ######## TODO: figure out scientific score
  950.  
  951. body OPERATION_SYSTEM    /\boperation system\b/
  952. describe OPERATION_SYSTEM Body mentions "operation system"
  953. score OPERATION_SYSTEM 1.5
  954.  
  955.  
  956. # rule: OBFUSCATED_STOCK
  957. # created 2005-01-18
  958. # edit 2005-02-28: typo fix (duh)
  959. # edit 2005-03-09: word boundaries (duh)
  960. ######## TODO: regression tests
  961.  
  962. body OBFUSCATED_STOCK /\b(?![Ss]tock|STOCK)[5Ss]{1,3}[Tt+]{1,3}[O0o]{1,3}[Cc]{0,3}[Kk](?:[5Ss]{1,3})?\b/
  963. describe OBFUSCATED_STOCK Uses word "stock" with funny 5p3ll1n6
  964. score OBFUSCATED_STOCK 2
  965.  
  966.  
  967. # rule: OBFUSCATED_DOWNLOAD
  968. # created 2005-01-18
  969. # edit 2005-02-28: typo fix (duh)
  970. # edit 2005-03-09: word boundary (duh)
  971. ######## TODO: regression tests
  972.  
  973. body OBFUSCATED_DOWNLOAD /\b(?![Dd]ownload|DOWNLOAD)[Dd]{1,3}.?[Oo0]{1,3}.?[Ww]{1,3}.?[Nn]{1,3}.?[Ll1]{1,3}.?[0Oo]{1,3}.?[Aa]{0,3}.?[Dd]/
  974. describe OBFUSCATED_DOWNLOAD Uses word "download" with funny 5p3ll1n6
  975. score OBFUSCATED_DOWNLOAD 3
  976.  
  977.  
  978. # rule: OBFUSCATED_SOFTWARE
  979. # created 2005-02-28
  980. # edit 2005-03-09: word boundaries (duh)
  981. # test: spam-2005-02-28/1583368982-1109516276.V802I3ceb8.localhost.localdomain
  982. # test: spam-2005-02-28/1583368997-1109516284.V802I3cebc.localhost.localdomain
  983.  
  984. body OBFUSCATED_SOFTWARE /\b(?![Ss]oftware|SOFTWARE)[Ss5]{1,3}.?[Oo0]{1,3}.?[Ff]{1,3}.?[Tt\+]{1,3}.?[Ww]{1,3}.?[Aa4]{0,3}.?[Rr]{1,3}[Ee3]{0,3}\b/
  985. describe OBFUSCATED_SOFTWARE Uses word "software" with funny 5p3ll1n6
  986. score OBFUSCATED_SOFTWARE 3
  987.  
  988.  
  989. # rule: OBFUSCATED_WINDOWS
  990. # created 2005-02-28
  991. # edit 2005-03-09: word boundaries (duh)
  992. # edit 2006-01-13: prevent false positives from dictionary hits
  993. # test: spam-2005-02-28/1583368997-1109516284.V802I3cebc.localhost.localdomain
  994.  
  995. body OBFUSCATED_WINDOWS /\b(?![Ww]in(d(o(w'?[sz]|[sz]e)|sor)|sock)|[Ww][Ww][Ww]\.|WIN(D(OW'?S|SOR)|SOCK))[Ww]{1,3}.?[Ii1l]{1,3}.?[Nn]{1,3}.?[Dd]{1,3}.?[Oo0]{1,3}.?[Ww]{0,3}.?[SsZz]{1,3}\b/
  996. describe OBFUSCATED_WINDOWS Uses word "windows" with funny 5p3ll1n6
  997. score OBFUSCATED_WINDOWS 2
  998.  
  999.  
  1000.  
  1001. # rule: FS_MIME_BOUNDARY_MADE
  1002. # added 2006-03-10
  1003. # edit 2006-03-13: restrict properly to top-level MIME bounary only
  1004. # test: ######## TODO: provide sample
  1005. ######## temp: spam-samples/youreudomain-sandbacka-2006-03-13.msg
  1006.  
  1007. header     FS_MIME_BOUNDARY_MADE Content-type =~ m{multipart/[^;\s]+; boundary=boundary-EU\.se-made$}
  1008. describe FS_MIME_BOUNDARY_MADE Funny MIME boundary "EU.se-made"
  1009. score     FS_MIME_BOUNDARY_MADE 4
  1010.  
  1011.