Detect any ELF executable

Reply
Highlighted
L1 Bithead

Detect any ELF executable

I would like to block any ELF executable, but this is not support in file blocking. I have tried to achieve this using two methods:

 

Create a custom data pattern. This didn't really work out, as the minimum string length is 7 bytes, but the file identifier is only four, plus it needs to be in the start of the file rather than anywhere in the file.

 

Create a custom vulnerability. This is ok, but not ideal. I created a pattern-match condition, with a context of file-elf-body. Unfortunately, I then need to add a 7 byte value to match against. I have put \x00000000000000\x, which catches any file I can find, but it is concievable that there are files with no such string.

 

Can anyone else suggest a better solution to this? You may have guessed, I'm a complete novice at this.

 


Accepted Solutions
Highlighted
L4 Transporter

Re: Detect any ELF executable

Hi,

 

You could try to do a pattern match on the context "file-unknown-body", with 4 7-byte patterns representing the different classes (32-bit or 64-bit) and endianness (little endian or big endian):

 

\x7f454c46010101\x

\x7f454c46010201\x

\x7f454c46020101\x

\x7f454c46020201\x

 

I haven't tried it myself, but I don't see why it wouldn't work.

 

Regards,

 

Benjamin

View solution in original post


All Replies
Highlighted
L4 Transporter

Re: Detect any ELF executable

Hi,

 

You could try to do a pattern match on the context "file-unknown-body", with 4 7-byte patterns representing the different classes (32-bit or 64-bit) and endianness (little endian or big endian):

 

\x7f454c46010101\x

\x7f454c46010201\x

\x7f454c46020101\x

\x7f454c46020201\x

 

I haven't tried it myself, but I don't see why it wouldn't work.

 

Regards,

 

Benjamin

View solution in original post

L4 Transporter

Re: Detect any ELF executable

It looks like content update 667 added a new file type to detect ELF files (ID #52175).

 

Benjamin

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!