Handling of compromised Linux systems

40
Linux Systems Compromised Understanding and dealing with break-ins Ede, 5 February 2016 Michael Boelen [email protected]

Transcript of Handling of compromised Linux systems

Page 1: Handling of compromised Linux systems

Linux SystemsCompromised

Understanding and dealing with break-ins

Ede, 5 February 2016

Michael [email protected]

Page 2: Handling of compromised Linux systems

Agenda

Today1. How do “they” get in2. Rootkits3. Malware handling4. Defenses

2

Page 3: Handling of compromised Linux systems

Michael Boelen

● Security Tools○ Rootkit Hunter (malware scan)

○ Lynis (security audit)

● 150+ blog posts

● Founder of CISOfy

3

Page 4: Handling of compromised Linux systems

How do “they” get in

Page 5: Handling of compromised Linux systems

Intrusions

● Passwords● Vulnerabilities● Weak configurations

5

Page 6: Handling of compromised Linux systems

Why?

6

Page 7: Handling of compromised Linux systems

Keeping Control

● Rootkits● Backdoors

7

Page 8: Handling of compromised Linux systems

Rootkits 101

Page 9: Handling of compromised Linux systems

Rootkits

● (become | stay) root● (software) kit

9

Page 10: Handling of compromised Linux systems

Rootkits

● Stealth● Persistence● Backdoors

10

Page 11: Handling of compromised Linux systems

How to be the best rootkit?

Page 12: Handling of compromised Linux systems

Hiding ★

In plain sight!

/etc/sysconfig/…/tmp/mysql.sock/bin/audiocnf

12

Page 13: Handling of compromised Linux systems

Hiding ★★

Slightly advanced

● Rename processes● Delete file from disk● Backdoor binaries

13

Page 14: Handling of compromised Linux systems

Hiding ★★★

Advanced

● Kernel modules● Change system calls● Hidden passwords

14

Page 15: Handling of compromised Linux systems

Demo

Page 16: Handling of compromised Linux systems

Demo

16

Page 17: Handling of compromised Linux systems

Demo

17

Page 18: Handling of compromised Linux systems

Continuous Game

18

Page 19: Handling of compromised Linux systems

Detection

Page 20: Handling of compromised Linux systems
Page 21: Handling of compromised Linux systems

Challenges

● We can’t trust anything● Even ourselves● No guarantees

21

Page 22: Handling of compromised Linux systems

Rootkit Hunter

Detect theundetectable!

22

Page 23: Handling of compromised Linux systems

Dealing with malware

Page 24: Handling of compromised Linux systems

● Owner?● Risk?● What if we pull the plug?

Activate your plan!

24

Page 25: Handling of compromised Linux systems

VLANBogus DNSLooks Real™

Quarantine

25

Page 26: Handling of compromised Linux systems

Consider Research

Memory dump(Volatility)

Static analysis

26

Page 27: Handling of compromised Linux systems

Restore

Does it include malware?

27

Page 28: Handling of compromised Linux systems

Defense

Page 29: Handling of compromised Linux systems

Best protection

At least● Perform security scans● Collect data● System Hardening

29

Page 30: Handling of compromised Linux systems

Frameworks / Patches

● SELinux● AppArmor● Grsecurity

30

Page 31: Handling of compromised Linux systems

Compilers

● Remove● Limit usage

31

Page 32: Handling of compromised Linux systems

Harden Applications

● Use chroot● Limit permissions● Change defaults

32

Page 33: Handling of compromised Linux systems

Kernel Hardening

● sysctl -a● Don’t allow ptrace

33

Page 34: Handling of compromised Linux systems

Automation

Page 35: Handling of compromised Linux systems

Tip: Lynis

● Linux / UNIX● Open source● GPLv3

35

Page 36: Handling of compromised Linux systems

Conclusions

Page 37: Handling of compromised Linux systems

Conclusions

● Good rootkits are hard to detect

● Use cost-effective methods● Detect● Restore● Learn

● Apply hardening

37

Page 38: Handling of compromised Linux systems

You finished this presentation

Success!

Page 39: Handling of compromised Linux systems

More Linux security?

Presentationsmichaelboelen.com/presentations/

Follow● Blog Linux Audit (linux-audit.com)● Twitter @mboelen

39

Page 40: Handling of compromised Linux systems

40