This lesson combines 2 topics: Threat Model and CIA Triad, OWASP Top 10 (2021) Overview.
Learning Objectives
- Understand the CIA Triad (Confidentiality, Integrity, Availability), the foundation of information security
- Know what an attack surface is and how to reduce it
- Practice basic threat modeling with the STRIDE framework
- Apply two core principles: defense in depth and the principle of least privilege
- Understand the types of attackers and their motives so you know "who could attack you"
- Know what OWASP is and what the OWASP Top 10 is used for
- Remember the names and meaning of the 10 categories A01-A10 in the 2021 edition
- Compare the changes between the 2017 and 2021 Top 10, and map 2021 to 2025
- Understand how to use the Top 10 in threat modeling and code review
- Know which categories are covered in depth in later lessons
Part 1: Threat Model and CIA Triad
1. Why Do Developers Need to Learn Security?
The harsh reality
Security bugs differ from functional bugs in 3 ways:
- Invisible: the code runs correctly, tests pass, yet the vulnerability is still there
- Non-linear consequences: a single SQL injection can leak the entire database
- Not reversible: once data has leaked, it has leaked; you cannot "roll it back"
Security is the developer's responsibility, not only the "security team's". You write the first code that touches user input, so you are the first line of defense.
2. CIA Triad: The Three Pillars of Information Security
Confidentiality
Only those who are authorized can read the data.
Real-world examples:
- User passwords are hashed + salted, never stored as plaintext in the DB
- KYC selfie images can only be viewed by compliance admins
- The API returns
account.balanceonly to the account owner, not to other users
How to protect it:
- Encryption at rest: AES-256 for DB, S3, disk
- Encryption in transit: TLS 1.2+ for all network traffic
- Access control: IAM, RBAC, ABAC
- Data classification: classify PII / PCI / HIPAA / public and apply the matching policy
Integrity
Data is not modified without authorization, whether accidentally or deliberately.
Real-world examples:
- An account balance of 1,000,000 VND does not mysteriously drop to 100,000 VND
- A firmware file downloaded from the vendor is really the original file (not altered by a MITM)
- The audit log is not deleted by an attacker after an intrusion
How to protect it:
- Cryptographic hash (SHA-256) to verify files
- Digital signature (RSA, ECDSA) to prove "the right author"
- HMAC for message authentication
- Database constraint + transaction to avoid inconsistent state
- Write-once / append-only log (CloudTrail, immutable S3)
Availability
Systems and data must be accessible when users need them.
Real-world examples:
- The website does not go down because of a DDoS
- A database backup can be restored after a disk failure
- The login service is not so overloaded that real users cannot log in
How to protect it:
- Redundancy (multi-AZ, multi-region)
- Auto-scaling, load balancer
- DDoS protection (Cloudflare, AWS Shield)
- Backup + disaster recovery with clear RPO/RTO targets
- Rate limiting against abuse
CIA is not balanced: you must make trade-offs
| Scenario | Priority |
|---|---|
| Patient medical records | C > I > A |
| Air traffic control system | I > A > C |
| Public news site | A > I > C |
| Payment system | I = C > A |
When designing a system, always ask yourself: if you had to sacrifice one of the three, which one has the least impact?
3. Attack Surface
Attack surface = the sum of all the points where an attacker can interact with your system.
Principle: Minimize the attack surface
- Unused API endpoint → delete or disable it
- Unneeded port → close it (firewall, security group)
- Unused dependency → uninstall it
- Old account/credential → revoke it
- Temporary feature flag → clean it up after launch
Everything you add to a system expands the attack surface. Less code = fewer bugs = fewer security holes.
4. Threat Modeling with STRIDE
Threat modeling = the process of "thinking like an attacker" to find weaknesses before code is deployed.
STRIDE: 6 types of threat (Microsoft)
| Threat | Violates | Example |
|---|---|---|
| Spoofing | Authentication | Impersonating another user, fake JWT |
| Tampering | Integrity | Changing the price in a request price=0 |
| Repudiation | Non-repudiation | A user denies "I didn't click that" |
| Information disclosure | Confidentiality | API leaks another user's email via IDOR |
| Denial of service | Availability | Spamming requests to crash the server |
| Elevation of privilege | Authorization | A regular user becomes admin |
The 4-step threat modeling process
1. What are we building? → Draw a data flow diagram
↓
2. What can go wrong? → Apply STRIDE to each component
↓
3. What are we going to do? → Mitigate the priority threats
↓
4. Did we do a good job? → Review, test, retro
Example: Threat model for a login API
Applying STRIDE:
| Component | S | T | R | I | D | E |
|---|---|---|---|---|---|---|
| Browser → API | TLS pinning? | Replay attack? | Audit log? | TLS required | Rate limit | — |
| Login API | Verify password hash | Input validation | Log login attempts | Don't leak "user exists" | CAPTCHA + lockout | Don't return an admin claim from user input |
| User DB | DB credential | Parameterized query | DB audit | Encrypt PII column | Connection pool limit | DB user least privilege |
| JWT issuer | Sign with strong key | Verify signature | Include iat, jti | Don't put PII in the JWT | Short TTL | Don't let the user pick the role claim |
Threat modeling does not need to be "complete"; it only needs to be good enough to uncover the biggest threats. A one-hour session with the team can find 80% of vulnerabilities.
5. Defense in Depth
Do not rely on a single layer of security. Each layer can fail, but many overlapping layers are unlikely to all fail at once.
Example for a web application:
- Layer 1: Cloudflare WAF blocks SQLi patterns
- Layer 2: TLS 1.3, HSTS preload
- Layer 3: JWT + RBAC checked on every route
- Layer 4: Validate input with Zod / Pydantic / struct tags
- Layer 5: Parameterized queries, the DB user only has SELECT for that service
If an attacker bypasses the WAF, there are still 4 more layers. If a dev forgets an authz check, validation still blocks the malicious payload.
6. Principle of Least Privilege (PoLP)
Every process, user, and service is granted only the minimum permissions needed to do its job, nothing more.
Applied examples
| Wrong | Right |
|---|---|
The web app's DB user is root | Create a webapp user with only SELECT, INSERT, UPDATE on the tables it needs |
Every developer has AWS admin permission | Each role has a scoped IAM policy, use AssumeRole when needed |
Container runs as root | USER 1000 in the Dockerfile, use a read-only filesystem |
Service account has *:* permission | List exact actions: s3:GetObject only for a specific bucket |
.env file chmod 644 (world-readable) | chmod 600 .env, or better: use a secret manager |
Blast radius
The most important question when granting permissions:
"If this account/credential leaks, what can an attacker do?"
PoLP reduces the blast radius: the scope of damage when a component is compromised. If the DB user only has SELECT * FROM products, the attacker cannot DROP TABLE users.
7. Types of Attackers
Understanding attackers helps you prioritize defenses in the right places.
Comparison table
| Type | Motive | Capability | Defense needed |
|---|---|---|---|
| Script kiddie | Bragging, fun | Low: uses ready-made Metasploit, sqlmap | Patch CVEs, basic WAF, no exposed admin panel |
| Hacktivist | Ideology, shock value | Medium | DDoS protection, hardened public API |
| Organized crime | Money (ransomware, fraud) | High: organized, funded | EDR, ransomware-resistant backups, MFA, vuln management |
| Nation-state (APT) | Politics, espionage | Very high: zero-days, sophisticated social engineering | Defense in depth + monitoring + incident response team. If they really target you, you can only limit the damage |
| Insider | Money, revenge, accident | Has legitimate access | PoLP, audit log, separation of duties, DLP |
Real threats for a startup/SMB app
Most of what you will face:
- Automated scanning bots (CVEs, default passwords): 80% of malicious traffic on the internet
- Credential stuffing (using passwords leaked from other sites)
- Phishing aimed at employees (cloud account admins, GitHub)
- Accidental insiders (pushing secrets to public GitHub, making S3 public)
Not everyone needs to defend against nation-states, but everyone must be able to defend against the 4 threats above.
Part 2: OWASP Top 10 (2021) Overview
1. What Is OWASP?
OWASP (Open Worldwide Application Security Project) is a non-profit organization founded in 2001 that focuses on application security. All of its documentation, tools, and frameworks are free and open-source.
When a recruiter, auditor, or compliance team asks "is your app exposed to the OWASP Top 10 vulnerabilities?", this is the list they mean.
2. What Is the OWASP Top 10?
A list of the 10 most critical risk categories for web applications, updated based on real-world data from hundreds of organizations + expert surveys.
How OWASP builds the list
OWASP collects data from:
- Bug bounty platforms (HackerOne, Bugcrowd): real vulnerabilities that were paid out
- Automated scanner results from thousands of organizations
- Industry surveys with security professionals
- CVE database: publicly disclosed vulnerabilities
Each category is scored on: Exploitability + Detectability + Impact + Prevalence.
Important notes
- The OWASP Top 10 is not a complete checklist; it is just the 10 most common/dangerous categories
- "Passing the OWASP Top 10" does not mean secure; it is only the minimum baseline
- One bug can belong to several categories at once
- The Top 10 changes with each edition; do not memorize the order, understand the essence
3. OWASP Top 10: 2021 Edition
A01 — Broken Access Control
A user can access resources/actions they are not allowed to.
Examples:
GET /api/users/123/profile: change123to someone else's ID → read their data (IDOR)- A regular user can call
DELETE /admin/users/5 - An uploaded file slips into the admin folder
- The JWT has a
roleclaim but the backend does not verify it
This is the #1 most common in 2021. Covered in depth on Day 3 (IDOR).
A02 — Cryptographic Failures (formerly "Sensitive Data Exposure")
Crypto is wrong or missing, leaking sensitive data.
Examples:
- Storing passwords as plaintext or MD5/SHA-1 (unsalted)
- Using deprecated TLS 1.0/1.1
- Hard-coding an AES key in source code
- JWT signed with
alg: noneor a weak secretsecret123 - Writing your own encryption instead of using a library
Covered in depth on Day 3 (password hashing), Day 4 (JWT) and Day 7 (TLS).
A03 — Injection
Untrusted input is embedded into a command (SQL, OS command, LDAP, XPath) without validation/escaping.
Includes:
- SQL Injection (covered on Day 3)
- XSS: essentially "JavaScript injection" (Day 2)
- OS Command Injection:
exec("ping " + userInput)→exec("ping a.com; rm -rf /") - NoSQL injection (
{"$ne": null}in MongoDB) - LDAP, XPath, ORM injection
It was #1 in the 2017 Top 10 and dropped to #3 in 2021 because frameworks/ORMs now protect better, but it is still very dangerous.
A04 — Insecure Design ⭐ NEW in 2021
The vulnerability lies in the design, not the implementation. The code follows the spec, but the spec is wrong.
Examples:
- Forgetting to rate limit "Forgot Password" → attacker brute forces the OTP
- Password reset only requires email + date of birth (information that can be found publicly)
- Business logic allows
total = sum(items) - discountwith an unchecked negative discount - A file upload design that saves files into a web-accessible directory using the user's original filename
How to prevent it: threat modeling from the design phase, secure design patterns, standard reference architectures.
A05 — Security Misconfiguration
The system has a default/insecure configuration.
Examples:
- S3 bucket public-read when not needed
- Database listens on 0.0.0.0 by default with no firewall
- Default credential
admin/adminstill in use - Debug mode
DEBUG=truein production (Django, Flask) - Stack traces returned to the client (
/api/errorshows file paths, library versions) - CORS
Access-Control-Allow-Origin: *with credentials - Missing security headers (covered on Day 2, Part 2)
The category most often scanned and exploited automatically by hackers.
A06 — Vulnerable and Outdated Components
Using libraries, frameworks, OSes, or container images with known CVEs.
Examples:
- Log4j 2.14 (CVE-2021-44228 "Log4Shell")
- Express 4.16 with a prototype pollution vulnerability
- jQuery 1.x with XSS sinks
- Docker base image
node:14(EOL, no security patches) - Spring4Shell (CVE-2022-22965)
How to prevent it:
- SCA tools: Snyk, Dependabot, npm audit, pip-audit
- SBOM (Software Bill of Materials): know what you are using
- Patch policy: critical CVE → fix within 7 days
A07 — Identification and Authentication Failures
Flaws in how users are identified and authenticated.
Examples:
- No lockout after N failed logins → brute force works
- Allowing weak passwords like
123456or password = username - Guessable session tokens (incremental ID)
- Sessions never expire, not invalidated after logout
- No MFA for admins
- Password reset link sent over HTTP (not HTTPS)
- "Remember me" cookie valid forever
Covered in depth on Day 4–5 (authentication patterns, OAuth/OIDC, MFA).
A08 — Software and Data Integrity Failures ⭐ NEW in 2021
Code, infrastructure, or data changes without integrity verification.
Examples:
- CI/CD pipeline pulls dependencies from npm/PyPI without verification
- Vendor auto-update without signature checks
- Deserializing untrusted data (Java
ObjectInputStream, Pythonpickle.loads, PHPunserialize) - Webhook receives a payload without verifying the HMAC signature
- Docker image pulled by the
:latesttag (digest not pinned)
This is how the SolarWinds supply chain attack happened (2020).
How to prevent it:
- Sign artifacts (Sigstore, GPG)
- Verify signatures in CI
- Pin versions + lockfile (
package-lock.json,Pipfile.lock) - Code signing for releases
A09 — Security Logging and Monitoring Failures
No logging, or logs that are not monitored → an attacker stays in the system for 200 days without anyone noticing.
Examples:
- Not logging failed logins, password resets, privilege changes
- Logs without timestamp, IP, user
- Logs stored on the same server, so the attacker can delete them
- Logs exist but there is no alert / SIEM
- Stack traces expose passwords in logs
How to prevent it:
- Log: login attempts, authz failures, input validation failures, admin actions
- Centralize logs (CloudWatch, ELK, Datadog)
- Alert on anomalies
- Immutable logs (write-once)
A10 — Server-Side Request Forgery (SSRF) ⭐ NEW in 2021
The server fetches a user-supplied URL without validation → the attacker forces the server to call internal services.
Classic example:
- A "preview URL" or "import from URL" feature
- The user sends
http://169.254.169.254/latest/meta-data/iam/security-credentials/(AWS IMDSv1) - The server fetches that URL → returns the EC2 instance's IAM credentials → the attacker takes over AWS permissions
The Capital One breach in 2019 (100M+ customers) happened through SSRF + IMDSv1.
Covered in depth on Day 3.
4. Comparing the OWASP Top 10: 2017 vs 2021
| 2017 | 2021 | Change |
|---|---|---|
| A1 Injection | A3 Injection | Dropped from #1 to #3 (better ORMs, frameworks) |
| A2 Broken Authentication | A7 Identification and Authentication Failures | Renamed, dropped |
| A3 Sensitive Data Exposure | A2 Cryptographic Failures | Renamed (more precise about the root cause) |
| A4 XML External Entities (XXE) | (merged into A5 Misconfiguration) | XXE declined as XML use declined |
| A5 Broken Access Control | A1 Broken Access Control | Rose to #1: most exploited in 2021 |
| A6 Security Misconfiguration | A5 Security Misconfiguration | Moved up |
| A7 Cross-Site Scripting (XSS) | (merged into A3 Injection) | XSS = JS injection |
| A8 Insecure Deserialization | (merged into A8 Integrity Failures) | Broader scope |
| A9 Using Components with Known Vulnerabilities | A6 Vulnerable and Outdated Components | Shorter name |
| A10 Insufficient Logging and Monitoring | A9 Security Logging and Monitoring Failures | Moved up |
| — | A4 Insecure Design ⭐ | NEW: design-level threat |
| — | A8 Software and Data Integrity Failures ⭐ | NEW: supply chain attack |
| — | A10 SSRF ⭐ | NEW: cloud-era threat |
Key observation
Top 10 2017 is heavy on CODING bugs (XSS, SQLi, XXE)
Top 10 2021 is heavy on DESIGN + SUPPLY CHAIN bugs
↓
Reason: more and more apps use frameworks (automatically preventing code-level bugs)
but there are more supply chain attacks + cloud config bugs
All 3 new categories reflect trends: cloud (SSRF), DevOps/CI-CD (Integrity), thinking ahead (Insecure Design).
2021 vs 2025
OWASP has published the Top 10:2025. This lesson still follows the 2021 edition (docs, tools and pentest reports still use 2021 codes widely), but when you read newer material, map it with this table:
| 2021 | 2025 | Change |
|---|---|---|
| A01 Broken Access Control | A01 Broken Access Control | Stays #1; SSRF (A10:2021) is merged into it |
| A02 Cryptographic Failures | A04 Cryptographic Failures | Down from #2 to #4 |
| A03 Injection | A05 Injection | Down from #3 to #5 |
| A04 Insecure Design | A06 Insecure Design | Down from #4 to #6 |
| A05 Security Misconfiguration | A02 Security Misconfiguration | Up from #5 to #2 |
| A06 Vulnerable and Outdated Components | A03 Software Supply Chain Failures | Expanded to the whole software supply chain, up to #3 |
| A07 Identification and Authentication Failures | A07 Authentication Failures | Renamed, stays #7 |
| A08 Software and Data Integrity Failures | A08 Software or Data Integrity Failures | Stays #8 (name changes "and" to "or") |
| A09 Security Logging and Monitoring Failures | A09 Security Logging and Alerting Failures | Renamed (emphasis on alerting), stays #9 |
| A10 Server-Side Request Forgery (SSRF) | (merged into A01) | No longer its own category |
| — | A10 Mishandling of Exceptional Conditions | NEW — improper error handling, failing open, logic errors |
Summary of 2025: 2 new categories (A03 Software Supply Chain Failures, A10 Mishandling of Exceptional Conditions) and 1 consolidation (SSRF into A01). When you cite a category code in a report, always include the year (e.g. A03:2021 is Injection, while A03:2025 is Software Supply Chain Failures).
5. Learning Path for the Categories in This Course
| Category | Covered in | Day |
|---|---|---|
| A01 Broken Access Control (IDOR) | Week 1 | Day 3 (IDOR), Day 5 (RBAC/ABAC) |
| A02 Cryptographic Failures | Week 1–2 | Day 3 (password hashing), Day 4 (JWT), Day 7 (TLS, encryption) |
| A03 Injection (XSS) | Week 1 | Day 2 |
| A03 Injection (SQLi) | Week 1 | Day 3 |
| A04 Insecure Design | Week 1 | Day 1 (threat modeling) |
| A05 Security Misconfiguration | Week 1 | Day 2 (security headers) |
| A06 Vulnerable Components | Week 2 | Day 9 (SCA, dependency scanning) |
| A07 Authentication Failures | Week 1 | Day 4–5 (auth deep dive) |
| A08 Integrity Failures | Week 2 | Day 9 (supply chain security) |
| A09 Logging Failures | Week 2 | Day 11 (security logging) |
| A10 SSRF | Week 1 | Day 3 |
6. How to Use the OWASP Top 10 in Threat Modeling
When reviewing code or designing a new feature, use the Top 10 as a quick checklist:
[ ] A01: Does every endpoint check authorization?
Is object ownership verified?
[ ] A02: Is sensitive data stored/transmitted? Where is it encrypted?
Are passwords hashed correctly (bcrypt/argon2)?
[ ] A03: Which inputs go into SQL/shell/HTML?
Are parameterized queries / escaping used?
[ ] A04: Are easily abused features rate limited?
Does the business logic have a "happy path bypass"?
[ ] A05: Has the default config been hardened?
Debug mode off? CORS correct?
[ ] A06: Do dependencies have CVEs? (npm audit / snyk)
[ ] A07: Is there brute force protection?
Are sessions/tokens strong + expiring?
[ ] A08: Do webhooks verify signatures?
Does CI/CD pin versions + verify?
[ ] A09: Are important security events logged?
Is there alerting + long enough retention?
[ ] A10: Is there a feature that fetches a URL from user input?
Is there a whitelist + metadata IP block?
Integrating it into your process
- Design review: apply the Top 10 to the feature spec
- Code review: the PR template asks "which categories are relevant?"
- QA: test cases for each applicable category
- Release checklist: SCA scan, secret scan before deploy
Review Questions
-
A hospital publishes its list of doctors on its website, but a hacker changes the contact phone number to their own. Which CIA pillar is violated?
Show answer
Integrity is violated: the data was modified without authorization. Confidentiality is not violated because the information was already public. Neither is Availability (the website is still accessible). Mitigation: integrity checks (file hashes, signed content), an audit log on the CMS, RBAC for content editors.
-
What is the STRIDE letter
E(Elevation of Privilege)? Give an example in a web app.Show answer
E = Elevation of Privilege: a low-privileged user gains higher privileges. Example: the API endpoint
POST /api/usersaccepts{"role": "admin"}and the backend trusts this value instead of hard-coding a default role. The user creates an account that is admin from the start. Fix: the server assigns the default role itself and never takes it from user input. -
You are designing a payment processing microservice. What minimum layers should defense in depth include for this service?
Show answer
At least 5 layers: (1) Network: only accept traffic from the internal API Gateway, not public; (2) TLS/mTLS: every inter-service call uses TLS, ideally mTLS; (3) AuthN: verify the service token (OIDC) + verify the user identity (JWT); (4) AuthZ: check that the user is allowed to pay for this account (not another account); (5) Input validation: amount > 0, currency whitelist, idempotency key. Plus: DB user least privilege, secrets from KMS/Vault, audit log for every transaction.
-
Why shouldn't a web account service use a DB user with
ALL PRIVILEGES?Show answer
It violates the Principle of Least Privilege. If an attacker finds a SQL injection, they can do anything:
DROP DATABASE,CREATE USER(persistent backdoor), read another service'ssalariestable in the same DB. Correct approach: create a dedicated DB user for the service with onlySELECT/INSERT/UPDATEon the tables it needs, and noDROP,CREATE,GRANT. The blast radius of a SQLi is then significantly limited. -
Your startup has 5 employees and stores no sensitive data. Which types of attackers should you defend against as a high priority?
Show answer
High priority: (1) Automated bots scanning for CVEs, default passwords, admin panels: the bulk of malicious traffic; (2) Credential stuffing with already-leaked passwords; (3) Phishing of employees (especially GitHub/AWS admins); (4) Accidental insiders (committing secrets, public S3). Low priority: nation-state APTs; they rarely target SMBs without strategic data, and defending against them is an unequal fight. Focus resources on the 4 threats above: patching + MFA + secret scanning + security training.
-
Which OWASP Top 10 2021 category rose to #1, and why?
Show answer
A01 — Broken Access Control rose to #1 (from #5 in 2017). Reason: data from HackerOne and Bugcrowd showed that access control bugs (IDOR, missing authorization checks, privilege escalation) had the highest exploit rate and the largest impact. Frameworks do not automatically protect access control the way they protect against SQLi; developers must code each endpoint correctly.
-
Why was "Insecure Design" added in 2021 even though it is not a specific code bug?
Show answer
Because many breaches happen due to flawed design, not flawed code. The code can follow the spec while the spec ignores threats. Example: a "forgot password" feature designed to send a 6-digit OTP with no rate limit; the OTP generation code is correct, but the design allows brute force. A04 was added to emphasize threat modeling from the design phase, not just during coding.
-
You maintain a Node.js API. In the context of dependencies, what is the difference between A06 (Vulnerable Components) and A08 (Integrity Failures)?
Show answer
- A06: you use a version with a known CVE (e.g.
express@4.16has a vulnerability). Fix by updating and using an SCA tool. The problem is not having patched. - A08: you pull dependencies without verifying the source (no version pinning, no checksum verification, no malicious package scanning). Fix with a lockfile + signature verification + supply chain scanning. The problem is an untrustworthy source.
A06 = using something with a known vulnerability. A08 = you don't know what you are using or whether it has been tampered with. Some attacks (typosquatting, dependency confusion) belong to A08.
- A06: you use a version with a known CVE (e.g.
-
A developer says: "My app passes the OWASP Top 10, so it's secure." Is that right?
Show answer
No. The OWASP Top 10 is only a minimum baseline: the 10 most common risk categories, not every vulnerability. An app can have business logic bugs, race conditions, side channel attacks, mobile-specific issues, or other infrastructure misconfigurations that the Top 10 does not cover. The Top 10 is a starting point, not a destination. For more comprehensive coverage, use OWASP ASVS (Application Security Verification Standard) or NIST SP 800-53.
-
Your boss asks you to review an "import contacts from Google account" feature. Which Top 10 categories are the most concerning, and why?
Show answer
Top concerns:
- A10 SSRF: if the feature fetches URLs from the Google API, it could be manipulated into fetching internal URLs.
- A07 Auth Failures: the OAuth flow must be correct: verify the state param, whitelist redirect URIs, do not leak the access token.
- A02 Cryptographic Failures: the Google access token must be encrypted at rest if stored.
- A01 Broken Access Control: which account are contacts imported into? Is ownership checked?
- A09 Logging: log every OAuth grant for auditing.
A simple feature that touches 5 categories at once; that is why threat modeling is necessary.
Hands-on Exercises
Part 1: Threat Model and CIA Triad
# 1. List your app's attack surface
# Open the repo + Trello/Notion and write down:
# - Which endpoints are public?
# - Which service listens on which port?
# - Which accounts/credentials could be compromised?
# - Which third parties are called?
# 2. A 30-minute threat model for the login flow
# Draw a data flow diagram (Excalidraw / draw.io)
# Apply STRIDE to each component
# List the top 3 most concerning threats + mitigations
# 3. Check least privilege yourself
# AWS: run IAM Access Analyzer
aws accessanalyzer list-findings
# DB: check the service user's grants
psql -c "\du" -h <host>
# Container: try running as non-root
docker run --user 1000 myimage
# 4. Measure the blast radius
# Pick any secret/credential in the app
# Answer yourself: "If it leaked right now, what could an attacker do?"
# If the answer is too broad → narrow the permissions
Part 2: OWASP Top 10 (2021) Overview
# 1. Read the original OWASP Top 10 2021 (2025 edition: https://owasp.org/Top10/2025/)
open https://owasp.org/Top10/2021/
# 2. Run OWASP Juice Shop (an intentionally vulnerable app for learning)
docker run --rm -p 3000:3000 bkimminich/juice-shop
# Open http://localhost:3000
# Try to find bugs, starting with the "Score Board" challenge
# 3. Audit your project's dependencies
# Node.js
npm audit
npm audit fix
# Python
pip install pip-audit
pip-audit
# 4. Map the Top 10 onto your codebase
# Open the repo and mark which file/endpoint relates to which category
# For example:
# src/api/users.ts → A01 (access control)
# src/lib/passwordHash.ts → A02 (crypto)
# src/api/search.ts → A03 (SQLi if the query is dynamic)
# src/api/imageProxy.ts → A10 (SSRF)
# 5. Threat model one endpoint using the Top 10 checklist
# Pick 1 endpoint and go through each category A01-A10
# List the threats found + a mitigation plan
References
- OWASP Threat Modeling Cheat Sheet
- Microsoft STRIDE
- NIST SP 800-160 — Systems Security Engineering
- AWS Well-Architected — Security Pillar
- OWASP Top 10 2021
- OWASP Top 10 2025
- OWASP Top 10 2017 (for comparison)
- OWASP Cheat Sheet Series
- OWASP ASVS
- OWASP Juice Shop: hands-on lab