4 ## If you haven't worked with exim filters before, read
5 ## the install notes at the end of this file.
8 # Only run any of this stuff on the first pass through the
9 # filter - this is an optomisation for messages that get
10 # queued and have several delivery attempts
12 # we express this in reverse so we can just bail out
13 # on inappropriate messages
20 # Check for MS buffer overruns as per latest BUGTRAQ.
21 # http://www.securityfocus.com/frames/?content=/templates/article.html%3Fid%3D61
22 # This could happen in error messages, hence its placing
24 # We substract the first n characters of the date header
25 # and test if its the same as the date header... which
26 # is a lousy way of checking if the date is longer than
28 if ${length_80:$header_date:} is not $header_date:
30 fail text "This message has been rejected because it has\n\
31 \tan overlength date field which can be used\n\
32 \tto subvert Microsoft mail programs\n\
33 \tThe following URL has further information\n\
34 \thttp://www.securityfocus.com/frames/?content=/templates/article.html%3Fid%3D61"
38 # drop out error messages here
44 # Look for single part MIME messages with suspicious name extensions
45 # Check Content-Type header [vb2_regexp]
46 if $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat))"
48 fail text "This message has been rejected because it has\n\
49 \tan apparently executable attachment $1\n\
50 \tThis form of attachment has been used by\n\
51 \trecent viruses such as that described in\n\
52 \thttp://www.fsecure.com/v-descs/love.htm\n\
53 \tIf you meant to send this file then please\n\
54 \tpackage it up as a zip file and resend it."
58 # Attempt to catch embedded VBS attachments
59 # in emails. These were used as the basis for
60 # the ILOVEYOU virus and its variants
62 if $message_body matches "(?:Content-(?:Type:(?>\\\\s*)[\\\\w-]+/[\\\\w-]+|Disposition:(?>\\\\s*)attachment);(?>\\\\s*)(?:file)?name=|begin(?>\\\\s+)[0-7]{3,4}(?>\\\\s+))(\"[^\"]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat))[\\\\s;]"
64 fail text "This message has been rejected because it has\n\
65 \tan apparently executable attachment $1\n\
66 \tThis form of attachment has been used by\n\
67 \trecent viruses such as that described in\n\
68 \thttp://www.fsecure.com/v-descs/love.htm\n\
69 \tIf you meant to send this file then please\n\
70 \tpackage it up as a zip file and resend it."
79 # Widened list of content-types accepted, added WSF extension
81 # Embedded the install notes in for those that don't do manuals
83 # Check global content-type header. Efficiency mods to REs
85 # More minor efficiency mods, doc changes
87 # Added extension handling - thx to Douglas Gray Stephens & Jeff Carnahan
89 # Latest MS Outhouse bug catching
91 # Changed trigger length to 80 chars, fixed some spelling
95 # Exim filters run the exim filter language - a very primitive
96 # scripting language - in place of a user .forward file, or on
97 # a per system basis (on all messages passing through).
98 # The filtering capability is documented in the main set of manuals
99 # a copy of which can be found on the exim web site
100 # http://www.exim.org/
102 # To install, copy the filter file (with appropriate permissions)
103 # to /etc/exim/system_filter.exim and add to your exim config file
104 # [location is installation depedant - typicaly /etc/exim/config ]
105 # at the top the line:-
106 # message_filter = /etc/exim/system_filter.exim
107 # message_body_visible = 5000
109 # Any message that matches the filter will then be bounced.
110 # If you wish you can change the error message by editing it
111 # in the section above - however be careful you don't break it.
113 # After install exim should be restarted - a kill -HUP to the
114 # daemon will do this.
118 # This filter tries to parse MIME with a regexp... that doesn't
119 # work too well. It will also only see the amount of the body
120 # specified in message_body_visible
124 # The regexp that is used to pickup MIME/uuencoded parts is replicated
125 # below (in perl format). You need to remember that exim converts
126 # newlines to spaces in the message_body variable.
128 # (?:Content- # start of content header
129 # (?:Type: (?>\s*) # rest of c/t header
130 # [\w-]+/[\w-]+ # content-type (any)
131 # |Disposition: (?>\s*) # content-disposition hdr
132 # attachment) # content-disposition
133 # ;(?>\s*) # ; space or newline
134 # (?:file)?name= # filename=/name=
135 # |begin (?>\s+) [0-7]{3,4} (?>\s+)) # begin octal-mode
136 # (\"[^\"]+\. # quoted filename.
137 # (?:vb[se] # list of extns
145 # |[\w.-]+\. # unquoted filename.ext
146 # (?:vb[se] # list of extns
153 # ) # end of filename capture
154 # [\s;] # trailing ;/space/newline