🎓 BookMCQ
← Back to 15. Security

📝 Port scanning in network security (12 MCQs)

Discovering Network Services Through Port Scanning

Port scanning is a network reconnaissance technique that checks selected transport-layer ports on a host to identify reachable services. Security administrators use it to inventory exposed services and detect unnecessary listening endpoints. Attackers may also use scanning to discover potential entry points. A scan reveals network responses, not proof that a service is vulnerable or successfully compromised.

Why Open Ports Require Security Review

Networked operating systems expose services through transport protocols such as TCP and UDP. Unneeded or outdated services increase the attack surface, especially when reachable from untrusted networks. Regular scanning helps administrators compare actual exposure with approved configurations and identify unexpected changes after software installation or network reconfiguration.

Interpreting Port States and Service Responses

A scanning tool sends protocol-specific probes and interprets responses or timeouts. A port may be reported as open, closed, or filtered, depending on observed behaviour. An open port generally indicates a reachable service, a closed port indicates no listening service, and a filtered result suggests that a firewall or network device prevents a clear determination.

Example of a Server Service Inventory

A server is expected to provide HTTPS on TCP port 443 and SSH on TCP port 22. An authorised scan also identifies an unexpected database service on port 5432. The administrator checks whether it is needed and restricts access to approved systems, reducing unnecessary exposure.

Asset Visibility and Limits of Scan Results

Port scanning supports asset inventory, firewall validation, and vulnerability assessment. Results depend on scan timing, network filtering, protocol behaviour, and host availability. A filtered port is not necessarily closed, and an open port does not establish that its application is insecure. Scans should be authorised and interpreted alongside service versions and configuration reviews.

Misconceptions About Port Scanning

'An open port proves the service is vulnerable' is false because vulnerability depends on software and configuration. 'A filtered port is definitely closed' ignores blocked responses. 'Port scanning automatically compromises a host' confuses reconnaissance with exploitation; scanning primarily gathers information about network exposure.

Exam Focus: Open, Closed and Filtered Ports

Interpret scan results and distinguish open, closed, and filtered states. Explain how TCP and UDP services use port numbers and why administrators inventory listening services. Questions may ask how scanning supports firewall audits or vulnerability assessment, and why an open port alone is insufficient evidence of a security weakness.

Key Terms of Port Scanning

  • Port - Transport endpoint identifying a service.
  • Open - Port appears to accept connections.
  • Closed - No service is listening.
  • Filtered - Network controls obscure the port state.
  • Reconnaissance - Gathering information about a target.
3
Easy
5
Medium
4
Hard

📝 All Port scanning in network security MCQs

Q1. What is the term for an attacker pretending to be another host?

A.Masquerading ✅
B.Spoofing
C.Sniffing
D.Phishing
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The correct answer is Masquerading because it describes an attacker who pretends to be another host or user to bypass authentication. Spoofing usually refers to falsifying IP addresses, not full identity. Sniffing is passive listening on network traffic, and Phishing relies on social engineering. Recognizing Masquerading helps security professionals detect and mitigate unauthorized access attempts that exploit identity deception.

Q2. A network admin sees a sudden increase in SYN packets. Which scanning technique is most likely being used?

A.SYN scan ✅
B.ACK scan
C.FIN scan
D.Xmas scan
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: SYN scan is indicated by many SYN packets because the attacker sends half‑open connection requests to probe ports without completing the handshake. ACK scans use ACK flags, FIN scans use FIN flags, and Xmas scans set multiple flags. Detecting a surge of SYN packets allows administrators to identify reconnaissance activity and take appropriate defensive measures.

Q3. Why does a stealth FIN scan often evade detection by stateful firewalls?

A.Firewalls treat FIN packets as part of an established connection
B.Firewalls ignore all TCP flags except SYN ✅
C.FIN scans use raw sockets that bypass inspection
D.Firewalls block FIN packets entirely
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Stateful firewalls primarily track the state of TCP connections using the SYN flag to establish a session. FIN packets are usually seen as the termination of an existing connection, so many firewalls do not log them as new attempts. Therefore, a FIN scan can slip past detection. The other options mischaracterize firewall behavior or the nature of FIN scans.

Q4. If an attacker can only send UDP packets, which port scanning method can they use to infer open ports?

