This assignment's subject is about footprinting, scanning and enumeration

Authors Avatar

Scanning

Help from

               http://gaia.ecs.csus.edu/~ghansahi/classes/notes/196n_at_def_notes/lectures/wk02.ppt

               http://www.informit.com/index.asp

               http://www.dirc.org.uk/publications/techreports/papers/5.pdf.

               http://www.auditmypc.com/freescan/readingroom/port_scanning.asp

               http://www.oreilly.com/catalog/networksa/chapter/ch04.pdf.

                

(A) Introduction:

        In today’s internet world there are a lot of scanners has been introduced and it is constantly increasing and as a result the danger of attacks by hackers are increasing day by day.

So in order to protect ourselves from these attacks we should have the knowledge of the scanning tools and also the ways that these tools are using against us.

Definition:

 “The art of detecting which systems are alive and reachable via the Internet, and

What services they offer, using techniques such as ping sweeps, port scans, and operating system identification, is called scanning.”

Scanning can be considered as an equivalent to knocking on the walls to find all the doors and windows.

Scope of scanning:

  • TCP/UDP services running on each system identified.
  • System architecture (Sparc, Alpha, x86).
  • Specific IP addresses of systems reachable via the Internet.
  • Operating system type.

(B) Determining either the target is alive via ping sweeps:

1) ICMP sweeps:

        We can use ICMP packets to determine whether a target IP address is alive or not, by simply sending an ICMP ECHO request  packets to the targeted system and wait to see if an ICMP ECHO reply (ICMP type 0) is received. If an ICMP ECHO reply is received, it means that the target is alive.

        Querying multiple hosts:

                Querying multiple hosts using this method is referred to as Ping         Sweep. Ping Sweeps is the most basic step in mapping out a network.

        This is an older approach to mapping, and the scan is fairly slow.

        Some of the tools used for this kind of scan include

  • UNIX:        (Fping, Gping, Nmap, Snort etc)
  • Windows: ( Pinger, Nmap, NetCat etc )

                Pinger is one of the fastest ICMP sweep scanners. Its advantage                 lies in its ability to send multiple ICMP ECHO packets concurrently and         wait for the response. It also allows you to resolve host names and save         the output to a file.

2) Broadcast ICMP:

        Sending ICMP ECHO request to the network or/and broadcast addresses will produce all the information you need for mapping a targeted network in even a simpler way.

        The request will be broadcast to all alive hosts on the target network, and they will send ICMP ECHO reply to the attacker source IP after only one or two packets have been sent by him.

3) Non-ECHO ICMP:

        Blocking incoming ICMP ECHO requests is not enough. We can use non-ECHO ICMP protocols for gathering various information about a system.

        Other tools: We can use the icmpush & icmpquery tools to perform this                                 kind of scanning.

        Advantage: Many firewalls are configured to block only ICMP ECHO traffic, and in this case it makes the non-ECHO requests a valid form of host identification.

        Alternatives: Even if ICMP traffic is blocked on the border router or firewall, there are additional techniques that can be used to determine which systems are actually alive, although these techniques are not as accurate as a normal ICMP Sweep.

4) TCP Sweeps:

        The TCP connection establishment process is called “the three way handshake”, and is combined of three segments.

  1. A client sends a SYN segment specifying the port number of a server that the client wants to connect to, and the client initial sequence number.
  2. If the server’s service (or port) is active the server will respond with its own SYN segment containing the server’s initial sequence number. The server will also acknowledge the client’s SYN by ACKing the client’s SYN+1.

        If the port is not active, the server will send a RESET segment, which will         reset the connection.

  1. The client will acknowledge the server’s SYN by ACKing the servers ISN+1.

        When will a RESET be sent? – Whenever an arriving segment does not         appear correct to the referenced connection. Referenced connection         means the connection specified by the destination IP address and port         number, and the source IP address and the port number 5.

With the TCP Sweep technique, instead of sending ICMP ECHO request packets we send TCP ACK or TCK SYN packets to the target network.

Selection of port:

        The port number can be selected to meet our needs. Usually a good pick would be one of the following ports 21, 22, 23, 25, 80.

Other tools:

        Nmap and Hping6 are tools that support TCP Sweep, both for the Unix platform.

        An example with nmap:

                [root@mia /root] ./nmap –sP –PT80 192.168.2.0/24

                TCP probe port is 80

                Starting nmap V. 2.2-BETA4 by Fyodor ([email protected],                                    www.insecure.org/nmap/)

                Host host1.MyDomain.com (192.168.2.0) appears to be up.

                Host host2.MyDomain.com (192.168.2.1) appears to be up.

                Host.host3.MyDomain.com (192.168.2.2) appears to be up.

                Host host4.MyDomain.com (192.168.2.3) appears to be up.

                Host host5.MyDomain.com (192.168.2.4) appears to be up.

                Host host6.MyDomain.com (192.168.2.5) appears to be up.

                …

                Host host254.MyDomain.com (192.168.2.254) appears to be up.

                Nmap run completed -- 32 IP addresses (13 hosts up) scanned in                         12 seconds

5) UDP Sweeps/UDP Scans

        This method relies on the ICMP PORT UNREACHABLE message, initiated by a closed UDP port.

        If no ICMP PORT UNREACHABLE message is received after sending a UDP data gram to a UDP port that we wish to examine on a targeted system,

we may assume the port is opened.

UDP scanning is unreliable because:

         Routers can drop UDP packets as they cross the Internet.

         Many UDP services do not respond when correctly probed.

         Firewalls are usually configured to drop UDP packets.

         UDP sweep relies on the fact that a non-active UDP port will respond                    with an ICMP PORT UNREACHABLE message.

(C) Determine What Services (If Any) Are Running Or In A Listening State

                Ping Sweeps help us identify which systems are alive. Now we will determine the services running on the target system.

        1) Port Scanning:

                Now we will try to determine what services (if any) are running or in a LISTENING state on the targeted system, by connecting to the TCP and UDP ports of that system. This is called Port Scanning.

For the hacker it is critical to identify listening ports, because it helps him identify the

Join now!

operating system and application in use.

        The services detected as listening may suffer from vulnerabilities which may result from two reasons:

  • Mis-Configuration of the service
  • The version of the software is known to have security flaws

If identified, these vulnerabilities can lead to unprivileged access gained by the attacker.

We will further discuss port scanning types, techniques, and tools.

  1. Port Scanning Types:
  • TCP connect() scan

                        With this type of scan we use the basic TCP connection                                 establishment mechanism. To open a connection to an interesting                         port on the targeted machine:

  • A SYN packet is sent to ...

This is a preview of the whole essay