MikroTik Router OS Firewall Strategies



Similar documents
Firewall Firewall August, 2003

CS5008: Internet Computing

Firewalls. Pehr Söderman KTH-CSC

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

Firewalls. Test your Firewall knowledge. Test your Firewall knowledge (cont) (March 4, 2015)

Firewalls. Chapter 3

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

GregSowell.com. Mikrotik Security

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

How to protect your home/office network?

Solution of Exercise Sheet 5

How To Set Up An Ip Firewall On Linux With Iptables (For Ubuntu) And Iptable (For Windows)

CMPT 471 Networking II

IMPLEMENTATION OF INTELLIGENT FIREWALL TO CHECK INTERNET HACKERS THREAT

Firewalls, Tunnels, and Network Intrusion Detection

IDS 4.0 Roadshow. Module 1- IDS Technology Overview. 2003, Cisco Systems, Inc. All rights reserved. IDS Roadshow

Firewalls, IDS and IPS

SonicOS 5.9 / / 6.2 Log Events Reference Guide with Enhanced Logging

Chapter 15. Firewalls, IDS and IPS

Computer Security CS 426 Lecture 36. CS426 Fall 2010/Lecture 36 1

1. Firewall Configuration

Firewalls. Network Security. Firewalls Defined. Firewalls

10 Configuring Packet Filtering and Routing Rules

Firewalls Netasq. Security Management by NETASQ

FIREWALLS & CBAC. philip.heimer@hh.se

Chapter 5. Figure 5-1: Border Firewall. Firewalls. Figure 5-1: Border Firewall. Figure 5-1: Border Firewall. Figure 5-1: Border Firewall

Firewalls, Tunnels, and Network Intrusion Detection. Firewalls

REAL-TIME WEB APPLICATION PROTECTION. AWF SERIES DATASHEET WEB APPLICATION FIREWALL

Considerations In Developing Firewall Selection Criteria. Adeptech Systems, Inc.

General Network Security

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

TECHNICAL NOTE 01/02 PROTECTING YOUR COMPUTER NETWORK

ΕΠΛ 674: Εργαστήριο 5 Firewalls

A host-based firewall can be used in addition to a network-based firewall to provide multiple layers of protection.

Firewall Introduction Several Types of Firewall. Cisco PIX Firewall

8. Firewall Design & Implementation

Vanguard Applications Ware IP and LAN Feature Protocols. Firewall

Packet Capture. Document Scope. SonicOS Enhanced Packet Capture

Bypassing PISA AGM Theme Seminar Presented by Ricky Lou Zecure Lab Limited

CSE543 - Computer and Network Security Module: Firewalls

IBM. Vulnerability scanning and best practices

Implementing Secure Converged Wide Area Networks (ISCW)

1. Introduction. 2. DoS/DDoS. MilsVPN DoS/DDoS and ISP. 2.1 What is DoS/DDoS? 2.2 What is SYN Flooding?

CIT 480: Securing Computer Systems. Firewalls

NSFOCUS Web Application Firewall White Paper

Load Balancing and Sessions. C. Kopparapu, Load Balancing Servers, Firewalls and Caches. Wiley, 2002.

Overview. Firewall Security. Perimeter Security Devices. Routers

Proxies. Chapter 4. Network & Security Gildas Avoine

Firewalls. Ola Flygt Växjö University, Sweden Firewall Design Principles

Introduction of Intrusion Detection Systems

Firewalls and Intrusion Detection

Chapter 6 Configuring the SSL VPN Tunnel Client and Port Forwarding

CSC574 - Computer and Network Security Module: Firewalls

CSCI 4250/6250 Fall 2015 Computer and Networks Security

Reducing the impact of DoS attacks with MikroTik RouterOS

SonicWALL PCI 1.1 Implementation Guide

Barracuda Intrusion Detection and Prevention System

Firewalls, NAT and Intrusion Detection and Prevention Systems (IDS)

Firewalls. Ingress Filtering. Ingress Filtering. Network Security. Firewalls. Access lists Ingress filtering. Egress filtering NAT

Track 2 Workshop PacNOG 7 American Samoa. Firewalling and NAT

A S B

WEB APPLICATION FIREWALLS: DO WE NEED THEM?

Gateway Security at Stateful Inspection/Application Proxy

ΕΠΛ 475: Εργαστήριο 9 Firewalls Τοίχοι πυρασφάλειας. University of Cyprus Department of Computer Science

Securing Networks with PIX and ASA

Firewalls and VPNs. Principles of Information Security, 5th Edition 1

Security Technology: Firewalls and VPNs

Chapter 8 Security Pt 2

Firewalls. Ahmad Almulhem March 10, 2012

Remote Access Security

Chapter 4 Firewall Protection and Content Filtering

Linux Network Security

Networking for Caribbean Development

- Basic Router Security -

Chapter 8 Network Security

Internet Privacy Options

Classification of Firewalls and Proxies

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

FIREWALL AND NAT Lecture 7a

Security Technology White Paper

Chapter 4 Security and Firewall Protection

Chapter 3 LAN Configuration

Detecting rogue systems

20-CS X Network Security Spring, An Introduction To. Network Security. Week 1. January 7

Sitefinity Security and Best Practices

Network Defense Tools

Overview. Packet filter

Guide to DDoS Attacks December 2014 Authored by: Lee Myers, SOC Analyst

Security Type of attacks Firewalls Protocols Packet filter

Firewalls P+S Linux Router & Firewall 2013

What is a Firewall? A choke point of control and monitoring Interconnects networks with differing trust Imposes restrictions on network services

CIT 480: Securing Computer Systems. Firewalls

A Decision Maker s Guide to Securing an IT Infrastructure

Firewall VPN Router. Quick Installation Guide M73-APO09-380

Stateful Firewalls. Hank and Foo

Guideline on Firewall

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

SonicOS 5.9 One Touch Configuration Guide

Transcription:

MikroTik Router OS Firewall Strategies MikroTik Router OS Network Threats and Countermeasures Speaker: Tom Smyth CTO Wireless Connect Ltd. Location: Date: Wroclaw, Poland 1st of March 1

Wireless Connect Ltd. Irish Company Incorporated in 2006 Operate an ISP in the centre of Ireland. Good Infrastructure Expertise. Certified MikroTik Partners Training Certified OEM Integrators Consultants Distributor & Value Added Reseller 2

Speaker Profile: Studied BEng. Mechanical & Electronic Engineering, DCU, Ireland Have been working in Industry since 2000 Server Infrastructure Engineer Systems / Network Administrator IS Architect Internet Security Consultant 1st MikroTik Certified Trainer in June 2007 in Ireland 3

Ogma Connect A Collaborative Effort involved in the development and support of MikroTik Powered Appliances Ogma Connect's name comes from the Ancient God of Communications and eloquence who's name was Oghma Oghma was credited with the invention of the written language Ogham which is found carved in stones that mark the land of ancient tribes throughout the once vast Celtic world in northern & western Europe We want people to be able to connect with each other eloquently efficiently and elegantly 4

Presentation Objectives IP v4 Firewall Systems Concepts Outline what a firewall can and can not do Discuss Prevalent Network Attacks and Mitigation Strategies Structure the Firewall In a security centric manner Create policy based rule sets Protocol Specific Filtering Proxy Specifically Http Proxy 5

Sources of Security Information ENISA http://www.enisa.europa.eu/ OWASP http://owasp.org Rits Group http://www.ritsgroup.com/ SANS Institute http://sans.org CIS Centre for Internet Security http://cisecurity.org/ NIST Computer Security http://csrc.nist.gov/ Open BSD http://openbsd.org/ Spamhaus.org http://spamhaus.org nmap.org http://nmap.org ha.ckers.org http://ha.ckers.org/ 6

Firewall Systems One or more systems combined to achieve a desired security objective There are multiple ways firewall systems handle traffic Routing NATing Bridging Proxying 7

Firewall Design Objectives To implement a security policy by classifying, validating, logging and ultimately reacting to traffic Flowing to the system Flowing through the system Flowing from the system Legitimate / useful traffic for users and systems should: Not be Blocked Not be Corrupted Not be Slowed or Hampered Beyond Strict Tolerances Protect the users / systems behind it and Itself 8

