Lesson 4 of 9 · 21m
Attack Trees That Expose Real Paths
Attack trees turn a vague goal like 'steal accounts' into concrete branching paths. Build them shallow, annotate cost, and use them to choose controls.
A team once told me their password reset flow was safe because the token was random. Five minutes with an attack tree produced four other paths: enumerate whether accounts exist, poison the reset link through host header injection, replay an old token because tokens never expired, and brute force the six-digit "temporary code" because rate limiting applied per IP while the botnet had fifty thousand. Attack trees matter because attackers do not care which control you remember; they take the easiest path you forgot.
Start with an attacker goal, not a vulnerability list
Goal: take over a customer account
├─ Capture valid session
│ ├─ Steal cookie through XSS
│ ├─ Trick user into pasting session into attacker page
│ └─ Reuse token leaked in logs/analytics
├─ Abuse account recovery
│ ├─ Enumerate account existence
│ ├─ Poison reset link generation
│ ├─ Brute force reset code
│ └─ Replay reset token
└─ Bypass authentication entirely
├─ Forge tenant/user claim in request
├─ Use confused deputy internal endpoint
└─ Exploit password comparison logicThe tree is not exhaustive. It is a shared picture of plausible routes. The key is concrete attacker actions — "leak token in analytics" is testable; "hack the user" is not.
Annotate cost, skill, and detection
Attack trees become decision tools when you ask which branches are cheap and hard to detect:
branch: brute force reset code
attacker_cost: low
skill: commodity botnet
detection: high if per-account throttles exist
control_value:
per_account_rate_limit: high
long_random_token: high
ip_rate_limit_alone: lowThis avoids the common trap of buying an exotic control for a low-probability branch while leaving a commodity path open.
AND/OR branches describe dependencies
Some paths require multiple conditions: "stored XSS exists AND admin views report AND CSP allows inline script." Marking AND branches is useful because breaking any one child breaks the whole path. A content security policy will not stop the initial injection, but it may stop exploitation. That is defense in depth with a reason, not a pile of independent controls.
Use trees to compare mitigations
A control that cuts several branches — phishing-resistant MFA for account takeover, for example — may beat three narrower fixes. Conversely, a control can look strong in isolation and still fail because it sits behind a branch nobody uses. Attack trees keep the conversation about attacker economics rather than control fashion.
Field notes
- Keep operational trees shallow: two or three levels is usually enough for engineering decisions.
- Reuse trees across features; recovery, invitation, OAuth linking, and support impersonation often share the same account-takeover root.
- Include non-malicious misuse where it matters: fraud, scraping, chargebacks, insider abuse.
- If a branch depends on a third party, write down the trust assumption instead of outsourcing your thinking to the vendor.
Was this lesson helpful?