Network Scanning
Network Scanning
Network Scanning
Index:
1. Overview of Network Scanning 2
2. TCP Communication Flags 2-3
3. TCP/IP communication 3
4. Scanning Tools: 3-5
i. Nmap
ii. Hping3
5. Host Discovery Techniques 5
6. Nmap 6-15
7. OS discovery 16
8. OS discovery using NMAP script engine 16-17
9. IDS and Firewalls 17-18
10. Packet fragmentation 18
11. Source Routing 19
12. Source Port Manipulation 19
13. IP Address Decoy 19
14. IP Address Spoofing 19
15. Proxy Servers 19
16. Anonymizers 20
17. Zenmap 21-22
18. Hping3 23
19. Scanning a target network using Metasploit 23-29
2|Page
1. Identifying Live Hosts: Detect active devices within a network to map targets for further
investigation or testing.
2. Port Identification: Determine open, closed, or filtered ports to assess potential entry points
for unauthorized access.
3. Service and Version Detection: Identify services running on open ports and their software
versions to detect vulnerabilities or outdated applications.
4. Discovering Network Vulnerabilities: Scan for weak configurations, known vulnerabilities, or
misconfigurations to assess the security posture of systems.
1. SYN (Synchronize)
Initiates a new connection by synchronizing sequence numbers between sender and receiver.
2. ACK (Acknowledgment)
3. FIN (Finish)
4. RST (Reset)
5. PSH (Push)
6. URG (Urgent)
Marks a segment as urgent, giving it priority over other data in the queue.
The Urgent Pointer field specifies the end of the urgent data.
3|Page
These flags help maintain reliable data transmission and control the state of communication between
devices.
TCP/IP communication:
The TCP 3way handshake is a process used to establish a reliable connection between a client and
server.
1. SYN: The client sends a SYN packet to request a connection, indicating its sequence number.
2. SYNACK: The server responds with a SYNACK packet, acknowledging the client’s request and
providing its own sequence number.
3. ACK: The client sends an ACK packet, confirming the connection.
After this exchange, both devices are synchronized and can begin secure data transmission. The
handshake ensures proper connection setup before communication.
Scanning Tools:
1. NMAP:
What’s Nmap
Nmap (Network Mapper) is an open-source tool used for network discovery and security auditing. It
scans IP addresses, hosts, and ports to identify active devices, services, and potential vulnerabilities
on a network.
Nmap helps ethical hackers, security professionals, and administrators map network infrastructures,
detect unauthorized devices, find open ports, and assess vulnerabilities. It’s essential for penetration
testing and maintaining network security.
Advantages of Nmap
Disadvantages of Nmap
2. Hping3:
What’s Hping3
Hping3 is a command-line tool used for network scanning, auditing, and packet crafting. It supports
sending custom TCP, UDP, and ICMP packets, allowing testers to analyze networks, detect
vulnerabilities, and simulate attacks like DoS.
Hping3 allows ethical hackers and security professionals to craft custom packets for testing firewalls,
network paths, and intrusion detection systems. It is used for advanced port scanning, packet
spoofing, and performance analysis.
Advantages of Hping3
Disadvantages of Hping3
ICMP Ping Sweep ICMP (Layer 3) Any Network Ping, Fping, Nmap
Nmap:
6|Page
7|Page
8|Page
9|Page
10 | P a g e
11 | P a g e
12 | P a g e
13 | P a g e
14 | P a g e
OS discovery:
15 | P a g e
An IDS monitors network and host activity to detect malicious actions, policy violations, and unusual
behavior. It provides real-time threat detection by alerting administrators about attacks such as DoS,
brute force attempts, or malware infections. IDS systems analyze traffic patterns to identify
deviations from normal baselines and keep logs for forensic investigations. They help detect insider
threats by tracking unauthorized internal access. Additionally, IDS tools integrate with systems like
SIEM (Security Information and Event Management) to enhance threat intelligence. However, IDS
operates passively, only detecting and alerting, without directly blocking attacks.
Use of Firewalls
Firewalls control both incoming and outgoing network traffic by acting as a barrier between trusted
and untrusted networks, such as the LAN and the Internet. They prevent unauthorized access by
blocking or allowing traffic based on predefined security policies, including IP addresses, protocols,
and ports. Firewalls protect against malware and exploit attempts by filtering harmful traffic. They
can also limit access to specific applications and services, like databases or web servers. Additionally,
firewalls provide network address translation (NAT), which hides internal IPs behind a public IP for
enhanced security, and offer VPN support for secure remote connections. Firewalls are crucial in
preventing DoS attacks by regulating traffic and avoiding flooding attempts.
Intrusion Detection Systems (IDS) evasion techniques aim to avoid detection by manipulating traffic
patterns. Common methods include fragmentation, where attackers split malicious payloads into
smaller packets to bypass detection thresholds, and obfuscation, which alters the attack signatures
through encoding or encryption. Additionally, attackers may use protocol tunneling to hide malicious
traffic within legitimate protocols, reducing the likelihood of alerts.
Firewall evasion techniques focus on circumventing traffic filtering mechanisms. Techniques include
port scanning, where attackers probe for open ports, and using non-standard ports to evade
detection. Protocol manipulation, such as using tunneling to encapsulate malicious traffic within
allowed protocols, can also bypass firewall rules. Attackers might also employ traffic encryption to
obscure content, making it difficult for firewalls to inspect packets.
Packet fragmentation:
Packet fragmentation is the process of dividing large data packets into smaller fragments to fit
network protocols' size limits, ensuring efficient transmission and reassembly at the destination.
Source Routing:
18 | P a g e
Source routing allows the sender to specify the entire route a packet takes through the network. This
can improve routing efficiency but may complicate security and network management.
IP Address Decoy:
An IP address decoy is a technique used to mask the true source of internet traffic by routing it
through various intermediary servers. This approach can enhance online privacy and anonymity,
making it difficult for observers to trace activities back to the original user.
IP Address Spoofing:
IP address spoofing is a malicious practice where an attacker sends IP packets from a false source
address to disguise their identity. This can be used for various cyberattacks, including Denial of
Service (DoS) attacks, as it allows the attacker to bypass security measures and evade detection.
Proxy Servers:
A proxy server acts as an intermediary between a user and the internet. It forwards requests from
clients to web servers and retrieves the requested data, providing anonymity and security. Proxy
servers can filter content, improve load times, and bypass geographical restrictions, enhancing
privacy and access to information online.
1. Anonymity: Proxies mask the attacker's real IP address, making it difficult for security
systems to trace the origin of malicious activities.
2. Bypassing Restrictions: Proxies can help attackers circumvent firewalls, content
filters, and geo-blocks, allowing access to restricted networks or systems.
3. Traffic Redirection: Attackers can route traffic through multiple proxies to disguise
their intent, making it harder to detect patterns of malicious behavior.
4. Distributed Attacks: Using multiple proxy servers allows attackers to launch
distributed attacks (like DDoS) more effectively, as the traffic appears to come from
various sources.
5. Access Control Evasion: Proxies can help bypass security measures and access
restricted resources, enabling unauthorized data access or exploitation of
vulnerabilities.
19 | P a g e
By leveraging these advantages, attackers can execute their strategies with greater stealth and
effectiveness.
Anonymizers:
A proxy server acts as an intermediary between a user and the internet. It forwards requests from
clients to web servers and retrieves the requested data, providing anonymity and security. Proxy
servers can filter content, improve load times, and bypass geographical restrictions, enhancing
privacy and access to information online.
1. VPNs (Virtual Private Networks): Services like NordVPN, ExpressVPN, and CyberGhost
encrypt internet traffic and hide IP addresses.
2. Tor: A free, open-source software that routes traffic through a network of volunteer-
operated servers for anonymity.
3. Proxy Servers: Services like Smartproxy and Luminati that act as intermediaries,
hiding the user's IP address.
4. Anonymizing Browsers: Browsers like Brave and the Tor Browser prioritize user
privacy and offer built-in anonymization features.
5. Web-Based Anonymizers: Services like HideMyAss and Anonymouse.org that allow
users to browse websites without revealing their identity.
6. Onion Routing Services: These utilize the Tor network to provide additional layers of
anonymity while browsing.
Using these tools helps protect user privacy and maintain anonymity online.
Zenmap:
20 | P a g e
21 | P a g e
22 | P a g e
Hping3:
\
25 | P a g e
26 | P a g e
27 | P a g e
28 | P a g e