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).
List and explain the step-by-step process you would follow to perform an attack surface analysis for a newly deployed microservice that handles PII. Include the tools you would use, artifacts you would produce, and the cross-functional participants you'd invite for the analysis.
Sample Answer
Direct answer
Attack surface analysis for a new, personally identifiable information (PII)-handling microservice is a discovery-then-prioritization exercise: enumerate everything that can be reached or influenced from outside the service's trust boundary, map how PII moves through it, and turn that inventory into a ranked list of what needs review before launch. The process below runs in five stages, uses different tooling at each stage, and needs specific people in the room, not just the security team, because attack surface is created by product and infrastructure decisions the security team doesn't always see.
Structured elaboration
Stage 1: scope and data classification
- What happens: confirm the service's boundaries (what it owns versus calls out to), and classify exactly which PII fields it touches (name, email, government ID, payment data all carry different regulatory weight).
- Tools: a data classification spreadsheet or a data catalog tool if the org has one; the service's Application Programming Interface (API) schema (OpenAPI/Swagger) as the starting inventory of what the service exposes.
- Artifacts: a scope document and a data classification table.
- Participants: the product owner (what does the feature do), the lead engineer (what does the service actually touch), and, if PII crosses a regulatory threshold, a privacy or legal contact.
Stage 2: interface and dependency discovery
- What happens: inventory every inbound interface (public endpoints, internal service-to-service calls, admin/debug endpoints, message queue consumers) and every outbound dependency (databases, caches, third-party APIs, the CI/CD pipeline that deploys it).
- Tools: the API schema again, a network/port scanner for what's actually listening (not just what's documented), the cloud provider's asset inventory (for example AWS Config or an equivalent), and the service mesh's own topology view if one exists.
- Artifacts: an asset and interface registry, ideally one that gets regenerated automatically rather than hand-maintained, since a hand-maintained inventory goes stale within a quarter.
- Participants: the lead engineer and a DevOps/platform engineer who knows the actual deployed topology, which frequently differs from the design doc.
Stage 3: data flow and trust boundary mapping
- What happens: draw where PII enters, where it's transformed, where it's stored (including caches and logs, which are the most commonly missed PII stores), and where trust level changes (public internet to load balancer, load balancer to internal network, service to third-party processor).
- Tools: a diagramming tool (draw.io, Lucidchart) or a dedicated threat modeling tool (OWASP Threat Dragon, Microsoft Threat Modeling Tool) that produces a structured data flow diagram (DFD) rather than a static image.
- Artifacts: a DFD with trust boundaries marked explicitly.
- Participants: lead engineer plus whoever owns the service the microservice calls out to, since trust-boundary decisions are often made unilaterally by one team but affect both.
Stage 4: threat identification and technical verification
- What happens: apply a threat-modeling method (STRIDE: Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege is the standard starting point) against the DFD from stage 3, then verify the highest-concern items with targeted technical testing rather than assuming the design holds.
- Tools: STRIDE against the DFD; the OWASP Application Security Verification Standard (ASVS) as a checklist; API fuzzing and manual testing with Burp Suite or OWASP ZAP; static application security testing (SAST) and software composition analysis (SCA, dependency vulnerability scanning) run against the service's own repository.
- Artifacts: a threat log and a prioritized finding list with severity.
- Participants: security engineer running the testing, lead engineer to interpret findings against the real design.
Stage 5: operational and configuration review, then remediation planning
- What happens: check the things that don't show up in a DFD but create real attack surface anyway: whether PII leaks into logs, whether the service's identity and access management (IAM) role is broader than it needs, whether secrets are stored properly, whether encryption at rest is on. Then convert everything found into an owned, dated remediation backlog rather than a report nobody acts on.
- Tools: cloud IAM console/policy analyzer, secrets manager audit, log sampling for accidental PII exposure.
- Artifacts: a configuration checklist and a remediation backlog with owners and acceptance criteria.
- Participants: DevOps/SRE (owns the runtime configuration), QA (owns verifying the fix), and the original product owner (signs off that remediation doesn't silently break the feature).
Worked example
Take a concrete instance of stage 3 and 4 together: the microservice logs the full request body on error for debugging, and one field in that request body is the user's email address. Stage 3's DFD marks "logging pipeline" as a data flow most teams don't draw at all, because it feels like infrastructure rather than a feature. Stage 4's STRIDE pass against that flow flags Information Disclosure: the log aggregation system, which usually has broader read access than the production database itself, now holds PII outside the classification boundary set in stage 1. The fix (redact or omit PII fields before logging, and audit existing log retention for what's already there) only gets found because the process explicitly treats logging as an attack-surface component instead of leaving it implicit.
Trade-offs and pitfalls
The most common failure mode is treating this as a one-time exercise: an attack surface inventory produced at launch is accurate for exactly as long as nobody ships a new endpoint, which for an actively developed microservice is measured in weeks. The process above should feed a lightweight recurring check (ideally automated discovery re-run on each deploy) rather than a document that's filed away. A second pitfall is running stage 4's testing before stage 2 and 3 are actually complete; testing against an incomplete interface inventory reliably misses the exact debug or admin endpoint that turns out to be the real risk, because those are the ones least likely to appear in the official API schema. Finally, skipping the cross-functional participants in stages 1 and 3 to save time is a false economy: the security team alone usually cannot see which fields are actually PII under the applicable regulation, or which internal call the platform team quietly added last sprint, and both of those gaps show up as attack surface the model missed.
Design an annual attack-simulation program that combines red-team campaigns and purple-team exercises to validate detection coverage derived from your threat models. Include scoping principles, how you derive hypotheses from attack trees, required telemetry and detection analytics, success metrics (KPIs), and the process for feeding findings back to detection engineering and threat models.
Sample Answer
Direct answer
An annual attack-simulation program should be a closed loop, not two separate red-team and blue-team events run in isolation. Threat models produce a ranked set of plausible attack paths; red-team campaigns exercise realistic, full-kill-chain versions of the highest-priority paths under limited visibility to test whether defenses actually work; purple-team exercises run the same or complementary techniques collaboratively with defenders to validate and tune specific detection coverage live; and findings from both feed back into the detection team's rule set and the next threat-modeling cycle, so this year's gaps change what gets tested and defended next year.
Structured elaboration
Scoping principles. Derive scope from the threat model's ranked output, not from whatever happens to be convenient to test. The highest likelihood times impact threats identified in the current threat model should map directly to this year's simulation scenarios, so the exercise validates what actually matters rather than generic technique coverage. Define rules of engagement up front (what is off-limits, such as production data destruction or customer-facing availability impact) with documented authorization, and choose the engagement type per scenario: black-box (the red team starts with no inside knowledge, testing detection from a genuine external starting position) versus assumed-breach (the red team starts from a defined foothold, useful for validating detection deeper in the kill chain rather than initial-access resilience). Run one full annual red-team campaign against the two to four highest-priority scenarios, supplemented by more frequent, narrower purple-team sessions through the year against lower-priority or newly identified threats, since a single annual exercise cannot and should not try to cover an entire threat model.
Deriving hypotheses from attack trees. An attack tree, built during threat modeling as a root goal decomposed into AND/OR branches of the specific steps an attacker would need, is the direct source of testable hypotheses. Each leaf-to-root path is a candidate hypothesis of the form: if an attacker achieves this leaf-node action, can they reach the root goal, and will the organization detect it at a specific point along the way. Prioritize paths that the threat model rated highest for likelihood and impact and that currently have no confirmed detection coverage, an untested assumption in the model, since those two properties together are exactly what a time-boxed, expensive exercise should spend its budget validating, rather than paths already backed by strong evidence of coverage.
Required telemetry and detection analytics. For each hypothesis under test, define before the exercise runs what signal would need to exist for the defense to plausibly catch it, for example authentication logs and process-execution telemetry for a credential-theft-to-lateral-movement path, or network egress logging for a data-exfiltration path. This is a requirements list handed to whoever owns detection engineering and telemetry pipelines; the program defines and validates what is needed, it does not itself build the collection or alerting pipeline. If the required telemetry does not exist yet, that gap is itself a finding, independent of whether the red team was ultimately detected.
Success metrics (key performance indicators, KPIs).
- Detection rate: the proportion of tested attack-tree paths where the simulated actions were actually detected by existing controls, broken down by kill-chain stage (initial access, lateral movement, exfiltration), since coverage is rarely uniform across stages.
- Time to detect, measured within the exercise itself from the logged execution time of a technique to the logged time an analyst or alert flagged it, reported as an exercise-specific measurement rather than a claimed universal production average.
- Coverage delta year over year: the number of previously uncovered attack-tree paths, flagged in a prior exercise, that now have confirmed detection, showing whether the feedback loop is actually closing gaps rather than just re-finding the same ones.
- Time to remediate a finding, from the exercise finding to a validated fix, whether that fix is a new detection rule or an architectural mitigation.
Feeding findings back, explicitly to both named destinations:
- To detection engineering: each undetected or late-detected technique becomes a specific, reproducible ticket naming the technique, the telemetry that should have caught it, and the exercise's timestamped evidence, not a vague note to "improve detection."
- To threat models: a finding that shows a path was easier to execute than the model assumed feeds back as a likelihood or impact re-rating, and a finding that surfaces an attack path the model did not include at all feeds back as a coverage gap in the model itself, not only in the defenses. This closes the loop on the model, rather than leaving it static while only the detection rules get patched.
flowchart TD
TM[Threat model] --> AT[Attack tree]
AT --> HYP["Hypotheses: can we reach root goal, will we detect it"]
HYP --> RT[Red team campaign]
HYP --> PT[Purple team exercise]
RT --> FIND["Findings: detection rate, time to detect"]
PT --> FIND
FIND --> DE[Detection engineering tickets]
FIND --> TM2[Next threat model cycle]
DE -.-> TM
TM2 -.-> TM
Worked example
(Illustrative scenario.) A threat model for a SaaS platform ranks "compromised employee credentials leading to production database access" as the top likelihood times impact threat, with an attack tree showing three leaf paths: phishing, credential stuffing against a self-service password reset, and a leaked API token. This year's scoping selects the credential-stuffing path, previously untested, for an assumed-breach red-team exercise: the red team is granted a valid but low-privilege account and attempts privilege escalation to database access. Required telemetry defined up front includes authentication anomaly logging and database-access-pattern logging for the specific service-account tier involved. The escalation succeeds and is not detected within the exercise window, a detection-rate miss for that kill-chain stage. A companion purple-team session, run immediately after with the detection team on the same technique, confirms that a specific alert rule (unusual database query volume from a service account outside its normal access pattern) would have caught it, cutting the measured time-to-detect from "not detected" to a few minutes in the retest. Both the specific ticket (add that alert rule, filed to detection engineering) and the broader finding (filed to the threat model) go to their respective owners. Be precise about what the model finding can actually be, because the engagement type constrains it: this was an assumed-breach exercise, so the credential-stuffing leaf itself was never executed and the exercise produced no evidence at all about how hard that initial-access step is. What it did produce evidence about is everything after the foothold, so the honest re-rating is that escalation from a low-privilege account to production database access is both easier and quieter than the attack tree assumed, which raises the likelihood on that segment of the path and adds a detection-coverage gap the model had not recorded. If the initial-access leaf also needs re-rating, that requires a black-box engagement that actually attempts it, and saying so is part of the finding rather than a caveat on it.
Trade-offs and pitfalls
Running red-team and purple-team exercises as unconnected annual checkbox activities, rather than threat-model-derived and closed-loop, produces expensive theater: findings that do not map to anything already prioritized, with no mechanism ensuring gaps are actually fixed before the same finding repeats next year. Scoping a single annual campaign to "test everything" dilutes both realism and depth; a narrow, well-resourced campaign against the highest-priority attack-tree paths finds more than a shallow sweep across dozens of low-priority ones. Purple-team exercises can create false confidence if run only against techniques already known to be covered, an easy result to report, when the real value is specifically in testing unconfirmed coverage, which is less comfortable to schedule. Detection-rate KPIs measured only under the artificial conditions of a scheduled exercise, where defenders may be unusually alert and systems specially instrumented, can overstate real-world coverage; treat the number as a floor and say so explicitly when reporting it upward. Skipping the threat-model feedback step and only filing detection tickets leaves the model itself stale, so next year's exercise derives hypotheses from an outdated picture of what is actually likely.
Given the following simplified web application architecture, identify the top six assets, list attack-surface components, and name three high-priority threats.
Architecture:
Client -> CDN -> Load Balancer -> Web Tier -> App Tier -> Database
|-> S3 Object Storage
|-> Auth (OIDC)
|-> CI/CD Pipeline
Explain your reasoning and the initial mitigations you would propose for the high-priority threats.
Sample Answer
Direct answer
Redrawing the given architecture with its branches made explicit shows nine distinct attack-surface components across five trust zones. Of those, six qualify as top assets by blast radius, and three threats rise to high priority: a compromised build pipeline injecting malicious code, an authentication misconfiguration exposing the app tier, and a misconfigured storage bucket leaking data, in that order, because each represents a single point of failure that affects the whole system rather than one request at a time.
Structured elaboration
Architecture, redrawn with the branch points explicit
flowchart LR
Client[Client Browser or Mobile App]
CDN[Content Delivery Network]
LB[Load Balancer]
WEB[Web Tier]
APP[App Tier]
DB[(Database)]
S3[(S3 Object Storage)]
AUTH[Auth Service, OpenID Connect]
CICD[CI/CD Pipeline]
Client -->|HTTPS| CDN
CDN --> LB
CDN -->|static assets| S3
LB --> WEB
WEB --> APP
APP --> DB
APP -->|token issuance and validation| AUTH
CICD -->|deploys build artifacts| WEB
CICD -->|deploys build artifacts| APP
subgraph PublicZone["Untrusted: public internet"]
Client
end
subgraph EdgeZone["Semi-trusted: edge"]
CDN
LB
end
subgraph AppZone["Trusted: application network"]
WEB
APP
AUTH
end
subgraph DataZone["Trusted, restricted: data stores"]
DB
S3
end
subgraph OpsZone["Separate trust domain: build and deploy"]
CICD
end
Top six assets, in priority order, with reasoning
- Database. Holds the system's persistent, structured data. Compromise here is the largest single blast radius: every user's data, not one session's worth.
- Auth service (OpenID Connect, OIDC, an identity layer built on top of the Open Authorization 2.0 framework). Issues and validates the tokens the app tier trusts to make every access-control decision. Compromise here doesn't leak data directly, it lets an attacker convince the app tier that any request is legitimately authorized, which is a broader failure than any single data leak.
- CI/CD pipeline. Has write access to production code for both the web and app tiers. A compromise here is the only asset on this list that can silently modify the behavior of every other asset, since it controls what code actually runs.
- App tier. Holds business logic and, typically, the credentials or connection strings the other trusted-zone components need; it's the component every other trusted-zone asset routes through.
- S3 object storage. Holds static assets and, in most real deployments, uploaded user content or backups. Frequently the most likely component to be accidentally exposed, because object storage permissions are easy to misconfigure and the failure mode (a public bucket) is silent until discovered.
- Web tier. The rendering and request-handling layer. Ranks last of the six because a compromise here is typically scoped to what a single request touches, though it's still a meaningful pivot point toward the app tier.
Attack-surface components (every node and edge in the diagram that something outside the company's control can reach or influence): the client, the CDN edge configuration, the load balancer and its TLS termination, the web tier's HTTP endpoints, the app tier's APIs, the database, the S3 buckets and their access control lists, the auth service's OIDC flows (including the redirect and token endpoints), and the CI/CD pipeline's build agents and deploy credentials.
Three high-priority threats, with reasoning and initial mitigations
- CI/CD pipeline compromise leading to a malicious build reaching production. Why high priority: it bypasses every other control in the diagram, since a malicious build can simply disable or fake the checks meant to catch it, and it affects the web and app tiers simultaneously rather than one request or one user. Initial mitigations: enforce least-privilege, short-lived deploy credentials rather than long-lived static keys; require signed commits and artifact signing so an unsigned or improperly signed build cannot deploy; isolate build agents so a compromised dependency in one build can't persist into the next.
- Auth service misconfiguration or token compromise granting unauthorized app-tier access. Why high priority: every access-control decision downstream assumes a valid token means a legitimate, correctly scoped request, so a flaw here (weak signature validation, an overly broad token scope, a leaked signing key) invalidates that assumption for the entire app tier at once, not just one endpoint. Initial mitigations: verify token signatures against an explicit allow-listed algorithm and key, keep token lifetimes short with a separate rotating refresh mechanism, and scope tokens narrowly (least privilege per client) rather than issuing broad, all-purpose tokens.
- Public or misconfigured S3 bucket exposing stored data. Why high priority: this is the failure mode most likely to happen by accident (a permissive bucket policy set during initial setup and never revisited) and, unlike an active attack, requires no attacker skill to exploit once it exists, only discovery, which happens routinely via automated internet-wide scanning. Initial mitigations: block public access at the account level by default, require an explicit, reviewed exception to make any bucket public, and run automated, recurring scans that alert on any bucket drifting into a public or overly permissive state.
Worked example
Trace one concrete path through the diagram to show why the ranking above holds in practice, not just in theory: a dependency used by the build process is compromised (threat 1), and the resulting malicious build is deployed to the app tier through the CI/CD pipeline exactly as the diagram shows, with no separate approval gate catching it. The malicious code doesn't need to attack the auth service directly (threat 2); it already runs inside the app tier, which the auth service already trusts, so it can read whatever the app tier's own database credentials allow, and separately write a copy of that data to the S3 bucket it also has access to (threat 3), using the app tier's existing permissions to stage the exfiltration. Every one of the three high-priority threats acts as a link in a single chain here: the pipeline compromise is the entry point, the trust the auth service extends to the app tier is what lets the entry point reach real data without triggering a fresh authentication check, and the S3 bucket becomes the exfiltration path out. Notice the web tier plays no role in this particular chain, which is exactly why it ranks last among the six assets: an attacker with this level of access has no need to touch it.
Trade-offs and pitfalls
The most common mistake in this exercise is ranking assets by how much traffic they see rather than by blast radius; the web tier sees the most requests of anything in this diagram but ranks last of the six because a single compromised request there rarely cascades the way a pipeline or auth compromise does. A second pitfall is treating the CI/CD pipeline as "internal tooling" and out of scope for a customer-facing threat model; it has write access to the exact same production surface a direct attack would target, and is frequently under-defended relative to the customer-facing tiers precisely because it doesn't feel customer-facing. Initial mitigations listed above are a starting point, not a complete control set: each would need a follow-on threat model of its own (for example, the auth service's own OIDC token issuance flow deserves the same step-by-step treatment given to the system overall) before this analysis is considered complete.
Construct an attack tree for the 'password reset' feature of a SaaS application. Include at least three high-level branches (for example: social engineering, system-level exploit, third-party dependency abuse). For one branch, drill down to leaf steps and propose mitigations and detection requirements for those leaf steps.
Sample Answer
Direct answer
An attack tree is a threat-modeling technique that starts from a single attacker goal at the root (here: compromise an account through the password reset feature) and breaks that goal down into the distinct ways it could be achieved, branch by branch, down to concrete, testable leaf steps. For this feature, three high-level branches cover the realistic space: social engineering, a system-level exploit, and third-party dependency abuse. Drilling into the social engineering branch down to leaf steps is where the mitigations get concrete enough to actually implement.
Structured elaboration
Why an attack tree, and how it's used: unlike a flat threat list, an attack tree forces explicit reasoning about how sub-goals combine (an attacker generally needs to complete a full path from root to a leaf, not just one isolated step) and makes it visible which branches are cheapest for an attacker to pursue, which is what should drive mitigation priority. It's built by asking, at each node, "what are the distinct ways to achieve this," and stopping each branch once you reach a step concrete enough to test or defend against directly.
High-level branches
- Social engineering: convince a human, either the victim or a support agent, to complete part of the reset flow on the attacker's behalf.
- System-level exploit: attack the reset mechanism's own logic (broken authentication, insecure direct object references, token predictability, cross-site request forgery on the reset endpoint).
- Third-party dependency abuse: compromise a system the reset flow depends on but doesn't fully control, such as the email or SMS provider that delivers reset codes, or the DNS/CDN infrastructure serving the reset page.
A related account-takeover path worth naming alongside these three: if the application also supports social login through an external identity provider (for example, signing in via a third-party OAuth 2.0 identity provider), an attacker can sometimes bypass the password reset flow entirely by compromising that external account instead. That path belongs to the third-party dependency abuse branch conceptually (the application is trusting a system it doesn't control), even though it skips the reset flow altogether; it's worth flagging in the model as a sibling risk to keep the team from treating "harden the reset flow" as sufficient if social login is also enabled.
Drill-down: social engineering to leaf steps
Sub-branch: vishing (voice phishing) a support agent into resetting the account.
- Reconnaissance: attacker gathers enough of the victim's personal details (from public sources, prior breaches, or social media) to sound convincing.
- Contact: attacker calls support, impersonating the victim, and provides the gathered details to pass identity verification.
- Manipulation: attacker convinces the agent to initiate a reset, override a failed verification step, or redirect the reset notification to an attacker-controlled email or phone number.
- Takeover: attacker receives the reset link or code and completes the account takeover.
Mitigations and detection requirements per leaf step
- Step 1 (reconnaissance): mitigation is limiting how much account-identifying information is exposed anywhere public (support-ticket confirmations, profile pages); detection is largely out of the organization's direct visibility, but a spike in inbound support contacts referencing the same target within a short window is a weak signal worth correlating after the fact.
- Step 2 (contact and identity verification): mitigation is requiring verification methods an attacker with only public data cannot pass, specifically possession-based checks (a one-time code sent to the already-registered device) rather than knowledge-based questions (birthdate, address) that are widely available from breach data; detection is logging every verification attempt with outcome, and alerting on repeated failed verification attempts against the same account from different callers.
- Step 3 (manipulation of the agent): mitigation is removing the agent's ability to complete a reset unilaterally. Any reset initiated through support should still require the automated, user-confirmed channel (the reset link goes to the account's existing registered email or device, never to a new destination the agent enters); detection is an audit log of every agent-initiated reset, reviewed and flagged if the agent overrode a failed automated verification.
- Step 4 (takeover via the received reset link or code): mitigation is requiring an additional factor to complete the reset (the delivered code confirms possession of the channel, but a second factor confirms possession of the account, not just the channel); detection is monitoring for a reset immediately followed by a sensitive action (email change, payment method change, MFA reconfiguration) from a new device or location, since that sequence is a strong signal of takeover regardless of how the reset itself was obtained.
Worked example
Trace one full path through the tree to make the branch concrete: an attacker scrapes a victim's name, last four digits of a payment card (leaked in an unrelated breach), and approximate address from public sources (leaf step 1). They call support, pass the knowledge-based verification questions using that data (leaf step 2), and ask the agent to send the reset link to a "new" email address because they claim to have lost access to the old one (leaf step 3, the actual attack point: the agent's ability to redirect delivery). If the mitigation for step 3 is in place, redirecting delivery is simply not possible through the support channel, so the attacker's path dead-ends at step 2 regardless of how convincing the call was. This is the value of drilling to leaf steps: "train support agents to recognize social engineering" is a much weaker mitigation than "remove the technical capability that makes the manipulation useful even if it succeeds."
Trade-offs and pitfalls
The most common mistake building an attack tree is stopping at the branch level ("social engineering is a risk") without drilling to leaf steps, which produces a list that reads like a risk register but doesn't tell an engineer what to build. A second pitfall specific to this tree is treating the support-agent path as purely a training problem; training helps but degrades under pressure and high call volume, while removing the agent's technical ability to redirect delivery holds regardless of how good the attacker's story is, which is why the leaf-level mitigations above lean on removing capabilities rather than only on human vigilance. Possession-based verification (step 2's fix) is stronger than knowledge-based verification but adds friction for legitimate users who've lost their device, so a senior answer acknowledges that trade-off and typically pairs it with a slower, more heavily verified fallback path rather than a hard requirement with no recovery option.
Explain what an attack tree is and describe its main components (root, internal nodes, AND/OR gates, leaves). Create a small textual attack tree with at least three levels for the goal 'exfiltrate customer data' in a cloud-hosted application.
Sample Answer
Direct answer
An attack tree is a hierarchical diagram that decomposes an attacker's ultimate goal (the root) into the sub-goals and concrete steps (internal nodes and leaves) that could achieve it, connected by AND-gates (all children required) or OR-gates (any one child sufficient). It gives a threat modeler a structured way to reason about the many different routes to the same bad outcome, rather than listing threats as an unordered flat list.
Structured elaboration
Components: the root is the attacker's ultimate objective, stated as a goal rather than a technique (for example, "exfiltrate customer data," not "run SQLMap"). Internal nodes are intermediate sub-goals that must be achieved on the way to the root. Leaves are concrete, atomic attack steps, small enough that a specific control could plausibly block that exact step. Gates connect a node to its children: an OR-gate means the parent goal is achieved if ANY one child succeeds (this is the more common gate in practice, since most goals have multiple independent routes); an AND-gate means ALL children must succeed together (used when a goal genuinely requires a combination, such as "bypass authentication AND escalate privilege" for a specific compound attack).
Worked example: "exfiltrate customer data" for a cloud-hosted application, three levels deep
Level 1 (root): Exfiltrate customer data.
This branches via OR into three level-2 sub-goals, since any one route suffices: (A) Compromise the database directly, (B) Compromise an application server with database access, (C) Compromise a legitimate user's authenticated session.
Level 2 -> Level 3 for branch (A) Compromise the database directly, via OR: (A1) Obtain leaked database credentials from a misconfigured CI/CD secret store, (A2) Exploit a SQL injection vulnerability in an internet-facing endpoint, (A3) Access an unauthenticated database snapshot left in a public object-storage bucket.
Level 2 -> Level 3 for branch (B) Compromise an application server, via OR: (B1) Exploit a known unpatched CVE in a server-side dependency, (B2) Obtain SSH access via a reused or weak credential, (B3) Achieve remote code execution via an insecure deserialization endpoint.
Level 2 -> Level 3 for branch (C) Compromise a user session, via OR: (C1) Steal a session token via a cross-site scripting vulnerability, (C2) Phish the user's credentials directly, (C3) Exploit a predictable or non-expiring session identifier.
This is a genuine three-level tree (root, level-2 sub-goals, level-3 leaves) with 9 total leaves across 3 branches, entirely built from OR-gates because each leaf independently suffices to advance its parent branch -- a realistic shape for a data-exfiltration goal, since attackers generally have many independent routes rather than needing to chain unrelated techniques together.
Trade-offs and pitfalls
The most common attack-tree mistake is stating leaves as vague techniques ("hack the database") rather than concrete, control-addressable steps ("obtain leaked credentials from a misconfigured CI/CD secret store"), which makes the tree impossible to use for actually deciding what to fix. A close second is defaulting every gate to OR out of habit, even when a goal genuinely requires a combination of steps; that undercounts the real difficulty of compound attacks and can make prioritization look wrong (a leaf that looks cheap in isolation may in reality require an AND-combination with a much harder sibling step to matter at all).
Unlock Full Question Bank
Get access to all 18 Threat Modeling and Attack Surface Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.