Security WeeSan Lee

Slides:



Advertisements
Similar presentations
Backdoors A backdoor is a program that allows attackers to bypass normal security controls on a system, gaining access on the attacker’s own terms.
Advertisements

Ipchains and Iptables Linux operating system natively supports packet-filtering rules: Kernel versions 2.2 and earlier support the ipchains command. Kernel.
CSCI 530 Lab Firewalls. Overview Firewalls Capabilities Limitations What are we limiting with a firewall? General Network Security Strategies Packet Filtering.
Securing Network using Linux. Lesson Outline Setting up a secure system TCP Wrapper configuration Firewalls in Linux Authentication Systems –NIS –Kerberos.
Packet Filtering CS-480b Dick Steflik. Stateless Packet Filters A border router configured to pass or reject packets based on information in the header.
TCP/IP - Security Perspective Upper Layers CS-431 Dick Steflik.
COEN 252: Computer Forensics Router Investigation.
1 Lecture 20: Firewalls motivation ingredients –packet filters –application gateways –bastion hosts and DMZ example firewall design using firewalls – virtual.
Firewalls: General Principles & Configuration (in Linux)
Chapter 11 Phase 5: Covering Tracks and Hiding. Attrition Web Site  Contains an archive of Web vandalism attacks
1 Chapter 6 Network Security Threats. 2 Objectives In this chapter, you will: Learn how to defend against packet sniffers Understand the TCP, UDP, and.
Port Knocking Software Project Presentation Paper Study – Part 1 Group member: Liew Jiun Hau ( ) Lee Shirly ( ) Ong Ivy ( )
CS426Fall 2010/Lecture 361 Computer Security CS 426 Lecture 36 Perimeter Defense and Firewalls.
1 Figure 5-4: Drivers of Performance Requirements: Traffic Volume and Complexity of Filtering Performance Requirements Traffic Volume (Packets per Second)
NetFilter – IPtables Firewall –Series of rules to govern what Kind of access to allow on your system –Packet filtering –Drop or Accept packets NAT –Network.
07/11/ L10/1/63 COM342 Networks and Data Communications Ian McCrumRoom 5B18 Tel: voice.
Linux Networking and Security Chapter 11 Network Security Fundamentals.
Packet Filtering and Firewall
Karlstad University Introduction to Vulnerability Assessment Labs Ge Zhang Dvg-C03.
IPtables Objectives –to learn the basics of iptables Contents –Start and stop IPtables –Checking IPtables status –Input and Output chain –Pre and Post.
Cosc 4750 Networking. The basics Machine A and Machine B have a connection to a network When Machine A wants to “talk” to machine B, it creates a packet.
SCSC 455 Computer Security Network Security. Control access to system Access control mechanisms in specific network programs  e.g. 1, wu-FTP server support.
Honeypot and Intrusion Detection System
Iptables and apache 魏凡琮 (Jerry Wei). Agenda iptables apache.
Firewalls A device that screens incoming and outgoing network traffic and allows or disallows traffic based on a set of rules The “device” –Needs at least.
1 CHAPTER 3 CLASSES OF ATTACK. 2 Denial of Service (DoS) Takes place when availability to resource is intentionally blocked or degraded Takes place when.
1 Firewalls. ECE Internetwork Security 2 Overview Background General Firewall setup Iptables Introduction Iptables commands “Limit” Function Explanation.
1 實驗九:建置網路安全閘道器 教師: 助教:. 2 Outline  Background  Proxy – Squid  Firewall – IPTables  VPN – OpenVPN  Experiment  Internet gateway  Firewall  VPN.
NETWORK SECURITY USING IPTABLES. TOPICS OF DISCUSSION NETWORK TRAFFIC IN PRESENT SCENARIO !! WHY WE NEED SECURITY ? T TYPE OF ATTACKS & WAYS TO TACKLE.
Linux Networking and Security
Firewalling With Netfilter/Iptables. What Is Netfilter/Iptables? Improved successor to ipchains available in linux kernel 2.4/2.6. Netfilter is a set.
IPtables Objectives Contents Practicals Summary
Advanced Unix Chapter 14. Network Tools There are many, many network tools that come with a standard Linux installation. There are many, many network.
Firewall Tutorial Hyukjae Jang Nc lab, CS dept, Kaist.
Scanning & Enumeration Lab 3 Once attacker knows who to attack, and knows some of what is there (e.g. DNS servers, mail servers, etc.) the next step is.
CSN09101 Networked Services Week 6 : Firewalls + Security Module Leader: Dr Gordon Russell Lecturers: G. Russell.
Topics Network topology Virtual LAN Port scanners and utilities Packet sniffers Weak protocols Practical exercise.
1 Linux Security. 2 Linux is not secure No computer system can ever be "completely secure". –make it increasingly difficult for someone to compromise.
1 Security. 2 Linux is not secure No computer system can ever be "completely secure". –make it increasingly difficult for someone to compromise your system.
1 Firewalls. ECE Internetwork Security 2 Overview Background General Firewall setup Iptables Introduction Iptables commands “Limit” Function Explanation.
Unit - III. Providing a Caching Proxy Server (1) A caching proxy server is software that stores (caches) frequently requested internet objects such as.
Firewalls Group 11Group 12 Bryan Chapman Richard Dillard Rohan Bansal Huang Chen Peijie Shen.
Retina Network Security Scanner
Firewall C. Edward Chow CS691 – Chapter 26.3 of Matt Bishop Linux Iptables Tutorial by Oskar Andreasson.
IPTABLES -FIREWALL. IPTABLES IPTABLE BASIC IMPORTANT FILES SIMPLE SECURITY IMPLEMENTATION (GRAPHICAL WAY) IMPLEMENTING FIREWALL RULE WITH EXAMPLE (COMMAND.
Introduction to Linux Firewall
Firewalls Chien-Chung Shen The Need for Firewalls Internet connectivity is essential –however it creates a threat (from the network) vs.
LINUX® Netfilter The Linux Firewall Engine. Overview LINUX® Netfilter is a firewall engine built into the Linux kernel Sometimes called “iptables” for.
1 CNLab/University of Ulsan Chapter 19 Firewalls  Packet Filtering Firewall  Application Gateway Firewall  Firewall Architecture.
Linux Firewall Iptables.
防火牆 Firewall All rights reserved. No part of this publication and file may be reproduced, stored in a retrieval system, or transmitted in any form or.
Introduction to Vulnerability Assessment Labs Ge Zhang Dvg-C03.
Basic Linux Desktop Security © Konrad Rosenbaum this presentation is protected by the GNU General Public License version 2 or any newer.
Securing your network But still be able to access it Hugh Mahon.
Firewalls. A Firewall is: a) Device that interconnects two networks b) Network device that regulates the access to an internal network c) Program that.
Enumeration.
Firewalls Dr. X (Derived from slides by Prof. William Enck, NCSU)
FIREWALL configuration in linux
Firewalls.
The Linux Operating System
ECE 544: Middlebox lab Abhigyan Sharma.
Securing services in a unix-based environment
Packet Filtering Dick Steflik.
IS3440 Linux Security Unit 6 Using Layered Security for Access Control
Lab 7 - Topics Establishing SSH Connection Install SSH Configure SSH
Setting Up Firewall using Netfilter and Iptables
Firewalls By conventional definition, a firewall is a partition made
From ACCEPT to MASQUERADE Tim(othy) Clark (eclipse)
Presentation transcript:

