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).
A vulnerability with CVSS v3.1 score 9.0 is found in a production billing API and the asset criticality is rated as high on your business impact scale. Describe a method to calculate a combined risk score that uses CVSS and business impact, show a numeric example calculation, and explain how this combined score should influence remediation prioritization and SLAs.
Sample Answer
Direct answer
A combined risk score should multiply neither in isolation: it should blend the Common Vulnerability Scoring System (CVSS) base score, which measures technical exploitability and severity in the abstract, with a separate business-impact factor that captures what this specific asset is worth to the organization. A vulnerability's CVSS score never changes based on where it lives, but its actual organizational risk does, so the combining formula is what lets a 9.0 mean something different on a billing API than on an internal test server. For this billing API (CVSS 9.0, business-impact criticality High), a defensible weighted blend lands the combined score at 8.4 out of 10, which maps to the organization's Critical remediation tier and a short, fixed service-level agreement (SLA) rather than the default queue.
Structured elaboration
Two independent axes. CVSS scores exploitability and technical severity (attack vector, complexity, privileges required, and the confidentiality/integrity/availability impact of the vulnerability itself), assuming nothing about which system it lives on. Business-impact criticality scores what happens to the organization if that asset is compromised, regardless of how easy the compromise was. Neither axis alone is sufficient: a CVSS 9.0 bug on an air-gapped internal tool is a different remediation priority than the same CVSS 9.0 bug on a production billing API that moves money and holds payment data.
A simple combining formula. Normalize both to a common 0-10 scale, then take a weighted average biased toward the technical score, since exploitability should dominate but business context should still meaningfully move the number:
CombinedScore=wcvss⋅CVSS+wbi⋅BI10
with wcvss=0.6, wbi=0.4 as an illustrative, organization-chosen weighting (there is no single industry-standard split; some organizations weight the two axes evenly, others let business impact act as a multiplier rather than an additive term), and business-impact criticality mapped onto the same 0-10 scale by ordinal position:
| Business-impact criticality | BI10 |
|---|---|
| Low | 2.5 |
| Medium | 5.0 |
| High | 7.5 |
| Critical | 10.0 |
Mapping the combined score to remediation tiers and SLAs, an illustrative but common pattern:
| Combined score | Tier | Remediation SLA |
|---|---|---|
| 8.0-10.0 | Critical | 7 calendar days |
| 6.0-7.9 | High | 30 days |
| 4.0-5.9 | Medium | 90 days |
| 0.0-3.9 | Low | next scheduled patch cycle |
This is deliberately a different scale from CVSS's own qualitative severity bands (None 0.0, Low 0.1-3.9, Medium 4.0-6.9, High 7.0-8.9, Critical 9.0-10.0): the combined score is an organizational prioritization signal built on top of CVSS, not a replacement for it, and the two should not be confused when reporting to auditors or partners who expect the raw CVSS number.
Worked example
Given values from the scenario: CVSS v3.1 base score = 9.0 (which sits in CVSS's own Critical severity band, 9.0-10.0), business-impact criticality = High.
BI10=7.5 (from the mapping table, High)
CombinedScore=0.6×9.0+0.4×7.5=5.4+3.0=8.4
8.4 falls in the 8.0-10.0 band, so this finding lands in the Critical remediation tier with a 7-calendar-day SLA, the same urgency tier as the raw CVSS score alone would have implied (CVSS 9.0 is already Critical on its own scale), which makes sense: a Critical technical vulnerability on a High-impact production billing API should not be softened by the blend.
The formula's real value shows up when the business-impact input changes while the vulnerability stays fixed. Holding CVSS at 9.0 and varying only the business-impact criticality:
| Business-impact criticality | Combined score | Tier | SLA |
|---|---|---|---|
| Low | 0.6(9.0) + 0.4(2.5) = 6.4 | High | 30 days |
| Medium | 0.6(9.0) + 0.4(5.0) = 7.4 | High | 30 days |
| High (this scenario) | 0.6(9.0) + 0.4(7.5) = 8.4 | Critical | 7 days |
| Critical | 0.6(9.0) + 0.4(10.0) = 9.4 | Critical | 7 days |
Even at the lowest business-impact input (Low), the same underlying CVSS 9.0 vulnerability still lands at 6.4, a High tier with a 30-day SLA, not a Low tier: the 0.6 weight on CVSS deliberately prevents a low-impact asset label from letting a technically Critical vulnerability drop out of active remediation entirely, while still meaningfully separating a 7-day response from a 30-day one depending on what the asset actually is.
Trade-offs and pitfalls
The most common mistake is letting business-impact scoring become subjective and inflated: if every asset owner rates their own system as "Critical" to get faster remediation attention, the business-impact axis stops discriminating and the combined score collapses back to a re-scaled CVSS. Business-impact criticality needs its own defined rubric (data classification handled, revenue dependency, regulatory exposure, blast radius if compromised) reviewed by someone other than the asset owner, the same way CVSS needs a consistent scorer to stay comparable across findings. A second pitfall is picking weights that let a low business-impact rating fully cancel a Critical CVSS score; a formula where a low-value asset can push a remotely exploitable, no-authentication-required Critical vulnerability all the way down to a Low tier is usually wrong, because "low impact today" often changes as the asset's role in the architecture evolves, and a forgotten Critical-severity hole is exactly the kind of thing that gets rediscovered by an attacker after the business context around it has quietly changed. Finally, do not present the combined score as if it were CVSS itself when talking to external parties (auditors, customers, disclosure coordination): report both numbers separately, since CVSS is a portable, vendor-agnostic measure and the combined score is internal prioritization logic that will not mean the same thing outside the organization.
Create a threat model for a new public REST API that allows third-party integrations. Identify high-value assets, likely threat vectors (e.g., API key leakage, injection, mass scraping), and list mitigations including rate limiting, auth scopes, WAF rules, and monitoring you would implement.
Sample Answer
Direct answer
Treat a public, multi-tenant, third-party-facing Representational State Transfer (REST) API as reachable by any motivated attacker from day one, not just by the partners it was designed for. Start from what is actually valuable (the customer data the API returns, the keys and tokens that unlock it, and the platform's own availability), work through the realistic ways an attacker gets at it (a leaked key, an injection flaw, or mass automated scraping), and land on four concrete, complementary mitigation categories: rate limiting, scoped authorization, gateway-level validation and web application firewall (WAF) rules, and monitoring that feeds a real response, not just a dashboard.
Structured elaboration
High-value assets. The customer personally identifiable information (PII) and business data the API returns in responses; the API keys, Open Authorization (OAuth) tokens, and client secrets themselves, since possessing one of these is functionally equivalent to possessing whatever access it grants; privileged write actions reachable through the API, such as billing changes or configuration updates; and the platform's own availability and reputation, since abuse or an outage on a public API damages the product even without a direct data breach.
Threat vector: API key leakage. Keys end up in places they should never be: committed into a public code repository, embedded in client-side code that ships to end users, or printed into logs or error messages that are less carefully access-controlled than the API itself. Once leaked, a key is functionally a stolen credential.
Threat vector: injection. Unsanitized input from an API request reaching a downstream database query, command, or interpreter, the same class of vulnerability that affects any application, just reachable here through a documented public interface rather than a web form.
Threat vector: mass scraping. Automated, high-volume harvesting of data through endpoints that were designed for individual, low-volume legitimate calls, often using valid credentials (a real but abused API key, or repeatedly created free-tier accounts) rather than any technical exploit, which is what makes it hard to distinguish from legitimate heavy usage without deliberate design.
Mitigation: rate limiting. Apply limits at multiple levels at once, global, per-client, per-tenant, and per-endpoint, rather than a single global cap that a single abusive client could exhaust on behalf of everyone else. Use a token-bucket style limit that allows a reasonable burst for legitimate spiky usage but enforces a strict sustained rate over time, and tighten limits automatically for a specific key or client when anomaly signals (see monitoring, below) suggest abuse.
Mitigation: authorization scopes. Use OAuth 2.0 with fine-grained, least-privilege scopes issued per integration, short-lived access tokens with a separate refresh flow so a leaked access token has a limited window of usefulness, and, critically, authorize every request against the specific resource being requested, not just authenticate that the caller holds a valid credential. A token that is valid for one tenant must be explicitly checked against that tenant's own data on every call; treating "the token is valid" as equivalent to "this call is allowed" is exactly the broken object-level authorization gap that lets a legitimate credential reach another tenant's data.
Mitigation: gateway validation and WAF rules. Validate every request against the published contract at the gateway, rejecting malformed payloads, unexpected fields, and wrong content types before they reach application code, and layer WAF rules tuned for common injection and abuse patterns behind that. This is a second layer of defense, not a substitute for parameterized queries and proper input handling inside the service itself; a WAF catches known bad patterns, it does not fix an underlying injection vulnerability.
Mitigation: monitoring. Define, up front, the specific signals that indicate abuse for this API: an unusual request rate for a given key or client relative to its own baseline, requests from an unexpected geography or a sudden change in client behavior, repeated authorization failures suggesting scope or tenant-boundary probing, and error-rate spikes on specific endpoints. This design-time work is specifying what counts as anomalous for this particular API and handing those signal requirements to whoever owns detection and alerting; monitoring only functions as a mitigation if it is wired to an actual response (automatic throttling, temporary key suspension), not left as a dashboard nobody is watching when the abuse actually happens.
Worked example
A third-party developer accidentally commits their API key to a public code-hosting repository. An automated secret-scanning process the platform runs against public repositories flags the leak and the key is revoked and reissued. Because the leaked key was originally issued with a least-privilege scope, read-only access to that developer's own sandbox tenant rather than a broad administrative scope, an attacker who found the key before revocation could only read that one tenant's sandbox data, not pivot to other tenants or perform any write action; the authorization-scope mitigation bounds the damage even before revocation happens. Suppose the attacker instead tries to use the still-valid key to bulk-harvest 50,000 records from that sandbox at 100 records per response, requiring 50,000/100=500 requests. Against a sustained rate limit of 100 requests per minute for that key, exfiltrating all 500 requests takes at least 500/100=5 minutes, during which the anomaly-detection signal (a sustained request rate far above this key's historical baseline) has already fired and the response action (automatic throttling or suspension) can cut the attempt off mid-way rather than after the fact. (The specific numbers here are an illustrative scenario to make the mechanism concrete, not a claim about any particular deployment's actual limits or timings.)
Trade-offs and pitfalls
Overly strict gateway validation and WAF rules can generate false positives that block legitimate third-party traffic, especially early after launch when real partner usage patterns are not yet well understood; treat rule tuning as an ongoing feedback loop informed by real traffic, not a one-time "block everything suspicious" configuration. Rate limits that are only global or only per-client, without a per-endpoint dimension, let an attacker exhaust a shared budget by hammering one cheap endpoint, which can starve legitimate calls from unrelated clients hitting other endpoints if the limiting is not scoped correctly. A common and serious pitfall is authenticating the caller but not authorizing the specific request: it is easy to build a system that correctly verifies a token is valid while forgetting to check that the specific resource being requested actually belongs to that token's tenant, and broken object-level or tenant-level authorization of exactly this kind is a frequently seen real-world vulnerability class in public APIs, distinct from simply lacking authentication. Finally, monitoring that is not tied to an automated or fast human response provides the illusion of a mitigation without the substance of one; the value of defining anomaly signals up front is lost if nobody, or nothing, is watching them when abuse actually happens outside business hours.
Draw or describe a Data Flow Diagram (textual description acceptable) for a microservices-based payment system composed of: frontend, API gateway, payment service, order service, user service, third-party payment processor, and database. Identify trust boundaries and list three components that should be considered privileged or high-value targets, explaining why.
Sample Answer
Direct answer
A data flow diagram (DFD) for this payment system needs to show every component the question names (frontend, API gateway, payment service, order service, user service, third-party payment processor, database) plus where trust level changes between them. Of the seven components, the payment service, the database, and the API gateway are the three that deserve privileged-target status, because each of them, if compromised, gives an attacker either money movement, bulk sensitive data, or a foothold that spoofs every request behind it.
Structured elaboration
Data flow diagram
flowchart LR
Client[Customer Browser or App]
GW[API Gateway]
PAY[Payment Service]
ORD[Order Service]
USR[User Service]
DB[(Shared Database)]
TPP[Third-Party Payment Processor]
Client -->|HTTPS request| GW
GW --> PAY
GW --> ORD
GW --> USR
PAY --> DB
ORD --> DB
USR --> DB
PAY -->|signed transaction request| TPP
TPP -->|authorization callback| PAY
subgraph Public["Untrusted: public internet"]
Client
end
subgraph Edge["Semi-trusted: edge, enforces authentication"]
GW
end
subgraph Internal["Trusted: internal service network"]
PAY
ORD
USR
end
subgraph Data["Data tier: shared database, per-service least privilege"]
DB
end
subgraph External["External trust domain: payment partner"]
TPP
end
Trust boundaries (the four points above where trust level actually changes, not just where a network hop happens):
- Customer to API gateway: the public internet meets the first piece of infrastructure the company controls. Nothing here is authenticated yet from the system's point of view; the gateway's job is to establish identity before anything crosses further in.
- API gateway to internal services: the gateway is semi-trusted (it enforces authentication and rate limiting) but the services behind it are fully trusted internally. A request that reaches the payment, order, or user service is implicitly assumed to have already passed the gateway's checks, which is exactly why the gateway itself is a privileged target (see below).
- Internal services to the shared database: a trusted-to-trusted boundary in principle, which is exactly why the diagram above puts the database in its own zone rather than folding it in with the three services. "Trusted" does not mean "uniformly privileged": the order and user services should not need the same database permissions as the payment service, even though all three reach it over the same internal network.
- Payment service to the third-party payment processor: crossing into a separate organization's trust domain entirely. This boundary needs its own authentication (signed requests, mutual TLS, or an equivalent) independent of whatever authenticates traffic inside the company's own network, because the processor cannot rely on the company's internal trust assumptions and vice versa.
Three privileged / high-value targets, and why
- Payment service. It's the only component that both initiates money movement and holds (or brokers access to) payment credentials or tokens. Compromise here doesn't just leak data, it enables direct financial fraud: unauthorized charges, refund abuse, or manipulated transaction amounts. It also sits at the boundary to the external processor, so it's the natural place an attacker would target to pivot from "inside the network" to "able to move money externally."
- Shared database. It aggregates payment records, order history, and user identity data in one place. In a microservices design this is often the component that quietly violates the trust boundaries drawn above, because if payment, order, and user services all write to the same database with similar credentials, a compromise of any one service's database access can read data that belongs to a different service's domain. Its blast radius is the largest of any single component here.
- API gateway. It is the single enforcement point for authentication and authorization for every request into the system. A compromise or misconfiguration here doesn't threaten one data flow, it threatens all of them simultaneously, since every downstream service trusts that a request reaching it has already been authenticated by the gateway.
Worked example
Trace one concrete failure through the diagram: an attacker finds a server-side request forgery bug in the order service that lets them make the order service issue arbitrary internal requests. The order service itself holds no payment data, so on its own this looks low-severity. But because trust boundary 3 above (internal services to database) is not actually enforced with per-service least privilege, the order service's database credentials happen to have read access to the payment table too, a common shortcut when all three services share one database and one connection pool. The attacker uses the order-service bug to query payment records directly. This is exactly the kind of finding a DFD with clearly drawn, and separately verified, trust boundaries is meant to catch before launch: the diagram would prompt the question "does the order service's database credential actually need payment-table access," and the answer is no.
Trade-offs and pitfalls
The most common mistake in this exercise is drawing every network hop as a trust boundary, which produces a diagram with so many boundaries marked that none of them stand out; the four boundaries above are worth marking specifically because trust level changes there, not merely because a network call happens there. A second common mistake is treating "privileged target" as synonymous with "handles the most requests": the API gateway and order service both see more traffic than the payment service, but traffic volume is not the same as blast radius, which is why payment service, database, and gateway rank above order and user service here despite lower call volume. Finally, a shared database across services is a legitimate early-stage architecture choice, but it collapses the trust boundary between services at the data layer even when the service layer looks properly separated; a senior answer flags that collapse explicitly rather than assuming service-level separation implies data-level separation.
Given a simplified authentication flow: user submits credentials -> auth service validates -> issues JWT -> client stores JWT, list likely threats and map at least three concrete mitigations to each threat (short answers). Consider web and mobile clients and include detection/monitoring controls where appropriate.
Sample Answer
Direct answer
Walking the flow step by step, credential submission, server-side validation, JSON Web Token (JWT) issuance, and client-side storage, surfaces a distinct threat at each step, and each needs at least three concrete mitigations rather than one silver-bullet fix. The step that most changes between web and mobile clients is the last one, storage, because the two platforms offer fundamentally different secure-storage primitives.
Structured elaboration
1. Credential submission (spoofing and interception): credential stuffing or brute force against the login endpoint, and interception of credentials in transit.
- Enforce Transport Layer Security 1.2 or higher end to end with HTTP Strict Transport Security, so credentials never travel in cleartext.
- Rate limit and apply progressive lockout on the login endpoint, keyed by both account and source signal (IP address, device fingerprint), to blunt automated credential stuffing.
- Require a second factor beyond the password, specifically a time-based one-time password (TOTP) or a stronger hardware/passkey factor, so a stolen password alone is insufficient to authenticate.
2. Auth service validation (tampering and elevation of privilege): the validation logic itself being bypassed through injection, a timing side channel on password comparison, or insecure comparison logic.
- Use a vetted password-hashing library (bcrypt or Argon2) with constant-time comparison rather than custom comparison code.
- Use parameterized queries or an object-relational mapping (ORM) layer for the credential lookup to prevent injection into the validation path.
- Detect and lock out repeated failed validations against the same identity, distinct from the login-endpoint rate limiting above, since this catches abuse that targets the validation logic itself rather than just the endpoint.
3. JWT issuance (tampering and information disclosure): a weak or accepted alg: none signing configuration, an overly long token lifetime, or sensitive data embedded in the payload. A JWT's payload is base64-encoded, not encrypted, so anyone who obtains the token can read its claims.
- Sign with a strong algorithm (RS256 or ES256) server-side, and explicitly reject
alg: noneand algorithm-confusion attempts on verification. - Keep the access token short-lived (minutes, not days), paired with a separate, independently revocable refresh-token flow for renewing sessions.
- Minimize claims to non-sensitive identifiers only; never place personal data or secrets in the payload, since the token itself is not confidential.
4. Client-side storage (tampering and information disclosure, and where web and mobile genuinely diverge):
Web client: storing the token in localStorage or sessionStorage exposes it to any successful cross-site scripting (XSS) injection, since client-side JavaScript can read it directly; storing it in a cookie instead is vulnerable to cross-site request forgery (CSRF) if the cookie is not defended.
- Store the token in an httpOnly, Secure, SameSite cookie so client-side script cannot read it, closing the XSS-theft path.
- Pair the httpOnly cookie with CSRF defenses (a synchronizer token, or relying on a strict SameSite policy where it is sufficient for the application's cross-origin needs), since moving to a cookie reopens CSRF exposure that token-in-JavaScript storage did not have.
- Apply a strict Content Security Policy to reduce the chance of a cross-site scripting payload executing in the page at all.
Mobile client: the token typically lives in the app's local storage layer.
- Store it in the platform's secure enclave or keystore (iOS Keychain, Android Keystore) rather than plain shared preferences or a plist file.
- Bind the refresh token to the device, through device attestation or a device-specific claim, so a copied token file is far less useful to an attacker outside that device.
- Apply certificate pinning on the mobile client's Transport Layer Security connections to reduce interception risk on a compromised or hostile network path.
5. Ongoing session (repudiation and a detection gap the earlier steps do not close): no visibility into anomalous use of an otherwise valid token.
- Log and alert on impossible-travel patterns, the same token's subject claim used from two geographically implausible locations within a short window.
- Monitor for abnormal token-refresh velocity, a signature of automated abuse or token replay.
- Alert on repeated authentication-validation failures against the same identity, the credential-stuffing signature from step 1, correlated with the rest of the session-monitoring picture rather than viewed in isolation.
Worked example
An attacker successfully phishes a user's password (step 1's threat realized despite the mitigations, since no single control is perfect). Because the login also required a TOTP-based second factor, the phished password alone is insufficient, and the attacker is blocked at step 1's third mitigation. If instead the organization had skipped multi-factor authentication, the attacker would authenticate successfully at step 2, receive a valid JWT at step 3, and the outcome would then depend entirely on step 5's monitoring: an impossible-travel alert (the legitimate user's last session was in one country, this new one originates from another within minutes) is the mitigation that actually catches the compromise after the fact, illustrating why the ongoing-session detection layer matters even when every earlier preventive control is in place, since none of them are guaranteed to hold in every case.
Trade-offs and pitfalls
The most common mistake is treating JWT storage as a single, platform-agnostic decision; "store it in a cookie" is close to correct advice for a web client and simply does not apply to a native mobile app, which has no browser cookie jar at all, so the storage mitigation has to be chosen per platform, not copied across them. A second pitfall is over-trusting a short token lifetime as sufficient on its own; a short-lived access token limits the damage window of a stolen token but does nothing to prevent the theft itself, which is why it appears paired with the storage-hardening mitigations above rather than as a replacement for them. A third is skipping the detection layer entirely on the assumption that strong prevention makes it unnecessary; the worked example above shows detection catching exactly the case where a preventive control was missing or bypassed, which is precisely the scenario detection exists for.
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 20 Threat Modeling and Attack Surface Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.