Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling malware as zip protected file #538

Closed
axpatito opened this issue Apr 11, 2018 · 9 comments
Closed

Handling malware as zip protected file #538

axpatito opened this issue Apr 11, 2018 · 9 comments

Comments

@axpatito
Copy link

Hi all,

How would a use case be if I need to upload files that are password zipped and contain malware?

Sometimes I get samples from external sources that are delivered as compressed files with password in order to avoid AV detection. Is there a functionality that would allow me to upload the file AS IS to TheHive and extract the artifacts from it, creating the necessary observables?

Can this be done automagically?

@nadouani
Copy link
Contributor

Hello,

this is not supported in the current TheHive version, but could be a good idea.
I don't know when this could be added but, it's definitely a good feature request

@nadouani nadouani changed the title [QUESTION] Handling malware as zip protected file Handling malware as zip protected file Apr 12, 2018
@AustinHaigh
Copy link

Hi @axpatito and @nadouani,

Just want to be clarify what you are looking for, in terms of observables and what you mean by “extract the artifacts”. I am presuming that we simply want to identify accessible metadata about the content, versus actually extracting/unzipping the live malware content.

With that in mind, some useful metadata might include:

  • Filenames
  • Directory structure
  • Original file size
  • Compressed file size
  • CRC/Checksum data
  • Dates/Times
  • Compression type
  • etc.

Would having access this type of information meet the need for this feature request?

@saadkadhi
Copy link
Contributor

Hi @AustinHaigh. In fact it's much simpler than that. As an analyst, you may receive password- protected zipped malware (or suspicious file that need to be analyzed). In the current version of TheHive, you'll have to:

  • unzip the password-protected archive in a location that is not scanned by your endpoint's AV and by taking extra precautions to avoid accidentally infect your machine
  • add the file as an observable to TheHive
  • analyze it using Cortex etc.

The feature request should allow analysts to have access to a new datatype (for ex. protected zip) and when they import the archive, they can specify the password needed to open it and TheHive should extract all files (if more than one) and add them as file observables while, if possible, adding the original zip file as-is for the audit trail.

@AustinHaigh
Copy link

Okay, thanks for the clarification. I have implemented a proof of concept, would someone mind taking a look at it and providing some comments/feedback?

The code extracts each file from the zip archive and submits the archive and each file as separate observables (with the same tags and description).

  • IF the archive is password protected it checks for a tag beginning with ‘password:’ and uses the string after the colon as the password.
  • IF it doesn’t find such a tag it pulls the datastore.attachment.password configuration option which is used by AttachmentCtrl when a user downloads a file observable as an encrypted zip archive (and defaults to ‘malware’).”

https://github.com/AustinHaigh/TheHive/tree/zipFileUpload

@axpatito
Copy link
Author

I can jump into it. I'll do some tests tomorrow.

@axpatito
Copy link
Author

axpatito commented Jul 9, 2018

@AustinHaigh I've been doing test and I can't get the code base to work. I tried with various files compressed with both malware and benign files, also from different compressing software (7zip, winrar, native linux, zip command con centos and ubuntu) IMO we should add unit test to this feature before creating a PR.

@AustinHaigh
Copy link

I'm sorry, I forgot to mention I added a new datatype called 'zipfile', and only files uploaded with the 'zipfile' datatype are automatically uncompressed. Are you using the right datatype? I added the datatype to thehive-backend/app/models/Migration.scala but it only gets created when the database is being initialized. Is there something else I need to do to add the datatype to an already initialized database? Maybe increment a version number?

@axpatito
Copy link
Author

axpatito commented Jul 18, 2018

Hey @AustinHaigh I confirm that this feature actually works as expected. Sorry it took so long, I got caught in another PR I'm working on. Are you gonna open a PR?

@AustinHaigh
Copy link

No problem. I'll open a PR now.

@To-om To-om added this to the 3.1.0 (Cerana 1) milestone Jul 30, 2018
@To-om To-om closed this as completed Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants