Lecture Materials for the John Wiley & Sons book: Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions April 14, 2015 DRAFT1.

Slides:



Advertisements
Similar presentations
Lecture Materials for the John Wiley & Sons book: Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions October 8, 2014 DRAFT1.
Advertisements

Overview The TCP/IP Stack. The Link Layer (L2). The Network Layer (L3). The Transport Layer (L4). Port scanning & OS/App detection techniques. Evasion.
21.1 Chapter 21 Network Layer: Address Mapping, Error Reporting, and Multicasting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
ECE Department: University of Massachusetts, Amherst ECE 354 Lab 3: Transmitting and Receiving Ethernet Packets.
Introduction1-1 message segment datagram frame source application transport network link physical HtHt HnHn HlHl M HtHt HnHn M HtHt M M destination application.
Hands-On Ethical Hacking and Network Defense Chapter 5 Port Scanning.
The Network Layer Chapter 5. The IP Protocol The IPv4 (Internet Protocol) header.
COS 420 Day 18. Agenda Assignment 4 Posted Chap Due April 6 Group project program requirements Submitted but Needs lots of work Individual Project.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Chapter 5 The Network Layer.
Chapter 14 TCP/IP and Routing Part #1 Unix System Administration.
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Understanding Networks. Objectives Compare client and network operating systems Learn about local area network technologies, including Ethernet, Token.
Network Analyzer Example
Chapter 3 Review of Protocols And Packet Formats
Computer Security and Penetration Testing
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
TCP/IP Tools Lesson 5. Objectives Skills/ConceptsObjective Domain Description Objective Domain Number Using basic TCP/IP commands Understanding TCP/IP3.6.
Chapter Overview TCP/IP Protocols IP Addressing.
CS 356 Systems Security Spring Dr. Indrajit Ray
1.  A protocol is a set of rules that governs the communications between computers on a network.  Functions of protocols:  Addressing  Data Packet.
Wireshark and TCP/IP Basics ACM SIG-Security Lance Pendergrass.
IST 228\Ch3\IP Addressing1 TCP/IP and DoD Model (TCP/IP Model)
Network Protocols. Why Protocols?  Rules and procedures to govern communication Some for transferring data Some for transferring data Some for route.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network Chapter 3: TCP/IP Architecture.
Chapter 23 TCP/IP Overview Network Layer Transport Layer Application Layer WCB/McGraw-Hill  The McGraw-Hill Companies, Inc., 1998.
Chapter 9.
SEED Infotech Pvt. Ltd. 1 Networking in Java. SEED Infotech Pvt. Ltd. 2 Objectives of This Session Describe issues related to any type of network using.
TCP/IP and the Internet ARPANET (1969) –R&D network funded by DARPA. –Packet Switching Survive nuclear war. –Experimental to operational (1975). –Not suitable.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
Chap 9 TCP/IP Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
Chapter 4 TCP/IP Overview Connecting People To Information.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
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.
Chapter 2: Linux & POSIX “She sells bash shells by the C shore”
Linux Networking and Security
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
TCP/IP Honolulu Community College Cisco Academy Training Center Semester 2 Version 2.1.
1 Chapter 8 – TCP/IP Fundamentals TCP/IP Protocols IP Addressing.
Data Communications and Networks
Unix, Linux, DOS, Windows Command Line CSE 660 May 12, 2008.
1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation.
Chapter 14 The User View of Operating Systems The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition,
Monitoring Troubleshooting TCP/IP Chapter 3. Objectives for this Chapter Troubleshoot TCP/IP addressing Diagnose and resolve issues related to incorrect.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
© ITT Educational Services, Inc. All rights reserved. IS3220 Information Technology Infrastructure Security Unit 1 Essential TCP/IP Network Protocols and.
CTC 228 – Computer Networks Fall 2015 Instructor: Robert Spengler.
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
The OSI Model. Understanding the OSI Model In early 1980s, manufacturers began to standardize networking so that networks from different manufacturers.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Computer Networking 网络课件 双语教学 模拟实验 计算机网络教研室 Department of Computer Networking Application CHAPTER 14 INTERNETWORKING 1 The first section 2 Exercises.
Graciela Perera Department of Computer Science and Information Systems Slide 1 of 18 INTRODUCTION NETWORKING CONCEPTS AND ADMINISTRATION CSIS 3723 Graciela.
© 2003, Cisco Systems, Inc. All rights reserved.
Chapter4 Packet and Protocol.
CITA 352 Chapter 5 Port Scanning.
Introduction to TCP/IP
Network Commands 2 Linux Ubuntu A.S.
UNIX Introduction History Main Features UNIX Operating System
Part I. Overview of Data Communications and Networking
Lec 2: Protocols.
Network Architecture Introductory material
Net 431: ADVANCED COMPUTER NETWORKS
What is Bash Shell Scripting?
Topic 5: Communication and the Internet
Review of Important Networking Concepts
1 TRANSMISSION CONTROL PROTOCOL / INTERNET PROTOCOL (TCP/IP) K. PALANIVEL Systems Analyst, Computer Centre Pondicherry University, Puducherry –
Networking Essentials For Firewall-1 Administrators
16EC Computer networks unit II Mr.M.Jagadesh
Review of Internet Protocols Network Layer
32 bit destination IP address
Presentation transcript:

Lecture Materials for the John Wiley & Sons book: Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions April 14, 2015 DRAFT1 Chapter 6: Protocol Analysis and Network Programming

Networking Theory and Practice Open Systems Interconnection (OSI) defines the standard protocol stack –Out of the 7 layers, only 4 are used in practice: Physical (Layer 1) Data Link (Layer 2) Network (Layer 3) Transport (Layer 4) –The successor to OSI is Reference Model for Open Distributed Processing (RM-ODP), we encountered in Chapter 3, Row 3. 4/14/2015 DRAFT2 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Frequently Encountered Network Protocols IEEE Ethernet protocol L2 IEEE wireless protocols (commercially known as Wi-Fi) L2 Address Resolution Protocol (ARP) L2 IP Version 4 (IPv4) L3 IP Version 6 (IPv6) L3 Internet Control Message Protocol (ICMP) L3 User Datagram Protocol (UDP) L4 Transmission Control Protocol (TCP) L4 4/14/2015 DRAFT3 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Network Protocol Analysis Network protocol analysis can be performed automatically by Wireshark –Manual protocol analysis is outdated Each frame (L2) or packet (L3) has a header and a payload –L3 header/payload are attached before and after L2 header/payload, i.e. encapsulate –L4 headers/payload are attached before and after L3 header/payload 4/14/2015 DRAFT4 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Address Resolution Protocol (ARP) and Layer 2 Analysis 4/14/2015 DRAFT5 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

ARP Frame 4/14/2015 DRAFT6 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Internet Protocol (IP) Analysis 4/14/2015 DRAFT7 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Internet Control Message Protocol (ICMP) 4/14/2015 DRAFT8 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

