๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Cybersecurity Fundamentals Module 1 ยท Lesson 3 of 15

0% Exit to course

Module 1 ยท How attacks actually start Lesson 3 of 15

Attack surface: what you can see, you can defend

Learning objective

Every service listening on a port is something an attacker can talk to. Shrinking that list is the most effective defensive work there is, and it is less glamorous than it sounds.

The concept

Attack surface is everything an attacker can reach: open ports, web forms, old test pages, an admin panel, a Git repository with a key in it, an unattended laptop on a public network. You cannot defend what you have not listed, so the first exercise in any audit is making the list.

Do it on your own project this week. Which endpoints are public? Which database is reachable from the internet? Which repository has ever contained a password or a key? Which accounts have admin rights and do all of them need them? Every answer that surprises you is a finding, and finding them yourself is the job.

Terminal
# Run only on your OWN machine.
ip=$(curl -s ifconfig.me)
nmap -F "$ip"                       # common ports
ss -tulpn                           # local listening services
systemctl list-units --type=service --state=running

Close what you do not need. Remove default accounts.
Enable a firewall. Fewer open doors, smaller attack surface.

Common mistakes

The mistake is a development server left running with a default password, months after the project it belonged to. Remove, close or protect โ€” and write down what you removed, because the list is what you show in an interview.

Worked example

A development server left running on port 8080 with no password is a breach waiting for a scanner. Scanners are automated and constant; nothing has to be targeted at you personally for this to be found.

Your practice task

List every service on your own machine that opens a port, and mark which ones you actually need.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Attack surface is everything an attacker can reach: open ports, web forms, old test pages, an admin panel, a Git repository with a key in it, an unattended laptop on a public network.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.