osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: character set spec bypassing filter? -
msg#00048

List: mail.procmail

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

On Thu, 7 Nov 2002, Charles Gregory wrote:

CG>
CG> However, just today I received two e-mails that specify these strings
CG> clearly in the 'from' and 'subject' headers, but still got past the
CG> filter. It would appear to do so because of some effect of the surrounding
CG> characters on the line. If I use Pine's "full headers" command, I see
CG> expanded strings consisting of:
CG> From: "=?EUC-KR?B?sbnBpiCxs8ivx9C7/SC8vsXN?="
CG> Subject: =?EUC-KR?B?ucyxubGzyK/H0Lv9uPDB/VuxpLDtXQ==?=
CG>
CG> Interestingly enough, if I use Pine's *bounce* command, the 'Resent
CG> Subject' turns up as:
CG> Resent-Subject: =?X-UNKNOWN?B?ucyxubGzyK/H0Lv9uPDB/VuxpLDtXQ==?=
CG>
CG> So I suspect that some sort of processing is occurring, and that my
CG> procmail filter never really 'sees' the 'euc-kr' string, because of some
CG> 'handling' done on the control characters(?). My question is, how would I
CG> get procmail to ignore control characters so that it 'sees' the euc-kr
CG> that is obviously there?
CG>


I use this:

# Mime header extension in subject
:0
* ^Subject: =\?(gb2312|big5|ks_c_5601|2022-kr|euc-kr).*\?=
{
# action

for mime encoded headers that contain undesirable charsets. Although I am
going off filtering on charsets as I have had some false negatives (not
false positive - in my terminology, I let through desirable mail rather
than reject undesirable mail).


I test for the charsets in the mime attachments:

# Mime format with charset
# Multiline headers are grepped.
:0
* ^Content-Type:.*boundary
* B ?? ^Content-Type:(.|$)*charset=.?(big5|ks_c_5601|2022-kr|euc-kr)
{
# action



I look for non-ascii chars in the subject


# 5% gagabuggee subject
# avoid empty subject
:0
* ^Subject: \/.+
{
:0 D
* -1^1 MATCH ?? .
* 2^1 MATCH ?? =[0-9A-F][0-9A-F]
* 20^1 MATCH ?? [ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿]
* 20^1 MATCH ?? [ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß]
* 20^1 MATCH ?? [àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ]
* 20^1 MATCH ?? =[A-F][0-9A-F]
{
# action




And pre-process if base64 header:


# B Mime header extension in subject?
:0
* ^Subject:.*=\?.*\?b\?\/.+\?=
{
## LOG="B mime header $MATCH $NL"
MIMESUBJECT=`echo $MATCH | mimencode -u -b`
## LOG="B mime header $MIMESUBJECT $NL"

# 5% gagabuggee subject
:0 D
* -1^1 MIMESUBJECT ?? .
* 2^1 MIMESUBJECT ?? =[0-9A-F][0-9A-F]
* 20^1 MIMESUBJECT ?? [ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿]
* 20^1 MIMESUBJECT ?? [ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß]
* 20^1 MIMESUBJECT ?? [àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ]
* 20^1 MIMESUBJECT ?? =[A-F][0-9A-F]
{



and in the body:


# 5% gagabuggee body
:0 BD
* -1^1 .
* 2^1 =[0-9A-F][0-9A-F]
* 20^1 [ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿]
* 20^1 [ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß]
* 20^1 [àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ]
* 20^1 =[A-F][0-9A-F]
{


The last one should match quoted printable encoded "chinese" characters
but not base64 encoded.



CG> Also, while I'm here, I've noticed another spammer trick, of late, is to
CG> send spam encoded as base64. I can capture this by looking for
CG> 'Content-Type: text/html
CG> Content-Transfer-Endocing: BASE64'
CG> (BASE64 is still legitimate for attachments)
CG>
CG> Is there a tool/module to DECODE the base64 so that procmail filtering
CG> checks on the message body can be performed? This would be preferable to
CG> treating all BASE64 text as spam.......
CG>


I did have a think about this one but have not done anything as it looked
rather complicated because the mime attachments can contain attachments -
ie the messagage body can be made of several parts but in turn, each part
can be made of several parts - if I read the rfc correctly.



Alan

( Please do not email me AS WELL as replying to the list. Personal
email is welcome but may invoke a password autoresponder. )



_______________________________________________
procmail mailing list
procmail@xxxxxxxxxxxxxxxxxxxx
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail




Thread at a glance:

Previous Message by Date:

Re: Problem running from within recipe

would that be because procmail is running as a user that doesn't have access to that dir or executable? mp On Thu, Nov 07, 2002 at 05:13:58PM -0500, Matthew G. Saroff wrote: > My ISP just upgraded servers, and I've been changing recipes and > variables to account for new file locations. Most of it works, but I have > trouble with an autoresponder that uses mmencode, to send a PDF copy of my > resume. It does not seem to be able to find the mmencode executable. Here > is the recipe: > > #This sends my resume as a mime attachment to anyone who wants a > #copy of my resume in PDF (Acrobat) format > :0ch > * ^Subject:.*send pdf resume > * !^X-Loop: msaroff@charm\.net > | (formail -r \ > -I"X-Loop: msaroff@xxxxxxxxx"\ > -I"MIME-Version: 1.0"\ > -I"Content-Type: multipart/mixed; boundary=\"fls3jekls3=_sd3\"";\ > echo "--fls3jekls3=_sd3";\ > echo "Content-type: TEXT/PLAIN; charset=US-ASCII";\ > echo "";\ > cat $HOME/pdf.rsp;\ > echo "--fls3jekls3=_sd3";\ > echo "Content-Type: APPLICATION/PDF; name=\"saroffm.pdf\"";\ > echo "Content-Transfer-Encoding: base64";\ > echo "Content-Description:";\ > echo "";\ > /usr/local/bin/mmencode -b $HOME/saroffm.pdf;\ > echo "--fls3jekls3=_sd3--") | $SENDMAIL -t > > The message is fine, but the attachment is truncated and screwed > up. > I get the following error: > Total Number Folder > ----- ------ ------ > 0 1 ## /usr/local/bin/mmencode: not found > 1988 1 /var/mail/msaroff > ----- ------ > 1988 2 > > That is where mmencode is located, and I can run it from the > command line, so I'm wondering why this is not working. > > -- > Matthew Saroff > > > _______________________________________________ > procmail mailing list > procmail@xxxxxxxxxxxxxxxxxxxx > http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail _______________________________________________ procmail mailing list procmail@xxxxxxxxxxxxxxxxxxxx http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

Next Message by Date:

Re: Problem running from within recipe

I don't think so. Here are the permissions: -rwxr-xr-x 1 root wheel 9384 Oct 28 16:37 /usr/local/bin/mmencode On Thu, 7 Nov 2002, Michael Powe wrote: > would that be because procmail is running as a user that doesn't have > access to that dir or executable? > > mp > > On Thu, Nov 07, 2002 at 05:13:58PM -0500, Matthew G. Saroff wrote: > > My ISP just upgraded servers, and I've been changing recipes and > > variables to account for new file locations. Most of it works, but I have > > trouble with an autoresponder that uses mmencode, to send a PDF copy of my > > resume. It does not seem to be able to find the mmencode executable. Here > > is the recipe: > > > > #This sends my resume as a mime attachment to anyone who wants a > > #copy of my resume in PDF (Acrobat) format > > :0ch > > * ^Subject:.*send pdf resume > > * !^X-Loop: msaroff@charm\.net > > | (formail -r \ > > -I"X-Loop: msaroff@xxxxxxxxx"\ > > -I"MIME-Version: 1.0"\ > > -I"Content-Type: multipart/mixed; boundary=\"fls3jekls3=_sd3\"";\ > > echo "--fls3jekls3=_sd3";\ > > echo "Content-type: TEXT/PLAIN; charset=US-ASCII";\ > > echo "";\ > > cat $HOME/pdf.rsp;\ > > echo "--fls3jekls3=_sd3";\ > > echo "Content-Type: APPLICATION/PDF; name=\"saroffm.pdf\"";\ > > echo "Content-Transfer-Encoding: base64";\ > > echo "Content-Description:";\ > > echo "";\ > > /usr/local/bin/mmencode -b $HOME/saroffm.pdf;\ > > echo "--fls3jekls3=_sd3--") | $SENDMAIL -t > > > > The message is fine, but the attachment is truncated and screwed > > up. > > I get the following error: > > Total Number Folder > > ----- ------ ------ > > 0 1 ## /usr/local/bin/mmencode: not found > > 1988 1 /var/mail/msaroff > > ----- ------ > > 1988 2 > > > > That is where mmencode is located, and I can run it from the > > command line, so I'm wondering why this is not working. > > > > -- > > Matthew Saroff > > > > > > _______________________________________________ > > procmail mailing list > > procmail@xxxxxxxxxxxxxxxxxxxx > > http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail > -- Matthew Saroff | Standard Disclaimer: Not only do I speak for _____ | No one else, I don't even Speak for me. All my / o o \ | personalities and the spirits that I channel ______|_____|_____| disavow all knowledge of my activities. ;-) uuu U uuu | | In fact, all my personalities and channeled spirits Saroff wuz here | hate my guts. (Well, maybe with garlic & butter...) For law enforcement officials monitoring the net: abortion, marijuana, cocaine, CIA, plutonium, ammonium nitrate, militia, DEA, NSA, PGP, hacker, assassinate, Osama, Al Queida, Palestinian, Daisy Cutter, 911, suicide bomber, Taliban, George Bush is a Twinkie, Anthrax, Uranium, Thorium. Send suggestions for new and interesting words to: msaroff@xxxxxxxxxxxxxxxxx (remove the numbers to reply) Check http://www.pobox.com/~msaroff, including The Bad Hair Web Page _______________________________________________ procmail mailing list procmail@xxxxxxxxxxxxxxxxxxxx http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

Previous Message by Thread:

character set spec bypassing filter?

Greetings! I've just newly subscribed, so if this question is old, my apologies. I've constructed a spam filter using procmail. One of the tests that I perform is to check for either 'euc-kr' or 'ks_c_5601-1987', and trashcan the mail, as it is obviously in a character set I cannot (and do not want to) read. However, just today I received two e-mails that specify these strings clearly in the 'from' and 'subject' headers, but still got past the filter. It would appear to do so because of some effect of the surrounding characters on the line. If I use Pine's "full headers" command, I see expanded strings consisting of: From: "=?EUC-KR?B?sbnBpiCxs8ivx9C7/SC8vsXN?=" Subject: =?EUC-KR?B?ucyxubGzyK/H0Lv9uPDB/VuxpLDtXQ==?= Interestingly enough, if I use Pine's *bounce* command, the 'Resent Subject' turns up as: Resent-Subject: =?X-UNKNOWN?B?ucyxubGzyK/H0Lv9uPDB/VuxpLDtXQ==?= So I suspect that some sort of processing is occurring, and that my procmail filter never really 'sees' the 'euc-kr' string, because of some 'handling' done on the control characters(?). My question is, how would I get procmail to ignore control characters so that it 'sees' the euc-kr that is obviously there? --------- Also, while I'm here, I've noticed another spammer trick, of late, is to send spam encoded as base64. I can capture this by looking for 'Content-Type: text/html Content-Transfer-Endocing: BASE64' (BASE64 is still legitimate for attachments) Is there a tool/module to DECODE the base64 so that procmail filtering checks on the message body can be performed? This would be preferable to treating all BASE64 text as spam....... Thanks for any/all replies. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Charles Gregory Hamilton CommunityNet Webmaster cgregory@xxxxxxxx Connecting the Community! www.hwcn.org _______________________________________________ procmail mailing list procmail@xxxxxxxxxxxxxxxxxxxx http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

Next Message by Thread:

Re: character set spec bypassing filter?

On Thu, 7 Nov 2002, Alan Clifford wrote: AC> AC> and in the body: AC> AC> There were enough higher ascii characters in recipes in my last post for the working versions of the same recipes to identify the post as spam when it came back from the list. I suppose I should be pleased .... Alan ( Please do not email me AS WELL as replying to the list. Personal email is welcome but may invoke a password autoresponder. ) _______________________________________________ procmail mailing list procmail@xxxxxxxxxxxxxxxxxxxx http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!