5 ## If you haven't worked with exim filters before, read
6 ## the install notes at the end of this file.
9 # Only run any of this stuff on the first pass through the
10 # filter - this is an optomisation for messages that get
11 # queued and have several delivery attempts
13 # we express this in reverse so we can just bail out
14 # on inappropriate messages
21 # Check for MS buffer overruns as per latest BUGTRAQ.
22 # http://www.securityfocus.com/frames/?content=/templates/article.html%3Fid%3D61
23 # This could happen in error messages, hence its placing
25 # We substract the first n characters of the date header
26 # and test if its the same as the date header... which
27 # is a lousy way of checking if the date is longer than
29 if ${length_80:$header_date:} is not $header_date:
31 fail text "This message has been rejected because it has\n\
32 \tan overlength date field which can be used\n\
33 \tto subvert Microsoft mail programs\n\
34 \tThe following URL has further information\n\
35 \thttp://www.securityfocus.com/frames/?content=/templates/article.html%3Fid%3D61"
39 # This is a nasty compromise.
40 # This crud is now being sent with a <> envelope sender, but
41 # blocking all error messages that pattern match prevents
42 # bounces getting back.... so we fudge it somewhat
43 if $header_from: contains "@sexyfun.net"
45 fail text "This message has been rejected since it has\n\
46 \tthe signature of a known virus in the header."
49 if error_message and $header_from: contains "Mailer-Daemon@"
51 # looks like a real error message - just ignore it
55 # Look for single part MIME messages with suspicious name extensions
56 # Check Content-Type header [vb2_regexp]
57 if $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|cmd|shs|bat|scr|pif)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|cmd|shs|bat|scr|pif))"
59 fail text "This message has been rejected because it has\n\
60 \ta potentially executable attachment $1\n\
61 \tThis form of attachment has been used by\n\
62 \trecent viruses or other malware.\n\
63 \tIf you meant to send this file then please\n\
64 \tpackage it up as a zip file and resend it."
68 # Attempt to catch embedded VBS attachments
69 # in emails. These were used as the basis for
70 # the ILOVEYOU virus and its variants
72 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|cmd|shs|bat|scr|pif)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|cmd|shs|bat|scr|pif))[\\\\s;]"
74 fail text "This message has been rejected because it has\n\
75 \ta potentially executable attachment $1\n\
76 \tThis form of attachment has been used by\n\
77 \trecent viruses or other malware.\n\
78 \tIf you meant to send this file then please\n\
79 \tpackage it up as a zip file and resend it."
88 # Widened list of content-types accepted, added WSF extension
90 # Embedded the install notes in for those that don't do manuals
92 # Check global content-type header. Efficiency mods to REs
94 # More minor efficiency mods, doc changes
96 # Added extension handling - thx to Douglas Gray Stephens & Jeff Carnahan
98 # Latest MS Outhouse bug catching
100 # Changed trigger length to 80 chars, fixed some spelling
101 # 0.09 29 September 2000
102 # More extensions... its getting so we should just allow 2 or 3 through
103 # 0.10 18 January 2001
104 # Removed exclusion for error messages - this is a little nasty
105 # since it has other side effects, hence we do still exclude
106 # on unix like error messages
107 # 0.11 20 March, 2001
108 # Added CMD extension, tidied docs slightly, added RCS tag
112 # Exim filters run the exim filter language - a very primitive
113 # scripting language - in place of a user .forward file, or on
114 # a per system basis (on all messages passing through).
115 # The filtering capability is documented in the main set of manuals
116 # a copy of which can be found on the exim web site
117 # http://www.exim.org/
119 # To install, copy the filter file (with appropriate permissions)
120 # to /etc/exim/system_filter.exim and add to your exim config file
121 # [location is installation depedant - typicaly /etc/exim/config ]
122 # at the top the line:-
123 # message_filter = /etc/exim/system_filter.exim
124 # message_body_visible = 5000
126 # You may also want to set the message_filter_user & message_filter_group
127 # options, but they default to the standard exim user and so can
128 # be left untouched. The other message_filter_* options are only
129 # needed if you modify this to do other functions such as deliveries.
130 # The main exim documentation is quite thorough and so I see no need
131 # to expand it here...
133 # Any message that matches the filter will then be bounced.
134 # If you wish you can change the error message by editing it
135 # in the section above - however be careful you don't break it.
137 # After install exim should be restarted - a kill -HUP to the
138 # daemon will do this.
142 # This filter tries to parse MIME with a regexp... that doesn't
143 # work too well. It will also only see the amount of the body
144 # specified in message_body_visible
148 # The regexp that is used to pickup MIME/uuencoded parts is replicated
149 # below (in perl format). You need to remember that exim converts
150 # newlines to spaces in the message_body variable.
152 # (?:Content- # start of content header
153 # (?:Type: (?>\s*) # rest of c/t header
154 # [\w-]+/[\w-]+ # content-type (any)
155 # |Disposition: (?>\s*) # content-disposition hdr
156 # attachment) # content-disposition
157 # ;(?>\s*) # ; space or newline
158 # (?:file)?name= # filename=/name=
159 # |begin (?>\s+) [0-7]{3,4} (?>\s+)) # begin octal-mode
160 # (\"[^\"]+\. # quoted filename.
161 # (?:vb[se] # list of extns
172 # |[\w.-]+\. # unquoted filename.ext
173 # (?:vb[se] # list of extns
183 # ) # end of filename capture
184 # [\s;] # trailing ;/space/newline