Firewall Capabilities Can Identify traffic according to the following Entry interface Exit interface Source Address (Source Address List) Destination Address (destination Address List) Address Types Protocol type (number) Protocol port (source and destination Message type (ICMP) State of the Connection IP V4 Options TCP Flags Number of Concurrent Connections Packet Rate Packet Size Packet Fragmentation Layer 7 Packet Matching (unencrypted) 9

Firewall Limitations Firewalls generally have difficulty with the following Protocol Validation / Filtration Deep packet inspection beyond the first 10 packets / 2.5KB of data in the stream Inspection of encrypted data streams such as Ssh sessions Https Ipsec TLS Protected Connections 10

Firewall Limitations Dont Worry Proxies pick up where firewalls leave off... Proxies allow fine control over specific protocols :) Limitations are not a problem for inherently safe protocols For unsafe protocols proxies help can provide some damage limitation. 11

Proxy 12

What is a Proxy It a service that accepts connections from a client and in turn makes a request to another server. 2 Connections for each Accepted Request Client to the proxy Proxy to the Server 1 Connection for each Rejected Request HTTP Firewall (understands http) RFC Compliance Checking Blocking non http protocols running on port 80 Disable Certain Dangerous Requests Block Content 13

Proxy Limitation Cant Reverse Proxy SSL / TLS Settings :( However one can use Stunnel to decrypt the SSL Traffic before it hits the reverse proxy :) 14

Example Http Reverse Proxy 15

Web Client Makes Https Request 16

Stunnel Decrypts the Request & forwards to Reverse Proxy 17

Reverse Proxy Analyses Request 18

Proxy Accepts & Relays Request 19

Http Server Responds to Proxy Request 20

Proxy forwards Response to Stunnel 21

Client receives the Webpage 22

What if the Proxy Says No? 23

Proxy Sends Error Msg To Stunnel 24

Client Recieves Error Message 25

Http Proxy / Reverse Http Proxy Identical Http Proxy serves to protect clients Http Reverse Proxy serves to protect servers Http Proxy can access any Server from a few clients Http Reverse Proxy can access few servers and is available to any client. Http Proxy Utilises External DNS Servers for Name Resolution. Http Proxy uses a local DNS for Name Resolution 26

Reverse Proxy Setup Same as a standard Proxy Setup Except for the Following Changes Proxy Listens on Port 80 (or redirect to proxy port) Static local DNS entries are setup on reverse proxy External DNS servers point protected hostnames at the external IP of the Reverse Proxy Proxy is heavily firewalled, usual precautions apply Firewall Rules, no outbound connections allowed except for Http tcp port 80 to your webserver Network Syslog udp port 514 NTP Server Requests udp port 123 27

Http Firewall Proxy access list provides option to filter DNS names Urls Filetypes Url paths designed to hack http servers Ports IP address You can make redirect to specific pages Home page of your website Custom Error Pages giving as much or as little information as you require 28

Http Firewall Building Aproach Block Unwanted Requests for telnet, smtp, ftp ports Block Unwanted / Unrequired Http Methods Block URL Paths containing Dangerous Characters Prevent IP Obfuscation Requests Allow White listed Servers Deny access to dissalowed ports Deny Proxying access to Local Networks Deny Proxying access to any other system. 29

Block / Allow Selected Http Methods Only allow Required Methods (Safest) HEAD GET POST Block potentially dangerous Types of HTTP Methods TRACE CONNECT DELETE PUT OPTIONS 30

Example of Http firewall Rules 31

Path Rule Example http://example.com/index.php?=phpb8b5f2a0-3c92-11d3-a3a9-4c7b08c10000 32

Web Proxy Access Rule Add an access rule as follows 33

Protecting sensitive files in poorly configued Servers Deny access to following url paths Any. Files in linux /etc/ /etc/shadow /var/mysql/ /var/log /system32 /syswow /WinNT /Winnt 34

Proxy Limitation ASCII Character codes are not evaluated by proxy but are by webservers e.g. ros.php =%2F%72%6F%73%2E%70%68%70 http://example.com/ros.php = http://example.com%2f%72%6f%73%2e%70%68%70 = http://example.com/72%6f%73.%70h%70 Solution use Regular expressions :) 35

Regular expression example We want to block any requests containing.. to guard against a infamous flaw in IIS a few years ago. http://poorlyimplementedserver.com/../../winnt/system32/cmd.exe We need to block.. and any ascii character codes for the same Required Expression= (\. %2E)(\. %2E) Regular Expressions are denoted in MTROS by entering a preceeding : Path to block = :(\. %2E)(\. %2E) 36

