Lecture 3

Updated 14 Oct 2026

CSS484 · Ethical Hacking · Lecture 3 Dr. Matthew Gaber — CSS484 // Ethical Hacking // Week 3

Crossing the line: probing systems directly to map what is exposed


Week 3 · Learning Objectives — What you will be able to do

  • This week takes you from the networking that makes scanning meaningful, through Nmap in depth, to turning what you find into a plan of attack.
  • 01 — Discover targets & services: Explain how attackers actively reach out and discover which systems and services respond.
  • 02 — Perform & interpret Nmap scans: Run multiple scan techniques, and, crucially, understand what the results actually mean.
  • 03 — Identify exposed services & flaws: Find open services, their exact versions, and the misconfigurations that create real risk.
  • 04 — Turn fingerprints into exploits: Understand how service banners and OS fingerprints lead directly to known vulnerabilities.
  • 05 — Operate responsibly: Use reconnaissance tools only within the isolated lab, and always within authorization.

Section 1 — Update GVM

  • Kali GVM (Greenbone Vulnerability Manager)
  • Run the update now so by the end of the lecture it is ready to go.
  • Either bridged and authenticated, or NAT.
$ sudo gvm-start
# It will open the browser at 127.0.0.1:9392/login
# The username: admin and the password: newpass
 
$ sudo greenbone-feed-sync

Section 1 — Networking Foundations for Recon

Why understanding the network is what makes scanning meaningful

[Image: hooded figure at multi-monitor setup — decorative]

A scanner is only as good as its operator

  • Core idea: Reconnaissance is a networking skill first, a tooling skill second.
    • Nmap sends the packets and tabulates the responses, but knowing why a port is silent, why UDP is ambiguous, or why the inside looks nothing like the outside is entirely on you.
  • Tools interact with live services: Scanners work by sending crafted packets to services and watching exactly what comes back, nothing more.
  • Attackers focus on what responds: You don't need the OSI model from memory; you need to read a response and know what it means.
  • Open ports define the attack surface: Every listening service is a door an attacker can try. Discovering them is the whole point of a scan.
  • Your position shapes what you see: The same target looks completely different from inside the LAN than from out on the internet.

Analogy A scanner is like a stethoscope — it just reports the sound it hears. Whether that sound means "healthy" or "problem" depends entirely on the doctor's (your) knowledge of anatomy (networking).


LAN vs WAN — Two Very Different Vantage Points

Where you scan from changes everything. The internal network and the public internet expose completely different attack surfaces.

PropertyLAN: internalWAN: the internet
ScopePrivate, internal networksLarge-scale public networks
AddressingPrivate (RFC 1918): 10 / 172.16 / 192.168Public, globally routable IPs
Trust & filteringHigh trust, low filtering insideHardened perimeter, heavy filtering
What a scan seesEverything: the full internal surfaceOnly deliberately exposed services
Scan speedFast, relatively unrestrictedSlower, restricted by the firewall
Attacker's goalImpact: reach the real objectivesEntry: find one weak door in

Why the Inside is the Real Prize

An external scan sees a deliberately small, hardened surface. Getting inside the perimeter changes the picture entirely, which is why so many attacks are really about pivoting.

  • Outside: a hardened wall — a few public services visible from outside
    • The firewall hides everything internal. You see only the web, mail, or VPN endpoints the organisation chose to expose, and each is likely well defended.
  • Inside: a soft, sprawling surface — hundreds of internal services visible once inside
    • Past the boundary, internal hosts trust each other, filtering is minimal, and services that were invisible are suddenly reachable and often unpatched.
  • The bridge: pivoting — 1 door is all it takes to begin the pivot
    • Compromise one public-facing host, get inside the NAT boundary, and scan from there: the whole internal attack surface opens up at once.

Analogy A building's exterior has one locked front door and reinforced windows. Once you're inside, every office door is unlocked and every filing cabinet is reachable.


IP Addressing: Public vs Private

An IP address is how a scanner locates a target. The split between routable public space and hidden private space governs what you can scan, and from where.

  • Private: hidden inside LANs — not routable on the internet
    • 10.0.0.0/8 — one huge block
    • 172.16.0.0 to 172.31.255.255 — 16 contiguous blocks
    • 192.168.0.0/16 — the home-router classic
    • Invisible from outside; reachable only by getting inside (or via NAT).
  • Public: exposed to the world — globally routable, reachable from anywhere
    • Assigned by ISPs, for an organisation's external systems
    • Carry public services: web, mail, VPN — must be reachable
    • Every one grows the surface: a door visible to the entire internet
    • Enumerate these first for external recon.

NAT / PAT: Why Outside is Not Inside

Many private hosts share one public IP. The router rewrites addresses on the way out and tracks each connection by port, so an external scan sees only the router, never the hosts behind it.

[Image: diagram — Private LAN (Host A 192.168.1.10, Host B 192.168.1.11, Host C 192.168.1.12) → NAT/PAT router (203.0.113.5) → Internet sees ONE public IP]

  • Many private hosts hide behind one public IP. PAT maps them by port. External scans see only the router.
  • Many hosts, one public IP: PAT distinguishes connections by port number.
  • External scans stop at the boundary: you can't even tell how many hosts exist.
  • To reach them, get inside first: compromise something public, then scan from within.

Analogy NAT/PAT is like an office receptionist with one phone number — every employee's outgoing calls show the same caller ID, and outsiders can't dial an employee directly without the receptionist forwarding the call.


Ports as the Attack Surface

An IP address gets you to the machine; a port gets you to a specific service. Every open port is a listening service (a door), and every unnecessary one is pure risk.

Anatomy of a Socket Address

10.10.2.244:443\boxed{10.10.2.244:443}

  • 10.10.2.244 → which host (IP address)

  • 443 → which service (port)

  • Ports are entry points: where a service listens for connections.

  • More open ports = bigger target: 1 door is trivial; 20 is a sprawling surface.

  • Unneeded services = free risk: a door open for no reason, pure exposure.

$ netstat -tuln
 
Proto  Local Address     State    
tcp    0.0.0.0:22        LISTEN   # SSH, needed?
tcp    0.0.0.0:445       LISTEN   # SMB, high risk
tcp    0.0.0.0:3389      LISTEN   # RDP, exposed!
tcp    0.0.0.0:8080      LISTEN   # old web app?

High-value targets:

PortService
22SSH
23Telnet
80/443HTTP/S
445SMB
3389RDP
  • When you scan, you're asking one question: which doors are open, and what's behind each one?

Port Forwarding: How Outside Gets In

Port forwarding: incoming traffic from the WAN addressed to 203.0.113.5:443 is forwarded to 192.168.1.10.

  • Outbound translations create themselves as traffic flows. Inbound ones don't exist until an administrator writes them, and every rule they write is a door in the wall.

[Image: diagram — Private LAN (Webserver 192.168.1.10:443, Host B, Host C) → NAT/PAT router (203.0.113.5) → Attacker sees ONE public IP and port 443]

  • The rule exists before the packet: No dynamic entry can match unsolicited traffic, so someone configured this one by hand.
  • The port number is a label, not a promise: External 2222 can land on internal 22; this is why you run -sV instead of assuming.

Analogy A forwarding rule is like telling the office receptionist "if anyone calls extension 443, put them through to Bob's desk." Without that instruction, unsolicited calls just get dropped.


TCP vs UDP: From the Attacker's View

Two transport protocols, opposite in almost every property, and that shapes how you scan, what you learn, and where the overlooked weaknesses hide.

PropertyTCP: connection-orientedUDP: connectionless
Connection3-way handshake firstFire and forget, no setup
ReliabilityGuaranteed, orderedBest-effort, may be lost
ScannabilityPredictable, clear statesAmbiguous, silence is not closed
Scan speedFastSlow (retries + timeouts)
Key servicesWeb, SSH, databasesDNS, SNMP, NTP
Attacker noteMost of your attentionOverlooked, so misconfigured
  • Why UDP matters: because everyone finds it annoying and skips it, UDP services are frequently misconfigured. A thorough attacker doesn't.

