Dr. Maik Ro ➡️🦋 Profile picture
Dec 16, 2023 28 tweets 9 min read Read on X
Day 1️⃣3️⃣ of Your SOC Analyst Journey

Automatic detection of malware: Image
In the last threads we walked through

FIM - File Integrity Monitoring,
Signature-based detection via YARA
and your first detection rules Image
That’s a lot of ground we covered already - now that pops the question:

How can we test each file that is added to the monitored folders for possible malware quick and easy?!

Thats where CDB come in! Image
A what now?

A CDB is a Content Database - as the name suggests it holds data about content - the content can be almost anything (as long as its text)

What does that means specifically - a CDB is a Key:Value Database Image
For starters we will fill the the CDB with hashes of known malware/viruses

This will be responsible to work together with FIM -

1 - FIM detects changes in the monitored folders Image
2 - now that is where the CDB comes in, FIM saves the file hash in your SIEM

3 - and IF you have a rule that compares the saved hashes to the CDB it triggers a security alert if a match is found 🚨 Image
Ok great but how do I implement this in my SIEM mr maikroservice

Allow me to share

You start by creating a CDB list
all those are stored in the /var/ossec/etc/lists directory and we will create one called “malware” 🦠

you can use
touch /var/ossec/etc/lists/malware

to create the file Image
and then either manually or automatically add hashes to the file

Download a list of known malware hashes e.g. from my favorite - malware bazaar



We will use sha256 hashes because they are more collision-resistant than md5/sha1 bazaar.abuse.ch/export/txt/sha…
Image
When you open the list you will see the following: Image
now there is a slight issue this file holds all the hashes alright

BUT

We need only hashes and a colon in the end of each of the hashes

How on earth do we get that done?!

AWK to the rescue!
GAWK 🦅

awk '!/^#/{print $1":";}' full_sha256.txt >> malware

pheeew that umm… looks complicated Image
Lets walk through it step-by-step

awk ‘!/^#/

this checks if a line starts with a # and takes ALL the other lines (those are the hashes we want)
{print $1”:”;} - this prints out the hashes and ADDS a colon behind the hashes

so that they look like this beauty here

2abe23989adfbe45f6e92a32c49eaf324240627da1f32a3838edbb51d6968152: Image
we read all of this from the downloaded full_sha256.txt and finally append all the correct hashes into the malware CDB list we created earlier Image
AAAAAND 🚀 MAGIC

all the hashes are now in the the wonderful malware Content Database

keep in mind that if you add hashes they need to be UNIQUE (which is why we used SHA256)
Image
Image
Each CDB has to be added to the ossec.conf file on the wazuh server machine

This needs to be inside the section

etc/list/malware Image
Ok great we have 2/3 covered on our road to automatic alerting

now comes the detection rule!

head to /var/ossec/etc/rules/local_rules.xml Image
pheew that is also a lot going on here

again step-by-step Image
The rule runs in case a new file is created in the monitored location by FIM

It matches the sha256 file hash of the newly created file to the CDB list key (that is the part before the colon)
Image
Image
if the hashes match STUFFS ON FIRE - CALL THE POLICE 👮

the only thing you have to do to automatically run this

is restarting the wazuh manager via

systemctl restart wazuh-manager Image
OK GREAT - but does it work?!

YESSSSSSS IT DOES - works like a charm!

try to download malware samples from malware bazaar and watch the magic happen in the Security Events 🪄✨
Image
Image
Now we have a full running pipeline - FIM → CDB → Alerting

but a final step is “missing”! Image
There is an option to automatically take action when malware was identified

and guess what?!

We will cover that in the next thread! Image
If you enjoyed the thread please consider following me for more content just like this!

and if you loved this post - scroll a little further Image
You have exactly 14 days left to preorder the course that covers the steps necessary to take your Cyber career to the next level

If you want to be a Security or SOC Analyst now is the time to take action

You can buy the course for $50 now but only until 01.01.2024 Image
Afterwards the course price will go up to $150

There is one more perk - anyone who buys the course now in preorder mode, will get

a FREE bootcamp spot!

What are you waiting for?

Take your careeer into your own hands NOW.
@threadreaderapp unroll

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Dr. Maik Ro ➡️🦋

Dr. Maik Ro ➡️🦋 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @maikroservice

Jul 14, 2024
How to setup effective computer interrogation 🖥️ 🔍 🕵️‍♀️ - a 🧵:
Hey friends - in this thread we will walk through the setup of zentral to allow you to query all your endpoints at once using only SQL

ready, set - GO: MAGIC 🪄✨
but first things first - why would I want this in the first place?!

GREAT question! 💜
Read 27 tweets
Jun 28, 2024
If you work in Tech/IT/Security today everyone is talking about TeamViewer.

Wanna know what happened and how you can easily triage cases like this in the future as a SOC Analyst?

Allow me to share, a 🧵:
The TeamViewer Application is used by IT Professionals and everyone who lives far away from home but still has to deal with their families’ IT problems.

It allows you to remotely login to any computer that shares some session information with you.
What happened recently was that TeamViewer announced they might have been compromised

😱😱😱
Read 16 tweets
Jun 18, 2024
The easiest way to start with Cybersecurity:
Imagine the following situation:

WOHOOOOOO - YOU WON 🥇🏆

You have your first day as the new security person.

Congratulations, this journey was not easy but you made it anyway! 🚀🎉
and of course, you are EAGER to show up on your first day and fix any security problem that comes your way!!!!!11 👩‍🔧🧑‍🔧👨‍🔧

and then you arrive… 🚗💨
Read 28 tweets
Feb 19, 2024
Walkthrough 🚶🚶‍♀️🚶‍♂️ - What does all of this mean and why should I care?! Image
In the last post I shared the screenshot above with you ⬆️

& wanted to know what you would do if you see this after an alert was triggered when a new account logged into one of the machines in your company network
First up, what do you need to do as a SOC Analyst when you see a new alert?! 🚨🤨🔍
Read 26 tweets
Jan 25, 2024
Day 2️⃣7️⃣

MITRE ATT&CK Framework for brainiacs 🧠 and other cyber stars🌟:
Imagine you are a glorious SOC Analyst working on a beautiful new case after the following alert has been thrown: Image
OH SHOOOOOOT - that is possibly bad karma, terrible mojo and defcon 1 all combined.

So you start investigating - first which machine was this on:

The webserver.
Read 26 tweets
Jan 15, 2024
Day 2️⃣6️⃣

Detecting Image
Brute Force attacks are very common lateral movement / initial access vectors because humans are inherently bad at remembering long complex passwords.
💡 What is the difference between brute-force, password spraying and credential stuffing?
Brute-Force - attackers use common usernames / password combos (e.g. root 4 linux & administrator 4 windows)

Password Spraying - one/few passwords against many accounts (internal/external)

Credential Stuffing - known credentials 4 computers that they did not yet compromise Image
Read 33 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(