Project

General

Profile

Actions

Feature #7846

closed
JE PA

rules/transform: add gunzip transform

Feature #7846: rules/transform: add gunzip transform

Added by James Emery-Callcott 8 months ago. Updated 24 days ago.

Status:
Closed
Priority:
Normal
Target version:
Effort:
Difficulty:
Label:

Description

We've seen many use cases in which we would love the ability to utilise some sort of gzip keyword/transformation to allow us to match content within that decompressed buffer. This should function similarly to how base64 keywords work.

A recent example saw a HTTP POST request with a base64 string parameter value. Once decoded, that base64 string contained a gzip compressed data blob which ended up being a malicious executable. Unfortunately, due to this limitation, we were only able to use base64 keywords and then write a signature on the gzip header.

This new feature would allow us to write signatures 1 layer deeper and to identify and differentiate between malicious and benign depending on what is found in that final layer.

ex.

gzip_decompress:relative; gzip_data; content:"blah";


Subtasks 1 (0 open1 closed)

Feature #8235: rules/transform: add gunzip transform (8.0.x backport)ClosedPhilippe AntoineActions

Related issues 1 (1 open0 closed)

Related to Suricata - Feature #6922: Have a way to manually request decompression/inflate if headers are not presentNewOISF DevActions

SD Updated by Stuart DC 8 months ago Actions #1

preferably, adding gzip decompression (gunzip) to the transformations would allow us to not only call transform any given buffer but also enable detection writers to transform carved buffers via pcrexform.

VJ Updated by Victor Julien 3 months ago Actions #2

  • Subject changed from add the ability to manually call gzip decompress on any buffer and use it with other keywords and transformations to rules/transform: add gunzip transform

VJ Updated by Victor Julien 3 months ago Actions #3

I think this should be a regular transform and not use the old base64 pattern with base64_decode; base64_data;

Since decompression comes with some problems, we should be careful about imposing limits.

There should be global hard limits for max decompressed size, possibly also for the input to output ratio.

Then the rule should be able to specify the same settings. The rule limits may not exceed the global limits.

e.g.

# specify limits in the rule
file.data; gzip_decompress: max-size 1MiB, max-ratio 10; content:"MZ";
# use global limits
file.data; gzip_decompress; content:"MZ";

Other options that might make sense are around how many bytes to consider for decompression on the input size.

VJ Updated by Victor Julien 3 months ago Actions #4

  • Related to Feature #6922: Have a way to manually request decompression/inflate if headers are not present added

VJ Updated by Victor Julien 3 months ago Actions #5

  • Status changed from New to Assigned
  • Assignee changed from OISF Dev to Philippe Antoine
  • Target version changed from TBD to 9.0.0-beta1
  • Label Needs backport to 8.0 added

OT Updated by OISF Ticketbot 3 months ago Actions #6

  • Subtask #8235 added

OT Updated by OISF Ticketbot 3 months ago Actions #7

  • Label deleted (Needs backport to 8.0)

PA Updated by Philippe Antoine 3 months ago Actions #8

Would you have a pcap for testing ?

PA Updated by Philippe Antoine 2 months ago Actions #9

  • Status changed from Assigned to In Review

PA Updated by Philippe Antoine about 1 month ago Actions #10

  • Status changed from In Review to Resolved

VJ Updated by Victor Julien about 1 month ago Actions #11

  • Status changed from Resolved to Closed

VJ Updated by Victor Julien about 1 month ago Actions #12

  • Status changed from Closed to In Progress

Reopening to track a small change to the rule syntax. Instead of the non-standard max-size=8 we'll use the standard max-size 8.

PA Updated by Philippe Antoine about 1 month ago Actions #13

  • Status changed from In Progress to In Review

PA Updated by Philippe Antoine 24 days ago Actions #15

  • Status changed from In Review to Closed
Actions

Also available in: PDF Atom