Security WeeSan Lee

What’s wrong with this picture? The Internet www eon db kilo-1

What’s wrong with this picture? The Internet www eon db kilo-1 fw

What’s wrong with this picture? The Internet www eon db kilo-1 fwfw2 DMZ

What’s wrong with this picture? The Internet www eon db kilo-1 fw fw2 DMZ fw3

Roadmap Introduction How security is compromised? Security Tips Security Tools iptables Q&A

Introduction The philosophy of Unix/Linux was optimized for convenience over security Until the “Internet Worm” from Robert Morris, Jr. CERT was formed as a result Even so, Unix/Linux is still more secure than Windows In general, Windows/Unix/Linux is not secure, get a dedicate firewall

How security is compromised? Social engineering  The users/admins are often the weakest links in the chain of security  60% of security incidents involve an insider  Educate the users Configuration errors  Accounts without passwd Software vulnerabilities  Buffer overflow  Use of relative paths

How security is compromised? system("/bin/cat ". $_POST["filename"]); OOPS!

Security Tips Employ packet filtering Update software patches  Put “yum update” in the crontab Frequent backups Logging  /var/log/messages  /var/log/secure  /var/log/maillog  /var/log/wtmp Centralized remote logging  $ man syslog.conf

Security Tips Turn off unnecessary services  $ /bin/netstat -ta | grep LISTEN tcp 0 0 *:submission*:* LISTEN tcp 0 0 *:sunrpc*:* LISTEN tcp 0 0 *:x11*:* LISTEN tcp 0 0 *:38516*:* LISTEN tcp 0 0 localhost:ipp*:* LISTEN tcp 0 0 *:smtp*:* LISTEN …  $ /usr/sbin/lsof -i :38516 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME rpc.statd 911 nobody 9u IPv TCP *:38516 (LISTEN)