Block urls containing.. 37

Characters required for attacks The Following Characters can be used in attacks against web servers < > ( ) ; ^, Double Quotes ' Single Quotes ` Grave Accent %0A Line Feed %0D Carrige Return $ ` ' ~ * \ #! : 38

The following Combination s of characters can be used in attacks against the web servers @@ -- :// 39

40

IP Address Obfuscation Wirelessconnect.eu IP address can be represented in the following ways Decimal 89.184.47.93 Dword Address 1505242973 Hex Address 0x59.0xb8.0x2f.0x5d Octal Representation 0131.0270.0057.0135 Why Does this Work? 89.0xb8.0057.0x5d 41

Combating IP Obfuscation 42

White Listing Example We want to allow GET, POST & HEAD to the webserver wirelessconnect.eu Remember to always put url path filtering rules above the host whitelist rules 43

Last rules of any reverse proxy Place the following rules below the host whitelists 44

POST HTTP Method Analysis Not Possible with MT HTTP Proxy Need web application knowledge. Web application must have built in validation 45

Modular Firewall System Example 46

Firewall hardening Some of the checks may be duplicated, this is ok, belt and braces. Check for unusual TCP Flags and drop. Drop packets with invalid connection state Your Effort will complement and bolster your networking operating software provider's efforts to maintain security Ultimately you are responsible for your networks security 47

Firewall Best Practices Populate a Router with the Maximum RAM Configuration Use Connection Tracking to achieve state-full packet inspection & perform fragmented packet reassembly Disable Administration interfaces from External Interfaces Try where possible to use in interfaces rather than source ip address for establishing the level of trust that you have for the 48

Firewall System Best Practices Run as few network services on the firewall hardware as possible Turn off all Administration services that are not needed Do not use un-encrypted administration protocols Shore up un-encrypted services with IPSEC policies SNMP DNS (internal use not for customer use) Http fetch Shore up weak encrypted protocols with IPSEC policies 49

Disable Un-needed services Drastically reduces attack surface of your firewall. If a service has a vulnerability your firewall can be compromised (stability, availability, integrity) Administration Services are particularly risky as they allow for the change of firewall configuration DNS Server services should be offloaded to a Hardened DNS Box NTP Server services should be offloaded to a Hardened NTP Box 50

Unencrypted Administration Risk Vulnerable to Sniffing / Replay attacks. Can allow an attacker who can view the traffic to harvest user authentication credentials IPSEC can eliminate this risk by securing the traffic with the best available FIPS grade cryptography protocols IPSEC can be used to increase confidence if encryption quality of an administration service is unknown. 51

More RAM More Connections NSA Security Guide for Routers suggests that Perimeter routers /firewalls be configured with the maximum available RAM The More RAM you have the harder the device is to Crash due to memory exhaustion (DOS / DDOS attacks) MT ROS Devices are Optimised against RAM Exhaustion Attacks. The firewall can cope better in busy periods. Ogma Connect Routers are always Sold with the maximum Supported RAM available :) Wireless Connect Customers can avail of RAM upgrades for RB1000 & the New and Improved RB1100 :) 52

Hardware with multiple Physical Interfaces The More Interfaces the more you can isolate multiple untrusted interfaces. For Clients who require higher levels of Secuity assurance. Please Check Out my colleague Wardner Maia's Presentation on Layer 2 Threats and Countermeasures. 53

Hardware fit for the Job :) As you have seen from the My colleague and Friend Patrik Schaub's presentation on Mikrotik Datacentre products. 54

RB 1100 13 Interfaces :) so greater control of your network Available from Wireless Connect Shortly. 55

Ogma Connect 2500 11 GBE Interfaces by Default Up to 19 GBE with Expansion Cards 56

Connection Tracking ConTrack carries out the following essential tasks It monitors the state of all connections / requests flowing in the firewall Allows the firewall to dynamically open / close ports according to the connection state in the firewall Performs IP Packet Reassembly before inspection (prevents IP Fragment Attacks) 57

Filter Administration Services Minimise Risk from outside attacks Allow Flexibility of management internally 58

Firewall Setup Strategy Turn on connection tracking Break down the security policy into functional groups Use chains to define these functional groups Granularly control settings within the chains /groups Make use of Address lists group hosts together 59

