skip to content

Untrusted Client Devices

Everything shipped to a mobile, desktop or embedded client is readable and modifiable, so a client-side check is user experience and not a control. Interviewers listen for what you moved server-side.

on this pageshow

questions

4

A field-service app ships an integration API key inside its package — which threats does that create on a lost handset?

level: middleimportance: must knowfreq 74%

answer

  1. Shipped means published
  2. One key for the whole fleet
  3. What can you revoke, and how fast?
  4. Two assets: credential and personal data
  5. Cached data survives revocation

basics

~20 s

Anything shipped inside an app package is readable by whoever holds a copy, so treat that key as public. Two assets are exposed: a fleet-wide credential an attacker can replay against your API, and the customer data cached on a device you do not own.

solid answer

~50 s

I model the handset as sitting outside my trust boundary, which means the app package and everything cached on it is disclosed to whoever ends up with the device. That splits into two threats with different owners. First, the embedded integration key is a shared credential: extracting it lets an attacker call the integration API as the whole fleet, which is Spoofing and often Elevation of Privilege, and because it is one value for every technician I cannot revoke a single lost handset without an app release. Second, the cached route with customer addresses is Information Disclosure against personal data, and it persists after the handset is gone. So the model drives two fixes: per-device credentials issued at enrolment and individually revocable, scoped to what one technician needs; and minimising what is cached — today's route only, expiring on a short clock, behind a session that ends.

go deeper

for a junior

Know the rule and be able to say why: a credential inside an app package can be read by anyone who has the app, so it should be treated as public. Mention that cached customer data on a lost phone is a separate problem.

for a middle

Explain the mechanics of why the fleet-wide key is worse than a per-device one — no selective revocation, no rotation without a release, no attribution in logs — and how enrolment-time credentials fix all three.

for a senior

Demonstrate judgment by ranking the two assets, showing which controls act before versus after a loss, and driving the design toward minimised caching, narrow server-side scoping and a revocation path that works within minutes.

for a principal

Own the policy question: what data a device is ever allowed to hold, how credential lifetime trades against offline working hours for field staff, and how you make enrolment and revocation cheap enough that operations will actually use them.

