TCP Scanning Basics
Introduction to TCP Scanning
TCP scanning is a fundamental technique in network security and reconnaissance, used to discover open ports and understand network service configurations. At its core, TCP scanning involves sending specific network packets to target systems to determine their accessibility and available services.
TCP Connection Mechanism
sequenceDiagram
participant Client
participant Server
Client->>Server: SYN
Server-->>Client: SYN-ACK
Client->>Server: ACK
Note over Client,Server: TCP Three-Way Handshake
TCP scanning relies on the TCP three-way handshake process, which establishes a connection between client and server. This mechanism allows security professionals to gather critical network information.
Types of TCP Scanning
Scanning Type |
Description |
Purpose |
SYN Scanning |
Sends SYN packets |
Stealthy port discovery |
Connect Scanning |
Completes TCP connection |
Comprehensive service identification |
ACK Scanning |
Sends ACK packets |
Firewall rule mapping |
Key Scanning Concepts
Port States
Ports can exist in three primary states:
- Open: Service is actively listening
- Closed: No service is running
- Filtered: Firewall or network device blocking access
Basic Scanning Example (Nmap)
## Basic TCP SYN scan
sudo nmap -sS 192.168.1.100
## Comprehensive TCP connect scan
nmap -sT 192.168.1.100
Ethical Considerations
TCP scanning should only be performed:
- On networks you own
- With explicit permission
- For legitimate security assessment purposes
By understanding these fundamentals, cybersecurity professionals can effectively utilize TCP scanning techniques in network exploration and security assessment. LabEx recommends practicing in controlled, authorized environments.