We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Security Architecture
Free preview: the first 2 parts of this 7-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Security Architecture
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
A security audit revealed an application server with 47 open ports. Port 80 and 443 served the web application. The other 45 were leftovers: an old FTP server nobody used, a debug endpoint from development, database ports exposed to the internet, an SSH server with password authentication. Each open port was a potential entry point. The attacker who eventually breached the system did not go through the web application at all. They exploited an unpatched FTP daemon on port 21.
This pattern shows up in every breach report. Verizon's 2023 Data Breach Investigations Report found that 74% of breaches involved exploitation of exposed services that should not have been public-facing. The fix is not better firewalls around those 47 ports. The fix is having 2 ports instead of 47.
Attack surface reduction means eliminating every unnecessary entry point, feature, service, port, and dependency. You cannot secure what you do not need if you simply remove it instead.
| Category | What to Reduce | How | Real Example |
|---|---|---|---|
| Network | Open ports, exposed services | Close unused ports, private subnets, VPC peering | Capital One breach: SSRF through a misconfigured WAF reached the metadata service on 169.254.169.254 |
| Application | Unused features, debug endpoints | Remove dead code, disable dev features in production | Django debug=True in production leaks full stack traces, settings, and database queries to any visitor |
| Dependencies | Third-party libraries | Remove unused deps, audit transitive dependencies | event-stream npm package (2018): a compromised dependency injected a Bitcoin-stealing payload into millions of apps |
| Data | Stored sensitive data | Delete what you do not need, minimize collection | GDPR Article 5(1)(c): data minimization. If you do not store it, it cannot leak |
| Identity | User accounts, API keys | Remove stale accounts, rotate and revoke unused keys | Uber 2022: an attacker used a leaked contractor credential that should have been deactivated months earlier |
| Infrastructure | Unused servers, old AMIs, orphaned resources | Decommission, automate cleanup with infrastructure-as-code | Equifax breach: an unpatched Apache Struts server that the team had forgotten existed |
The dependency problem deserves special attention. A typical Node.js application has 500 to 1,500 transitive dependencies. Each one is an attack vector. When ua-parser-js was compromised in October 2021, a single package published by one maintainer affected 7.8 million weekly downloads. The attacker inserted a cryptominer and credential stealer that ran on install.