## The design A gas utility ships an Android app to field technicians. Each morning it downloads the day's route — customer names, addresses, appointment windows, meter history — and caches it so the technician can work in basements and rural areas with no signal. To reach the routing partner's service, the app carries an integration API key compiled into the package. Handsets get lost, sold, rooted and handed between contractors. ## The single modeling move The handset is outside your trust boundary. That is not a statement about how careful the technicians are; it is a statement about who can ultimately execute code on the device and read its storage. From that one placement, every threat below follows mechanically. The corollary that engineers resist is that **shipping a secret to the far side of a trust boundary discloses it**. An API key inside an application package is not stored, it is published — to a slow-moving audience, but published. Model it as a public string. ## Threat one: the fleet-wide credential Extracting the key gives an attacker the ability to call the integration API as your application. In STRIDE terms this is **Spoofing** (they authenticate as something they are not, violating authentication) and usually **Elevation of Privilege** as well (violating authorization), because integration keys are habitually issued with far broader reach than any single technician needs — often the whole customer database rather than one route. The property that actually hurts is that it is *one* credential for the entire fleet: - You cannot revoke the lost handset without revoking every handset. - Rotation means shipping a new build and waiting for install rates, so in practice the key is never rotated. - Logs cannot attribute a call to a technician, which is a **Repudiation** problem: after an incident you cannot reconstruct who did what. The model therefore argues for per-device credentials issued during enrolment, bound to an authenticated technician session, scoped down to the data that one person's route requires, short-lived, and individually revocable from your side the moment a handset is reported gone. Note the shape of the fix: it does not try to make the device trustworthy, it makes the credential worth less and the loss containable. ## Threat two: the data already on the device The cached route is **Information Disclosure** against personal data — names, addresses and appointment times that tell someone when a house is empty. It is a privacy harm to people who are not your users in any meaningful sense and never consented to their address sitting on a contractor's phone. The threat has an unusual property: it survives the compromise. Revoking a credential stops future API calls, but the addresses cached yesterday are already in the attacker's hands. Controls have to act *before* the loss, which points at data minimisation as the primary mitigation rather than an afterthought: - cache one day's route rather than a rolling history, - store the minimum field set (does the technician need the customer's full name and phone number, or a meter identifier and an address?), - expire the cache on a clock the device enforces locally, so an unopened handset ages out on its own, - tie access to a session that ends, so a found handset is not a logged-in handset. ## What about protected storage on the platform? Modern mobile platforms offer storage that is harder to extract, and using it is worth doing — it raises attacker cost and defeats casual extraction. It does not change the model's assumption. The device is still outside the boundary, the running app can still use whatever it can decrypt, and a rooted handset erodes the guarantee. Treat platform storage as a cost multiplier layered on top of the real controls, never as the reason a fleet-wide secret becomes safe to ship. The mechanics of key storage belong to a cryptography discussion; the threat-modeling conclusion is simply that it moves the cost, not the boundary. ## Assembling the model Written out, the finished model for this design reads: attacker — whoever ends up holding a lost, resold or rooted handset, including a contractor with legitimate access today and none tomorrow; assets — an integration credential and third-party personal data; boundary — the device edge, with the app package and its storage on the untrusted side; dominant threats — Spoofing and Elevation via the shared key, Information Disclosure of cached personal data, Repudiation from unattributable calls; controls — per-device short-lived credentials, server-side scoping to one technician's route, minimised and expiring cache, prompt revocation on a report of loss; residual — data already cached before the loss, which is bounded by how little you chose to cache. ## The interview failure mode Weak answers stop at "don't hardcode secrets in the app" and reach for obfuscation or an encrypted config file whose key also ships. The strong answer is that no amount of hiding fixes a secret you hand to an untrusted party — you change the credential's shape until losing it costs little and you can take it back.

  • The team proposes encrypting the key in the app's config file. Does that change your model?
    No. The app has to decrypt the value to use it, so the decryption key ships alongside it and the chain terminates on the untrusted device. It raises the effort of casual extraction and nothing else. The model's assumption — that anything shipped to the handset is disclosed — is unchanged, so I would still spend the effort on per-device, short-lived, narrowly scoped credentials instead.
  • How does the model change if the app must work offline for a full shift?
    Offline operation forces data onto the device and extends credential lifetime, so it directly increases both threats. I model it as an explicit tradeoff: cache the smallest field set that lets the job be done, cap the cache to the shift, keep the credential's validity to roughly the same window so a found handset expires on its own, and reconcile plus re-authenticate when connectivity returns.
  • Which threat here survives revoking the credential, and what does that imply?
    The disclosure of already-cached customer data. Revocation stops future API calls but cannot recall addresses sitting in the device's storage. Because the control cannot act after the event, the mitigation has to be preventive and structural — minimise what is cached and expire it — rather than a response procedure. That is why data minimisation ranks above incident response for this particular threat.

Giving every technician a copy of the same master key means a lost keyring re-keys the entire building, and only after you notice.

saying these in an interview costs you the question

  • Says obfuscating the key makes it safe to ship
  • Encrypts the key with another key shipped in the same package
  • Assumes only rooted devices can expose the package contents
  • Treats a single fleet-wide credential as rotatable in practice
  • Ignores the cached personal data and models only the key
  • Relies on remote wipe for a handset that never comes back online

context

open as a page

A game client computes currency balances locally and reports totals to your server — how do you threat-model it?

level: seniorimportance: must knowfreq 65%

basics

~20 s

Put the trust boundary between the device and your API. Anything the client computes is an assertion, not a fact, so the server must re-derive the balance from state it holds. The client-side calculation is user-experience, not a control.

open as a page

Field-provisioned solar inverters accept firmware and config over the air — how do you model that update path as an entry point?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Model the update channel as an inbound flow crossing into the device, so the question is what the device verifies before accepting, not just how you authenticate it. A shared installer credential and a fleet-wide push make one compromise reach every unit at once.

open as a page

Stadium turnstiles must validate season passes offline at kickoff — how do you model a decision the server cannot make?

level: principalimportance: nice to knowfreq 36%

basics

~20 s

Accept that authorization happens on hardware you do not own and model the cost instead of denying it: stale revocation, duplicated passes, no global uniqueness check. Convert prevention into bounded loss plus reconciliation, and decide deliberately which way the gate fails.

open as a page