Project

General

Profile

Actions

Security #6796

closed
PA PA

output/filestore: slowdown because of running OutputTxLog on useless packets

Security #6796: output/filestore: slowdown because of running OutputTxLog on useless packets

Added by Philippe Antoine about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Label:
CVE:
Git IDs:
Severity:
MODERATE
Disclosure Date:
05/21/2024

Description

Found by oss-fuzz
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66918

Reproducer is with attached pcap and force-filestore: yes or similar

This pcap can be seen as a simple HTTP request, and then we get from the server many one-byte packets that are not yet acknowledged by the client.
This is a bit similar to #6299 - do not run detection if nothing has been updated, but here it is tx logging and not detection

FLOW_TS_APP_UPDATED gets set with UPDATE_DIR_OPPOSING when the server acknowledges the request
And it does not get reset until PKT_IS_TOSERVER(p)

OutputTxLog. now only checks if flow flags have app update, but not if it is a fresh one


Files

filestore.pcap (5.74 MB) filestore.pcap Philippe Antoine, 02/22/2024 08:38 AM

Subtasks 1 (0 open1 closed)

Security #6798: output/filestore: timeout because of running OutputTxLog on useless packets (7.0.x backport)ClosedPhilippe AntoineActions

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

  • Subtask #6797 added

OT Updated by OISF Ticketbot about 2 years ago Actions #2

  • Label deleted (Needs backport to 6.0)

OT Updated by OISF Ticketbot about 2 years ago Actions #3

  • Subtask #6798 added

OT Updated by OISF Ticketbot about 2 years ago Actions #4

  • Label deleted (Needs backport to 7.0)

PA Updated by Philippe Antoine about 2 years ago Actions #5

  • Status changed from New to In Review
  • Label Needs backport to 6.0, Needs backport to 7.0 added

Gitlab MR

PA Updated by Philippe Antoine about 2 years ago Actions #6

  • Label deleted (Needs backport to 6.0, Needs backport to 7.0)

VJ Updated by Victor Julien about 2 years ago Actions #7

Can we get into this exact same situation if instead of useless packets we get tiny packets that xfer a body for example? So each packet does in fact update the state?

PA Updated by Philippe Antoine about 2 years ago Actions #8

Victor Julien wrote in #note-7:

Can we get into this exact same situation if instead of useless packets we get tiny packets that xfer a body for example? So each packet does in fact update the state?

I wrote "and then we get from the server many one-byte packets that are not yet acknowledged by the client."

So, these are tiny packets that transfer a body.
They are useless just until the client acks them which happens at the end of the pcap.

Do you mean having the same pcap with stream.inline mode ? Or that each tiny packet with body gets acked by the client ?
Or what do I not understand in this question ?

VJ Updated by Victor Julien about 2 years ago Actions #9

What if they are acknowledged? Or indeed if we are in inline mode and have to inspect each unack'd packet? I think my concern is that we should not timeout if we do this type of inspection/logging per packet, for any packet size or type.

VJ Updated by Victor Julien about 2 years ago Actions #10

  • Subject changed from output/filestore: timeout because of running OutputTxLog on useless packets to output/filestore: slowdown because of running OutputTxLog on useless packets

VJ Updated by Victor Julien about 2 years ago Actions #11

Unneeded snprintf call in filestore should get optimized.

PA Updated by Philippe Antoine about 2 years ago Actions #12

Victor Julien wrote in #note-9:

What if they are acknowledged? Or indeed if we are in inline mode and have to inspect each unack'd packet? I think my concern is that we should not timeout if we do this type of inspection/logging per packet, for any packet size or type.

You look right : with my patch, I go from 2 seconds to 30 seconds by setting stream.inline=true
61% is spent in OutputTxLogFiles. and 33% in snprintf in OutputFilestoreLogger

PA Updated by Philippe Antoine about 2 years ago Actions #14

  • Status changed from In Review to Resolved

PA Updated by Philippe Antoine about 2 years ago Actions #15

  • Status changed from Resolved to Closed

VJ Updated by Victor Julien about 2 years ago Actions #16

  • Private changed from Yes to No
Actions

Also available in: PDF Atom