Threat Modeling and Attack Surface Analysis Questions
Systematically identifying how a system can be attacked and where its exposure lies. Covers structured methodologies (STRIDE, PASTA, DREAD, OCTAVE, attack trees), enumerating and reducing attack surface, mapping trust boundaries and data flows via DFDs, profiling likely threat actors, and prioritizing identified threats by likelihood and impact during design. Includes applying this methodology to specific architectural substrates (cloud-native and serverless, microservices, ML/AI systems, IoT, CI/CD pipelines, cryptographic subsystems) and operationalizing it as a recurring program (SDLC integration, governance, tooling, KPIs). The proactive 'think like an attacker before you build' discipline: distinct from live penetration testing (the adversarial validation of a built system), from runtime detection/monitoring (recognizing an attack already in progress), and from implementing the resulting security controls (a separate design-and-build discipline).
Design an enterprise-scale threat modeling program for a multinational organization. Describe program governance (centralized vs federated), roles and responsibilities, toolchain (including automation and the types of tools), workflows for onboarding new systems, integration points with SDLC and vulnerability management, and measurable success metrics you would track.
Sample Answer
Direct answer
For a multinational organization, the governance question that shapes everything else is centralized versus federated: a fully centralized model (one team runs every threat model) does not scale past a handful of business units and creates a single point of delay across time zones, while a fully federated model (every business unit runs its own, independently) drifts into inconsistent quality and un-comparable risk data across regions. The workable answer is a hybrid: a small central function sets the methodology, the risk-scoring scale, and the tooling standard, while regional or business-unit security leads own execution and staffing within their own org. Roles split along that same line, the toolchain has to bridge automation with human judgment rather than replace it, onboarding a new system is a defined checklist triggered at project intake rather than an ad hoc request, and the program integrates with the Software Development Life Cycle (SDLC) at the design stage and with vulnerability management at the operational stage, so a threat identified on paper and a vulnerability found by a scanner land in the same prioritized backlog instead of two disconnected ones.
Structured elaboration
Program governance: centralized versus federated
| Model | Strength | Weakness | Where it breaks down at multinational scale |
|---|---|---|---|
| Centralized | Consistent methodology, comparable risk data across the whole org, easier audit story | Becomes a bottleneck, distance from regional context and local regulatory nuance | A central team in one time zone cannot review models for business units 10+ hours away without becoming the critical-path delay on every regional release |
| Federated | Local ownership, faster turnaround, context-aware to regional regulation | Inconsistent quality, methodology drift, risk scores that cannot be compared across business units for enterprise reporting | Without a shared scale, "high risk" in one business unit's model means something different from "high risk" in another's, and executive reporting becomes noise |
| Hybrid (recommended) | Central team owns methodology, scoring rubric, tooling, and training; regional/business-unit leads own execution, staffing, and local sign-off within that shared standard | Requires investment in a shared standard and periodic calibration audits to prevent regional drift | Scales because execution capacity grows with each region's own headcount, while the risk data stays comparable because the scoring rubric is uniform |
The hybrid is not a compromise for its own sake: it separates the two things a multinational program actually needs, a single comparable risk language (centralized) and enough hands to execute across every region and time zone (federated), and gives each to the structure best suited for it.
Roles and responsibilities
- Central governance function: owns the methodology (typically STRIDE, an acronym for Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege), the risk-scoring rubric, the tooling standard, and runs periodic calibration audits across regions to catch drift.
- Regional/business-unit security lead: staffs and trains local security champions, owns the execution backlog for their region, and is the escalation point before anything reaches the central function.
- Security champion (embedded in product teams): facilitates the actual modeling session and is accountable for the local model's currency.
- System/product owner: accountable for the system having a current model and its findings being tracked to closure or documented acceptance.
- Vulnerability management team (a distinct function from the threat-modeling program): consumes threat-model output as prioritization input and feeds discovered vulnerabilities back as validation input, described further below.
Toolchain, including automation and types of tools
Three distinct categories, each doing a different job:
- Modeling and diagramming tools: where the data-flow diagram (a diagram of processes, data stores, external entities, and the flows between them) and the STRIDE analysis live, stored as versioned artifacts rather than slide decks.
- Automation for detection, not judgment: infrastructure-as-code scanners that flag when a change introduces a new trust boundary (a point where data crosses between zones of differing trust) or a new external integration, prompting a model update rather than silently going unnoticed. This automation's job is narrowly to notice change; the actual threat-identification and mitigation judgment stays human.
- Workflow and tracking tools: the issue tracker where findings become real tickets, and a program-level dashboard that rolls up model status, age, and open findings across every business unit on the shared scoring rubric, which is what makes centralized reporting possible despite federated execution.
Workflows for onboarding new systems
A new system (a new service, a new major feature with its own trust boundary, or an acquired system being integrated) triggers a defined intake, not an ad hoc request:
- Registration at project intake, using the same intake process as architecture review, with a short risk-tiering questionnaire (data sensitivity, external exposure, regulatory scope, revenue criticality).
- Assignment to a regional security champion, or to the central function directly if the system is tiered highest-risk.
- An initial full model before the system's first production release, not after.
- Entry into the program's tracking dashboard, so from day one the new system is visible in the same rollup as every existing system, rather than being informally "known about" until someone remembers to add it.
Integration points with the SDLC and with vulnerability management
- With the SDLC: the model is a required artifact at architecture review, before implementation begins, since this is the cheapest point to change a structural decision; it is not a post-hoc document produced to satisfy an audit after the system is already built.
- With vulnerability management (a distinct downstream discipline that scans, validates, and remediates operational vulnerabilities): the relationship runs both directions. A threat model's findings feed the vulnerability-management backlog as prioritization context, so a scanner finding on a component the model already flagged as high-exposure gets triaged faster than the same finding on a low-exposure component. In the other direction, vulnerabilities discovered by scanning or a real incident feed back into the model as validation: if a scanner repeatedly finds real issues on a code path the model rated low-risk, that is a signal the model's risk rating, not just the code, needs review.
Measurable success metrics
- Coverage: percentage of systems, weighted by risk tier, with a current model.
- Cross-region consistency: variance in risk-scoring distributions across business units for comparable system types, which is the metric that specifically validates whether the hybrid governance model's shared rubric is actually holding, versus regions quietly diverging.
- Time-to-mitigate: median days from a critical or high finding to closure or formal acceptance, trackable per region and rolled up centrally.
- Vulnerability-management correlation: the rate at which vulnerabilities found by scanning land on components the threat model had already flagged as high-exposure, versus components it had not; a low correlation over time signals the model is not actually predicting where real risk shows up, which is a program-quality signal, not just a coverage signal.
Worked example
A multinational retailer has three regions: North America, EMEA (Europe, Middle East, and Africa), and APAC (Asia-Pacific). Under the hybrid model, the central function (based wherever headquarters sits) defines one shared 5-point risk-scoring rubric and STRIDE-based methodology. Each region staffs its own champions proportional to its own system count, so EMEA's rollout of a new payments feature is reviewed by an EMEA-based champion during EMEA business hours, not queued behind North America's backlog. Because all three regions score against the same rubric, the central dashboard can produce a single comparable coverage number (illustratively, "X% of our globally-tiered high-risk systems have a model under 6 months old") that means the same thing regardless of which region contributed the underlying data; under a purely federated model with three independent scoring scales, no such single number could be produced at all, since "high-risk" would mean three different things depending on which region's model you were reading.
Trade-offs and pitfalls
- Choosing pure centralization for the sake of consistency is the classic multinational-scale mistake: it looks safer on paper and is the actual reason many programs stall, because a single team spanning every time zone becomes the bottleneck on every regional release, and regional teams learn to work around it.
- Choosing pure federation for the sake of speed loses the thing executive reporting actually needs, a single comparable risk number across the whole org; a program that cannot answer "which of our regions carries the most unmitigated risk right now" has not actually solved the problem it exists to solve.
- Treating vulnerability management and threat modeling as fully separate programs wastes the correlation signal described above; a threat model that never gets checked against what scanners actually find has no feedback loop telling it whether its risk ratings are any good.
- Onboarding new systems informally, rather than through the defined intake trigger, is how programs end up with an unknown long tail of unmodeled systems; a program that can name every system it has not yet modeled is in a fundamentally different position than one that cannot, and the intake trigger is what makes that list knowable.
Create a security and privacy threat model for enabling corporate invoicing and expense features inside a B2B workplace-collaboration platform. Identify critical assets, threat vectors (data leakage, fraud), and propose architectural controls and processes to mitigate the top 5 risks.
Sample Answer
Direct answer
Corporate invoicing and expense features are different from a typical application feature in one important way: they combine money movement with sensitive personally identifiable information (PII) and third-party accounting integrations, which produces two headline threat vectors rather than a generic list. Data leakage covers exfiltration of invoices, tax documents, and employee or corporate PII; fraud covers fabricated or manipulated invoices, unauthorized refunds, or redirected payments. Every one of the top risks that follow traces back to one or both of those two vectors, and the controls split accordingly: encryption, access scoping, and isolation address leakage, while multi-step approval workflows and anomaly detection address fraud, with a few risks (like an admin account takeover) enabling both at once.
Structured elaboration
Critical assets. Corporate billing profiles and invoices, including generated invoice PDFs; payment instrument tokens, which stay in Payment Card Industry (PCI) scope even when tokenized rather than storing raw card data; employee and corporate PII such as names, emails, and tax identifiers; accounting export and reconciliation data shared with external bookkeeping systems; and audit logs and admin credentials, since compromising the audit trail itself would hide evidence of everything else going wrong.
Threat vector: data leakage. Exfiltration of invoices or PII through a compromised admin account, an access-control gap that grants a service or employee more visibility than their role requires, or a compromised third-party accounting integration pulling more data than it needs.
Threat vector: fraud. Fabricated or unauthorized invoice creation, manipulated refunds, or redirected payment destinations, most often via a compromised or malicious privileged account, or a compromised integration partner able to submit requests the system treats as legitimate.
Top 5 risks, with architecture and process controls for each.
-
Unauthorized access to corporate invoices (data leakage). Architecture: encrypt data at rest with customer-scoped keys so one tenant's compromised key cannot expose another tenant's invoices, enforce row-level multi-tenant isolation, and tokenize identifiers wherever the raw value is not needed. Process: periodic access reviews so unused permissions get revoked, automated alerts on unusually large or bulk downloads, and scheduled key rotation.
-
Unauthorized invoice creation or refund (fraud). Architecture: run payment-affecting operations through a separate service with its own append-only audit trail, keep payment processor interactions tokenized so raw payment details never transit the invoicing logic, and encode business-rule checks (amount thresholds, velocity limits) that flag outliers automatically. Process: require a multi-step approval workflow (draft, then a distinct approver, then the invoice becomes payable) so no single compromised account can both create and approve a payment-affecting change, require multi-factor authentication for any high-value action, and run reconciliation jobs with a defined manual-review service-level agreement (SLA) for anomalies.
-
Compromise via a third-party accounting integration. Architecture: issue narrowly scoped Open Authorization (OAuth) credentials or application programming interface (API) keys per integration rather than broad access, proxy all third-party calls through a gateway that validates request and response schemas, and restrict outbound network egress to an explicit allowlist of approved endpoints. Process: security review the vendor before integration, run periodic penetration testing against the integration surface specifically, rotate integration credentials on a fixed cadence, and require a contractual breach-notification SLA from the vendor. This risk deserves the same rigor as the primary invoicing path, not a lighter review, because a compromised integration can expose or manipulate the same data the rest of the controls above are protecting.
-
Corporate admin account takeover (enables both leakage and fraud). Architecture: integrate single sign-on (SSO) with each corporate customer's own identity provider where possible, backed by a centralized, hardened internal identity service for accounts that cannot use SSO. Process: require multi-factor authentication for all administrative operations, apply risk-based or adaptive authentication that adds friction only when a login looks anomalous (new location, new device), and monitor for login-anomaly patterns with a defined account-lockout and recovery procedure.
-
Insider misuse and audit gaps. Architecture: write audit logs to immutable, tamper-evident storage separate from the primary production database, and give analytics or reporting workloads a read-only replica rather than direct access to production data. Process: require just-in-time, time-limited elevated access with an approval step rather than standing administrative privilege, run role attestation on a fixed cadence (confirming each privileged account still needs what it has), and apply background checks for roles with standing access to the most sensitive data.
Worked example
Trace risk 2 through both an architecture and a process control to see them work together. An attacker compromises a low-privilege accounts-payable clerk's account and attempts to create a large invoice payable to an external account they control, then immediately approve it themselves. The multi-step approval workflow blocks the self-approval outright: the clerk role does not carry approver entitlement in the system's role model, so the create-and-approve attempt fails at the authorization check regardless of what the attacker does at the application layer. Now assume a more determined attacker who has also compromised a second account that does carry approver entitlement. The business-rule engine's velocity and pattern checks still apply: a rule such as "flag any invoice above a defined value threshold that is both created and approved within a short window by accounts sharing the same login network origin" would flag this pairing for manual review before the payment actually releases, because the anomaly is in the pattern of the two actions, not in either action alone. The fraud is not guaranteed to be caught with certainty in every case (no control is), but the combination of a role-based approval gate and a behavior-based anomaly check means the attacker needs to defeat two independent mechanisms in sequence, not exploit one gap in the workflow, which is exactly the layered reasoning this kind of design should apply.
Trade-offs and pitfalls
Per-tenant dedicated encryption keys and network isolation are stronger than shared, logically isolated infrastructure, but they add real cost and operational complexity at scale; a common, workable answer is to offer tiered isolation, standard logical isolation for most customers and dedicated keys or network isolation as an enterprise option, rather than building the most expensive version of every control for every tenant regardless of need. A second trade-off is friction: requiring multi-factor authentication and strict step-up checks on every action makes the product harder to use for legitimate work, so risk-based authentication that adds friction only for high-value or anomalous actions is usually a better balance than blanket friction everywhere. A common and costly pitfall is securing the primary invoicing and payment path carefully while treating the third-party accounting export as a lightly reviewed side channel, when in practice that export often carries the same sensitive data the primary path was built to protect; every integration needs the same threat-modeling rigor as the core product, not an afterthought review. Finally, a multi-step approval workflow only works if the approver actually has enough context to evaluate what they are approving; an approval step that shows an approver nothing more than a rubber-stamp confirmation button trains people to click through it without engaging, which quietly turns a two-person control back into a one-person control in practice.
Threat-model a multi-tenant SaaS platform that uses federated single sign-on (SAML/OIDC), tenant-scoped data isolation, and supports tenant-level custom integrations (webhooks). Identify risks such as token audience confusion, tenant ID misrouting, SSRF via integrations, and tenant admin compromise. Propose specific mitigations, detection signals, and testing approaches for cross-tenant isolation.
Sample Answer
Direct answer
Multi-tenant single sign-on (SSO) built on Security Assertion Markup Language (SAML) or OpenID Connect (OIDC) introduces a specific class of risk that single-tenant SSO does not: the identity token itself needs to prove not just who a user is, but which tenant they authenticated for, and the four named risks (token audience confusion, tenant ID misrouting, server-side request forgery, SSRF, via tenant integrations, and tenant admin compromise) are all variations on that same underlying gap: some layer of the system trusts a token or request without re-checking that it actually belongs to the tenant it claims to. Every mitigation below follows the same principle: never treat "successfully authenticated" as equivalent to "authorized for this specific tenant," and validate that explicitly at every layer, not just at the identity provider.
Structured elaboration
Token audience confusion. Both SAML and OIDC carry an explicit claim naming the intended recipient: SAML assertions include an AudienceRestriction inside the assertion's Conditions, naming the service provider's entity identifier, and OIDC ID tokens carry an aud (audience) claim naming the intended client. If a platform serves many tenants from shared application infrastructure and validates only the token's signature, not that its audience claim matches the specific tenant endpoint receiving it, a token legitimately issued for Tenant A can be replayed against Tenant B's endpoint and accepted. This risk is specific to the shared-infrastructure pattern multi-tenant SaaS almost always uses; a single-tenant deployment never faces it because there is only one possible audience.
sequenceDiagram
participant User
participant IdP as Tenant A Identity Provider
participant AppA as App Endpoint: Tenant A
participant AppB as App Endpoint: Tenant B, shared infra
User->>IdP: Authenticate for Tenant A
IdP->>User: Token with audience claim set to Tenant A
User->>AppA: Present token
AppA->>AppA: Validate signature and audience matches Tenant A
AppA-->>User: Access granted, correct tenant
User->>AppB: Replay same token against Tenant B endpoint
AppB->>AppB: Validates signature only, skips per-tenant audience check
AppB-->>User: Access granted, wrong tenant, isolation breach
Tenant ID misrouting. Distinct from audience confusion at the token layer, this is a request-routing or data-access-layer bug: the application correctly identifies the authenticated user's tenant, but a downstream service call, database query, or cache key derivation uses the wrong tenant identifier, often because it was read from a client-supplied parameter rather than derived server-side from the validated session or token. This produces the same outcome as audience confusion (cross-tenant data exposure) through a completely different mechanism, at the application layer rather than the identity layer, which is why both need separate mitigations rather than assuming fixing one fixes the other.
Server-side request forgery via tenant integrations. Webhook-based custom integrations mean the platform, on a tenant's behalf, makes outbound HTTP requests to a URL that tenant configured. If the platform does not restrict where that outbound request can target, a malicious or compromised tenant admin can configure a webhook URL pointing at the platform's own internal network (an internal metadata endpoint, an internal admin API, another tenant's internal service address if network segmentation is weak), turning the platform's own webhook-delivery infrastructure into an SSRF vector that reaches resources the tenant was never meant to reach.
Tenant admin compromise. A compromised tenant-admin account is dangerous in a multi-tenant system specifically because tenant admins usually hold broad configuration power within their own tenant (managing integrations, inviting users, configuring SSO settings for their tenant), so a compromise here is a full-tenant-blast-radius event even though it never touches the platform's own infrastructure; the risk is contained to one tenant only if isolation between tenants is actually enforced everywhere else on this list.
Mitigations, mapped to each risk:
- Audience confusion: validate the token's audience claim strictly against the specific tenant/service-provider identifier for the endpoint receiving it, on every request, not only at initial login; never accept a token whose audience does not match, even if the signature is valid.
- Tenant ID misrouting: derive the tenant identifier for every downstream operation from the validated session or token server-side, never from a client-supplied parameter, and enforce tenant scoping as a mandatory filter at the data-access layer itself (so a missing application-layer check does not silently become a cross-tenant read).
- SSRF via integrations: restrict outbound webhook destinations to public, non-internal address ranges (blocking private/internal Internet Protocol (IP) ranges and cloud-metadata endpoint addresses specifically), and route outbound integration traffic through infrastructure that is itself unable to reach the platform's internal network, rather than the same network path internal services use.
- Tenant admin compromise: require multi-factor authentication (MFA) for tenant-admin roles specifically (even if not mandated platform-wide), and log every tenant-admin configuration change (especially SSO configuration changes, since that is the one category of admin action that could otherwise be used to further compromise identity for that tenant) to an audit trail the tenant, not only the platform operator, can review.
Detection signals: a token whose audience claim does not match the receiving endpoint (should be exceedingly rare and therefore a high-confidence signal if it occurs at all); a spike in cross-tenant-shaped queries at the data layer, any query pattern lacking the expected tenant-scoping predicate; outbound webhook requests targeting a private or internal IP range; and tenant-admin actions occurring from an unfamiliar network location or immediately following a password reset, a common pattern after a successful phishing-driven account takeover.
Testing approaches for cross-tenant isolation: automated tests that attempt to use a valid Tenant A token against every Tenant B endpoint and assert rejection, run as part of the deployment pipeline rather than only during an occasional manual review; data-layer tests that attempt a query without the expected tenant filter and assert it either fails or scopes to nothing rather than silently returning cross-tenant results; and a webhook-configuration test that attempts to register an internal or private-range URL as an integration target and asserts the platform rejects it.
Worked example
Trace the SSRF path concretely at the scale a platform like this might actually operate, illustratively similar to a project-management SaaS product supporting on the order of 100,000 customer organizations, where the webhook feature exists so each tenant can receive event notifications (a task completed, a project updated) at a URL of their choosing. A malicious tenant admin configures their webhook URL to point not at their own server, but at the platform's internal cloud-metadata endpoint (a well-known internal address many cloud environments expose to running workloads, used to fetch instance credentials). If the webhook-delivery service makes that outbound request from the same network context as the platform's other internal services, without restricting the destination address range, the response, potentially including sensitive instance credentials, gets delivered back through the webhook payload path to the tenant admin who configured it, an SSRF that turns a self-service integration feature into a path for stealing infrastructure-level credentials, entirely without needing to compromise any other tenant or the identity layer at all. The mitigation is not tenant-specific: restricting the webhook-delivery service's outbound reach to exclude internal and private address ranges protects every tenant's webhook configuration equally, and is exactly the kind of control that needs to exist regardless of how much any individual tenant is trusted, since the point of the control is that a self-service feature should never be able to reach infrastructure the tenant was never granted access to.
Trade-offs and pitfalls
The most common mistake is treating token validation (checking the signature) as equivalent to tenant validation (checking the audience matches this specific tenant); a cryptographically valid token is not the same claim as a token valid for this endpoint, and conflating the two is exactly the audience-confusion gap. A second is enforcing tenant scoping only at the application layer and assuming that is sufficient, when a single missed check in one code path (the tenant-ID-misrouting risk) creates a cross-tenant leak that a data-layer enforcement (row-level security or equivalent) would have caught regardless of the application bug. A third, specific to SSRF via integrations, is under-restricting outbound webhook traffic because "the tenant configured this URL themselves, so it's their own choice," which misses that the target of an SSRF attack is not the tenant's own infrastructure, it is the platform's internal network, reached by abusing the platform's own trusted delivery service on the tenant's behalf. Finally, cross-tenant isolation testing is easy to treat as a one-time audit rather than a continuous, automated check; isolation bugs are exactly the class of defect that a single new endpoint or a single refactor can silently reintroduce, which is why the testing approaches above are framed as pipeline-integrated rather than periodic.
Scenario: You're threat-modeling a REST API that uses OAuth2 authorization code flow with refresh tokens. Identify key threats specific to token handling, list potential attack paths (token theft, CSRF, redirect-uri manipulation, refresh-token misuse), and recommend mitigations and detection strategies for each threat.
Sample Answer
Direct answer
The Open Authorization 2.0 (OAuth2) authorization code flow with refresh tokens has four threat-bearing surfaces worth naming explicitly: theft of either token, Cross-Site Request Forgery (CSRF) against the authorization step, redirect-URI manipulation during the code exchange, and misuse of a refresh token after it has been issued. Each needs both a mitigation (stop it happening) and a detection strategy (notice it happening anyway), because none of these controls is airtight on its own.
Structured elaboration
Threat 1: token theft (access token or refresh token)
- Attack paths: cross-site scripting (XSS) reading a token out of browser storage, a compromised device reading it from insecure client storage, network interception on a stripped-TLS connection, or the token appearing in logs.
- Mitigation: keep access tokens short-lived and narrowly scoped; on browser clients store tokens in an
HttpOnly,Secure,SameSitecookie rather thanlocalStorageso page script cannot read them; on native/mobile clients use OS-level secure storage (Keychain/Keystore); enforce Transport Layer Security (TLS) everywhere with HTTP Strict Transport Security (HSTS); redact tokens from all logging and telemetry paths. - Detection: alert on a single token being used from multiple, geographically inconsistent IP addresses or device fingerprints in a short window; alert on token use patterns that don't match the historical behavior of that client.
Threat 2: Cross-Site Request Forgery (CSRF) on the authorization step
- Attack path: an attacker forges the request that starts or completes the authorization flow, causing the victim's browser to authorize a client the victim didn't intend, or to bind the attacker's own authorization code into the victim's session (login CSRF).
- Mitigation: use the
stateparameter as a high-entropy, single-use value tied to the user's browser session and verified on callback; add the Proof Key for Code Exchange (PKCE) extension, originally designed for public clients but now recommended for all client types, which binds the authorization code to a secret only the legitimate client holds. - Detection: reject and log any callback whose
statevalue doesn't match an outstanding request; monitor for spikes instatemismatch errors, which usually indicate either a CSRF attempt or a broken client, and either is worth investigating.
Threat 3: redirect-URI manipulation
- Attack path: a loosely validated redirect URI (wildcard matching, path traversal, or an open redirect elsewhere on the registered domain) lets an attacker redirect the authorization code or token to a server they control.
- Mitigation: register exact-match redirect URIs only, no wildcards; reject any authorization request whose
redirect_uridoesn't exactly match a registered value; require HTTPS on every registered redirect URI in production; audit the client's own domain for open redirects, since those can be chained into this attack even with strict matching at the authorization server. - Detection: log and alert on authorization requests with a
redirect_urithat fails exact-match validation; treat a rising rate of these as a probing signal even though each individual attempt is blocked.
Threat 4: refresh-token misuse
- Attack path: a stolen refresh token is replayed by the attacker to mint new access tokens long after the original session ended, or a refresh token is reused from an unexpected client after rotation should have invalidated it.
- Mitigation: rotate refresh tokens on every use, issuing a new one and invalidating the old one each time; bind the refresh token to the client and, where feasible, to a specific device; set an absolute expiry independent of rotation so a token cannot be refreshed forever; cap the number of concurrently valid refresh tokens per user/client pair.
- Detection: refresh-token reuse detection is the strongest signal available here. If a refresh token that was already rotated (and should be dead) is presented again, that is a near-certain sign of theft; the correct response is to revoke the entire token family immediately, not just the reused token, and force re-authentication.
Worked example
Concretely trace refresh-token rotation with reuse detection: the client exchanges refresh token R1 for a new access token and a new refresh token R2, and the server marks R1 as spent. Two outcomes are possible:
- Legitimate client continues normally, using
R2next time. No alert. - An attacker who separately stole
R1(say, from an old device backup) presents it after the legitimate client has already rotated toR2. The server sees a spent token being reused and, rather than quietly rejecting it, treats this as evidence the whole token family (R1through whatever is current) is compromised, revokes all of them, and forces the legitimate user to re-authenticate.
This is the mechanism that converts a single stolen artifact into a bounded incident instead of indefinite silent access: theft alone is not sufficient for the attacker to stay in undetected, because using the stolen token is what trips the detector.
Trade-offs and pitfalls
Token binding and rotation add real operational cost: rotating refresh tokens means the client must handle rotation failures gracefully (a dropped response after rotation but before the client persists the new token can otherwise lock a legitimate user out), and this is a common source of confusing production bugs, not just a theoretical trade-off. state and PKCE overlap in what they defend against but are not redundant: PKCE protects the code exchange even if the authorization request itself was somehow observed, while state specifically defends against CSRF on the redirect callback; a senior answer keeps both rather than treating them as alternatives. The most common pitfall is validating redirect_uri with prefix or wildcard matching for developer convenience; this is the single highest-leverage misconfiguration in OAuth2 deployments because it turns a correctly implemented flow into one where the authorization code can be redirected off-domain. Finally, detection strategies here are only as good as what's logged: if token values (even hashed identifiers) and client/device metadata aren't captured, none of the reuse-detection or anomaly alerting above is possible after the fact.
Explain the STRIDE threat modeling categories (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege). For each category, provide a concise example vulnerability or attack path in the context of a web-based e-commerce application (authentication, payments, product catalog) and explain why it maps to that STRIDE category.
Sample Answer
Direct answer
STRIDE is a mnemonic for six threat categories, each corresponding to the violation of a security property: Spoofing (violates authentication), Tampering (violates integrity), Repudiation (violates non-repudiation), Information Disclosure (violates confidentiality), Denial of Service (violates availability), and Elevation of Privilege (violates authorization). Its value is that it forces you to ask all six questions at every trust-boundary crossing rather than relying on whatever threats happen to come to mind.
Structured elaboration
For a web-based e-commerce application (auth, payments, product catalog):
| STRIDE category | violates | e-commerce example | why it maps here |
|---|---|---|---|
| Spoofing | Authentication | An attacker replays a stolen session cookie to impersonate a logged-in customer's checkout session | The attacker is pretending to BE someone they are not; that is the defining test for Spoofing |
| Tampering | Integrity | A request to /api/cart/update has its unit_price field modified client-side before submission, bypassing server-side price validation | Data is being altered in a way the system did not intend; integrity, not confidentiality, is the property broken |
| Repudiation | Non-repudiation | A customer disputes a charge and the payment service has no signed, immutable log tying that specific customer session to that specific transaction | The system cannot PROVE who did what, which is exactly what non-repudiation logging exists to prevent |
| Information Disclosure | Confidentiality | The product catalog API returns full internal SKU cost and supplier fields in its JSON response, visible to any authenticated user via browser dev tools | Data intended to stay internal is exposed to an unintended audience |
| Denial of Service | Availability | An attacker scripts thousands of cart-abandonment requests against the checkout service, exhausting the database connection pool for legitimate shoppers | The system becomes unavailable to legitimate users; this is the availability axis specifically |
| Elevation of Privilege | Authorization | A regular customer account discovers that the admin order-refund endpoint only checks for a valid session token, not an admin role claim, and can call it directly | The attacker already has SOME access (a valid session) and uses it to gain MORE access than authorized; that upgrade-in-privilege is the defining test |
The classification test that keeps these six from blurring together: ask which single security PROPERTY is being violated (who you are, what you're allowed to do, whether data can be altered, read, proven, or kept available), not what TECHNIQUE the attacker used (an attacker might use SQL injection to achieve either Tampering or Information Disclosure depending on what the injected query does -- the technique doesn't determine the category, the violated property does).
Worked example
Trace one flow end to end through all six lenses: the checkout POST request. An attacker could (S) forge the session identity via a predictable session token, (T) alter the cart total in the request body, (R) complete a purchase then deny having done so if no audit trail ties their authenticated session to the order, (I) intercept the response and see another customer's saved card metadata due to an IDOR-style object reference bug, (D) flood the endpoint to exhaust checkout capacity during a sale, and (E) invoke an internal-only discount-application parameter that a normal customer request should never carry. Walking every STRIDE category against a SINGLE data flow like this, rather than against the application as a whole, is what makes the technique produce a complete rather than an ad hoc threat list.
Trade-offs and pitfalls
STRIDE tells you WHAT KIND of thing can go wrong per component or data flow; it does not tell you HOW LIKELY or HOW SEVERE each threat is -- that is DREAD's or a risk matrix's job, applied afterward. A common mistake is running STRIDE once against the whole application instead of once per component/data-flow-crossing-a-trust-boundary in the DFD; the latter is what actually produces a tractable, complete threat list rather than a handful of threats someone happened to think of.
Unlock Full Question Bank
Get access to all Threat Modeling and Attack Surface Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.