Raw Sockets - 101 Vivek Ramachandran. A day in the life of Network Packet.

Slides:



Advertisements
Similar presentations
Florida State UniversityCOP Advanced Unix Programming Raw Sockets Datalink Access Chapters 25, 26.
Advertisements

© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Addressing the Network – IPv4 Network Fundamentals – Chapter 6.
Tactics to Discover “Passive” Monitoring Devices
CISCO NETWORKING ACADEMY PROGRAM (CNAP)
Packet Injection 101 Vivek Ramachandran. What is packet injection ? Please go through the raw socket tutorial before going further. Simply put packet.
Network Attacks Mark Shtern.
1 Version 3 Module 8 Ethernet Switching. 2 Version 3 Ethernet Switching Ethernet is a shared media –One node can transmit data at a time More nodes increases.
1 Fall 2005 Hardware Addressing and Frame Identification Qutaibah Malluhi CSE Department Qatar University.
Computer Network 實踐資管 Wang-Jiunn Cheng 2004 PART IV-2 Local Area Networks (LANs) Frame.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
Sanjay Goel, School of Business/Center for Information Forensics and Assurance University at Albany Proprietary Information 1 Unit Outline Information.
Adjusting out device-driver Here we complete the job of modifying our ‘nicf.c’ Linux driver to support ‘raw’ packet-transfers.
Chapter 3 Review of Protocols And Packet Formats
Detection of Promiscuous nodes Using Arp Packets By Engin Arslan.
Socket options A way for network applications to ‘tweak’ the processing done at lower-levels of the TCP/IP stack.
Hubs & Switches Ethernet Basics -10. There is only so much available bandwidth, in some instances it can be dynamic An overabundance of data on the network,
Introduction to InfoSec – Recitation 12 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises.
1 Introduction to Raw Sockets 2 IP address Port address MAC address TCP/IP Stack 67 Bootp DHCP OSPF protocol frame type UDP Port # TCP Port.
CSCD433 Advanced Networks Fall 2011 Raw vs. Cooked Sockets.
ARP Scenarios CIS 81 and CST 311 Rick Graziani Fall 2005.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Multicast routing.
1 Network Packet Generator Midway presentation Supervisor: Mony Orbach Presenting: Eugeney Ryzhyk, Igor Brevdo.
TCP/IP Guide. OSI Reference Model Real-World Analogy Phase OSI Layer CEO LetterWeb Site Connection (Simplified) Transmission 7 The CEO of a company in.
LWIP TCP/IP Stack 김백규.
Introduction to InfoSec – Recitation 11 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Internet Ethernet Token Ring Video High Speed Router Host A: Client browser: REQUEST:http//mango.ee.nogradesu.edu/c461.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
Lab 2: SSL Security Attack June 17, 2008 Hyun Jin Kim.
Chapter 19 - Binding Protocol Addresses
Chapter 2 Applications and Layered Architectures Sockets.
1 CS 4396 Computer Networks Lab TCP/IP Networking An Example.
Media Access Control (MAC) addresses in the network access layer ▫ Associated w/ network interface card (NIC) ▫ 48 bits or 64 bits IP addresses for the.
Chapter 9 Hardware Address & Frame Type Identification Hardware address of frame Addressing schemes Ethernet Frame header format.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
DoS Suite and Raw Socket Programming Group 16 Thomas Losier Paul Obame Group 16 Thomas Losier Paul Obame.
Chapter 9 Hardware Addressing and Frame Type Identification 1.Delivering and sending packets 2.Hardware addressing: specifying a destination 3. Broadcasting.
1 Ch 9 Hardware Addressing and Frame Type Identification.
Network Sniffer Anuj Shah Advisor: Dr. Chung-E Wang Department of Computer Science.
1 Microsoft Windows 2000 Network Infrastructure Administration Chapter 4 Monitoring Network Activity.
WiFi networks & RAW SOCKETS IL-HACK2009 Eddie Harari.
Linux Operations and Administration Chapter Eight Network Communications.
0x440 Network Sniffing.
ISDS 4120 Project 1 DWAYNE CARRAL JR 3/27/15. There are seven layers which make up the OSI (Open Systems Interconnection Model) which is the model for.
Transmission Control Protocol (TCP) Internet Protocol (IP)
Network Router Security Packeting Filtering. OSI Model 1.It is the most commonly refrenced protocol model. It provides common ground when describing any.
ARP ‘n RARP. The Address Resolution Protocol (ARP) is a request sent out by a computer to find another computer’s MAC address. It already knows the IP.
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises: Lab 4 (Network Packet Filtering)
COMP2322 Lab 1 Introduction to Wireless LAN Weichao Li Apr. 8, 2016.
Chapter 4: server services. The Complete Guide to Linux System Administration2 Objectives Configure network interfaces using command- line and graphical.
Mobile Packet Sniffer Ofer Borosh Vadim Lanzman Dr. Chen Avin
CSCD433/533 Advanced Networks Spring 2016 Lecture 15
1 CMPT 471 Networking II Multicasting © Janice Regan,
A quick intro to networking
Sockets and Beginning Network Programming
Distributed Systems.
LAN Vulnerabilities.
Programming Multi-Core Processors based Embedded Systems A Hands-On Experience on Cavium Octeon based Platforms Lab Exercises.
Introduction to Data-Link Layer
IP Network Layer and Ethernet Encapsulation
Computer Networks 9/17/2018 Computer Networks.
Ethernet : Framing and Addressing
Wireshark LAN Monitoring HaganFox.net/NetSec Originally presented at
TCP/IP Protocol Suite: Review
CSCD433/533 Advanced Networks Winter 2019 Lecture 13
IP Multicast COSC /5/2019.
Data-Link Layer The Internet is a combination of networks glued together by connecting devices (routers or switches) If a packet is to travel from a host.
16EC Computer networks unit II Mr.M.Jagadesh
Packet Sniffing and Spoofing
Virtual Private Network
Presentation transcript:

Raw Sockets Vivek Ramachandran

A day in the life of Network Packet

The gory details …..

Problem formulation- why raw sockets ? We can only receive frames destined to us (Unicast), to everyone (Broadcast) and to some selected addresses we subscribe to (Multicast). All Headers i.e. Ethernet, IP, TCP etc are stripped by the network stack and only the data is shipped to the application layer. We cannot modify the packet headers of packets when they are sent out from our host.

What could be interesting ? If we could receive the frames for all computers connected to our broadcast domain – Promiscous mode If we could get all the headers i.e. Ethernet, TCP, IP etc from the network and analyze them – Raw Sockets. If we could inject packets with custom headers and data into the network directly – Raw Sockets.

Promiscous Mode It is the “See All, Hear All” Wizard mode Tells the network driver to accept all packets irrespective of whom the packets are addressed to. Used for Network Monitoring – both legal and illegal monitoring We can do this by programmatically setting the IFF_PROMISC flag or by using the ifconfig utility (ifconfig eth0 promisc)

Getting all headers - Sniffing Once we set the interface to promiscous mode we can get “full packets” with all the headers. We can process these packets and extract data from it. Note we are receiving packets meant for all hosts => see what your neighbors are doing in the lab

Sending arbitrary packets – Packet Injection We “manufacture” our own packets and send it out on the network. Absolute power – total network stack bypass Most active network monitoring tools and hacking tools use this. Remember the Dos attacks ? Syn Floods ? IP Spoofs ?

Raw Sockets – a closer look Application Raw Socket

What are raw sockets ? Simply put raw sockets provide a way to bypass the whole network stack traversal of a packet and deliver it directly to an application. There are many ways to create raw sockets. We will concentrate on the PF_PACKET interface for creating raw sockets.

PF_PACKET It is a software interface to send/receive packets at layer 2 of the OSI i.e. device driver. All packets received will be complete with all headers and data. All packets sent will be transmitted without modification by the kernel to the medium. Supports filtering using Berkley Packet Filters.

Creating a Raw Socket Call socket() with appropriate arguments. Socket(PF_PACKET, SOCK_RAW, int protocol) Protocol is ETH_P_IP for IP networks. It is mostly used as a filter. To receive all types of packets ETH_P_IP is used.

The making of a Sniffer Create Raw socket – socket() Set interface you want to sniff on in promiscous mode. Bind Raw socket to this interface – bind() Receive packets on the socket – recvfrom() Process received packets Close the raw socket().

The making of a Packet Injector Create a raw socket – socket() Bind socket to the interface you want to send packets onto – bind() Create a packet Send the packet – sendto() Close the raw socket – close()

Class over !! Lets start coding !!!