How Scanners Read the Network

A scanner sends a probe and infers the port's state from the reply. Open and closed both answer; filtered is defined by silence, and silence is ambiguous.

  • Scanner sends probes →

    • SYN-ACK → OPEN: the service is there, offering to connect
    • RST → CLOSED: host reachable, nothing listening here
    • no reply / ICMP → FILTERED: a firewall is silently dropping the probe
  • The core logic: poke each port, watch the reply, infer the state. Open and closed give a definite answer; filtered gives silence, and that gap is where the subtlety lives.


Concept Check: No Response

Scenario: During a TCP SYN scan you send a probe to a port and get NO response at all. What is the most accurate interpretation?

The tempting answer is "closed", but closed ports behave differently. Reason it through before you commit.

  • Why can't we say the port is closed? A closed port usually replies with an RST. If it were closed, you would expect a reply, not silence.
  • What two situations look identical here? Filtered by a firewall (probe silently dropped), or open but simply not responding. From one probe you cannot tell them apart.
  • Why is this worse with UDP? UDP has no handshake and silent drops are routine, so no-response is the norm rather than the exception.
  • So the honest answer is: No response does not mean closed. It means uncertain. Design a follow-up probe rather than forcing a conclusion.

Key takeaway: In scanning, no response is not a result, it is an ambiguity.


Concept Check: What to Do Next

Scenario: You have just compromised one public-facing web server. It is yours. What is your next priority?

  • Pivoting? The internal network is a far larger attack surface, with higher trust between hosts and many more targets. The web server was just the door.
  • When might external recon still make sense? Multi-tenant hosting, shared infrastructure, or supply-chain paths, where the box shares an environment with other valuable targets.
  • What does this reveal about WAN scanning? It is about entry, not impact. The public scan gets you in; the internal work is where the real objective lives.
  • The strategic frame: WAN recon finds the door. LAN recon, after you pivot, maps the building and finds the safe with the treasure in it.

Key takeaway: WAN recon finds doors; LAN recon finds impact. Knowing which you are doing sets your priorities.


Concept Check: What Limits Visibility

Scenario: What most limits what a scanner can actually see?

  • What do the common answers share? Firewall, filtering, NAT, policy, routing — they are all about network controls and design, not about the scanner itself.
  • A better tool. Why (not)? A more expensive scanner does not see through a firewall that is silently dropping packets. Capability is not the constraint.
  • What does this imply for defenders? Architecture matters far more than signatures. How you segment and filter shapes what an attacker can discover.
  • What does this imply for attackers? Gaining position matters more than better tools. The right vantage point reveals more than any amount of tuning from a bad one.

Key takeaway: Recon is constrained far more by where you are standing than by what you are holding.


Concept Check: UDP Port 53

Scenario: You run a UDP scan against port 53 (DNS) on a host and receive no response. What is the most correct conclusion?

In the TCP world signals are fairly clear. In UDP everything is murky.

  • Open UDP port? Often gives no response at all, so silence is perfectly consistent with the port being open.
  • Closed UDP port? Sometimes returns an ICMP unreachable, but those are frequently rate-limited or blocked, so you may see nothing.
  • Filtered UDP port? Also gives no response. All three cases can look absolutely identical from a single silent probe.
  • Nmap's honest label: open|filtered, which in plain terms means unknown. You cannot distinguish these cases, and that is not a tool failure.

Key takeaway: UDP scanning is inherently ambiguous. "Unknown" is a legitimate, professional answer — don't manufacture false certainty.


Networking Commands: Your Orientation Kit

The moment you land on a machine, these tell you where you are and what it exposes. Windows and Linux mirror each other: same concepts, slightly different names.

WindowsLinux / KaliWhat It Does
ipconfigifconfigInterface IP configuration
netstatnetstatListening ports + their programs
routerouteView / modify routing table
pingpingICMP: is the target reachable?
tracerttracerouteTrace the path, hop by hop
arparpMAC-to-IP cache on the segment
nslookupdigDNS queries
telnet / ftptelnet / ftpRaw interaction: plaintext, insecure
  • Help yourself: Windows uses /? after a command; Linux uses -h / --help or the full man <command>. Never memorise flags, learn to ask.

Foundation Laid: Now We Scan

Everything so far underpins what comes next. With the networking in place, we move to active scanning and the tool that dominates it.

What you now understand:

  • LAN vs WAN: where you scan from matters
  • Public vs private addressing & NAT
  • Ports = the attack surface
  • TCP vs UDP, and why silence is ambiguous
  • How scanners infer open / closed / filtered

What is coming:

  • Active scanning & Nmap — the core trade-off: richer information vs greater detectability

  • Nmap, in depth — scan types, versioning, scripting, evasion

  • Automated scanning — OpenVAS / GVM for full vulnerability reports

  • Discovery to exploitation — turning findings into a prioritised plan

  • The link: tools automate the probing, but the underlying logic is entirely network-based. A scanner is a precision instrument for someone who understands networking, and just noise for someone who doesn't.


Section 2 — Active Scanning

Direct interaction with targets: richer information, at the cost of noise

The Defining Trade-off of the Week

Active scanning means reaching out and probing systems directly. That gives you confirmed, current intelligence, but every probe is a packet that arrives, gets logged, and can be seen.

What you GAIN:

  • Confirmed, current data — not inference: you see what is actually running now
  • Exact services & versions — the raw material for finding real vulnerabilities
  • A live attack-surface map — which hosts, which ports, where you can move

What it COSTS:

  • Every probe is a packet — that arrives at the target and can be recorded
  • Logs & alerts fire — firewalls and IDS/IPS are tuned to spot scans
  • You announce your presence — active recon is detectable by design, unlike passive

Active vs Passive: One More Time

This contrast anchors the whole week. You start passive to build a quiet picture, then go active, selectively, to confirm and deepen it. Passive tells you where to look; active tells you what is there.

PropertyPASSIVE (last week)ACTIVE (this week)
ContactNo contact with the targetDirect probing of systems
SourcesPublic records, OSINT, DNSLive hosts, ports, services
DetectabilityEssentially invisibleNoisy, logged & alertable
InformationLimited to what is publicDetailed, current, confirmed
WhenFirst, build the pictureSecond, confirm & deepen
  • The professional switch: start passive to find where to look, go active to confirm what is there. Knowing when to switch is the judgement.

The Attacker's Shopping List

Why accept the detection risk? Because of what active scanning delivers. Read this list top to bottom and you can see an attack plan forming, step by step.

  1. Live hosts — Which machines are actually up and reachable: no wasted effort on ghosts.
  2. Port states — Open, closed, filtered: where the doors are, and which are viable.
  3. Services & versions — The dangerous one: outdated software is exactly where exploitable flaws live.
  4. Attack-surface map — The whole environment, revealing where lateral movement becomes possible.
  5. Misconfigurations — Services exposed that shouldn't be, defaults left in place, plain mistakes.
  • What's alive, exposed, vulnerable, reachable. Active scanning is how a vague target becomes a concrete plan. Too valuable to skip.

Precision vs Coverage

How you scan matters as much as that you scan. There is no single right answer: context decides where on this spectrum you operate.

BROAD SCANS ←—————————→ TARGETED SCANS

  • Broad scans:
    • Maximum visibility: map the whole range
    • High noise: trips IDS/IPS quickly
    • Slow across large targets (can take hours)
    • ⏱ Time: broad scans across large targets can take hours, sometimes far longer
  • Targeted scans:
    • Stealthy: minimal footprint
    • Precise: only what you need
    • Fast, but you must know where to look
    • 🔔 Detection: aggressive scans can be actively blocked mid-scan, cutting you off

On the Other Side of Your Scan

A reality check before we run anything. While you scan, this is what happens on the defender's side, and it is often the very first sign of an attack.

Your scan (probes arrive) → Logs (every probe recorded) → IDS/IPS (pattern recognised) → Correlation (intent revealed) → ALERT (defender responds)

  • A single odd packet means nothing. A correlated pattern is unmistakable.
  • In many real breaches, the reconnaissance scan is the defender's very first indication that something is wrong, before any exploitation. Careless scanning is often what gets you caught, which is exactly why evasion exists.

