Project

General

Profile

Actions

Bug #8995

closed
JI JI

smtp: rejected BDAT reply leaves parser in data mode

Bug #8995: smtp: rejected BDAT reply leaves parser in data mode

Added by Jason Ish about 1 month ago. Updated 25 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

  1. Summary

A syntactically valid, non-empty SMTP BDAT command can be rejected by the
server before the client sends the advertised chunk octets. Suricata does not
handle the error reply and remains in
`SMTP_PARSER_STATE_COMMAND_DATA_MODE`.

Subsequent client commands and message content are consumed as if they were
part of the missing BDAT chunk, desynchronizing Suricata's SMTP parser from the
actual SMTP session.

  1. Example sequence

```text
C: EHLO client
S: 250 CHUNKING
C: BDAT 1000000 LAST
S: 503
C: RSET
S: 250
C: MAIL FROM ...
```

After the `503` response, Suricata remains in BDAT mode waiting for the
declared bytes. The following `RSET`, envelope commands, DATA command, and
message content are therefore not parsed correctly.

  1. Impact

Traffic following the rejected BDAT command can bypass SMTP, MIME, and file
inspection for the remainder of the connection.

The Suricata-Verify reproducer sends an EICAR antivirus test file in a message
after the rejected BDAT command. The corresponding detection rule does not
trigger because the later SMTP commands and message are not parsed.

  1. Relationship to existing work

This is related to #8741. The fixes for that issue address other BDAT parsing
and transaction handling problems, but do not handle an error response to a
syntactically valid BDAT command before its advertised chunk is received.

  1. Suggested remediation

When the server returns an error response to a BDAT command, clear
`SMTP_PARSER_STATE_COMMAND_DATA_MODE` so subsequent client commands can be
parsed normally.

  1. Credit

Please credit Nozomi Networks Labs.


Subtasks 1 (0 open — 1 closed)

Bug #8996: smtp: rejected BDAT reply leaves parser in data mode (8.0.x backport)ClosedJason IshActions

Related issues 1 (0 open — 1 closed)

Related to Suricata - Bug #8741: smtp: complete BDAT transactions at LASTClosedJason IshActions

JI Updated by Jason Ish about 1 month ago Actions #1

  • Status changed from New to Assigned
  • Assignee changed from OISF Dev to Jason Ish
  • Target version set to 9.0.0-beta1
  • Severity set to LOW
  • Label Needs backport to 8.0 added

OT Updated by OISF Ticketbot about 1 month ago Actions #2

  • Subtask #8996 added

OT Updated by OISF Ticketbot about 1 month ago Actions #3

  • Label deleted (Needs backport to 8.0)

JI Updated by Jason Ish about 1 month ago Actions #4

  • Related to Bug #8741: smtp: complete BDAT transactions at LAST added

JI Updated by Jason Ish about 1 month ago Actions #5

  • Status changed from Assigned to In Review

MR on GL.

JI Updated by Jason Ish 30 days ago Actions #6

  • Tracker changed from Security to Bug
  • Private changed from Yes to No
  • Severity deleted (LOW)
  • Disclosure Date deleted (11/25/2026)

PA Updated by Philippe Antoine 28 days ago Actions #8

  • Status changed from In Review to Resolved

VJ Updated by Victor Julien 25 days ago Actions #9

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom