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).
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.
You are the security architect and need to obtain board-level acceptance for a residual-risk posture that allows certain 'medium' risks to remain for six months while mitigations are implemented. Prepare an outline of the briefing to the board: key metrics to present, remediation timeline, compensating controls, expected business impact if accepted, and the explicit 'ask' (budget, timeline, or authority).
Sample Answer
Direct answer
A board does not need, and will not sit through, the technical detail behind a risk-acceptance request; it needs enough to exercise its actual job, deciding whether the organization's exposure and the plan to close it are acceptable, in about ten minutes. The outline below covers five elements in the order a board actually consumes them: the metrics that establish scope and trend, the remediation timeline that shows this is a plan and not a shrug, the compensating controls that justify why "medium" is tolerable for the stated window, the business impact framed in terms the board already tracks, and a single, explicit, answerable ask.
Structured elaboration
1. Key metrics to present
Lead with the smallest set of numbers that establishes scope and trend, not a full findings list:
- Count and trend of medium-severity findings covered by this acceptance, shown against the prior period so the board can see whether the backlog is growing or shrinking, not just its current size.
- Time already elapsed versus time requested, since a board evaluating "six months" needs to know if this is a fresh request or a renewal of an earlier one, which changes how it should be read.
- Comparable prior acceptances and their outcomes (did previously accepted medium risks get closed on schedule, or did they slip), since a board's confidence in this request is directly informed by whether the last one delivered on its timeline.
2. Remediation timeline
A single visual timeline, not a table of tickets: milestones at roughly the 30/90/180-day marks, each tied to a concrete, checkable deliverable (a specific system patched, a specific control deployed) rather than a vague "progress will be made" statement. The timeline should make clear what closes the acceptance early versus what is the outside boundary the board is actually approving.
3. Compensating controls
Name the specific controls standing in for full remediation during the acceptance window, and be explicit about what each one does and does not cover: for example, enhanced monitoring on the affected systems catches exploitation attempts but does not prevent them, while a network-level access restriction reduces the population of people who can reach the exposure but does not eliminate the underlying weakness. The board's actual question here is "what stands between us and harm right now," and a vague "we have monitoring in place" without specifying what it would and would not catch does not answer it.
4. Expected business impact if accepted
Translate the risk into terms the board already tracks: financial exposure range, regulatory or contractual obligations at stake, and reputational exposure if realized, stated as a range grounded in the nature of the systems and data involved (what could plausibly happen, and why) rather than a fabricated single number, since a board that later checks a suspiciously precise financial figure against nothing will trust the whole briefing less. Pair this with the counterfactual: what it costs, in time, budget, or business disruption, to remediate immediately instead of over six months, since the acceptance request only makes sense in contrast to that alternative.
5. The explicit ask
End with exactly one clear ask, stated as a decision the board can make in the room: approval of the six-month window itself, budget for the remediation plan behind it, or the authority for a named executive (rather than the board itself) to approve any future extension without returning to the board. A briefing that ends without a specific ask leaves the board unsure what "approving" even means, and invites a meandering discussion instead of a decision.
Worked example
A briefing following this outline might read, in compressed form: "We are asking the board to accept 14 medium-severity findings, down from last quarter's 17, for a six-month remediation window. Compensating controls are enhanced logging and a network restriction on the affected systems, which catch and limit exploitation attempts but do not close the underlying gaps. If unaddressed longer than this window, the exposure carries potential regulatory notification obligations and a financial range consistent with our prior two incidents of this class, which cost the organization in the low-to-mid six figures each in direct remediation and notification costs. Our ask: approve this six-month window and the associated $400K remediation budget already scoped in the plan; if approved, we commit to closing at least half the findings by the 90-day mark." Every clause in that example maps to one of the five sections above, and the two prior-incident cost figures are explicitly framed as historical comparables (assumed known to the presenter from the organization's own incident record), not fabricated precision about the current, not-yet-realized risk.
Trade-offs and pitfalls
- The most common wrong turn is leading with technical detail (a full findings list, Common Vulnerability Scoring System figures, individual system names) before the board has the framing to care; boards disengage from detail they cannot act on, and the ask gets lost.
- Presenting a business-impact figure with false precision ("this risk costs the company $2.3M") without a stated basis is worse than a stated range, because a board member who probes the number and finds no basis for it discounts the entire briefing, not just that line.
- Ending without a single explicit ask is the second most common failure: a briefing that only informs, without requesting a specific decision, forces the board to guess what action is being requested, which usually means no decision gets made at all.
- A senior answer treats the board briefing as a request for a specific decision under time pressure, not a status report, and structures every section to build toward that one ask rather than toward comprehensive coverage of the underlying findings.
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.
Scenario: A mobile app stores encrypted user data locally and syncs with a backend when the device is online. Threat-model the offline sync feature: consider local storage, key management, sync protocol security, conflict resolution, and attacker models such as device theft or man-in-the-middle. Propose mitigations and detection approaches.
Sample Answer
Direct answer
Threat-modeling an offline sync feature means separating two distinct attacker models that threaten different parts of the system: a device-theft attacker who gets physical access to data at rest, and a man-in-the-middle (MITM) attacker who gets network access to data in transit while the device is syncing. Local storage and key management defend against the first; sync protocol security defends against the second; conflict resolution needs its own scrutiny because it is where a malicious or spoofed device can quietly corrupt shared state even without breaking encryption at all. Detection has to work without the device being online, so much of it happens after the fact, on the backend, once a device does reconnect.
Structured elaboration
Local storage. Encrypted data at rest is necessary but not sufficient; the real question is where the decryption key lives. Data encrypted with a key stored in the same application sandbox as the data itself gives a device-theft attacker who can extract the app's storage everything they need. The stronger pattern is deriving or storing the key in the platform's hardware-backed secure storage (the OS keystore/keychain), tied to device unlock (biometric or passcode) so the key is unavailable while the device is locked, and separate from the encrypted blob so extracting the storage file alone is useless.
Key management. Each device should hold its own key material, provisioned per-device rather than sharing one key across a user's devices, so compromising or wiping one device does not expose data synced to others. Keys need a rotation and revocation path: when a device is reported lost or a user logs out remotely, the backend must be able to invalidate that device's ability to decrypt future syncs and, ideally, force re-provisioning rather than relying on the device itself to behave correctly once compromised. Where the backend needs to read synced data server-side (for search, backup, or a web client), envelope encryption, wrapping a per-record data key with a device or user key managed through a key management service (KMS), keeps the KMS from being a single point that can decrypt everything with one compromised key.
Sync protocol security. Every sync exchange should be mutually authenticated (the device proves it holds a valid, non-revoked credential; the backend authenticates over Transport Layer Security, TLS) so a MITM attacker on an open Wi-Fi network cannot simply observe or inject traffic. Confidentiality in transit (TLS) is not the same guarantee as integrity of the payload's origin: sign each changeset with the device's key so the backend can verify a given change genuinely came from that device and was not altered or replayed, and include a monotonic sequence number or timestamp per device to detect and reject replayed sync batches.
Conflict resolution. This is the subtlest attack surface because it can be abused without ever breaking encryption or authentication. If two devices' changes to the same record are merged with a simple last-write-wins rule, a compromised or cloned device with a valid (stolen) credential can overwrite legitimate data just by syncing a change with a later timestamp, and the system will accept it as legitimate because it is correctly signed and authenticated, just from the wrong actor. Mitigations include keeping a server-side, per-record change history (not just the final merged state) so a suspicious overwrite can be audited and rolled back, and treating a spike in conflicting writes from a device as a signal worth flagging rather than silently auto-resolving.
Attacker models and what they threaten:
flowchart LR
subgraph DeviceTrust["Device (attacker model: theft)"]
LS[(Encrypted Local Store)]
KS[Secure Keystore or Keychain]
SC[Sync Client]
end
subgraph NetTrust["Network (attacker model: MITM)"]
NET[TLS Channel]
end
subgraph BackendTrust["Backend: trusted"]
API[Sync API]
DB[(Server Datastore)]
KMS[Key Management Service]
end
KS -->|wraps data key| LS
SC -->|reads and writes| LS
SC -->|mutual auth plus signed changeset| NET
NET --> API
API -->|validate signature, origin, version| DB
API -->|per-device key issuance and rotation| KMS
KMS -->|provisions device key| KS
- Device theft: threatens the Device box, specifically whether the local store is readable without the keystore-held key and whether a locked device's stored credential can be reused. Mitigation: hardware-backed key storage tied to device unlock, remote revocation.
- Man-in-the-middle: threatens the Network box, specifically whether traffic can be read (confidentiality) or altered/replayed (integrity) in transit. Mitigation: mutual authentication over TLS, signed changesets, sequence numbers.
Detection approaches, given the device is offline for stretches so detection is mostly backend-side and after the fact: flag sync sessions from a device credential presenting from a materially different network fingerprint than its recent history right after a period of prolonged silence, which can indicate a stolen device coming back online under new conditions; flag an unusually high rate of conflicting writes from one device, which can indicate a cloned credential racing the legitimate device; and alert on any sync attempt using a revoked or rotated key, which by construction should never succeed and therefore has a very low false-positive rate as a signal.
Worked example
Trace one concrete scenario through the diagram above: a device is stolen while unlocked (the attacker has the passcode, perhaps observed being entered), and the attacker keeps it online. Because the local store's data key lives in the hardware-backed keystore and is only released while the device is unlocked, the attacker who has an unlocked device does get access to that device's local data through the running application, the same access the legitimate user had; encryption-at-rest alone does not stop a fully-unlocked-device attacker, which is why hardware-backed key storage is a mitigation for a locked-device theft, not an unlocked one. What limits blast radius here is the per-device key and per-device revocation: as soon as the legitimate user reports the theft, the backend revokes that device's credential and rotates the affected keys, which prevents the stolen device from syncing further changes or reading newly synced data, even though it retains whatever was already cached locally at the moment of theft. This is the concrete reason per-device (not per-user, shared across devices) key provisioning matters: it bounds the compromise to one device's cached state rather than exposing the user's entire sync history across all devices.
Trade-offs and pitfalls
The most common mistake is treating "encrypted at rest" as a finished answer without asking where the key lives; encryption whose key sits next to the ciphertext in the same app sandbox defends against almost nothing a device-theft attacker cares about. A second is conflating transport security with payload integrity: TLS protects the pipe, but without a per-payload signature and sequence number, a MITM attacker who can also compromise a device's credential (or an attacker who gains write access some other way) can inject or replay a change and the backend has no way to distinguish it from a legitimate one. A third, easy-to-miss pitfall is under-scrutinizing conflict resolution, since it is often designed purely for data correctness (what should the merged record look like) without anyone asking the security question (could a malicious actor exploit this merge logic to overwrite legitimate data with a plausible-looking, correctly-signed change). Finally, remote revocation only helps if the device actually calls home before the attacker can extract cached data offline; for genuinely sensitive data, a stronger mitigation is minimizing how much gets cached locally in the first place and letting the sync protocol re-fetch on demand rather than assuming revocation will always win the race against an attacker working offline.
Walk through a threat modeling exercise for a new cloud-native microservice that accepts file uploads and stores them in object storage. Use an explicit framework (e.g., STRIDE) to identify assets, actors, threats, attack paths, and mitigations. List the artifacts you'd produce (data flow diagram, threat list, prioritized mitigations) and one example detection control for a critical threat.
Sample Answer
Direct answer
A threat-modeling exercise for a cloud-native file-upload microservice produces three concrete artifacts: a data-flow diagram (DFD) that names every asset, actor, and trust boundary; a threat list built by walking each element of the DFD against STRIDE (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege); and a prioritized mitigation list ranking those threats by realistic impact and likelihood. For this specific design, the highest-priority threat is Elevation of Privilege through the asynchronous processing worker, since a compromised file-processing step inherits whatever cloud permissions that worker's identity holds, and the concrete detection control below is built around exactly that threat.
Structured elaboration
Assets, actors, and the data-flow diagram. Assets: the uploaded file content itself, the object storage bucket it lands in, the metadata database recording upload and processing state, and the upload API's authentication tokens. Actors: the authenticated end user (legitimate uploader), an external attacker (unauthenticated, or holding a stolen or forged token), and two internal service identities, the upload API and the asynchronous processing worker, each of which holds its own cloud permissions.
flowchart LR
User[Authenticated End User]
Attacker[External Attacker]
subgraph Edge["Edge: public-facing"]
API[Upload API]
end
subgraph Internal["Internal: service network"]
Queue[[Processing Queue]]
Worker[Async Processing Worker]
MetaDB[(Metadata Database)]
end
subgraph Storage["Object Storage"]
Bucket[(Object Storage Bucket)]
end
User -->|upload request plus token| API
Attacker -.->|forged or stolen token| API
API -->|validated file| Bucket
API -->|enqueue job| Queue
Queue --> Worker
Worker -->|reads object| Bucket
Worker -->|writes result metadata| MetaDB
API -->|writes upload record| MetaDB
Threat list (STRIDE walked against the diagram above):
| STRIDE category | Threat | Where |
|---|---|---|
| Spoofing | Attacker uses a stolen or forged token to call the upload API as a legitimate user | Upload API edge boundary |
| Tampering | Uploaded object is modified after storage by an actor with broader-than-intended bucket write access | Object storage bucket |
| Repudiation | A user who uploaded malicious content denies doing so, with no verifiable record tying the upload to their authenticated session | Upload API to metadata database |
| Information Disclosure | Overly broad bucket policy, or an overly long-lived pre-signed URL, exposes stored files to unintended readers | Object storage bucket |
| Denial of Service | An attacker uploads very large files, many small files rapidly, or a decompression-bomb-style file that consumes excessive resources when the worker processes it | Upload API and processing worker |
| Elevation of Privilege | A malicious file exploits a vulnerability in the processing worker's file-handling logic (an image, document, or archive parser), and the worker's cloud identity has broader permissions than the processing task needs, letting the compromise reach other cloud resources | Async processing worker |
Attack path for the highest-priority threat. The Elevation of Privilege path runs: attacker uploads a crafted file that passes the upload API's basic validation (correct declared content type, acceptable size) but is actually built to exploit a parsing vulnerability in whatever library the worker uses to process it (image library, document parser, archive extractor); the worker picks the job off the queue, reads the object, and processing triggers the exploit; if the worker's cloud identity holds permissions beyond what processing strictly requires (for example, broad read/write across all buckets rather than just the one it processes, or permissions to call unrelated cloud application programming interfaces, APIs), the compromised worker process can pivot to reading or modifying data well outside the original upload's scope.
Prioritized mitigations, ranked by the combination of how likely the path is and how much damage it enables:
- Least-privilege identity for the processing worker (addresses Elevation of Privilege, ranked highest because it is the one threat here whose worst case is otherwise unbounded: every other entry on the list has a blast radius confined to one upload, one bucket, or one log record, while a compromised worker holding broad cloud permissions reaches resources that have nothing to do with file uploads at all. Ranking it first is not the same as it being sufficient, and it is worth saying which entries it does not touch: least-privilege scoping on the worker does nothing for Repudiation, nothing for Information Disclosure through an over-long pre-signed URL, and nothing for resource exhaustion, which is why items 2 through 5 are requirements rather than nice-to-haves): scope the worker's cloud identity to only the specific bucket paths and operations processing requires, with no broad cross-bucket or administrative permissions.
- Content validation beyond declared type (addresses Elevation of Privilege and Denial of Service): validate actual file content (magic-byte/content sniffing, not just the client-declared content type or file extension), enforce size limits before the file is fully accepted, and guard against decompression bombs by capping expanded size during any extraction step.
- Short-lived, narrowly scoped upload tokens and pre-signed URLs (addresses Spoofing and Information Disclosure): tokens tied to a specific authenticated session with a short expiry, and any pre-signed URLs generated for reading objects scoped to minutes, not days.
- Bucket policy least privilege plus encryption (addresses Information Disclosure and Tampering): default-deny bucket policy with explicit, narrow grants, and server-side encryption so a misconfigured policy is not the only line of defense.
- Signed, immutable audit logging of upload events (addresses Repudiation): record each upload tied to the authenticated identity and a content hash, in a log the uploading service itself cannot retroactively edit.
Worked example
One example detection control for the highest-priority threat, Elevation of Privilege via the processing worker: alert on any API call made by the processing worker's cloud identity that falls outside its expected, narrow allow-list, most importantly any call touching a bucket other than the one it is scoped to process, or any call to an unrelated service (identity and access management, compute control-plane APIs, and so on). Because the least-privilege mitigation above already constrains what the worker's identity is supposed to be able to do, any call outside that expected set is a strong, low-noise signal, not a fuzzy heuristic: a correctly-behaving worker should never generate one. Concretely, this means shipping the cloud provider's own API audit log (for example, an AWS-style CloudTrail equivalent) for the worker's service identity to a monitoring pipeline with a rule that fires the moment that identity's calls deviate from its documented allow-list, which catches exactly the pivot step in the attack path above (the compromised worker attempting to read or write outside its intended scope) even if the initial exploit itself was never directly observed.
Trade-offs and pitfalls
The most common mistake is validating only the client-declared content type or file extension and treating that as sufficient input validation; an attacker fully controls both of those fields, so real validation has to inspect actual file content. A second is scoping the worker's cloud identity broadly "to avoid permission issues later," which is precisely the choice that turns a contained parsing-library exploit into a cross-resource compromise; least-privilege scoping has real operational cost (more explicit configuration, more friction when the processing logic legitimately needs a new resource) but that cost is the point, since it forces each new permission to be a deliberate decision rather than a default. A third pitfall is treating the DFD, threat list, and mitigation list as one-time deliverables produced once at design time and never revisited; this pipeline's processing logic and dependencies will change, and a new library version or a new processing step reopens the STRIDE walk for at least the elements it touches, not the whole system from scratch, but not nothing either.
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.