On Thu, 07 Oct 2010 11:09:43 -0400, Charles Marcus
<[email protected]> wrote:
> On 2010-10-07 10:30 AM, K Post wrote:
>> I think what we're suggesting is logical and I'm sure Thomas will too. 
>> It's
>> just a question of finding the time to code it!
> 
> After Thomas' last, it might not be so easy... maybe because there is no
> easy way to distinguish 'Subject' in the header. I'd think the parser
> could just count the bytes and when it reaches the max, skip to the body
> checks... but ianap, so may be totally off base...

Well, I've been running a patch on my ASSP for the past week or so and it
seems to fix the problem for me (although I'm still running 1.6.1.3, so the
patch might or might not work for later versions).

Inside sub makeSubject, after the line "$sub =~ s/\r\n\s*//go;" I added
this code snippet:

my $slength = length $sub;
if ($slength > 2000) {
delayWhiteExpire($fh);
mlog( $fh, "Bomb attempt $slength bytes in Subject: line");
$Con{$fh}->{prepend} = "[SubjectBomb]";
seterror( $fh, "554 5.7.1 Subject exploit attempt ($slength)", 1);
done($fh);
$sub = substr($sub,0,50);
}

The failing messages almost ALL have subject lines of exactly 9999 bytes,
and they are multi-line subject headers with somewhere between 2000 and
4000 bytes per line.  I have a log message of each attempt to push one
through, and they all have exactly 9999 bytes in the Subject: multi-line
header.

I found something out in my testing of the patch on my 1.6.1.3
installation:  1.6.1.3 will only grab the first 6 lines of a multi-line
subject line due to how the regex is written (a peek at the code on a later
version shows that the later versions may grab all lines of multi-line
subject lines), and the only way to get 9999 bytes in less than 7 lines is
for each line to have around 2000 bytes at least, but I found that lines
longer than 4096 bytes get truncated, I'm assuming by the getline function.
I had to build a test email message with 4000 bytes in each line of a
multi-line subject line to trigger the condition (and that email message
did indeed cause the unpatched ASSP to go cpu-bound).

I can tell you that when the bug is triggered, it gets cpu-bound while
inside the "thisIsSpam" function (which is called after makeSubject is
called from another function), and I'd hazard a guess that it might have
something to do with the fact that at this point $this->{myheader} is very
long (well over 10,000 bytes) and there are a lot of .= operations
performed on it (including adding another 10,000 bytes with the
X-Assp-Original-Subject: line added).  It could also be a buffer overrun
somewhere since we're adding a single subject line of 9999+ bytes (not a
multi-line subject line).  Just my rambling.

What I DO know is that over the last 7 days, I've logged over 22 attempts
to push an email into my system with a subject line of exactly 9999
bytes.... and oddly enough one attempt to push an email with a subject line
of 6578 bytes.




------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to