A.UDP scan ✅
B.TCP connect scan
C.ICMP ping sweep
D.ARP scan
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A UDP scan sends UDP datagrams to target ports; lack of an ICMP port‑unreachable reply often suggests the port is open or filtered. TCP connect scans require TCP, ICMP ping sweeps test host reachability, and ARP scans operate at layer 2. Using UDP probes matches the attacker’s limitation and provides useful information about service availability.

Q5. How does a man‑in‑the‑middle attack differ from a simple masquerade in terms of session state?

A.Both replace credentials but do not affect sessions
B.Both require encrypted channels
C.Man‑in‑the‑middle hijacks an existing session while masquerade creates a new fake session ✅
D.They are identical techniques with different names
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: A man‑in‑the‑middle attack intercepts and possibly alters an ongoing communication session, preserving the session state between the original parties. In contrast, masquerading typically involves creating a new session while pretending to be another entity. The other options incorrectly describe the relationship between the techniques or claim they are the same.

Q6. A penetration tester uses nmap with the -sS option. What does the -sS flag indicate?

A.SYN stealth scan ✅
B.UDP scan
C.TCP connect scan
D.Ping sweep
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The -sS option tells nmap to perform a SYN stealth (half‑open) scan, sending SYN packets without completing the TCP handshake. This reduces the chance of being logged by the target. UDP scan is invoked with -sU, TCP connect scan with -sT, and ping sweep with -sn. Knowing nmap flags helps testers select the appropriate reconnaissance technique.

Q7. A host blocks all inbound SYN packets but allows inbound ACK packets. Which scanning technique would you employ to discover open ports, and why?

A.SYN scan
B.ACK scan ✅
C.FIN scan
D.Xmas scan
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: An ACK scan works because the firewall permits ACK packets; open ports typically do not send a RST response, while closed ports reply with RST. SYN scans would be dropped, and FIN or Xmas scans may be filtered as well. By analyzing the RST responses, the scanner can infer which ports are open despite the SYN block.

Q8. Why is port scanning considered a reconnaissance activity in the attack lifecycle?

A.It exploits vulnerabilities to gain privilege escalation
B.It gathers information about open services for target selection
C.It disrupts network availability as a denial‑of‑service technique ✅
D.It modifies data packets to alter communication content
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Port scanning gathers information about which services are listening on a host, fitting the reconnaissance phase that precedes exploitation. It does not directly exploit vulnerabilities, cause denial‑of‑service, or modify data. Understanding its role helps defenders recognize early warning signs of an attacker mapping the network.

Q9. An organization’s firewall drops packets with the FIN flag set. An attacker switches to a TCP Xmas scan. What is the expected outcome and why?

A.The scan will be identified as open ports
B.The scan will be marked as closed ports
C.The scan will trigger an immediate alert
D.The scan will likely receive no response, appearing filtered ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Because the firewall already drops FIN packets, a packet with multiple flags like FIN, URG, and PSH (Xmas) will also be discarded, resulting in no reply. This makes the ports appear filtered rather than open or closed. The other options incorrectly assume the firewall treats Xmas packets as normal or generates alerts.

Q10. What is the total number of TCP/UDP ports available on a typical host?

A.1024
B.65535 ✅
C.49152
D.32768
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: A host has ports numbered from 0 to 65535, giving a total of 65 535 ports. The first 1 024 (0‑1023) are well‑known ports, 49 152 (49152‑65535) are dynamic or private ports, and 32 768 is not a standard division. Knowing the full range helps planners design comprehensive scans.

Q11. Why might a combination of TCP SYN and UDP scans be more effective than using either alone?

A.It confuses intrusion‑detection systems
B.It speeds up the scanning process
C.It provides broader coverage of both TCP and UDP services ✅
D.It bypasses all firewall rules
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Using both SYN (TCP) and UDP scans covers services that run over either protocol, reducing false negatives and giving a more complete view of the target’s attack surface. While it may affect IDS or scanning speed, the primary benefit is increased coverage. Bypassing firewalls is not guaranteed, and confusion of IDS is a secondary effect.

Q12. If a remote host responds with an ICMP port unreachable to a UDP probe on port 53, what does this indicate about the port's state?

A.Closed ✅
B.Open
C.Filtered
D.Host is down
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: An ICMP port‑unreachable message signals that the destination UDP port is closed. Open ports typically generate no response, and filtered ports may cause the probe to be dropped silently. The host being down would produce no reply at all. Recognizing this behavior lets scanners differentiate closed ports from other states.

🔗 Related Topics (MCQs)