Analogy One person jiggling a doorknob means nothing. Someone systematically jiggling every doorknob on the street, in order, is what makes neighbors call the police.


Consider (Discussion Questions)

Q1: You connect to the free WiFi at a Starbucks and run an nmap scan against the local IP range (other devices on the same WiFi). Is this a crime?

  • A. Yes - scanning is always a felony, no exceptions
  • B. Port scanning is not, by itself, specifically illegal in most jurisdictions — but it's a different question from whether it's authorized ✅
  • C. Only illegal if you find an open port
  • D. No, and because it's legal there are zero consequences of any kind

Q2: While you're connected to that WiFi, what has the network almost certainly recorded about your device?

  • A. Nothing - public WiFi keeps no records
  • B. Just the total amount of data you used
  • C. Only your username, if you signed in
  • D. At minimum your device's MAC address and the IP it was assigned, usually with timestamps — and often the domains/traffic you generated ✅

Q3: You switch on a VPN before connecting, thinking it makes you anonymous on the local network. What does the VPN actually change?

  • A. It hides your MAC address from the local access point and makes you untraceable
  • B. It encrypts your traffic's contents/destinations from the local network — but the AP still sees your real MAC, and a scan of the local subnet doesn't go through the tunnel the way you'd expect ✅
  • C. Nothing - VPNs do absolutely nothing on public WiFi
  • D. It makes local scanning completely anonymous and consequence-free

Q4: Different scenario — instead of the local WiFi, you point the scan at a public website out on the internet, with the VPN switched on. What has actually changed — and what hasn't?

  • A. Nothing changes - the website sees the coffee shop's IP either way
  • B. The scan is now completely untraceable and no one can ever connect it to you
  • C. The target logs the VPN's IP instead of yours — but the scan is still recorded, the VPN provider can tie that exit IP back to you, and scanning a site you don't own can still be unauthorized regardless ✅
  • D. It's guaranteed legal now, because the VPN is in a different country

Analogy A VPN is like wearing a ski mask while walking down the street — passersby can't identify your face (traffic contents), but the doorman at the building you entered (local AP) still saw your height, build, and gait (MAC address) on the way in.


Section 3 — Nmap: The Attacker's Tool of Choice

Scan types, detection, scripting, evasion: Nmap is configured, not just run

Nmap is Configured, Not Just Run

The industry-standard scanner, and its whole power is in choosing the right scan for the situation. Beginners type "nmap target" and accept whatever happens. Professionals choose.

Why it dominates:

  • Automates active recon — packet-crafting and interpretation at speed
  • Flexible & configurable — the key word: you shape every scan
  • Works LAN and WAN — the same tool, internal or external
  • Attacker & defender — learn it once, use it on both sides

The key insight: Different goals require different scans.

  • Beginner: types nmap target, accepts whatever happens.
  • Professional: chooses scan type, timing, and depth for the goal. Poor scan choice equals noisy or useless results.

SYN Scan: The Default Weapon

Nmap's default for a privileged user (sudo): a half-open scan. It gets the same answer as a full connection, with fewer packets and nothing complete for the target to log.

Full Connect Scan (-sT):

  • Scanner → SYN → Target
  • Target → SYN-ACK → Scanner
  • Scanner → ACK → Target
  • Result: connection OPEN (logged by target)

SYN Scan (-sS): half-open

  • Scanner → SYN → Target
  • Target → SYN-ACK (port open) → Scanner
  • Scanner → RST (tear down) → Target
  • Result: never completes (stealthier, faster)
nmap -sS 192.168.1.0/24
  • Fast & stealthy, but crafts raw packets, so it needs root and can be blocked by firewalls watching for the pattern.

Analogy A full connect scan is like walking into a store, browsing, and checking out at the register (fully logged). A SYN scan is like opening the door, peeking in, and walking away before the bell even finishes ringing.


Lab: SYN Scan, Before and After Defences

Run a SYN scan from Kali against Win11, then watch how host defences change what you can see. This is our isolated lab, so we can safely lower the target's guard.

  1. Lower the target's defences (lab only) — On Win11: turn OFF the firewall (check BOTH places) and disable real-time & virus protection.

    • Win11 · Windows Security
  2. Start a service to find — On Win11, run a simple web server so there is something listening on a known port.

    python -m http.server 443
  3. Scan from Kali — Run the SYN scan against Win11's address. You should now see that port open.

    nmap -sS <win11-ip>
  4. Re-enable the firewall & re-scan — Watch those ports shift to filtered. The before-and-after shows how defences hide the surface. Are some still open and why?

    nmap -sS <win11-ip>

Three Ways to Probe a Port

The three core TCP/UDP scan types, side by side. Which you use depends on your privileges, your stealth needs, and whether you are willing to wait.

-sS — SYN scan (half-open)

  • Sends SYN, reads reply, sends RST — never completes the handshake
  • Fast & stealthy — fewer packets, often unlogged
  • Needs root privileges — crafts raw packets
  • the default when privileged

-sT — Connect scan (full handshake)

  • Completes SYN / SYN-ACK / ACK — a real, full connection
  • Easily logged — completed connections show clearly
  • Works unprivileged — uses normal OS sockets
  • the fallback without root

-sU — UDP scan (connectionless)

  • Fires UDP, infers from silence — no reply is not closed
  • Slow & ambiguous — retries, timeouts, ICMP hints
  • Finds overlooked services — DNS, SNMP, NTP
  • tedious but high-value

Version Detection: Where Recon Becomes an Exploit

A plain scan says "something's on port 80." Version detection says "Apache 2.4.49", and a specific version is a specific, searchable list of known vulnerabilities.

$ nmap -sV -p 21,22,80 10.10.2.244
 
PORT    STATE  SERVICE  VERSION
21/tcp  open   ftp      vsftpd 3.0.3
22/tcp  open   ssh      OpenSSH 7.2p2
80/tcp  open   http     Apache 2.4.49
 
# exact software + version, handed over
nmap -sV target

That one line, weaponised:

  1. Apache 2.4.49 — the version string from the scan
  2. Search CVE / Exploit-DB — "Apache 2.4.49 vulnerability"
  3. CVE-2021-41773 — path traversal, RCE when CGI is enabled
  4. Working exploit — a targeted, reliable way in
  • The trade-off: -sV has a fuller conversation with each service, so it's noisier, but accurate versioning turns a vague hope into a targeted attack. Worth the visibility.

OS Fingerprinting: A Strong Hint, Not Gospel

Identifies the host's operating system from the subtle quirks in how it implements the network stack. Powerful for narrowing exploits, but probabilistic, so treat it as a lead.

$ nmap -O 10.10.2.244
 
Running: Microsoft Windows 10|11
OS CPE: cpe:/o:microsoft:windows_10
 
Aggressive OS guesses:
  Windows 10 (92%), Win11 (87%)
 
# a probability, not a certainty

How it works:

  • Reads TCP/IP quirks — every OS implements the stack slightly differently

  • Times the responses — and inspects default values & edge cases

  • Matches a signature DB — comparing quirks against known fingerprints

  • Narrows exploit choices — tells you which family of techniques fits

  • Note the percentages. Nmap infers, it doesn't confirm. Use the result to focus effort, verify where it matters, and never bet everything on a fingerprint being exactly right.

Analogy OS fingerprinting is like identifying a car's make from a blurry photo of its tire tread — you get a confident guess (92% Toyota), not a VIN check.


NSE: The Nmap Scripting Engine

What turns Nmap from a port scanner into a reconnaissance framework: hundreds of scripts that encode known attack logic, the knowledge of countless researchers, invoked instantly.

# run vulnerability scripts
$ nmap --script vuln target
 
# they live here, go browse them
$ ls /usr/share/nmap/scripts/
600+ .nse scripts ...
 