Security Tips Passwords  To check for null passwords $ perl -F: -ane ‘print if not $F[1];’ /etc/shadow  To find logins without passwords $ perl -F: -ane ‘print if not $F[2];’ /etc/passwd  Password aging

Security Tips Minimize the # of setuid programs  35 setuid programs on average  $ find / -user root -perm print | mail –s ‘setuid root files’ sysadm File permissions  /etc/{passwd,group} should have 644  /etc/shadow should have 600

Security Tips Don’t use /etc/hosts.equiv and ~/.rhosts  Create unwritable, zero-length ~/.rhosts Use LDAP instead of NIS Use NFSv4 Run ClamAV, antivirus software /etc/hosts.{allow,deny}  $ cat /etc/hosts.deny ALL:ALL  $ cat /etc/hosts.allow sshd: / Sendmail: ALL

Security Tools - simple less  $ /usr/bin/less /var/log/maillog last  $ /usr/bin/last -f /var/log/wtmp -t

Security Tools lastlog  $ lastlog -u weesan Username Port From Latest weesan pts/14 xx.xx.xx Tue May 27 22:39: grep  $ /bin/grep "Relaying denied" /var/log/maillog May 27 21:54:58 fw sm-mta[4463]: m4S4swAI004463: ruleset=check_rcpt,arg1=, relay= adsl-tpe.dynamic.so- net.net.tw [ ], reject= Relaying denied

Security Tools cat  /bin/cat /var/log/secure May 27 21:14:05 fw vsftpd[4068]: refused connect from May 27 22:24:15 fw vsftpd[4474]: refused connect from May 27 23:10:02 fw in.rshd[4558]: connect from May 27 23:11:36 fw su[4606]: + pts/4 weesan-root tail -f  $ /usr/bin/tail -f /var/log/messages May 27 22:10:52 fw sshd[4118]: Accepted publickey for weesan from port ssh2 May 27 21:58:12 fw -- MARK -- May 27 22:18:13 fw -- MARK -- May 27 22:38:13 fw -- MARK --

Security Tools watch  $ /usr/bin/watch /usr/bin/who

Security Tools - advanced nmap  Port scanning $ nmap -sT  Guess what OS a remote system is running $ nmap -O -sV Nessus  A powerful and useful software vulnerability scanner John the Ripper  Crack replacement

Security Tools Samhain  Host-based intrusion detection Security-Enhanced Linux (SELinux)  Not recommended Kerberos  Guarantees that users and services are in fact who they claim to be PGP – Pretty Good Privary  Used to encrypt data, to generate signatures, and to verify origin of the files and messages  GnuPG

