Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

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 cookie. 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 HTTP 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, session 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:

Every arrow that crosses a boundary carries data the receiving side must check. The reset link leaves Cedar and passes through two parties Cedar does not control before it comes back.

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:

Attackers described by capability, applied to Cedar's reset
AttackerWhat they can doWhat it means for the reset
Remote guesserSend many requests from many networks, with lists of leaked passwordsRequest resets for many addresses, and learn which ones belong to staff
PhisherPersuade someone to open a page and type or approve somethingSend a fake reset email that leads to a look-alike page
Malware on a deviceRun as the employee on a device that is already signed inRead the reset email as it arrives, or use the existing session
Someone holding the deviceUse an unlocked phone or laptop, even for a few minutesComplete a reset through the personal mailbox open on it
Insider with administrative accessUse help desk or administrative tools as they were designedChange an employee's recovery address, then send a reset there
Compromised partnerMisuse access that a trusted provider or integration already hasRead every reset link that a compromised email provider carries

Capabilities make defenses comparable. A passkey 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_ONLY

Ask the changed-identifier question of the first link. If the server takes the account from the URL 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.

Step: requesting a reset. Question: done by someone else? Someone types a list of addresses into the reset form to learn which ones belong to Cedar staff. Here is how one design replies. What does a careful design do instead? 1 of 4
Address: [email protected]
Reply:   Check your recovery email for a reset link.

Address: [email protected]
Reply:   No account uses this address.

Enable JavaScript to check an answer here, or open the explanation below.

Show the answer and why

Give every address the same reply in about the same time, and email only real staff. The form then reveals nothing about which addresses exist. An employee with an account still receives the link, and nobody else learns anything.

Step: opening the reset link. Question: repeated? Yesterday an employee used a reset link to set a new password. Today someone opens the same link from the browser history of a shared computer. What does a careful design do? 2 of 4
Day 1 18:02  reset link opened  token ending 7Q2  account usr_5307
Day 1 18:03  password changed   account usr_5307
Day 2 09:15  reset link opened  token ending 7Q2
Show the answer and why

Refuse the link, because each token works only once, and offer to start a new reset. The server records that the token was used and refuses it afterward, so a link found in a browser history, a forwarded email or a log is worthless.

Step: opening the reset link. Question: out of order? An employee requests a reset at 14:00 and again at 14:05, because the first email seemed slow. At 14:20, someone opens the 14:00 link, which had been forwarded to a shared mailbox. What does a careful design do? 3 of 4
Show the answer and why

Refuse it, because issuing the 14:05 link cancelled the earlier ones. Only the newest link should work. The employee has no reason to expect the first one to still work, and cancelling it removes a copy someone else may hold.

Step: setting the new password. Question: skipped? Someone sends the new-password form straight to the server without opening any reset link. What does a careful design do? 4 of 4
POST /reset/new-password HTTP/1.1
Host: login.cedar.example
Content-Type: application/x-www-form-urlencoded

account=usr_5307&password=EXAMPLE_ONLY
Show the answer and why

Refuse it. The request that changes the password must carry a valid, unused token. The check belongs where the change happens. Without a token in this request, nothing connects the sender to the reset email.

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 lead

The 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.

A draft of Cedar's reset puts both a user ID and a token in the link. The server checks that the token is valid, but not that it was issued for that user ID. Which of the five questions finds the flaw? 1 of 3
Cedar staff who switch to a passkey no longer have a password at all. Which attacker capability from the lesson does the passkey not address? 2 of 3

Choose one answer.

Cedar's threat model rates "someone else reads the personal mailbox" as high impact and low likelihood. What makes the part left after reducing it an accepted risk rather than a gap? 3 of 3

Choose one answer.

Try it in the Lab

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.

  1. Expense Portal Assessment Difficulty 5 of 5 · About 75 minutes · Browser application

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity