OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Non-ASCII characters in envelope

From: Alexey Lobanov (A.Lobanovcro-rct.ru)
Date: Wed Jan 30 2008 - 03:27:33 CST


Hello all.

I see now that Postfix (2.4.5) accepts non-ASCII characters in SMTP
envelope. Postfix logs these character as "?", Postgrey says more
definitely:

======
Jan 30 08:50:07 mail postgrey[29659]: delayed 9268 seconds:
client=mirapoint3.brutele.be, from=uo<EA>oibrutele.be,
to=*censored*cro-rct.ru

Jan 30 08:50:11 mail postfix/qmgr[11912]: 13B9B10E736:
from=<uo?oibrutele.be>,
size=1363, nrcpt=2 (queue active)
======

First of all, this malformed message is just a spam generated by a
RFC-ignorant engine.

Second, the malformed header is (properly) rejected by Cyrus IMAP at the
next stage and generates scattermail:

========
Jan 30 08:50:12 mail postfix/lmtp[16911]: 26A5E10E73C:
to=<infoimap.office.rct-int>, relay=imap.office.rct-int[10.0.0.3]:24,
delay=0.04, delays=0.02/0.01/0.01/0, dsn=5.5.4, status=bounced (host
imap.office.rct-int[10.0.0.3] said: 501 5.5.4 Syntax error in parameters
(in reply to MAIL FROM command))
============

I have looked through smtpd_token.c and found no checks for US-ASCII
compliance in it. However, RFC2821 chapter 2.4 says:

"No sending SMTP system is permitted to send envelope commands in any
character set other than US-ASCII; receiving systems SHOULD reject such
commands, normally using "500 syntax error - invalid character" replies."

What can we do to fix this issue?

NB: "strict_7bit_headers" is not a solution. First of all, I must
receive (malformed) messages with unwrapped Russian text in Subject.
Second, headers and envelope in spam differs. This issue is about
envelope data only.

Alexey