List Objectives (policies) We want to Detect / Block Traffic to / from Invalid Addresses Detect / Block Traffic that have a large packet size Detect / Block Traffic that has unusual characteristics Detect / Block Traffic from Port Scanners Detect / Block Traffic from Brute Force Hackers Once Traffic has been inspected don't keep reprocessing the same connection. Analyse Traffic originating from and Leaving router Protect Traffic Entering and destined for the router. Update some Rules dynamically (Self Defending Networks) 60

Invalid Addresses Bogons (source and destinations) Un allocated addresses Remove (Special Purpose Allocated Addresses) Allocated Special Purpose: Multicast Addresses (source addresses only) 224.0.0.0/4 Broadcast Addresses 255.255.255.255 Connected Network Broadcast addresses such as 192.168.0.255 if the router has an ip address of 192.168.0.x/24 192.168.0.127 if the router has an ip address of 192.168.0.x/25 Private IP Addresses Test IP Addresses 192.0.2.0/24 Loopback Addresses 127.0.0.0/8 61

Block invalid packets with IP Broadcast source address 62

Blocking IP Directed broadcast In forward chain create a rule with destination address type = Broadcast. Example of IP Directed broadcast 192.168.1.255 63

Blocking IP Directed Broadcast 64

Block Bad People Dynamic updates Reference Spamhaus DROP List (Dont Route or Peer) updated Weekly Reference SANS ISC Top 10 10000(optional if you wish) Bogons (un allocated not special Purpose) Updated a circa every month 65

Updating Address Lists automatically Use a combination of Scheduler and Scripting tools, and Fetch. Fetch is very good because of the ability to use DNS Addresses for ease of management. Security Concerns...Updates traversing untrusted networks Use IPSEC Policy for fetch tool, ensure DNS Requests don't traverse untrusted networks or Use Static DNS 66

Address List Update Script Sample :global oldbogoncount; :global totalbogoncount; /ip firewall address-list set comment="oldbogons" [/ip firewall address-list find list=bogons_address_list] :set oldbogoncount [ip firewall address-list print count-only value-list where list=bogons_address_list]; /tool fetch mode=http url="http://wirelessconnect.eu/store/images/bogonsnoprivate.rsc" import bogonsnoprivate.rsc :set totalbogoncount [ip firewall address-list print count-only value-list where list=bogons_address_list]; :if ($oldbogoncount < $totalbogoncount) do {/ip firewall address-list remove [/ip firewall address-list find comment="oldbogons"] } 67

Block Packets with Large Size Block Packets larger than 1500 bytes to protect legacy clients. 68

Block Un-needed IP Options Strict Source Route Loose Source Route Route Record Timestamp Router Alert (if not using RSVP) 69

Block Port Scanners Detect Nmap Scan types (TCP) Christmas Tree SYN FIN FIN ALL SYN/RST Detect using MT Port Scan Detect TCP Detect and drop scans using ICMP Messages out bound (Port Unavailable) Communications Prohibited 70

Port Scan Detect TCP Scans Detected Directly UDP Scans indirectly Drop UDP Scans / Results of UDP Scans (ICMP) Add big offenders to Port Scanners blocking list 71

Checking Rate of matches For blacklisting obvious UDP Scanners Limit the speed of a scan for 120 ports per minute 72

Blocking the UDP Attacker Use Add Dst Address to Address List action 73

Brute Force Detection Depends on server disconnection after failed authentication attempts. Requires that any one administration session is maintained as continuous established connection. Based on some cool ideas from the MT User Community On First Connection ( First authentication attempt) add src to Management Light Grey List On Second Connection add src to Management Grey List On Third Connection add src to Management Dark Grey List On Fourth Connection add src to Management Black List Then insert Rule to Block members of the Management Black List this List on the Router 74

Sending Protocols to bruteforce check Send selected protocols to the Brute Force Check Chain 75

Brute Force Detection 76

Last Rule in Detection Chain Accept new connection as long as Src Address is not in the management Black List 77

Further Reading For more information on firewall rules click on Http://wirelessconnect.eu/layer3_subscriptions Sign up for an account and we will send you instructions for setting up the firewalls and Proxies when they are publicly released after the MUM http://wiki.mikrotikl.com 78