Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rules/ftp-events.rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

alert ftp any any -> any any (msg:"SURICATA FTP Request command too long"; flow:to_server; app-layer-event:ftp.request_command_too_long; classtype:protocol-command-decode; sid:2232000; rev:1;)
alert ftp any any -> any any (msg:"SURICATA FTP Response command too long"; flow:to_client; app-layer-event:ftp.response_command_too_long; classtype:protocol-command-decode; sid:2232001; rev:1;)
alert ftp any any -> any any (msg:"SURICATA FTP too many transactions"; app-layer-event:ftp.too_many_transactions; classtype:protocol-command-decode; sid:2232002; rev:1;)
2 changes: 2 additions & 0 deletions rust/src/ftp/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub enum FtpEvent {
FtpEventRequestCommandTooLong,
#[name("response_command_too_long")]
FtpEventResponseCommandTooLong,
#[name("too_many_transactions")]
FtpEventTooManyTransactions,
}

/// Wrapper around the Rust generic function for get_event_info.
Expand Down
13 changes: 11 additions & 2 deletions src/app-layer-ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,17 @@ static FTPTransaction *FTPTransactionCreate(FtpState *state)
SCEnter();
FTPTransaction *firsttx = TAILQ_FIRST(&state->tx_list);
if (firsttx && state->tx_cnt - firsttx->tx_id > ftp_config_maxtx) {
// FTP does not set events yet...
return NULL;
FTPTransaction *tx_old;
TAILQ_FOREACH (tx_old, &state->tx_list, next) {
if (!tx_old->done) {
tx_old->done = true;
tx_old->tx_data.updated_ts = true;
tx_old->tx_data.updated_tc = true;
SCAppLayerDecoderEventsSetEventRaw(
&tx_old->tx_data.events, FtpEventTooManyTransactions);
break;
}
}
}
FTPTransaction *tx = FTPCalloc(1, sizeof(*tx));
if (tx == NULL) {
Expand Down
1 change: 1 addition & 0 deletions suricata.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ app-layer:
ftp:
enabled: yes
# memcap: 64 MiB
# max-tx: 1024
websocket:
#enabled: yes
# Maximum used payload size, the rest is skipped
Expand Down
Loading