1 / 57

Network Security

Network Security. Cyber Security . ARP Spoofing. A computer connected to an IP/Ethernet has two addresses Address of network card (MAC address) Globally unique and unchangeable address stored on the network card.

sevita
Download Presentation

Network Security

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Security Cyber Security

  2. ARP Spoofing • A computer connected to an IP/Ethernet has two addresses • Address of network card (MAC address) • Globally unique and unchangeable address stored on the network card. • Ethernet header contains the MAC address of the source and the destination computer. • IP address • Each computer on a network must have a unique IP address to communicate. • Virtual and assigned by software

  3. ARP Spoofing • IP communicates by constructing packets. • Packet are delivered by Ethernet. • Adds an Ethernet header for delivery • Splits the packets into frames • Sends them down the cable to the switch. • The switch then decides which port to send the frame to. By comparing the destination address of the frame to an internal table which maps port numbers to MAC addresses.

  4. ARP Spoofing • When an Ethernet frame is constructed from an IP packet, it has no idea what the MAC address of the destination machine is. • The only information available is the destination IP address. • There must be a way to the Ethernet protocol to find the MAC address of the destination machine, given a destination IP. • This is where ARP, Address Resolution Protocol, come in.

  5. Address Resolution &Reverse Address Resolution

  6. Encapsulation of ARP

  7. How ARP Works • Get IP address of target. • Create a request ARP message • Fill sender physical address • Fill sender IP address • Fill target IP address • Target physical address is filled with 0 • The message is passed to the data link layer where it is encapsulated in a frame. • Source address: physical address of the sender. • Destination address: broadcast address.

  8. How ARP Works (cont) • Every host or router on the LAN receives the frame. • All stations pass it to ARP. • All machines except the one targeted drop the packet. • The target machine replies with an ARP message that contains its physical address. • A unicast message. • The sender receives the reply message and knows the physical address of the target machine.

  9. How ARP Works (cont)

  10. How ARP Works (cont)

  11. How ARP Works (cont)

  12. How ARP Works (cont)

  13. How ARP Works (cont)

  14. How ARP Works (cont)

  15. How ARP Works (cont) • To avoid having to send an ARP request packet each time, a host can cache the IP and the corresponding host addresses in its ARP table (ARP cache). • Each entry in the ARP table is usually “aged” so that the contents are erased if no activity occurs within a certain period. • When a computer receives an ARP reply, it will update its ARP cache. • ARP is a stateless protocol, most operating systems will update their cache if a reply is received, regardless of whether they have sent out an actual request.

  16. ARP Spoofing • Construct spoofed ARP replies. • A target computer could be convinced to send frames destined for computer A to instead go to computer B. • Computer A will have no idea that this redirection took place. • This process of updating a target computer’s ARP cache is referred to as “ARP poisoning”.

  17. Spoofed ARP reply IP:10.0.0.2 MAC:cc:cc:cc:cc Spoofed ARP reply IP:10.0.0.2 MAC:cc:cc:cc:cc Spoofed ARP reply IP:10.0.0.2 MAC:cc:cc:cc:cc ARP Spoofing switch A IP:10.0.0.1 MAC:aa:aa:aa:aa B IP:10.0.0.2 MAC:bb:bb:bb:bb Hacker IP:10.0.0.3 MAC:cc:cc:cc:cc ARP cache ARP cache

  18. ARP Spoofing switch A IP:10.0.0.1 MAC:aa:aa:aa:aa B IP:10.0.0.2 MAC:bb:bb:bb:bb Hacker IP:10.0.0.3 MAC:cc:cc:cc:cc ARP cache ARP cache A’s cache is poisoned

  19. ARP Spoofing • Now all the packets that A intends to send to B will go to the hacker’s machine. • Cache entry would expire, so it needs to be updated by sending the ARP reply again. • How often? • depends on the particular system. • Usually every 40s should be sufficient. • In addition the hacker may not want his Ethernet driver talk too much • Accomplish with ifconfig -arp

  20. ARP Spoofing • Complication • Some systems would try to update their cache entries by sending a unicast ARP request. • Like your wife calling you just to make sure you are there.  • Such a request can screw things up, because it could change victim’s ARP entry that the hacker just faked. • A computer will also cache the MAC address appeared in the ARP request.

  21. ARP Spoofing • Prevention is better than cure • Accomplished by feeding the “wife” system with replies so that it never has to ask for it. • A real packet from B to A will be sent by the hacker’s machine. • How often? • Again every 40s is usually OK.

  22. To: cc:cc:cc:cc Spoofed ARP reply IP:1.2.3.4 MAC:aa:aa:aa:aa Spoofed ARP reply IP:1.2.3.4 MAC:aa:aa:aa:aa ARP Spoofing The switch will then think that aa:aa:aa:aa is connected at this port switch A IP:10.0.0.1 MAC:aa:aa:aa:aa B IP:10.0.0.2 MAC:bb:bb:bb:bb Hacker IP:10.0.0.3 MAC:cc:cc:cc:cc

  23. Port Scanning • Attackers wish to discover services they can break into. • Security audit: Why are certain ports open? • sending a packet to each port, one at a time. • Based on the type of response, an attacker knows if the port is used. • The used ports can be probed further for weakness.

  24. Port Scanning • An abstraction of the OS + Net Stds • Part of UDP and TCP packets • UDP and TCP port numbers are disjoint • Typical to use the same port number for both UDP and TCP service • E.g., 80/TCP and 80/UDP for www • 16-bit unsigned integer • Well Known Ports (0 .. 1023) • Registered Ports (1024 .. 49151) • Dynamic and/or Private Ports (49152 .. 65535).

  25. Sockets

  26. Server socket() bind() listen() Client accept() socket() blocks until server receives a connect request from client connect negotiation connect() data write() read() data write() read() close() close() Sockets Socket calls for connection-oriented communication

  27. Sockets Server socket() Client socket() bind() bind() recvfrom() blocks until server sendto() data receives data from client sendto() data recvfrom() close() close() Socket calls for connection-oriented communication

  28. Well Known Ports • Only root-privileged programs are allowed to open these ports. • Examples • ftp-data 20/udp • ftp 21/tcp • ssh 22/tcp • telnet 23/tcp • Time 37/tcp • Time 37/udp • Whois 43/tcp • Imap 143/tcp

  29. Registered Ports • Ordinary programs/users can use these • shockwave2 1257/tcp Shockwave 2 shockwave2 1257/udp Shockwave 2 • x11 6000-6063/tcp X Window System x11 6000-6063/udp X Window System

  30. Dynamic/Private Ports • Ordinary programs can use these

  31. State of a Port • Open • A service process is listening at the port.  The OS receives packets arriving at this port and gives the messages to the service process.  If the OS receives a SYN at an open port, this is the first packet of the three way handshake. • Closed • No process is listening at the port.  If the OS receives a SYN at a closed port, an RST is sent. • Filtered • A packet filter is listening at the port.

  32. TCP connect(0) scanning • Try connect()-ing to every port • If the port is listening, connect() will succeed. • Otherwise, the port isn’t reachable. • No need for any special privileges. Any user can use it. • Speed - slow. • Scanner can be identified.

  33. TCP SYN scanning • Often referred to as half-open scanning. • Send a SYN packet • Wait for a response. • A SYN/ACK indicates the port is listening. • If a SYN/ACK is received, send an RST to tear down the connection immediately. • Most sites do not log these. • Need root privileges to build SYN packets.

  34. TCP FIN scanning • Send a FIN packet (without a preceding SYN etc.) • FIN packets may pass through firewalls • Closed ports reply with RST. • Open ports ignore the FIN packet. • Some hosts violate RFC. • Reply with RST’s regardless of the port state • Thus, are not vulnerable to this scan.

  35. TCP reverse identd scanning • identd protocol (rfc1413): Disclose the username of the owner of any process connected via TCP, even if that process didn’t initiate the connection. • Example: connect to the http port (80), and then use identd to find out whether the server is running as root. • Must have full TCP connection to the port.

  36. Fragmentation scanning • Not a new scanning method in and of itself. A modification of other techniques. • Split the probe packet into IP fragments. • By splitting up the TCP header over several packets, it is harder for packet filters to detect a probe.

  37. FTP Bounce Scan • A port scanner can exploit this to scan TCP ports form a proxy ftp server. • Connect to an FTP server behind a firewall, and then scan ports that are more likely to be blocked. • If the ftp server allows reading from and writing to a directory (such as /incoming), you can send arbitrary data to ports that you do find open.

  38. FTP Bounce Scan • Take advantage of a vulnerability of FTP protocol. • Requires support for proxy ftp connections. • For example, evil.com can establish a control communication connection to FTP server-PI (protocol interpreter) of target.com. • Then it is able to request the server-PI to initiate an active server-DTP (data transfer process) to send a file anywhere on the Internet.

  39. FTP Bounce Scan • Use the PORT command (of FTP) to declare that our passive user-DTP is listening on the target box at a certain port number. • LIST the current directory, and the results is sent over the server-DTP channel. • If our target host is listening on the port, the transfer will be successful. • Otherwise, connection will be refused. • Then issue another PORT command to try the next port on the target.

  40. FTP Bounce Scan • Advantages • Harder to trace • Potential to bypass firewalls. • Disadvantages • Slow • Many FTP servers have (finally) disabled the proxy feature.

  41. UDP Scans • UDP is simpler, but the scanning is more difficult • Open ports do not have to send an ACK. • Closed ports are not required to send an error packet. • Most hosts send an ICMP_PORT_UNREACH error when you send a packet to a closed UDP port. • Can find out if a port is NOT open.

  42. UDP Scans • Neither UDP packets, nor the ICMP errors are guaranteed to arrive. • Slow: the ICMP error message rate is limited. • Need to be root for access to raw ICMP socket. • Non-root users cannot read port unreachable errors directly.

  43. UDP Scans • But users can learn it indirectly. • For example, a second write() call to a closed port will usually fail. • recvfrom() on non-blocking UDP sockets usually return EAGAIN (try again), if the ICMP error hasn’t been received. • It will return ECONNREFUSED (connection refuse), if ICMP error has been received.

  44. Stealth Scan • Simple port scanning can be easily logged by the services listening at the ports. • E.g. they see an incoming connection with no data, thus they log an error. • Stealth scan refers to scanning techniques that can avoid being logged. • These techniques include fragmented packets, SYN scanning, FIN scanning etc.

  45. Stealth Scan • Scan slowly • A port scanner typically scans a host too rapidly • Some detectors recognize these “signatures”. • So, scanning very slowly (e.g., over several days) is a stealth technique. • Firing packets with fake IPs • Flood with spoofed scans and embed one scan from the real source (network) address.

  46. Signatures of a port scan • Several packets to different destination ports from the same source within a “short period” of time. • SYN to a non-listening port

  47. Detection of Port Scanning • Open a socket • SOCK_RAW mode. • protocol type IPPROTO_IP • recvfrom() to capture the packets • Discovering stealth scans requires kernel level work. • A detector can inform us that we have been port-scanned, but the source address may have been spoofed.

  48. Scanner Leaks • If the packets we received have an IP TTL of 255, we can conclude that it was sent from or local network, regardless of what the source address field says. • if TTL is 250, we can only tell that the attacker was no more than 5 hops away.

More Related