Threat modeling an identity system
Defenses chosen before anyone has asked what could go wrong tend to protect the wrong things. This lesson threat models Cedar's self-service password reset: it maps what the reset protects and where data crosses between parties, describes attackers by what they can do, questions each step of the flow, and decides which findings to fix first.
Before choosing defenses
After the incident in Why attackers go after identity, Cedar's identity team agrees that its self-service password reset needs to be more secure. Ideas arrive quickly: a puzzle to stop scripts, a second step before every reset, links that expire sooner, an email afterward. Any of them might help. But nobody has said what the reset protects, who might attack it or where it could go wrong, so there is no way to tell which ideas matter and which only add friction for staff who have simply forgotten a password.
Threat modeling is a structured way to answer those questions before choosing defenses. It works on a design rather than on finished code, and it is usually organized around four questions. What are we building? What can go wrong? What are we going to do about it? Did we do a good enough job? The answers are written down, so that others can challenge them and the team can come back to them when the design changes.
The first question comes first for a reason. Cedar's sign-in page at login.cedar.example asks for a work email address and a password, then issues a session cookieA small value that a website asks the browser to store and send back with later matching requests. Cookies commonly carry a session identifier, so the site can recognize an ongoing sign-in without your password.. To reset a forgotten password, an employee enters their work email address, and Cedar emails a link to the personal recovery address that employee registered when they joined, since someone locked out of their account usually cannot read their work mail. The link contains a reset token, a long random value that should work only once and only for a short time. Opening the link lets the employee choose a new password.
As How applications communicate showed, each of those steps is a separate HTTPThe Hypertext Transfer Protocol, the rules browsers, apps, and servers use to send requests and responses on the web. request. Nothing guarantees that the requests arrive in the order the designers pictured, or that they come from the person the designers pictured. Most of what can go wrong with a reset follows from that.
What needs protecting
Start with the things worth protecting, called assets: staff accounts and what they can reach, and everything that grants access to them, such as password hashes, reset tokens, sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier. identifiers and the key Cedar uses to send email through its email provider. Two kinds of asset are easy to forget. Configuration, such as how long a reset link lasts, can weaken every account at once if someone changes it. Audit history, the record of sign-ins, resets and administrative changes, is what the team will need when something goes wrong, and exactly what an attacker would like to erase.
Next, find the entry points, the places where something from outside arrives: the sign-in form, the reset request form, the link in the email and the form that sets the new password. A help desk agent who can change an employee's recovery address is an entry point too, although no web page leads there: whoever changes that address decides where the next reset link goes.
Then mark where data passes between parts with different owners. Each crossing is a trust boundary, as Trust boundaries explained, and whatever crosses one must be checked on arrival, because a browser can send any value in any field. A data flow diagram draws exactly this: the parties as boxes, the data passing between them as numbered arrows, the stores where data is kept, and the boundaries as dashed lines. Writing each threat beside the arrow it travels on keeps the model tied to the design:
Drawing the flow makes an uncomfortable fact visible. The reset depends on the employee's personal mailbox, which sits entirely outside Cedar's control, so whoever can read that mailbox can reset the password. That is a property of the design, not a bug, and the model should say so plainly. A reset can stand in for every other way of signing in, so it deserves the same care as the sign-in itself, as Enrollment, replacement, and recovery explained.
Who you are defending against
Attackers are often pictured as types, such as a bored teenager or a criminal group, which says little about what a design must withstand. A more useful description is what an attacker can do, and what that would mean for this flow:
| Attacker | What they can do | What it means for the reset |
|---|---|---|
| Remote guesser | Send many requests from many networks, with lists of leaked passwords | Request resets for many addresses, and learn which ones belong to staff |
| Phisher | Persuade someone to open a page and type or approve something | Send a fake reset email that leads to a look-alike page |
| Malware on a device | Run as the employee on a device that is already signed in | Read the reset email as it arrives, or use the existing session |
| Someone holding the device | Use an unlocked phone or laptop, even for a few minutes | Complete a reset through the personal mailbox open on it |
| Insider with administrative access | Use help desk or administrative tools as they were designed | Change an employee's recovery address, then send a reset there |
| Compromised partner | Misuse access that a trusted provider or integration already has | Read every reset link that a compromised email provider carries |
Capabilities make defenses comparable. A passkeyA credential that your phone, computer or password manager creates for one website and keeps for you, unlocked with a fingerprint, face or PIN. Nothing you could type is sent, and it works only for the site it was made for, which helps it resist phishing. defeats the remote guesser, because there is no password to guess, and the phisher, because the browser will not use it on a look-alike site. It does nothing about malware on a laptop that is already signed in, because that malware never needs to sign in: it uses the session the sign-in produced. A limit on reset requests slows the guesser and means nothing to someone holding the phone, who needs only one request.
Capabilities also combine. The attacker in Cedar's incident began as a phisher, relaying Riley's sign-in, then phoned the help desk hoping Rowan would use an insider's administrative access on their behalf. A model can also say which capabilities are out of scope. Cedar cannot protect a reset made from a laptop that malware completely controls, and saying so openly is better than implying otherwise.
Questioning each step of a flow
With the flow drawn and the attackers described, go through it one step at a time and question each step as someone trying to misuse it would. At every step, ask five questions. What if this step is skipped? Repeated? Done out of order? Done with a changed identifier, such as a different user ID? Done by someone else? Each step was designed on the assumption that the previous one happened as intended, and these questions test that assumption without attacking anything.
Start with the reset request, where anyone can type any address. Done by someone else, the request should achieve nothing on its own: the old password keeps working and the account stays as it was until the link is used. Repeated, the request can fill an employee's personal inbox, so it needs limits for each address and each network.
Next comes the link. Here are two ways Cedar could build it:
https://login.cedar.example/reset?account=usr_4182&token=EXAMPLE_ONLY
https://login.cedar.example/reset?token=EXAMPLE_ONLYAsk the changed-identifier question of the first link. If the server takes the account from the URLA web address, such as https://photos.example/api/albums/42?limit=10. It names how to connect (https), the domain, the path to a particular page or resource, and any extra parameters after the question mark. and checks only that the token is valid, Riley could request a reset for usr_4182, change it to an administrator's user ID, and reset the administrator's password with Riley's own genuine token. The user ID in the link is not the problem; trusting it is. The server has to confirm that this token was issued for this account. The second link leaves no choice: the server finds the account from its own record of the token, along with the token's expiry and whether it has been used.
The walk does not end when the password changes. Skip the cleanup, and anyone already signed in stays signed in, even though a reset is often how someone tries to throw an intruder out. A careful design ends the account's other sessions, cancels outstanding reset links, notifies the employee, including at the previous recovery address if it changed recently, and records the reset in audit history. The exercise below asks the same questions of four more moments in this flow.
Walk the reset flow
Simulation. Each item pairs a step in Cedar's self-service password reset with one of the lesson's five questions. Choose what a careful design does. The staff, records and requests are made up, and answering sends nothing.
Deciding what to fix first
A walk like this produces more findings than a team can fix at once. Two measures put them in order. Impact asks what happens if a threat succeeds; likelihood asks how easy and attractive it is for the attackers described. The missing check that ties a token to its account ranks first: any employee with a genuine reset token for their own account could take over an administrator's. A form that reveals which addresses belong to staff comes next, because it helps attackers choose targets. Reset-email flooding matters too, but it annoys people rather than handing over accounts.
Some threats are reduced and then accepted. Cedar cannot remove the reset's dependence on the personal mailbox without a different kind of recovery, so it limits the damage: a reset ends other sessions and notifies the employee, and staff who later add a passkey could be asked to use it during a reset. What remains is an accepted risk: a decision made by someone with the authority to make it, for a stated reason, with a date or an event that reopens it. A gap that nobody noticed is not an accepted risk.
Flow: self-service password reset, login.cedar.example
Reviewed: 2026-09-14
Revisit: when the reset, sign-in methods or email provider change
Threat Impact Likelihood Decision
Missing reset-token account binding High High Fix now: use the token record
Reset reveals which emails exist Medium High Fix now: same reply for all
Used or older links still work High Medium Fix now: single use, newest only
Inbox flooded with reset emails Low Medium Fix next: limits per address
Someone else reads the mailbox High Low Reduce: end sessions, notify.
Rest accepted by the identity leadThe record answers the fourth question, whether the team did a good enough job, only for the flow it describes. It goes out of date when the flow changes. Adding sign-in by emailed link, letting staff reset with a code sent by text message, or moving to a new email provider each adds entry points or boundaries the old model never saw. Cedar revisits the model whenever the flow changes, and after any incident that shows something it missed.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Threat-model a password reset using the Lab InboxDraw the reset flow and its boundaries, give Mia an account at the Lab Inbox, question each step of her reset, and rank what you found.
Try a Capture the Flag challenge
Apply this lesson against an isolated, intentionally vulnerable application. Capture a flag, explain the mistake, then repair and retest it.