skip to content

Pinning & Attestation

Pinning a server key defeats a rogue certificate authority but can lock out old binaries when the key rotates, and attestation helps only if the server checks it. Interviewers probe both trade-offs.

on this pageshow

explore

questions

6

Should a banking app pin its server keys, and for which domains: its own API, an image CDN, an analytics host?

level: middleimportance: must knowfreq 48%

answer

  1. pinning only tightens system trust
  2. a rogue or added authority
  3. lockout, proxies, debugging
  4. protects the customer, not the server
  5. only hosts whose keys you schedule

basics

~20 s

Pin the bank's own API, not hosts it does not control. Pinning defeats a mis-issued or device-added certificate authority, but it costs lockout risk when keys change, breaks inspecting proxies and complicates testing, so it comes with a rotation plan.

solid answer

~50 s

By default the app trusts any certificate that chains to one of the many authorities on the device and passes the standard checks; pinning additionally requires one of a few public keys compiled into the app, and it can only tighten that trust, never loosen it. It defeats an on-path attacker holding a certificate that a trusted authority mis-issued, or one from an authority added to the device. The costs are real: if the server's key changes to one the build does not pin, that build is locked out until it updates; corporate proxies that inspect TLS stop working; testers need debug-only trust. Pinning also protects the honest customer from the network, not the server from a hostile phone, because the phone's owner can hook the check out. So pin the bank's API and sign-in hosts, with backup keys and a plan; leave CDNs and SDK hosts on system trust.

go deeper

for a junior

Recall that pinning makes the app accept only a few known server keys, on top of the normal certificate checks, and that it can break when those keys change.

for a middle

Explain which attackers pinning defeats, a mis-issued or added authority, which it does not, the phone's own owner, and what lockout and proxies cost.

for a senior

Decide host by host from who controls the keys and the harm of interception, and refuse to pin without backup keys, an expiry and failure reporting.

for a principal

Frame pinning as an operating commitment across years of installed builds: worth it for hosts the bank schedules, a liability anywhere else.

## What the app trusts without pinning By default a mobile app accepts a server's certificate when it chains to one of the many **certificate authorities** on the device's trust list and passes the standard checks. That already defeats the common attacker on public Wi-Fi: a self-signed certificate, or one for the wrong name, is rejected with no extra work. **Pinning** narrows trust further: the app also requires that the server's chain contains one of a small set of public keys compiled into the app. One platform's vendor guidance is blunt that pinning *cannot loosen* trust, only tighten it; a pinned connection must still pass ordinary validation. (Which key in the chain to pin is its own question; this one is about whether, and where.) ## What pinning adds - **A mis-issued certificate.** If any trusted authority issues a certificate for the bank's API host to someone else, by error, compromise or coercion, system trust accepts it and an on-path attacker can read the traffic. A pin rejects it. - **An authority added to the device.** A customer talked into installing a "security profile", an employer's device management or privileged malware can add an authority. On one platform, apps built for current releases already ignore user-added authorities by default, which narrows this case there; a pin closes it on both platforms whatever the build targets. - **A stated requirement.** One platform vendor gives regulatory limits on which authorities may vouch for a host as an example of when pinning is needed, and a widely used mobile security verification standard expects identity pinning for endpoints the developer controls. ## What pinning costs | Cost | Why it happens | How it shows up | |---|---|---| | **Lockout** | the pin set is compiled in; a server key outside it is refused, and only an app update changes the set | every old build fails at once after a careless key change | | **Inspecting proxies** | a corporate proxy presents its own certificate for the bank's host | customers cannot use the app on their office network | | **Testing and debugging** | traffic-inspection tools work by adding an authority | QA needs debug-only trust or a pin-free test build | | **Operations** | changing a key becomes a plan across many releases | security and mobile teams must schedule rotations together | One platform's vendor guidance goes as far as saying most apps do not need pinning and should avoid it; the other's says that a pinning app should always include a backup key. Both are describing the same cost. ## What pinning does not do Pinning protects an **honest customer from the network**. It does not protect the server from a **hostile phone**. Whoever controls the device can hook the pin check at runtime or patch it out of the binary, then read the API in plaintext. A fraudster studying the bank's API is slowed, not stopped. Defending the API against modified apps and scripted clients is the server's job, using attestation and risk checks, not the pin's. ## Deciding per domain | Host | Bank controls its keys? | Harm if intercepted | Pin? | |---|---|---|---| | Bank's API: balances, payments, card freeze | yes | high | yes, with backup keys and an expiry | | Bank's sign-in host | yes | high | yes | | Third-party image CDN | no | low to moderate | no; system trust | | Analytics or crash-reporting endpoints | no | low, if the data is minimised | no | | Partner content | no | moderate | no; relay it through the bank's API if it matters | The rule behind the table: 1. Pin only hosts whose key changes the bank controls and schedules; a CDN rotates its keys on its own timetable and would lock out builds without warning. 2. Pin only where interception harms the customer or the bank. 3. Pin only if the team will run the operating plan: backup keys, an expiry on the pin set, and failure reports per app version. 4. Otherwise rely on system trust, which is what most apps do. ## The corporate-proxy decision Pinning the API means a customer behind an inspecting proxy cannot reach it from that network. That is the pin working as designed: the proxy is, technically, an interception. The bank decides this up front and designs the failure: a clear message ("this network is inspecting secure traffic; try mobile data"), not a generic error, and no option to continue anyway. ## The answer an interviewer wants Yes for the bank's own API, no for hosts it does not control, and the yes comes with its operating plan, not just a hash in the binary. The strongest candidates add, unprompted, that pinning is not a defence against the person holding the phone.

  • The fraud team says pinning will stop attackers reverse-engineering the banking app's API. Are they right?
    No. The attacker owns the phone, so they can hook or patch the pin check and read their own traffic. Pinning protects honest customers from a network attacker. Protecting the API from modified apps and scripts needs server-side checks: attestation verified by the server, rate limits, and step-up for sensitive actions.
  • A large business customer says the app fails on its office network. Do you exempt their proxy?
    Not from inside the app: adding the proxy's authority or relaxing pins for one network ships a weakness to every customer. The fix lies in their network, by excluding the bank's host from inspection, or in the customer using mobile data; the app should explain exactly that.
  • Why not pin the image CDN as well, since images appear on banking screens?
    The bank does not schedule that CDN's key changes, so any rotation would lock out every installed build until users update. The harm of a tampered image is lower; if an image must be trusted, serve it from the bank's pinned API or check a hash the API supplies.

  • Pinning replaces system certificate validation with the app's own list.
  • Pinning stops a fraudster from reading the API on their own phone.
  • Pinning third-party CDN and SDK hosts is as safe as pinning your own API.
  • Once the hash is in the app, pinning costs nothing more.
  • Without pinning, anyone on public Wi-Fi can read a banking app's TLS traffic.
open as a page

A banking app pins its API keys and two-year-old builds are still installed; how do you rotate the server key without locking those builds out?

level: seniorimportance: must knowfreq 42%

basics

~20 s

Never deploy a key that installed builds do not pin. Each build ships the live key, an offline backup and an expiry on the pin set; a new key goes live only after shipping for one expiry window, so every build pins it or has expired.

open as a page

In a banking app, how should the cleartext policy handle a partner's plain-HTTP feed and a plain-HTTP test server?

level: juniorimportance: should knowfreq 44%

basics

~20 s

Keep the app TLS-only, as current platform defaults already are. Move the partner feed to HTTPS or relay it through the bank's own HTTPS API, and give the test server a debug-only exception that the release build never carries.

open as a page

How should a banking app's server check platform attestation before adding a new payee, and what does a pass not prove?

level: middleimportance: should knowfreq 45%

basics

~20 s

The server issues a one-time challenge; the platform signs a statement about app and device that embeds it; the server verifies it and decides. A pass shows a genuine app on a genuine device, not an honest human or their intent.

open as a page

The fraud team wants a banking app to refuse rooted or jailbroken phones using on-device checks; why won't that hold, and what would you build instead?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Whoever controls the phone controls the app's code, so hooking or patching makes any on-device check report clean. Keep checks as cost and telemetry; let the server decide per action, scoring device signals and stepping up risky payee additions.

open as a page

After a server certificate change, a banking app's pin-failure reports spike; how do you tell your own mistake from interception, and what should the app do?

level: seniorimportance: nice to knowfreq 30%

basics

~20 s

Slice reports by app version, network and presented key: failures everywhere, in exactly the builds lacking the new key, are your rollout; an unknown key clustered on some networks is interception. Either way the app refuses and explains.

open as a page