Dr. Maik Ro ➡️🦋 Profile picture
Jan 5, 2024 31 tweets 9 min read Read on X
Linux Log Files and where to find them: Image
First up - are you ready to become a full fledged cyber professional?

Maybe even a Security Analyst or Security Operations Center Analyst?

Good - I have just the thing for you - sign up now for the bootcamp waitlist at:
maikroservice.com/waitlist
Image
*nix systems store logs in a variety of locations but most of them are aggregated in one central folder:

/var/log Image
GREAT! but umm… is this universal?

Do all unix systems store the same log files?

Is the content always the same across distributions?

NO. Image
If you compare e.g. debian and debian-based ubuntu 22.04 you will see some differences: Image
But now comes the tricky part…

If you compare ubuntu 22.04 and ubuntu 23.04…

well… They also differ Image
WHAT THE FUDGE?!

Exactly - Apparently ubuntu 23.04 added a new file called apport.log (it holds information about program crashes) which ubuntu 22.04 does not have
Huh, interesting.

Well but it also makes sense - software evolves and changes - just like Operating Systems ;) (they are software)
Ok cool, but which files do I need to know when I want to become a Security/SOC Analyst?

There are at least 5 you should have heard of (probably more) Image
Wanna look at them?

OK HERE WE GO!
First candidate is auth.log, located in /var/log/auth.log and it is one of the important logs that every SOC Analyst needs to know Image
auth.log holds

logins
user changes
group changes
system reboot timestamps
sudo command history
… more Image
Wanna look at an example?

Here we go! 🚀 Image
Next up in our list is syslog

The ultimate log, cut directly from Yggdrasil and forged in the hell fire protected by Kerberos (or something like that 🤣) - the holy grail of logs Image
The systemlog or syslog is a combination of multiple different log information - e.g. authentication events, kernel events and something called “locales” Image
a local is basically a configurable channel that you can fill with almost any log of your choice

Have a webserver that you want to monitor closely? Put it on a local

Need to know when your Database throws up? Put it on a local

You get the idea 💡
Cool but what does syslog look like?

e.g. like this: Image
Wonderful, but I want to know where I can look for brute-force attacks.

Smart!

You could find those in two specialized logs - wtmp and btmp Image
These two are a little special though, they are binary logs.

Binary what?

They hold 0s and 1s ? almost. They are in a format that is not plain text but needs a special command to be readable

PFFF I dont believe you.
You dont?

Well.. that makes me sad. but luckily I can prove it!

try opening wtmp with a text editor: Image
WOAAAAAHHHHH ITS TOOO BRIGHT - MY EYES

HEAAAAAAALP
Image
Image
MAKE IT STOP - ahh ok much better.

How would I open those to be readable in dark mode though?!

use the last and lastb commands: Image
last reads the wtmp file which holds all the current logon sessions (who is using the computer)

while lastb needs sudo rights to execute and it holds failed logon attempts

check it out:

sudo lastb

oh. Its empty. Image
ok ok ok - we can easily generate some failed logons - either use hydra for brute force or just type your password wrong at least 2x

Just like I do every time… … 😅🫠 Image
Can we also see when users logged in the last time?

SURE! That is where lastlog comes in - its a command that allows you to see who logged into the computer at which time. Image
if e.g. a hacker would login as root because they escalated their privileges and then uploaded a ssh key into the root .ssh folder - you can see that

and start the investigation 🔬👀 🕵️ Image
and then CATCH THE BAD GUYS MUHAHAHAHAH

CLICK CLACK IS THE SOUND OF THE HAND CUFFS (kinda) Image
The last one for today is called journalctl - it is a good starting point to check if services/software had errors during their installation / runtime Image
typically you would use

journalctl -xe

to see the end of the file (-e), the most recent part, and more metadata (-x) Image
Just like MAGIC! 🪄✨

I hope you learned something today - if you did please follow me @maikroservice for more content like this Image
@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!

:(