Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

47
MODSECURITY ELK If we do not wish to fight we can prevent! {

description

Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Transcript of Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Page 1: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

MODSECURITYELK

If we do not wish to fight we can prevent!

{

Page 2: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 2

ModSecurity

Page 3: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 3

*log

Page 4: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 4

ELK

Page 5: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 5

ModSecurity

Ryan C. BarnettModSecurity is an open source, cross-platform web application firewall (WAF) module. Known as the "Swiss Army Knife" of WAFs, it enables web application defenders to gain visibility into HTTP(S) traffic and provides a power rules language and API to implement advanced protections.

Blackhat Arsenal 2014

Page 6: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 6

Surviving D-Day Omaha Beach 1944

Page 7: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 7

Surviving D-Day Omaha Beach 1944 Fake tank

Fake aircraft

Fake Napoli (Egypt)

Fake ……

Page 8: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 8

HoneyTraps with ModSecurityhttp://map.honeycloud.net/

Page 9: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 9

1.Real-time Application Profiling

Page 10: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 10

Real-time Application Profiling Request method(s)

Number of parameters (minimum/maximum range)

Parameter names

Parameter lengths (minimum/maximum range)

Parameter types

Flag (such as /path/to/foo.php?param)

Digits (such as /path/to/foo.php?param=1234)

Alpha (such as /path/to/foo.php?param=abcd)

Alphanumeric (such as /path/to/foo.php?param=abcd1234)

E‑mail (such as /path/to/[email protected])

Path (such as /path/to/foo.php?param=/dir/somefile.txt)

URL (such as /path/to/foo.php?param=http://somehost/dir/file.txt)

SafeText (such as /path/to/foo.php?param=some_data-12)

Page 11: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 11

Real-time Application Profiling

Page 12: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 12

Post-Process Profiling

Page 13: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 13

4 scenarios

If the HTTP response code is 404, the resource doesn’t exist. In this case, not only do we skip the profiling, but we also remove the resource key, so we delete the persistent storage. This is achieved by using the setvar:!resource.KEY action.

If the HTTP response code is either level 4xx or level 5xx, the application says something is wrong with the transaction, so we won’t profile it in this case either.

The OWASP ModSecurity Core Rule Set (CRS) can use anomaly scoring. We can check this transactional anomaly score. If it is anything other than 0, we should skip profiling.

Finally, we have already seen enough traffic for our profiling model and are currently in enforcement mode, so we skip profiling.

Page 14: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 14

2. Hacker Traps

Page 15: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 15

Hacker Traps

Unused Web Ports

Fake robots.txt Disallow Entries

Fake HTML comments

Fake hidden form fields

Fake cookies

Page 16: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 16

Hacker Traps

Unused Web Ports

Page 17: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 17

Hacker Traps

Fake robots.txt Disallow Entries

Page 18: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 18

Hacker Traps

Fake HTML comments

Page 19: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 19

Hacker Traps

Fake HTML comments

Page 20: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 20

Hacker Traps

Fake hidden form fields

Page 21: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 21

Hacker Traps

Fake cookies

Page 22: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 22

Hacker Traps

Fake cookies

Page 23: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 23

3a. Self-Contained vs. Collaborative Detection

Page 24: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

24

Self-Contained vs. Collaborative Detection

Self-Contained Collaborative

Security Bootcamp 2014

Page 25: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 25

Anomaly Scoring Threshold Levels

Page 26: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 26

3b. Inbound/Outbound Correlation

Page 27: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 27

Correlation

Did an inbound attack occur?

Did an HTTP response status code error (4xx/5xx level) occur?

Did an application information leakage event occur?

Page 28: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 28

Correlation

If an inbound attack was detected, and either an outbound application status codeerror or information leakage event was detected, the overall event severity is raised to one of the following:

• 0, EMERGENCY, is generated from correlation of anomaly scoring data where an inbound attack and an outbound leakage exist.

• 1, ALERT, is generated from correlation where an inbound attack and an outbound application-level error exist.

Page 29: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 29

4. Detecting Malicious Links

Page 30: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 30

Detecting Malicious Links

URI Blacklist RBL6

Google’s Safe Browsing API7

ModSecurity @rbl operator

@gsbLookup operator

@rsub operator

SecGsbLookupDb directive

SecStreamOutBodyInspection directive

SecContentInjection directive

STREAM_OUTPUT_BODY variable

Page 31: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

31

5. Normalizing Unicode

Security Bootcamp 2014

Page 32: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 32

Normalizing Unicode

Best-Fit Mapping

Detecting Use of Full-/Half-Width Unicode

Page 33: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 33

Best-Fit Mapping

%u3008scr%u0131pt%u3009%u212fval(%uFF07al%u212Frt(%22XSS%22)%u02C8)%u2329/scr%u0131pt%u232A

⟨(0x2329) ~= <(0x3c)

〈 (0x3008) ~= <(0x3c)

< (0xff1c) ~= <(0x3c)

ʹ(0x2b9) ~= '(0x27)

ʼ(0x2bc) ~= '(0x27)

ˈ(0x2c8) ~= '(0x27)

′(0x2032) ~= '(0x27)

' (0xff07) ~= '(0x27)

Page 34: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 34

Unicode Mapping

Page 35: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 35

Unicode Mapping

Page 36: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 36

Full-/Half-Width Unicode

Page 37: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 37

6. Abnormal Header Ordering

Page 38: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 38

Passive OS fingerprinting

Page 39: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 39

7. Detecting Page Title Changes

Page 40: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 40

Detecting Page Title Changes

Page 41: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 41

8. Web Client Device Fingerprinting

Page 42: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 42

Web Client Device Fingerprinting

Page 43: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 43

9. Slowing Down Automated Attack Tools

Page 44: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 44

Slowing Down Automated Attack Tools

Page 45: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 45

NSM

Logstash Elasticsearch KibanaNo code required

Real-time analysis of streaming data

Highly scalable

Open source, community driven

Page 46: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 46

DEMO

Page 47: Triển khai Modsecurity vào hệ thống NMS - Quan Minh Tâm

Security Bootcamp 2014 47

Thank you!Question, huh?

FPT TELECOM