aenetmail icon indicating copy to clipboard operation
aenetmail copied to clipboard

CRITICAL: Multi-part Mail at END of stream results in a CPU-Heavy INFINITE loop!

Open rlaphoenix opened this issue 7 years ago • 1 comments

MailMessage's string body = parseMime(...) can land in an INFINITE loop.

This took me about a month of security testing and research. This is CRITICAL to be fixed.

The loop occurs at Line 190' while loop https://github.com/andyedinborough/aenetmail/blob/master/MailMessage.cs#L190

If a multi-part message (has nestedBoundary) is at the very end of a stream, it will do the recursive parseMime to handle nestedBoundary fine, but when its passed parseMime and is now in the while loop to get the streams position to the next boundary, it will seriously fk up, since it will return ")" (probably empty lines or \n, \r before ")" e.t.c) then it will result in a non-responsive stream, and all the reader.ReadLine attempts will get a -1 from the ReadByte resulting in an empty string, resulting in it ALWAYS looping.

rlaphoenix avatar Aug 24 '18 23:08 rlaphoenix