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 # This is a nasty compromise.
39 # This crud is now being sent with a <> envelope sender, but
40 # blocking all error messages that pattern match prevents
41 # bounces getting back.... so we fudge it somewhat
42 if $header_from: contains "@sexyfun.net"
44 fail text "This message has been rejected since it has\n\
45 \tthe signature of a known virus in the header."
48 if error_message and $header_from: contains "Mailer-Daemon@"
50 # looks like a real error message - just ignore it
54 # Look for single part MIME messages with suspicious name extensions
55 # Check Content-Type header [vb2_regexp]
56 if $header_content-type: matches "(?:file)?name=(\"[^\"]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat|scr|pif)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|shs|bat|scr|pif))"
58 fail text "This message has been rejected because it has\n\
59 \ta potentially executable attachment $1\n\
60 \tThis form of attachment has been used by\n\
61 \trecent viruses such as that described in\n\
62 \thttp://www.fsecure.com/v-descs/love.htm\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|shs|bat|scr|pif)\"|[\\\\w.-]+\\\\.(?:vb[se]|ws[fh]|jse?|exe|com|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 such as that described in\n\
78 \thttp://www.fsecure.com/v-descs/love.htm\n\
79 \tIf you meant to send this file then please\n\
80 \tpackage it up as a zip file and resend it."
89 # Widened list of content-types accepted, added WSF extension
91 # Embedded the install notes in for those that don't do manuals
93 # Check global content-type header. Efficiency mods to REs
95 # More minor efficiency mods, doc changes
97 # Added extension handling - thx to Douglas Gray Stephens & Jeff Carnahan
99 # Latest MS Outhouse bug catching
101 # Changed trigger length to 80 chars, fixed some spelling
102 # 0.09 29 September 2000
103 # More extensions... its getting so we should just allow 2 or 3 through
104 # 0.10 18 January 2001
105 # Removed exclusion for error messages - this is a little nasty
106 # since it has other side effects, hence we do still exclude
107 # on unix like error messages
111 # Exim filters run the exim filter language - a very primitive
112 # scripting language - in place of a user .forward file, or on
113 # a per system basis (on all messages passing through).
114 # The filtering capability is documented in the main set of manuals
115 # a copy of which can be found on the exim web site
116 # http://www.exim.org/
118 # To install, copy the filter file (with appropriate permissions)
119 # to /etc/exim/system_filter.exim and add to your exim config file
120 # [location is installation depedant - typicaly /etc/exim/config ]
121 # at the top the line:-
122 # message_filter = /etc/exim/system_filter.exim
123 # message_body_visible = 5000
125 # Any message that matches the filter will then be bounced.
126 # If you wish you can change the error message by editing it
127 # in the section above - however be careful you don't break it.
129 # After install exim should be restarted - a kill -HUP to the
130 # daemon will do this.
134 # This filter tries to parse MIME with a regexp... that doesn't
135 # work too well. It will also only see the amount of the body
136 # specified in message_body_visible
140 # The regexp that is used to pickup MIME/uuencoded parts is replicated
141 # below (in perl format). You need to remember that exim converts
142 # newlines to spaces in the message_body variable.
144 # (?:Content- # start of content header
145 # (?:Type: (?>\s*) # rest of c/t header
146 # [\w-]+/[\w-]+ # content-type (any)
147 # |Disposition: (?>\s*) # content-disposition hdr
148 # attachment) # content-disposition
149 # ;(?>\s*) # ; space or newline
150 # (?:file)?name= # filename=/name=
151 # |begin (?>\s+) [0-7]{3,4} (?>\s+)) # begin octal-mode
152 # (\"[^\"]+\. # quoted filename.
153 # (?:vb[se] # list of extns
163 # |[\w.-]+\. # unquoted filename.ext
164 # (?:vb[se] # list of extns
173 # ) # end of filename capture
174 # [\s;] # trailing ;/space/newline