
A MIME parser is a memory of where it is. CVE-2026-57229 is what happens when that memory survives a boundary it should have forgotten: the inner message is read through the outer message's assumptions, and the rules never see the payload they were written to catch.
The two-line bug
In Suricata 8.0.0 through 8.0.5, rust/src/mime/smtp.rs handled an encapsulated message/rfc822 part like this:
if encap_msg {
ctx.state_flag = MimeSmtpParserState::MimeSmtpStart;
ctx.headers.truncate(ctx.main_headers_nb);
return (MimeSmtpParserResult::MimeSmtpNeedsMore, warnings);
}
Two fields are reset. The struct has at least nine fields that describe the current part: state_flag, headers, main_headers_nb, filename, encoding, decoder, content_type, bufeolen and decoded_line.
The boundary-close path was not much better. It cleared filename, truncated headers and set encoding back to Plain, but left content_type, decoder and decoded_line untouched.
The fix, commit c0215c7e17 on the 8.0 branch, replaces both paths with one function:
impl MimeStateSMTP<'_> {
fn restart(&mut self) {
self.state_flag = MimeSmtpParserState::MimeSmtpStart;
self.headers.truncate(self.main_headers_nb);
self.encoding = MimeSmtpEncoding::Plain;
self.decoder = None;
self.filename.clear();
self.bufeolen = 0;
self.content_type = MimeSmtpContentType::Message;
self.decoded_line.clear();
}
}
That is the entire fix: eight assignments in one place, called from the encapsulated-message path twice and from the boundary-close path once. Upstream's commit message calls it a consolidation, which is accurate and also understates it. The consolidation is what makes the reset complete.
What the leaked state does
content_type is the field that matters most. mime_smtp_process_headers() sets it to PlainText, Html or Unknown; a message/* part lands in Unknown and raises the encapsulation flag. The body loop only extracts URLs when the type is PlainText, Html or Message:
if ctx.content_type == MimeSmtpContentType::PlainText
|| ctx.content_type == MimeSmtpContentType::Html
|| ctx.content_type == MimeSmtpContentType::Message
{
...
mime_smtp_find_url_strings(ctx, full);
An inner message with no Content-Type header — which is legal, and common — inherits Unknown from the outer envelope. URL extraction is skipped for the entire inner body.
filename is just as damaging. If the outer part carried Content-Disposition: attachment; filename="invoice.pdf", the name survives into the inner part. The body loop's if ctx.filename.is_empty() guard then fails, so URL extraction and body handling are skipped again. The file name that rules match with file.name belongs to the wrong part.
encoding and decoder leak the other way. An outer base64 part leaves a live base64 decoder behind. A plain-text inner body is then fed through it, producing garbage. file.data contains bytes that never existed on the wire, and every rule written against the real attachment misses.
Why this is the fundamental flaw
The other bugs in the batch are memory-safety failures with a crash or an over-read as their symptom. This one has no symptom at all.
The sensor stays up. The transaction is logged. EVE records an SMTP event with a file attached. The dashboard shows mail being inspected. The only thing missing is the alert — because the data the rule evaluated was not the data the recipient received.
That is why the CVSS score of 5.3 (Integrity: Low only) misleads. Scored as a single message, the bug looks minor: one mail can evade one detection. Scored as a property of the detector, it is an epistemic failure. An operator who believes mail-borne malware is covered will not build the second control that would have caught it.
The precondition is not exotic
The advisory says the flaw allows crafted mail to evade "detections based on file.data, file.name, or extracted URLs when SMTP MIME decoding is enabled." That is the default configuration. decode-mime: yes, decode-base64: yes, decode-quoted-printable: yes — the example suricata.yaml enables all three.
An attacker needs no credentials. SMTP is pre-authentication by design: the message is the input. The only requirement is that the sensor parses the mail path, which is the reason the sensor was deployed.
What the fix changes, and what it does not
After 8.0.6, the inner message starts from a clean state. The regression test upstream added exercises the encapsulated path, and the diff is small enough to audit in a sitting.
What it does not change is the architecture. A stateful parser will always have a "reset everything" obligation, and the obligation is only as good as the struct's field list. The next field added to MimeStateSMTP is a new opportunity to forget one line.
Part 8 follows the versions: which branches were exposed, and why the branch that received the fix was already dead.

Next: Part 8 — the branch that died on patch day: how version sprawl turned a same-day fix into an upgrade project.

Comments (0)