# narrow to vuln scripts
$ ls .../scripts/*vuln*
 
# search by service name
$ ls .../scripts | grep smb
  • Encodes known attack logic — the checks a researcher would run, packaged
  • Automates enumeration — checks that would take hours by hand, in one command
  • Reduces manual effort — hundreds of researchers' knowledge, reused
  • Scales your capability — sophisticated checks, invoked instantly

NSE Done Right: Discover, Then Target

You almost never run --script vuln blindly against everything: it's slow, deafeningly noisy, and mostly wasted. The professional approach is two deliberate steps.

1. Identify services first

  • Run a service + version scan so you know exactly which ports are open and what's running. Now you have a map, you're no longer guessing.
nmap -sT -sV 10.10.2.244

2. Target only what you found

  • Found SMB on 445?
nmap -p445 --script smb-vuln*
  • Found HTTP on 80/443?
nmap -p80,443 --script http-vuln*
  • Faster, quieter, far more effective: testing only relevant vulns against confirmed services.

  • Discover then target: blind scanning is loud and lazy; targeted scanning is surgical. Always work in these two steps.


Evasion: Shaping the Signal, Not Vanishing

Evasion alters timing and structure to blend into the background, because it's patterns that trigger detection, not individual packets.

  • -T2 — polite timing

    • Deliberately slows the scan down. Rapid bursts of connection attempts are exactly what IDS is tuned to catch, so spreading probes over time makes the pattern less obvious.
  • -Pn — skip host discovery

    • Skips the initial ping that normally precedes a scan. Useful when a host blocks pings, or simply to reduce your footprint by assuming the host is up rather than checking first.
  • A single probe is unremarkable. A thousand in quick succession is a screaming signature.

    • So evasion is about breaking recognisable patterns, mainly by trading time for subtlety. And remember: Nmap produces information, not answers. The interpretation is always yours, and not every open port matters.
nmap -T2 -Pn target

Section 4 — From Discovery to Exploitation

Turning what you find into a prioritised attack plan

Where Are We? MITRE ATT&CK

The industry-standard catalogue of adversary tactics, read left to right as the life story of an intrusion. The key point: scanning appears TWICE.

ReconnaissanceInitial AccessExecutionPersistencePriv. EscalationCredential AccessDiscovery + LateralCollectionExfiltration
OSINTphishingrun codeautostartexploitMimikatzscanningstage datacovert channel
scanningpublic appscriptsaccountstokenshashespivot
fingerprintSMB
  • Defence Evasion runs throughout: hiding from the defenders at every stage.
  • Scanning appears twice: external reconnaissance at the start, and internal Discovery & Lateral Movement after a foothold. Recon isn't a one-time step, it threads through the whole attack.

The Discovery Workflow

Beneath all the tools, a consistent loop, and it spins faster and reveals more with every new foothold you gain. Discovery isn't a one-time step; it's a cycle.

Live hosts (who is reachable?) → Exposed services (what ports & apps?) → Weaknesses (versions, anomalies) → Prioritise paths (where to attack) ↳ repeat as access expands: discovery continues after every new foothold

  • The attacker mindset: attackers aren't impressed by what's expected, they hunt for what stands OUT. An unexpected service, outdated software, or a management interface in the wrong context is the flag that signals a misconfiguration or forgotten system.

Discovery to Exploitation

Where reconnaissance pays off: the chain from a version string to a working, prioritised attack. This is the whole point of everything you've learned this week.

  1. Extract banners & versions — from your scans, with version detection and banner grabbing
  2. Map to known vulnerabilities — take "Apache 2.4.49" and ask what it's known to be vulnerable to
  3. Search CVE & Exploit-DB — the CVE list and Exploit-DB catalogue exactly what applies
  4. Prefer reliable, low-effort paths — favour exploits likely to work without crashing the target
  • Exploitation follows prioritisation. You don't attack everything, or in random order — you prioritise by impact, reliability, and effort, then strike best-target-first.

Internal Discovery: The Real Payoff

Once inside, discovery becomes far more powerful. This is why perimeter defence alone is never enough, and why "assume breach" is the modern defensive mindset.

From outside the perimeter:

  • A small, hard surface — only the exposed, hardened public services
  • Heavy filtering — the firewall drops most of what you try
  • Low trust — nothing internal trusts your connection

Once you're inside:

  • Far more exposed services — everything hidden behind NAT is now reachable
  • Fewer controls — the soft interior is often lightly monitored
  • Trust breaks down — internal systems trust each other, and you inherit it
  • Lateral movement opens up — move host to host toward the real objective

Interpreting Banners, Versions & Fingerprints

A banner is what a service announces when you connect, often before authentication, and never intended as a security feature. Each one is a direct lead to an exploit.

$ nmap -sV -p 21,22,80 10.10.2.244
 
PORT    STATE  SERVICE  VERSION
21/tcp  open   ftp      vsftpd 3.0.3          -> search: vsftpd 3.0.3 CVE
22/tcp  open   ssh      OpenSSH 7.2p2 Ubuntu  -> dated build, check advisories
80/tcp  open   http     Apache 2.4.49         -> CVE-2021-41773 path traversal!
 
# a banner is what a service announces on connect
# version + software = a direct lead to known exploits
  • Banners are everywhere: services expose exact versions by default all the time. For attackers, a rich source of version intelligence; for defenders, a reminder that reducing that leakage is a real hardening step.

OpenVAS / GVM: Automated Scanning

Where Nmap is a precision instrument you drive by hand, OpenVAS (now GVM) is a comprehensive automated scanner, checking a target against a huge database and producing a full report.

$ sudo gvm-start
 
# It will open the browser at 127.0.0.1:9392/login
# The username: admin and the password: newpass
 
# If you need to update
$ sudo greenbone-feed-sync
  • OpenVAS is now GVM — the framework is GVM; "OpenVAS" is the scanner engine inside it. The package is gvm.
  • Record the admin password — gvm-setup prints an auto-generated password, capture it, it flies past quickly.
  • Web UI on port 9392 — access at https://localhost:9392 with the admin credentials from setup.
  • Be patient — setup downloads a massive vulnerability feed, it can take a long time.

OpenVAS / GVM: Running a Scan

The Greenbone Security Assistant web workflow, end to end: define a target, build a task, run it, and read the report.

  1. Create a target — Configuration > Targets > New Target. Point it at your Win11 lab machine's address.
  2. Create a scan task — Scans > Tasks > New Task. Name it "First Scan", choose the Full and Fast config, set the target.
  3. Run it — Scans > Tasks, click the play button. OpenVAS probes the target against its entire vulnerability database. Be patient.
  4. Open the report — A list of discovered vulnerabilities, each rated by severity. Click any one for details and remediation.
  • The payoff: the automated tool does, at scale, the same discover-then-assess workflow you learned by hand with Nmap. It finds services, identifies versions, and maps them to known vulnerabilities.

Scanning a Service on the Internet

  • http://scanme.nmap.org/
  • Bug bounties — check the conditions
  • VulnHub — download vulnerable VM's
  • Hack The Box, TryHackMe — but you VPN in and are on the same LAN as the target.

[Image: screenshot of scanme.nmap.org homepage — Fyodor's authorized public Nmap test target, with links to Nmap docs, security lists, security tools]


OpenVAS / GVM: Troubleshooting

This should NOT be required but just in case the admin setting has been lost

# If there is an error when creating the target that mentions Feed Import Owner then run
sudo runuser -u postgres -- psql gvmd -c \
  "SELECT value FROM settings WHERE uuid = '78eceaec-3385-11ea-b237-28d24461215b';"
 
# If the above returns 0, then run
sudo runuser -u _gvm -- gvmd --get-users --verbose
 
# The above will return something like
admin b544a23b-7a32-42f0-a190-6d26cc46a0a3
 
# Then run
sudo runuser -u _gvm -- gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value b544a23b-7a32-42f0-a190-6d26cc46a0a3

Week 3 Recap — From Doors Found to Doors Opened

  • Active reconnaissance turns a vague target into a concrete, prioritised attack plan, but it's noisy and detectable, so it demands both technical skill and careful judgement.
  • Next week: we take the exposed services and versions you've learned to discover and start turning them into actual compromises, moving from finding the doors to opening them.