Security Tools ssh  A replacement for telnet scp  A replacement for ftp One-time passwords  Generate passwd off-line and good for once only Stunnel  Secure tunnel Firewall  iptables

iptables Linux kernel ver 2.4 introduced Netfilter iptables controls Netfilter Applies ordered “chains” of rules to network packets 3 default chains (filter tables)  INPUT Rules applied to incoming packets  OUTPUT Rules applied to outgoing packets  FORWARD Rules applied to packets from one NIC to another

iptables (cont) In addition to 3 default filter tables  nat For setting up NAT  mangle For modifying the packet header Each rule has a target  ACCEPT  DROP  REJECT  LOG  REDIRECT  RETURN  …

iptables (cont) 1. $ iptables -F 2. $ iptables -P INPUT ACCEPT 3. $ iptables -P FORWARD ACCEPT 4. $ iptables -N RH-Firewall-1-INPUT 5. $ iptables -A INPUT -j RH-Firewall-1-INPUT 6. $ iptables -A FORWARD -j RH-Firewall-1-INPUT 7. $ iptables -A RH-Firewall-1-INPUT -i lo -j ACCEPT 8. $ iptables -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT 9. $ iptables -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT 10. $ iptables -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT 11. $ iptables -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 12. $ iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 13. $ iptables -A RH-Firewall-1-INPUT -j LOG 14. $ iptables -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited Flush the filter tables Default to ACCEPT, why??? Create a new chain Link the INPUT & FORWARD chain to the new chain In-interface Jump Reject all others Log to /var/log/syslog before rejecting it

iptables (cont) Add the following between line 10 & 11 to reject all the adv websites  for ad in $ADV_SERVERS; do  iptables -A RH-Firewall-1-INPUT -i eth1 -p tcp -d $ad --dport 80 -j REJECT  done To accept certain connections/services, figure out the protocol type, port number and add a new line similar to line 12  Q. What protocol type DNS uses? On which port?  A: Check out /etc/services

iptables (cont) To turn on NAT  $ iptables -t nat -F  # Redirect HTTP traffic to a web cache server  $ iptables -A PREROUTING -t nat -i eth1 -p tcp -d $ALL --dport 80 -j REDIRECT --to-ports 3128  # Turn on NAT for TCP, UDP and ICMP  $ iptables -A POSTROUTING -t nat -o eth0 -p tcp -s /24 -j MASQUERADE  $ iptables -A POSTROUTING -t nat -o eth0 -p udp -s /24 -j MASQUERADE  $ iptables -A POSTROUTING -t nat -o eth0 -p icmp -s /24 -j MASQUERADE

iptables (cont) To view the rules  $ iptables -L -v To view the rules in the NAT table  $ iptables -L -v -t nat

Reference LAH  Ch 20 - Security iptables  $ man iptables Unix Advanced System Admin. EdCert  Cert  Security Focus 

iptables (cont) $ iptables -F $ iptables -P INPUT DROP $ iptables -P FORWARD DROP $ iptables -A FORWARD -i eth1 -p ANY -j ACCEPT $ iptables -A FORWARD -d p tcp -dport 22 -j ACCEPT $ iptables -A FORWARD -d p tcp -dport 80 -j ACCEPT $ iptables -A INPUT -i eth1 -d p icmp -- icmp-type 8 -j ACCEPT Flush the filter tables Default to DROP Append a ruleIn-interfaceProtocolJump Destination Dest. port

iptables (cont) $ iptables -t nat -A PREROUTING -i eth0 -s /8 -j DROP $ iptables -t nat -A PREROUTING -i eth0 -s /12 -j DROP $ iptables -t nat -A PREROUTING -i eth0 -s /16 -j DROP $ iptables -t nat -A PREROUTING -i eth0 -s /8 -j DROP $ iptables -t nat -A PREROUTING -i eth0 -s /4 -j DROP Drop all the packets originated from private IP addresses.