User Datagram Protocol (UDP) Analysis 4/14/2015 DRAFT9 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Transmission Control Protocol (TCP) Analysis 4/14/2015 DRAFT10 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Network Programming: Bash Bash is an available command line shell for Linux and Unix systems –It is selected in the /etc/passwd file In network programming we are able to execute network commands in a script at the command line or from a script file During penetration tests, we frequently encounter raw shells (that do not support even backspace) where we can only submit 1 command line at a time –Use network programming to build security tools such as ping scans and banner grabbers (i.e. when services self identify) Network programming remains a rare but very useful skill among security pros 4/14/2015 DRAFT11 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Linux/Unix Bash Basics: Standard Input, Output, Error, Pipes Sorting reverse numerical –# sort /tmp/alertIPs | uniq –c | sort –nr Append to file including standard error –mount error >> log.txt 2>&1 Command sequence –# echo Hello Universe! > /tmp/tmp ; cd /tmp ; ls ; cat tmp ; rm tmp ; ls ; cd ~ 4/14/2015 DRAFT12 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Linux/Unix Bash for Basic Network Programming Ping an IP; returns ICMP response –# ping –c1 –w To ping an address range, i.e. a scan –# for i in `echo {1..254}`; do ping -c1 -w $i; done 4/14/2015 DRAFT13 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Linux/Unix Bash Network Sweep: Packaging a Script Package the ping sweep in a script file with Ctrl-C abort: –#!/bin/bash –trap bashtrap INT –bashtrap() { echo "Bashtrap Punt!"; exit; } –for i in `echo {1..254}`; do ping -c1 -w $i; done Use $1, $2, $3, … for command line arguments Use if statement for conditionality, e.g. –if $(test $# -eq 0 ); then network=" "; else network=$1; fi 4/14/2015 DRAFT14 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Linux/Unix Bash Network Scanning using While Read IP domains from a hosts file: –#!/bin/bash –trap bashtrap INT –bashtrap() { echo "Bashtrap Punt!"; exit; } –if $(test $# -eq 0 ); then network=" "; else network=$1; fi –while read n; do echo -e "\nSCANNING $network.$n"; nmap -O -sV --top-ports 9 -- reason $network.$n; done < hosts 4/14/2015 DRAFT15 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Bash Banner Grabbing #!/bin/bash trap t INT function t { echo -e "\nExiting!"; exit; } if $(test $# -eq 0 ); then network=" "; else network=$1; fi while read host; do echo –e "\nTESTING $network.$host PORTS..."; while read port; do echo -n " $port"; echo "" | nc -n -v -w1 $network.$host $port; done < ports done < hosts 4/14/2015 DRAFT16 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Windows Command Line Scripting In Windows Command Line the concepts are very similar to Bash Use.bat suffix for script (batch) files Batch file arguments are %1, %2, %3,… Script file variables use % prefix for /L for to iterate through numbers (i.e. counting) for /F to iterate through a set or file –Works like a while loop in Bash 4/14/2015 DRAFT17 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Windows Command Line : Standard IO, Pipes, and Sequences Example standard IO and pipes –C:\> type list.txt | sort /r >> sorted.txt & dir /b /s & type sorted.txt Command sequence (&), conditional (&&) –C:\> net use \\ passw0rd /u:testuser && echo SUCCESS & net use \\ /del 4/14/2015 DRAFT18 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Windows Command Line: Network Programming using For /L Ping sweep –set network=%1 –for /L %h in (2, 1, 255) –n 1 %network%.%h | find “byte=” > /nul && echo Host at %network%.%h 4/14/2015 DRAFT19 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Windows Command Line: Password Attack using For /F set ipaddr=%1 set usertarget=%2 for /F %p in (pass.txt) use \\%ipaddr% %p /u:%usertarget% 2> /nul && echo PASS=%p & net use \\%ipaddr% /del 4/14/2015 DRAFT20 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Python Scripting There are various categories of programming languages from command line (Bash, Windows CLI) to interpreted/compiled scripting (Python, Ruby) to systems programming (C, C++, C#) –Categories vary by number of lines needed to implement a capability, typical multiplier is 8 –Lower levels provide more detailed accesses, faster execution –Python’s advantage is that it is highly portable and has an extensive function library 4/14/2015 DRAFT21 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions

Python Programming for Accelerated Network Scanning #!/usr/bin/python import os from threading import Thread import time start=time.ctime() print start scan="ping -c1 -w1 " max=65 class threadclass(Thread): def __init__ (self,ip): Thread.__init__(self) self.ip = ip self.status = -1 def run(self): result = os.popen(scan+self.ip,"r") self.status=result.read() threadlist = [] for host in range(1,max): ip = " "+str(host) current = threadclass(ip) threadlist.append(current) current.start() for t in threadlist: t.join() print "Status from ",t.ip,"is",repr(t.status) print start print time.ctime() 4/14/2015 DRAFT22 Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions Threaded scanning is about 60X faster than serial scans

REVIEW CHAPTER SUMMARY Cyber Security: Managing Networks, Conducting Tests, and Investigating Intrusions 4/14/2015 DRAFT23