Find the holes before they do
Every defence so far answered a known attack. threat modelling asks the question earlier: before you build, what could go wrong, who would do it, and which problems matter most? It costs a whiteboard and an hour, and finds design bugs that no scanner can.
Say you are building an online chiya-order app for Pokhara cafes. Learners log in, order, and pay. Where could an attacker get in, and what would hurt the most?
Four questions and STRIDE
A simple method has four questions: What are we building? What can go wrong? What will we do about it? Did we do a good job? Draw the system as boxes (browser, server, database, payment provider) and arrows (the data flowing between them). Every arrow that crosses a trust boundary, like the internet to your server, deserves attention.
To find threats, walk each box and arrow with STRIDE, a checklist of six kinds of attack: Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, and Elevation of privilege. Each one breaks a security property you want.
- Spoofing: pretending to be someone else (breaks authentication).
- Tampering: changing data or code (breaks integrity).
- Repudiation: denying an action with no proof (breaks accountability).
- Information disclosure: leaking data (breaks confidentiality).
- Denial of service: making it unavailable (breaks availability).
- Elevation of privilege: doing what you may not (breaks authorization).