1 The Attack and Defense of Computers Dr. 許 富 皓. 2 Port Scanning.

Slides:



Advertisements
Similar presentations
Overview The TCP/IP Stack. The Link Layer (L2). The Network Layer (L3). The Transport Layer (L4). Port scanning & OS/App detection techniques. Evasion.
Advertisements

Network and Application Attacks Contributed by- Chandra Prakash Suryawanshi CISSP, CEH, SANS-GSEC, CISA, ISO 27001LI, BS 25999LA, ERM (ISB) June 2006.
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
 Dynamic policies o Change as system security state/load changes o GAA architecture  Extended access control lists  Pre-, mid- and post-conditions,
TRUE Blind ip spoofed portscanning Thomas Olofsson C.T.O Defcom.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4.
NMAP Scanning Options. EC-Council NMAP  Nmap is the most popular scanning tool used on the Internet.  Cretead by Fyodar ( it.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
CSE551: Computer Network Review r Network Layers r TCP/UDP r IP.
Hands-On Ethical Hacking and Network Defense Chapter 5 Port Scanning.
IP Network Scanning.
Instructor: Sam Nanavaty TCP/IP protocol. Instructor: Sam Nanavaty Version – Allows for the evolution of the protocol IHL (Internet header length) – Length.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Scanning.
Hands-On Ethical Hacking and Network Defense Chapter 5 Port Scanning Last updated
Hacking Exposed 7 Network Security Secrets & Solutions Chapter 2 Scanning 1.
System Security Scanning and Discovery Chapter 14.
Internet Control Message Protocol (ICMP). Introduction The Internet Protocol (IP) is used for host-to-host datagram service in a system of interconnected.
Scanning February 23, 2010 MIS 4600 – MBA © Abdou Illia.
Lecture 23: Network Primer 7/15/2003 CSCE 590 Summer 2003.
Port Scanning Yiqian Zhang CS 265 Project. What is Port Scanning? port scanning is equivalent to knocking on the walls to find all the doors and windows.
Computer Security and Penetration Testing
5/12/05CS118/Spring051 A Day in the Life of an HTTP Query 1.HTTP Brower application Socket interface 3.TCP 4.IP 5.Ethernet 2.DNS query 6.IP router 7.Running.
ECE Prof. John A. Copeland fax Office: Klaus 3362.
Port Scanning.
Port Knocking Software Project Presentation Paper Study – Part 1 Group member: Liew Jiun Hau ( ) Lee Shirly ( ) Ong Ivy ( )
Ana Chanaba Robert Huylo
Guide to TCP/IP, Third Edition
SCSC 555 Frank Li.  Port scanning  Port-scanning tools  Ping sweeps 2.
1 Reconnaissance, Network Mapping, and Vulnerability Assessment ECE4112 – Internetwork Security Georgia Institute of Technology.
1 IP: putting it all together Part 2 G53ACC Chris Greenhalgh.
1 Semester 2 Module 10 Intermediate TCP/IP Yuda college of business James Chen
Firewall and Internet Access Mechanism that control (1)Internet access, (2)Handle the problem of screening a particular network or an organization from.
Port Scanning 0x470~0x480 Presenter SangDuk Seo 1.
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Scanning.
TCP/IP Essentials A Lab-Based Approach Shivendra Panwar, Shiwen Mao Jeong-dong Ryoo, and Yihan Li Chapter 5 UDP and Its Applications.
A Virtual Honeypot Framework Author: Niels Provos Published in: CITI Report 03-1 Presenter: Tao Li.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
© Jörg Liebeherr (modified by M. Veeraraghavan) 1 ICMP: A helper protocol to IP The Internet Control Message Protocol (ICMP) is the protocol used for error.
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.
CIT 380: Securing Computer Systems
1 Reconnaissance, Network Mapping, and Vulnerability Assessment ECE4112 – Internetwork Security Georgia Institute of Technology.
Breno de MedeirosFlorida State University Fall 2005 Network Intrusion Detection Systems Beyond packet filtering.
Chapter 2 Scanning Last modified Determining If The System Is Alive.
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.
Lecture 22 Network Security CS 450/650 Fundamentals of Integrated Computer Security Slides are modified from Hesham El-Rewini.
1 Figure 4-1: Targeted System Penetration (Break-In Attacks) Host Scanning  Ping often is blocked by firewalls  Send TCP SYN/ACK to generate RST segments.
Sniffer, tcpdump, Ethereal, ntop
Firewalls A brief introduction to firewalls. What does a Firewall do? Firewalls are essential tools in managing and controlling network traffic Firewalls.
Scanning.
© Jörg Liebeherr (modified by M. Veeraraghavan) 1 ICMP The PING Tool Traceroute program IGMP.
or call for office visit,
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Network and Port Scanning Chien-Chung Shen
Port Scanning James Tate II
Introduction to TCP/IP networking
COMP2322 Lab 6 TCP Steven Lee Mar 29, 2017.
CITA 352 Chapter 5 Port Scanning.
or call for office visit, or call Kathy Cheek,
Hping2.
5. End-to-end protocols (part 1)
or call for office visit,
Port Scanning (based on nmap tool)
CIT 480: Securing Computer Systems
Information Gathering
Topic 5: Communication and the Internet
TCP/IP Networking An Example
-sI Idlescan Greatest stealth of any nmap scan
Process-to-Process Delivery:
Process-to-Process Delivery: UDP, TCP
EVAPI - Enumeration Auburn Hacking club
Presentation transcript:

1 The Attack and Defense of Computers Dr. 許 富 皓

2 Port Scanning

3 Port Scanning and Scanning Packets’ Source IP addresses In order to send the scan results back to the scanners, all scanning packet must carry the real source IP addresses, i.e. the scanner hosts’ IP addresses. For the port scanning methods mentioned in last week’s lecture, the above statement is true. However, there are other port scanning methods that do not require the scanners to use their real IP addresses to perform the scanning. E.g. IdleScan.

4 IPID Sequence Numbers The IPID is actually the id field of the IP protocol packet header. This field provides an identification for IP packets used in the process of assembling fragments: packets with the same id value belong to the same datagram, so the destination host knows how to assemble these packets into the original datagram (using also other information contained in the IP header).

5 Predictable IPID Sequence Numbers Many operating systems simply increment this number for every packet they send. So probing for this number can tell an attacker how many packets have been sent since the last probe.

6 Idle Scans (1) A machine which receives an unsolicited SYN|ACK packet to a close port will respond with a RST. An unsolicited RST will be ignored.

7 Idle Scans (2)

8 Idlescan Advantages - Stealth Ultimate stealth scan: There are many techniques people can use to shield their identity when scanning. Examples include using decoys ( nmap -D ) or half-open scanning ( nmap -sS ). But even these techniques require an attacker to send some packets to the target from her real IP address. Idlescan, on the other hand, is completely blind -- no packets are sent to the target from the true source address.

9 Idlescan Advantages – Expose the Trust Relationship among Hosts Defeating packet filtering firewalls/routers: IP source address filtering is a common security mechanism for limiting machines that may connect to a sensitive host. For example,  a company database server might only allow connections from the public web server which accesses it.  A home user might only allow ssh (interactive login) connections from his work machines. Idle scanning can frequently be used to map out these trust relationship. The key factor is that Idlescan results list open ports from the zombie host perspective. So a normal scan against the aforementioned database server might show no ports open. But performing an Idlescan while using the web server IP as the zombie could expose the trust relationship by showing the database-related service ports open.

10 More Fun with IPID Prediction – Traffic Analysis and Host Alias Detcection Traffic Analysis: Sequential IPID numbers expose the number of packets sent by a host over a given period. This can be used to estimate web site traffic, etc. Host alias detection: Sometimes a single host will have multiple IP addresses or ethernet interfaces. You can often determine which IPs match a given host by looking for similar IPID sequence numbers.

11 More Fun with IPID Prediction - Load Balancer Demultiplexing Load balancer demultiplexing: This is almost the reverse of the technique above. Large sites often use load balancing equipment so that a single address maps to a small farm of servers. By noting the IPID values, you can often determine how many machines are behind the load balancer and which one you are connected with. For example, the " id " fields in the following hping2 execution make it pretty obvious that beta.search.microsoft.com is handled by two machines behind a load balancer ( ).

12 Example of Load Balancer Demultiplexing # hping2 -c 10 -i 1 -p 80 -S beta.search.microsoft.com. HPING beta.search.microsoft.com. (eth ): S set, 40 headers + 0 data bytes 46 bytes from : flags=SA seq=0 ttl=56 id=57645 win=16616 rtt=21.2 ms 46 bytes from : flags=SA seq=1 ttl=56 id=57650 win=16616 rtt=21.4 ms 46 bytes from : flags=RA seq=2 ttl=56 id=18574 win=0 rtt=21.3 ms 46 bytes from : flags=RA seq=3 ttl=56 id=18587 win=0 rtt=21.1 ms 46 bytes from : flags=RA seq=4 ttl=56 id=18588 win=0 rtt=21.2 ms 46 bytes from : flags=SA seq=5 ttl=56 id=57741 win=16616 rtt=21.2 ms 46 bytes from : flags=RA seq=6 ttl=56 id=18589 win=0 rtt=21.2 ms 46 bytes from : flags=SA seq=7 ttl=56 id=57742 win=16616 rtt=21.7 ms 46 bytes from : flags=SA seq=8 ttl=56 id=57743 win=16616 rtt=21.6 ms 46 bytes from : flags=SA seq=9 ttl=56 id=57744 win=16616 rtt=21.3 ms --- beta.search.microsoft.com. hping statistic packets tramitted, 10 packets received, 0% packet loss round-trip min/avg/max = 21.1/21.3/21.7 ms

13 More Fun with IPID Prediction - OS Detection OS Detection As already discussed, operating systems differ wildly in how they generate IPID numbers. nmap uses this information to help determine what OS version a remote system is running.

14 Problems with Blocking Traffic from Identified Scanners The scanners don’t need to be the attackers. The identified scanners’ IP addresses may just be the IP addresses of zombie hosts. IP addresses could be shared (such as IP addresses used in the dial-up service;) therefore, the IP addresses used by a scanner may be used by an innocent user later on.

15 OS Fingerprinting

16 OS Fingerprinting Remotely detect the Operating System type and version of a remote host.

17 Info. Adopted by OS Fingerprinting Tools The majority of OS fingerprinting tools detect remote hosts’ OS information by analyzing TCP/IP traffic regarding to the target hosts. The traffic may be generated by the fingerprinting tools. The traffic may just be the normal traffic going through the target hosts.

18 Completeness of TCP/IP Protocols The TCP/IP protocol suite is NOT a complete protocol suite. It doesn’t take every possible scenario into account. For those undefined scenarios, it is depends on the code authors of the TCP/IP protocols to decide the protocols’ behavior. Different author usually implements the TCP/IP code in a different way.

19 Flexibility of TCP/IP Protocols The TCP/IP protocol suite gives some flexibilities to the code authors to chose some parameters used for TCP/UDP traffic, such as: initial sequence numbers initial TTL values initial window sizes … and so on. Similar different OS code authors usually use different parameters.

20 OS Fingerprinting Techniques And Corresponding Tools

21 Passive Fingerprinting Passive host fingerprinting is the practice of determining a remote operating system by measuring the peculiarities of observed traffic without actively sending probes to the host. Five parameters are particularly useful in this technique: The value of the "Time to Live" field (TTL) in the IP header The Initial Window Size in the TCP header The value of the "Don't Fragment" bit (DF) in the IP header The value of the "Type of Service" (TOS) field in the IP header The types of TCP options used (if any) No single signature can reliably determine the remote operating system. However, by looking at several signatures and combining the information, the accuracy of identifying the remote host increases.

22 Passive Fingerprinting Tools P0f Siphon … and so on

23 Limitations of Passive Fingerprinting Tools The tools must reside in places that can sniff target hosts’ traffic. In addition, it is relatively simple for a remote host to modify the default values for the TTL, Window Size, DF or TOS settings and, indeed this is considered one the countermeasures system administrators could and should take against passive fingerprinting.

24 Using RTT for TCP/IP Stack Fingerprinting This technique relies on the fact that timeouts and regeneration cycles between a SYN sent by the client and successive SYN/ACK sent by the server to complete the TCP handshake are loosely specified in the RFC, which means that almost each OS uses its own method and set of values.

25 Ring Ring is a tool that has been implemented to prove how the Round Trip Time can be effectively used to recognize the remote OS. A typical Ring identification session has the following steps: Ring sends a SYN packet to an open port of the target the target enters the state "SYN_RCVD" and sends back a SYN-ACK Ring ignores the SYN-ACK the target remains in the SYN_RCVD state while reinjecting SYN-ACK segments from time to time. Ring measures times between these segments.

26 Banner Grabbing One of the oldest techniques used to identify a remote operating system is banner grabbing, which consists in opening a connection to a remote application daemon and determining the operating system by examining the responses received from applications like telnet or ftp. Tools that use this technique span from scanners like Hackbot and ScanSSH to ad- hoc scripts aimed at particular application services.

27 Active TCP/IP Stack fingerprinting This kind of OS fingerprinting tools explicitly send probing packet to targets hosts. Based on the analysis results of the responses packets, these tools infer the remote hosts’ OS types and versions. Two of the most popular active TCP/IP stack fingerprinting tools: nmap Xprobe

28 nmap nmap tests the response of the remote system to undefined combinations of TCP flags, TCP Initial Sequence Number (ISN) sampling, determining the default setting of the DF bit, TCP initial windows size, ToS setting, fragmentation handling, types and order of TCP options. nmap fingerprints a system in three steps: port scanning, which provides as a result a list of open and closed TCP and UDP ports ad-hoc forged packets sending analysis of the responses received and comparison against a database of known OS's behaviour (fingerprints).

29 Some Other nmap Features Protocol scan, which determines which protocols (TCP, IGMP, GRE, UDP, ICMP, etc.) are supported by a given host; Idlescan which performs a scan via a "zombie" machine; ICMP timestamp and netmask requests; Detection of host uptime; Option to specify payload length IP Identification Number and TCP Initial Sequence Number predictability report; Random IP scanning mode is capable of skipping unallocated netblocks;

30 Fingerprinting Methodology -- The FIN Probe A FIN packet (or any packet without an ACK or SYN flag) is sent to an open port and wait for a response. The correct RFC 793 behavior is to NOT respond, but many broken implementations such as MS Windows, BSDI, CISCO, HP/UX, MVS, and IRIX send a RESET back. Most current tools utilize this technique.RFC 793

31 Fingerprinting Methodology -- TCP ISN Sampling The idea here is to find patterns in the initial sequence numbers chosen by TCP implementations when responding to a connection request. These can be categorized in to many groups such as: Traditional 64K (many old Unixes) Random increment (Solaris, IRIX, FreeBSD) True “random” (newer Linux and AIX) Time-dependent (MS Windows) Constant (some 3Com hubs, Apple LaserWriters)

32 Fingerprinting Methodology -- IPID sampling Most operating systems increment a system-wide IPID value for each packet they send. Others, such as OpenBSD, use a random IPID. Some systems (like Linux) use an IPID of 0 in many cases where the "Don't Fragment" bit is not set. Windows does not put the IPID in network byte order, so it increments by 256 for each packet.

33 Fingerprinting Methodology -- TCP Initial Window This simply involves checking the window size on returned packets. Older scanners simply used a non-zero window on a RST packet to mean "BSD 4.4 derived". Newer scanners such as queso and nmap keep track of the exact window since it is actually pretty constant by OS type. Constant window size: AIX uses 0x3F25. In their "completely rewritten" TCP stack for NT5, Microsoft uses 0x402E. Interestingly, that is exactly the number used by OpenBSD and FreeBSD.

34 Fingerprinting Methodology -- ACK Value Although it seems this would be completely standard, implementations differ in what value they use for the ACK field in some cases. For example, Send a FIN|PSH|URG to a closed TCP port. Most implementations will set the ACK to be the same as your initial sequence number, though Windows and some stupid printers will send your seq + 1. If you send a SYN|FIN|URG|PSH to an open port, Windows is very inconsistent. Sometimes it sends back your seq, other times it sends seq++, and still other times is sends back a seemingly random value. One has to wonder what kind of code MS is writing that changes its mind like this.

35 Fingerprinting Methodology -- Fragmentation Handling This takes advantage of the fact that different implementations often handle overlapping IP fragments differently. Some will overwrite the old portions with the new. In other cases the old stuff has precedence.

36 Fingerprinting Methodology -- TCP Options (1) These are truly a gold mine in terms of leaking information. The beauty of these options is that: They are generally optional so not all hosts implement them. You know if a host implements them by sending a query with an option set. The target generally show support of the option by setting it on the reply. You can stuff a whole bunch of options on one packet to test everything at once.

37 Fingerprinting Methodology -- TCP Options (2) nmap sends these options along with almost every probe packet: Window Scale=10; NOP; Max Segment Size = 265; Timestamp; End of Ops; Window Scale=10 When you get your response, you take a look at which options were returned and thus are supported. Some operating systems such as recent FreeBSD boxes support all of the above Others, such as Linux 2.0.X support very few. The Linux 2.1.x kernels do support all of the above.

38 Fingerprinting Methodology -- TCP Options (3) Even if several operating systems support the same set of options, you can sometimes distinguish them by the values of the options. For example, if you send a small MSS value to a Linux box, it will generally echo that MSS back to you. Other hosts will give you different values.

39 Fingerprinting Methodology -- TCP Options (4) And even if you get the same set of supported options AND the same values, you can still differentiate via the order that the options are given, and where padding is applied. For example Solaris returns NNTNWME which means: While Linux returns MENNTNW. Same options, same values, but different order!

40