Skip to content
Tech Interview Prep
Technical interview guide

Privileged Access Management

Extra controls around high-risk, elevated-privilege accounts: the accounts that matter most if compromised.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v6
Editorial status
Reviewed

Scope: NIST SP 800-53 Rev. 5 and SP 800-207, NIST SP 800-63B-4, current CISA, AWS, Microsoft Entra PIM, Google Cloud PAM, Kubernetes, IETF, OWASP, and sudo guidance reviewed 2026-09-04.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-3

Design separate administrator identities safely.

Answer

The 90-second answer. Assume Entra ID as the identity provider with PIM, or AWS IAM Identity Center with permission sets. The goal is one property: compromising the identity a person uses for mail and browsing must not yield admin authority. That means two identities per admin: a day-to-day account with a mailbox, and a privileged account with no mailbox, no Teams license, no browsing, cloud-only (not synced from on-prem AD, not federated), named to one human. Rights are eligible, not standing. On AWS the equivalent is IAM Identity Center permission sets with a 1-hour session (the default) and no long-lived access keys.

Why eligible matters, mechanically: a standing Global Administrator role is baked into the access token at sign-in, so a stolen refresh token or session cookie is admin authority for the token's lifetime. Effectively 24/7. An eligible assignment is not in the token; the attacker must also pass the activation gate. PIM's default activation maximum duration is 8 hours; set it to 1. With approval required, the window is only open while someone is watching.

Why no mailbox: phishing needs a delivery vector. An account with no mailbox and no Teams cannot receive a credential-harvesting link, cannot be used to reply to one, and has no "reset via email" path. That removes the initial-access vector rather than trying to detect it.

ControlMechanismConcrete setting
Eligible, not standingRole absent from token until activationPIM activation max 1h, approval required, justification required
Phishing-resistant MFANo shared secret to replayFIDO2 security key or Windows Hello for Business; not Authenticator push
Device + locationToken bound to a managed deviceConditional Access: require compliant device, named location, sign-in frequency
No mail/browsingRemoves delivery vectorNo Exchange/Teams license on the privileged account
Break-glassSurvives IdP misconfigurationTwo cloud-only accounts, excluded from CA, credentials offline, alert on any sign-in

Trace of the attack that fails: attacker phishes the day-to-day account, steals the session cookie, signs in. They can read mail. They try to activate Global Admin: the privileged account is a different identity, so the cookie is useless; they need its credentials plus a FIDO2 key they don't have. Activation emits an audit event with their justification text. Nothing happens.

Failure modes, with detection:

  • Lifecycle drift. Offboarding disables the day-to-day account and leaves the eligible assignment. Detection: weekly reconciliation of HR active roster against eligible role assignments; alert on any eligible assignment whose owner has no active HR record. Real breakage: a contractor offboarded in March activates in July.
  • Credential sharing. Two engineers on one admin account. Detection: sign-in log shows two device IDs or two ASNs inside a short window, or identical justification strings. Cost: the audit trail no longer attributes an action to a person, which breaks non-repudiation for incident response.
  • Recovery merge. Helpdesk SSPR or a break-glass mailbox that routes to the day-to-day inbox silently re-links the two identities. Detection: alert on any password reset or MFA method registration on a privileged account; exclude privileged accounts from SSPR.
  • Approval theater. Median approval latency under 30 seconds means the gate is decorative. Measure it.

Trade-offs. The cheaper alternative is JIT elevation on the day-to-day account (one identity, less lifecycle work) but the session cookie for that account already lives in a browser that reads external mail, so phishing gets you the account and activation is one more prompt on a device the attacker may control. Deciding criterion: does this person read external mail on the same device they administer from? If yes, split. The stronger alternative is a dedicated admin workstation with the same identity; it costs a second machine and is operationally heavy, so it's usually reserved for tier-0. When it isn't worth it: a five-person startup with one tenant and no compliance driver. Two identities, two MFA registrations and lifecycle sync cost more than the risk; one admin account with a hardware key and no mailbox is defensible.

What would change the decision: if the IdP can't enforce phishing-resistant MFA or eligible assignments, splitting identities buys much less, because the shared password is still the weak point.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-1

Design a just-in-time elevation workflow.

Answer

Assumptions. ~200 engineers, cloud IAM federated to an IdP, production admin is the sensitive tier, on-call must reach prod in under five minutes at 03:00, and auditors need to see who held what, when, and why. If any of those change, say a 5-person startup, the approval step is overkill and you should say so.

Core answer. JIT elevation replaces standing admin membership with a short-lived, approved, attributable grant. Six stages:

  1. Request. The principal names a role, a resource, a reason, and a ticket. Scope to the resource (prod-db-admin), not to admin.
  2. Policy check. Eligibility (group membership), separation of duties (requester ≠ approver), and risk tier. This is a lookup, not a human decision.
  3. Approval. Prod requires one approver from the owning team; low tiers auto-approve with post-hoc review. Approval is the latency cost you are buying blast-radius reduction with.
  4. Fresh authentication. Re-prompt for MFA (WebAuthn) and reject a session older than ~5 minutes. A session established eight hours ago is not proof of the person at the keyboard now.
  5. Grant. Issue a temporary role session, never a permanent group add. AWS: sts:AssumeRole with DurationSeconds=3600 (the default; the role's MaxSessionDuration caps it at 12 hours). Azure PIM: eligible assignment → active assignment, defaulting to a 1-hour activation with an 8-hour ceiling.
  6. Expiry and revocation. The issuer enforces a hard TTL; the resource validates it too. Renewal requires re-approval, and total elevated time per day is capped.

Trace. 03:12 on-call requests prod-db-admin for incident INC-4471. 03:12 policy check passes. 03:13 approver taps approve in Slack. 03:13 MFA re-prompt. 03:13 AssumeRole returns credentials expiring 04:13. 03:40 incident resolved, grant revoked. 04:13 credentials expire regardless of whether anyone remembered.

Trade-offs.

ChoiceBuysCosts
Standing roleZero activation latencyPermanent blast radius; every credential is a standing target
JIT + manual approvalSmall window, named approver1–10 min to access; approver is a dependency
JIT + auto-approveFast, still time-boundedNo human gate; you rely on detection after the fact
Session credentialsExpire without cleanupApps that cache credentials keep working past TTL

Pick manual approval for prod and auto-approve below it. If your on-call cannot tolerate the approval latency, fix the escalation path rather than removing the gate.

Failure modes.

  • Clock skew. Issuer and resource disagree, so a grant looks valid after expiry. Detect by comparing issued-at/expiry across both logs; alert on skew > 30 s. Enforce expiry at the resource, not only the issuer.
  • Duplicate requests. Two approvers approve the same request and two grants appear. Use an idempotency key on the request ID; a second approval is a no-op.
  • Partial failure. Grant created, audit write fails → orphaned grant nobody is tracking. A reconciliation job lists active grants against request records and alerts on grants with no request row.
  • Approver unavailable. Escalation timer (10 min) to a backup approver, then break-glass with mandatory post-incident review. Break-glass must still be logged and time-bounded.
  • Renewal abuse. Repeated renewals quietly recreate standing access. Cap cumulative elevated hours per principal per day and alert on the cap.

Detection, not just prevention. Every activation writes to the SIEM with principal, role, resource, approver, and TTL. Alert on use outside the declared resource, on grants that outlive their TTL at the target, and on break-glass. The audit trail is the deliverable auditors actually ask for.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2

Combine just-in-time and just-enough administration.

Answer

What a strong answer sounds like

JIT and JEA answer two different questions, and combining them means the effective privilege is the intersection, not the union. JIT bounds when privilege exists: an eligible assignment that must be activated, approved, and expires on its own. JEA bounds what the resulting session can do: a constrained endpoint exposing a named set of cmdlets against a named set of targets. Neither is sufficient alone. JIT without JEA gives you a time-boxed superuser. JEA without JIT gives you a permanently reachable constrained endpoint whose role capability can be edited by anyone holding the config.

Assumptions I'd state up front: a Windows/AD estate with Entra ID P2 for PIM, PowerShell 7 JEA endpoints on jump hosts, and a ticketing system that supplies the justification string.

Mechanism

Eligibility is a standing record that grants nothing. Activation converts it into a live assignment for a bounded window, gated on MFA, justification, and optionally a human approver. The JEA endpoint is what the activated identity then connects to: it runs as a non-privileged virtual account and its role capability file decides which cmdlets and providers exist in that session. The two layers compose: the activation decides whether you can reach the endpoint at all, and the endpoint decides what reaching it buys you. Expiry closes the window; the transcript and the activation record together are the audit trail.

LayerMechanismConcrete defaultFailure signal
EligibilityEntra ID PIM eligible assignment, scoped to a resource group or roleActivation max duration defaults to 8h, configurable to 24h; MFA + justification requiredEligible assignments >90 days old with zero activations
ApprovalPIM approval workflow, or ticket-linked auto-approval for low-risk rolesApprover must respond before the request expiresMedian approval latency above 10 min at 02:00
Session scopeJEA endpoint with a .psrc role capability; VisibleCmdlets limited to the taskRuns as a non-privileged virtual account, NoLanguage modeTranscript shows a cmdlet outside the capability
Cloud equivalentAWS STS AssumeRole with a permissions boundaryDurationSeconds defaults to 3600, max 43200; role chaining capped at 1hCloudTrail AssumeRole with no matching ticket
ExpiryAutomatic deactivation at end of windowEntra access tokens live roughly an hour, so revocation lands at the next refreshActions logged after the window closed

Worked trace (hypothetical timings)

02:14. On-call engineer requests the eligible SQL Operator role, scope rg-prod-sql, 2h, justification INC0048211. 02:15. On-call lead approves; MFA satisfied; assignment goes active. 02:16. Engineer connects to the SQLOps JEA endpoint; the capability exposes Get-Service and Restart-Service for SQLSERVERAGENT only. 02:18. Restart done, transcript written to the log share. 04:15. Assignment expires; the role drops at the next token refresh. Next morning the review shows 4 minutes of a 120-minute window used, one cmdlet, one target.

Trade-offs

Approval latency is the real cost. A 10-minute approval at 02:00 is a 10-minute outage extension, which is why low-risk roles get ticket-linked auto-approval and only destructive scopes get a human. JEA endpoints cost maintenance: every new task means editing a role capability and re-testing the endpoint, and a stale capability is a silent gap. Entitlement sprawl is the slow leak: eligible assignments accumulate and nobody removes them, so the review queue, not the activation path, is where the risk concentrates.

Failure modes and detection

Approval bottleneck: activation requests time out during incidents. Alert on requests expiring unapproved. Token-refresh lag: deactivation is not instantaneous, so a revoked operator can still act for up to an hour. Treat post-window actions in the transcript as a finding. Capability drift: someone adds a wildcard to a .psrc to unblock a task. Diff role capability files in CI. Break-glass accounts bypass all of this by design; alert on every use and rotate after.

What would change the decision

If the estate is Linux-only, JEA is irrelevant and the scoping layer becomes sudoers with command allowlists or a broker like Teleport. If approval latency exceeds the incident SLA, move to auto-approval with post-hoc review rather than removing JIT.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Build a privileged-access approval model.

Answer

Core answer (first 90 seconds)

Assume just-in-time privileged access to production, human approvers, requests tied to a ticket, and a few hundred engineers. The model has four parts: route to an independent, informed approver; capture enough evidence for that approver to decide; fail closed on timeouts; and keep a separately governed emergency path.

Route by resource ownership, not by org chart. The approver is the team that owns the service or data store, because they can judge blast radius and they carry the cost of a bad grant. Independence is a hard rule: the requester never approves, and every delegate or group alias is resolved to named people and filtered against the requester. A group alias that quietly contains the requester is the classic hole: resolve it before you trust it.

The request record carries identity, ticket, requested capability, target, duration, risk tier, and the requester's recent grants. Recent grants are the field approvers actually use: "you had prod-db-write three times in ten days" turns a standing-access request into a scoped one.

Fail closed. Request TTL is 30 minutes to first response, escalate to the next tier at 60 minutes, auto-deny at 4 hours. Auto-deny is a deny, not a grant.

Worked trace (figures illustrative)

Request: engineer asks for prod-db-write on orders-primary for 2h, ticket OPS-4412, risk tier high.

tevent
0Request created, routed to owner group payments-data; requester filtered out of the approver set
0High risk → two approvers required: one owner, one security
4 minOwner approves, comment "migration OPS-4412"
22 minSecurity approver approves
22 minGrant issued, TTL 2h, auto-revoke at 2h22
60 minIf second approval missing → escalate to security on-call
4 hStill missing → auto-deny, requester notified, ticket updated

Trade-offs

Ownership routing versus a central security team: ownership is faster and better informed but inconsistent across teams; central is consistent but slow and drifts into rubber-stamping. Deciding criterion is how many distinct resource owners you have: under about ten, ownership routing collapses to a central team anyway, so spend the effort on evidence fields and rubber-stamp detection instead.

Auto-deny versus auto-approve on timeout: auto-deny blocks work at 3am, which is why the emergency path exists. Auto-approve is silent approval and defeats the model.

Failure modes and detection

  • Rubber-stamping. Per approver, over a trailing 30 days, track median decision latency and approval rate. Flag when median latency < 15s and approval rate > 95% across at least 50 decisions. Example: approver A, 412 decisions, median 6s, 99% approve → flagged. Approver B, 88 decisions, median 4 min, 71% approve → healthy.
  • Orphaned ownership. Resource owner leaves; requests sit until auto-deny. Alert on resources with no active owner.
  • Queue depth. If pending queue exceeds roughly 20, escalation fires and approvers stop reading. Watch queue depth alongside latency.
  • Emergency-path abuse. Break-glass is pre-authorized to a small set, time-boxed to 1h, auto-revoked, and requires retro-approval within 24h. More than two uses per person per quarter without a matching incident triggers review.

What would change the decision

If you have thousands of resources, you need automated ownership resolution or the model stalls at routing. If you have very few owners, drop ownership routing and invest in the evidence fields and the rubber-stamp metric instead.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Issue credentials for an approved privileged session.

Answer

Core answer (first 60–120 seconds)

Assume the grant is already approved and the requester just re-authenticated with a phishing-resistant factor. What I hand back is not a password: it is a short-lived, audience-bound credential that names the actor, the effective role, the target, and the permitted actions, and that expires on its own. Concretely: an SSH certificate signed by our CA with -V +30m and -O force-command=..., or an OIDC token-exchange result (RFC 8693) whose aud is the single target service and whose exp is 10 minutes out, sender-constrained with DPoP (RFC 9449). The grant ID goes into the credential's identity field, so every use correlates back to the approval that produced it.

Why binding works

Audience binding stops substitution because the resource server validates aud against its own identifier and rejects anything else: a token minted for billing-api is useless against payments-api. Replay is stopped by making the credential proof-of-possession rather than bearer: DPoP signs each request with a key the client holds, and the server checks the jti against a short replay cache; mTLS-bound tokens (RFC 8705) get the same property from the channel. For SSH, the CA signs the public key, so the private key never leaves the requester and there is nothing to steal in transit.

mechanismwhat it bindstypical TTLreplay defence
SSH CA certprincipals, source-address, force-command5–30 minshort expiry, key stays client-side
OIDC token exchange (RFC 8693)aud, act, exp5–15 minDPoP (RFC 9449) or mTLS (RFC 8705)
SPIFFE X.509-SVIDSPIFFE ID, trust domain1 h default in SPIREmTLS, key never leaves workload
AWS STS AssumeRolerole session, source identity1 h default, 12 h maxsession policy, no long-lived keys
Vault dynamic DB credsrole, lease IDrole default_ttlrevoke by lease ID

Worked trace: SSH cert for one session

Grant g-8842 approved for alice as dbadmin on db-prod-07, 30 minutes. At T0 she completes WebAuthn. At T0+10s the CA signs:

ssh-keygen -s /ca/priv -I "g-8842:alice" -n dbadmin \
  -V +30m -O force-command=/usr/bin/psql \
  -O source-address=10.20.0.0/16 id_ed25519.pub

The cert is valid T0+10s to T0+30m10s. The host checks the principal against TrustedUserCAKeys, enforces source-address and force-command, and at T0+30m10s ssh fails with Certificate invalid: expired. No revocation call was needed: the TTL did the work.

Failure modes and detection

  • Audience substitution: token for service A replayed to B. Detected as a 401 with an aud mismatch; alert on any occurrence, since it means a token leaked.
  • Replay: stolen bearer token reused. Detected by jti reuse in the replay cache or a DPoP proof replay. Blast radius is bounded by the TTL, not by how fast you notice.
  • Revocation lag: if CRL/OCSP propagation p99 is 4 minutes and you promise revocation within 5, set TTL ≤ 5 minutes so a revoked-but-unpropagated credential cannot outlive the promise. Detect by alerting when a credential is used after its revoke event.
  • Delivery leak: credential written to logs or env. Detect with secret scanning on the issuance path.

Trade-offs

Brokered short-lived certs beat vaulted password checkout whenever the target speaks a federation or CA protocol: no secret to rotate, no shared password. Passwords are still right for a legacy target with only a local admin account and no RADIUS/TACACS+/SSH-CA support; there, check the password out for the session and rotate it on release. The deciding question is always: can the target validate a bound, expiring credential? If yes, never hand over a reusable secret.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Integrate a vault without mistaking it for complete PAM.

Answer

Core answer. A vault gives you secret custody: encryption at rest, narrow read permissions, an audit trail, rotation. PAM gives you session governance: who may become root on which host, under what approval, with the session recorded and commands audited. Integrating a vault solves the first and leaves the second untouched. The question that decides whether you have confused them: once the credential leaves the vault, what stops the holder from exercising everything it grants? If the answer is "nothing," you have custody without governance. So the integration is two jobs: vault the secrets, then separately constrain the authority they carry.

Brokered use beats reveal, and why. Reveal hands a human the secret value; from that moment it can be copied to a laptop, pasted into a ticket, or reused after its purpose ended, and the vault has no visibility. Brokering injects the credential into the connection so the human never holds it. HashiCorp Vault's database secrets engine is the canonical case: each read mints a unique DB user with a lease, default 1h, max 24h, and Vault drops the user at expiry.

vault read database/creds/readonly
lease_id          database/creds/readonly/2f6a...
lease_duration    1h
username          v-token-readonly-9x2k...
password          A1a-...

Trace it: the app reads the lease, opens a pooled connection, and at 1h Vault revokes the user. The pool's next query fails with password authentication failed for user "v-token-readonly-9x2k". That failure is the design working, the credential cannot outlive its purpose, but only if the consumer renews the lease or reconnects. Detection is a spike in auth failures from one service, not a silent leak.

When reveal is right. A legacy appliance with a fixed admin password, a vendor console that only accepts a typed credential, or break-glass during an incident. There, brokering is impossible and checkout-with-rotation is the honest answer: the operator checks the credential out, uses it, checks it back in, and the PAM system rotates it on check-in so the next checkout gets a new value. That is CyberArk's CPM model, and it is the part a vault does not do for you.

Where a vault falls short of PAM.

CapabilityVaultPAM (CyberArk, BeyondTrust)
Secret at restEncrypted, versioned, auditedEncrypted, checkout/checkin
LifetimeDynamic leases (DB engine 1h/24h)Static, rotated on check-in
Who holds itApp or operator after readOperator only during a session
Session recordingNoKeystrokes, screen, commands
Command allow/denyNoYes, per command
Approval workflowEnterprise control groups onlyNative request/approval

Vault OSS has no approval workflow; control groups are Enterprise. If your design assumes approval, name the edition.

Failure modes, with detection.

  • Static secret in CI. A long-lived token sits in a pipeline variable; rotation upstream breaks the build at 03:00. Detection: rotation job succeeds, consumer auth errors spike minutes later.
  • Rotation locks out a consumer. A service caches the DB password in its pool and never reconnects. Detection: password authentication failed in one service's logs while others are fine.
  • Vault mistaken for PAM. You vault the root password, but the operator who checks it out still has unrestricted root, no recording, no command audit. Detection: the audit log shows a checkout and nothing about what ran. The gap is the evidence.
  • Secret in logs. Vault's audit device HMACs sensitive values with a salt, so its own log is safe; the application log is not. Detection: grep the log pipeline for the credential prefix, not the value.

Blast radius, in numbers. A shared DB account used by 40 services means one rotation must be picked up by all 40 or 40 break together. Dynamic secrets give each service its own lease, so rotation blast radius is 1. That arithmetic, not the encryption, is the argument for brokering.

Migration. Move consumers to individual ephemeral credentials, then delete the shared accounts. A shared account you have vaulted but not retired is still standing authority: the vault only narrowed who could read it.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Apply authentication and step-up to privileged operations.

Answer

What I'd say in the first two minutes

Two things to pin down before designing anything: what counts as privileged, and who decides that a step-up actually happened. Assume a control plane with ~200 privileged identities, an OIDC IdP, and a resource server fronting the admin API. Privileged means any action that changes IAM policy, deletes data, rotates keys, or moves money. The answer: the authorization server, not the client, decides whether the caller's authentication is strong and fresh enough for this action, and the resulting assertion is bound to the session, the grant, and the target.

So no client flag. X-Step-Up: true is the caller making a claim about itself. The resource server reads acr and auth_time from a token the IdP signed and compares them against a per-action policy. When they don't match, it returns an RFC 9470 challenge, WWW-Authenticate: Bearer error="insufficient_user_authentication", acr_values="...", max_age="...", and the client re-runs the ceremony.

Why binding is the whole point

A step-up assertion is a bearer credential. If it only says "user U authenticated at T at AAL3", anyone who captures it replays it for any action until it expires. Binding the token to a proof-of-possession key, DPoP (RFC 9449) or mTLS-bound tokens (RFC 8705), makes it useless off the connection it was issued for. Binding to the grant and target kills the confused-deputy case where a step-up obtained to restart one service gets replayed to delete a namespace.

Trade-offs

JIT elevation versus step-up per operation. JIT: one WebAuthn ceremony buys a 30–60 minute role grant. Roughly one prompt per shift, but the entire window is exposed if the session is hijacked. Per-operation: a ceremony per destructive call, window down to seconds, but a 40-call runbook becomes 40 ceremonies and staff start sharing credentials to avoid it. The middle is JIT for read-heavy investigation, per-operation for irreversible actions. When not to step up: read-only paths, and the break-glass account. That needs a documented path that works when the IdP is down, with post-hoc review, not a step-up that depends on the IdP.

Failure modes and how you'd see them

  • Session fixation. Attacker plants a session ID pre-auth; if you don't rotate on elevation, their session becomes privileged. Detect: assert the session ID changes at every AAL transition, and alert on any ID that appears both before and after an authentication event.
  • Lockout. Hardware key lost at 03:00, it's the only factor, control plane unreachable. Detect: step-up failure rate per identity, alert at more than 5 failures in 10 minutes for one identity; require a second registered authenticator per privileged user.
  • Replay. Log the assertion ID and alert on reuse.
  • Confused deputy. Log the (subject, sid, grant, target) tuple and alert on any tuple that doesn't match the policy that minted it.

The check itself

Python
# resource server, Python 3.12, PyJWT 2.8
POLICY = {"delete_namespace": ("urn:mace:incommon:iap:silver", 300)}  # acr, max age (s)

def authorize(claims, session, action, target):
    acr, max_age = POLICY[action]
    if claims["acr"] != acr:
        return challenge(acr, max_age)          # RFC 9470
    if time.time() - claims["auth_time"] > max_age:
        return challenge(acr, max_age)
    if claims["sid"] != session.id:             # token bound to this session
        return deny("session_mismatch")
    if claims["target"] != target:
        return deny("target_mismatch")
    return allow()

Trace it. Token minted at auth_time = T, acr = silver, sid = S1, target = ns-prod. At T+120, delete_namespace on ns-prod from S1: acr matches, age 120 ≤ 300, sid matches, target matches → allow. At T+400: age 400 > 300 → challenge. Same token presented from S2 → session_mismatch. Same token, target = ns-staging → target_mismatch.

AALSession capIdle timeoutStep-up trigger
AAL212 h30 mindestructive action, or auth_time older than 5 min
AAL312 h15 minany control-plane write

Session caps and idle timeouts are SP 800-63B's; the 5-minute freshness is our policy. That policy is the arithmetic that matters: a 12-hour session with no freshness check gives an attacker a 12-hour replay window; a 5-minute one gives 5 minutes. 144× smaller.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Design privileged session recording and monitoring.

Answer

Assumptions I'd state first: a Linux and Windows estate reached through a bastion, ~100 privileged users, privileged meaning root/sudo on Linux and Domain Admin on Windows, and PCI DSS in scope. If any of those is wrong the design shifts, so I'd confirm them before drawing anything.

The answer in 90 seconds

Record at the proxy, not on the target. A root user on the target can stop auditd, unload the recording module, or delete the file: the recorder is inside the blast radius. A bastion they don't control can't be switched off from inside the session. So the session terminates at the bastion (Teleport with session_recording: proxy, CyberArk PSM, or SSM Session Manager streaming to S3), and the target only ever sees a connection from the bastion.

Bind each recording to actor, grant, target and time by minting a short-lived certificate at session start and writing that certificate's serial into both the recording metadata and the audit trail. A recording with no matching grant, or a grant with no recording, is then a join you can alert on rather than a thing you hope about.

Then monitor the pipeline, not just the sessions. A session that started and produced no artifact is the failure that actually matters.

Where the recording lives

ModeCapturedTamper resistanceRough cost
tlog / script on the targetterminal byte stream + timingweak: root on target kills it~1 KB/s
Bastion proxy (Teleport proxy, PSM)terminal stream, or full RDP framesstrong: target can't reach the recorder~1 KB/s SSH, ~125 KB/s RDP
pam_tty_auditkeystrokes as TTY audit recordsmedium: auditd can be stopped by rootsmall, but hex-encoded and awkward to read
Screen videopixelsstrong1 Mbps and up

SSM Session Manager is the awkward middle case: it logs to S3 or CloudWatch with KMS encryption, but the agent runs as root on the instance, so a root user can kill it mid-session. Fine for low-privilege access, not for the Domain Admin path.

Redaction

pam_tty_audit has a log_passwd option; leave it disabled so password entry isn't captured. That covers prompts, not secrets typed into a shell: export AWS_SECRET_ACCESS_KEY=... lands in the recording whatever you do. The fix is upstream: issue short-lived credentials from a broker (Vault, SSM) so there is no long-lived key to paste. Post-hoc redaction of a keystroke stream is unreliable; mask at capture or don't capture.

Monitoring

Three signals, each with a detector:

  • Gaps. Join USER_START/USER_END records (or the bastion's session-open/close events) against recording artifacts on the certificate serial. Alert on start-without-artifact within five minutes.
  • Recorder health. Heartbeat from the recorder itself. Set max_log_file_action = keep_logs in auditd.conf so rotation never deletes evidence, and ship to append-only storage: S3 Object Lock in compliance mode, where even an admin with the storage credentials can't shorten the retention period.
  • Reviewer abuse. Playback is a privileged action. Log who watched which session, require a ticket ID, and alert when a reviewer opens sessions outside their on-call window.

Retention: PCI DSS 10.5.1 wants 12 months of audit history with the most recent 3 months immediately available. That's the floor, not the target.

Failure modes

  • Recorder down or disk full: sessions continue unrecorded. Detected by heartbeat plus the gap join. Without the alert you find out at audit time.
  • Target-side tampering: root stops auditd. Detected by restart events and missing heartbeats; mitigated by recording at the proxy.
  • Storage growth: 100 users × 2 sessions/day × 30 min at ~1 KB/s is ~360 MB/day, ~130 GB/year for terminal capture. The same sessions as 1080p video at 1 Mbps is ~45 GB/day, ~16 TB/year. Illustrative figures, but they're why terminal capture is the default and screen capture is the exception.

When not to record

Read-only break-glass accounts, sessions to systems holding no privileged data, and any session that would capture regulated third-party content you aren't allowed to store. For those, use command-level audit (auditd execve rules) instead of full session capture, and write the exemption into the policy so it's a decision rather than an oversight.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Implement command-level privileged policy.

Answer

Say this first. Assume Linux, sudo 1.9.x, and a requirement that a group of operators run a handful of privileged operations without handing out root. The answer is to stop writing policy over command strings and write it over a structured request (argv array, resolved absolute path, caller uid/gid, cwd, environment) enforced at one trusted boundary. In practice that is either sudoers with exact paths and no wildcards, or a small privileged broker that accepts a JSON argv over a Unix socket and calls execve itself. Anything that relies on users not typing a dangerous command is not a policy.

Why string matching fails. sudoers matches the command line as a single concatenated string, so a * matches across argument boundaries. And sudo does not invoke a shell (;, | and && arrive as literal argv) but the program you allowed may exec on its own: find -exec, tar --checkpoint-action=exec, vi with :!sh, less with !sh, awk with system(), git -c core.pager=....

Trace it. A tight policy looks like this:

Cmnd_Alias OPS = /usr/bin/systemctl restart nginx, /usr/bin/systemctl reload nginx
alice ALL=(root) NOPASSWD: OPS

sudo -l as alice lists exactly those two commands. Now the tempting version: alice ALL=(root) /usr/bin/find *. Alice runs sudo find / -name x -exec /bin/sh \;. sudo matches, the wildcard swallows the arguments, execs find as root, and find execs /bin/sh as root. One line, full root. The same shape applies to sudo /usr/bin/vi /etc/hosts followed by :!sh.

Two fixes for the editor case. Use sudoedit (sudo -e): sudo copies the file into a temp directory owned by the invoking user, runs the editor as that user, then writes the result back as root. Or tag the command NOEXEC: so an LD_PRELOAD shim blocks the child exec: with the caveat that it does not cover statically linked binaries.

Pick the enforcement point.

pointwhat it seesbreaks when
sudoersresolved path + concatenated argvwildcards, exec-capable programs, PATH
broker (Unix socket + SO_PEERCRED)structured argv, caller uid/gid/pidbroker bug; it needs its own authorization
target-side (capabilities, seccomp, AppArmor)syscalls of the processprofile drift; awkward for "restart nginx"

Details that decide it. sudoers entries must be absolute paths; sudo resolves the typed name against PATH (or secure_path when set) and matches the resolved path, so a user-writable PATH directory cannot smuggle a binary in, but a user-writable target of an allowed command can. Defaults env_reset is on by default; keep it, and never env_keep EDITOR, VISUAL, PAGER or LD_*. Log with Defaults log_output into iolog_dir for session replay; sudo writes to syslog/journald. Check-and-exec must land on the same inode: open with O_PATH, fstat, then fexecve, or let the broker own the file.

When this is the wrong tool. If the operation is "restart nginx", grant a systemd unit plus a polkit rule, or a capability such as CAP_NET_BIND_SERVICE, rather than a command. If it is "read one file", ship a setuid helper that opens the path itself. Command-level policy is the fallback for when you cannot change the target program.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Control a legacy system that supports one shared admin account.

Answer

Assumptions first. The system has no per-user account model (no LDAP/AD bind, no local user creation) and at least one human operator needs interactive admin access. If either is false, the answer changes (see the last section). The goal is not to hide the shared password better; it is to make every use of it attributable to a named human.

The core answer. Put the credential in a broker and never hand it out. Each operator authenticates as themselves (SSO + MFA), gets a scoped, time-boxed grant, and the broker injects the credential into the session. The shared account becomes an implementation detail behind the broker. Concretely: HashiCorp Vault's SSH secrets engine signs a short-lived SSH certificate for the operator, or CyberArk PSM proxies the session and types the password on the operator's behalf. Either way the operator never sees the secret, and every request is logged with the human identity attached.

Why it works. The secret never lands on the operator's disk, shell history, or CI variables, so the usual leak paths are closed by construction. The broker is the only thing that knows the password, so every use is a request that can be approved, denied, and logged. Without the broker, the shared password gets copied into chat, .bash_history, and job configs, and you cannot tell who used it.

A trace. Operator runs vault ssh -role=legacy-admin -mode=ca admin@legacy01. Vault checks the operator's SSO token, checks the policy allows role legacy-admin, signs an SSH cert with principal admin and a TTL you set (15–60 minutes is typical), and writes an audit entry with the operator's entity ID and the cert serial. The SSH client presents the cert; sshd on legacy01 accepts it because TrustedUserCAKeys points at Vault's public key. No password exists on the operator's machine. The session ID ties entity ID → cert serial → target host → start/end.

Options, and when each fails.

optionaccountabilityblast radiusfails when
Shared password in a vault, checked outMedium: checkout is logged, but the password works anywhere until rotatedWhole account until rotationOperator copies it out; no session binding
Brokered JIT session (Vault SSH CA, CyberArk PSM)High: per-request identity, short TTLMinutes, one hostSystem can't be proxied; automation needs a service identity
Named or federated accountsHighestPer-userLegacy app has no user model

Failure modes and detection.

  1. Credential leaks via shell history or process args. Operator runs mysql -p$PASS or exports the password. Detect: the broker injects rather than reveals, and EDR/auditd rules alert on the shared password appearing in command lines or files. If you must check out the raw password, rotate on check-in: CyberArk CPM does this.
  2. Session hijack after approval. Attacker steals the operator's SSH agent or session token. Detect: bind the grant to the operator's device with an mTLS client cert, keep TTL short, and alert on two concurrent sessions for the same grant from different source IPs.
  3. Log tampering by the same admin. The shared account is root on the box, so it can edit /var/log/auth.log. Detect: ship logs off-host in real time to a separate trust domain (remote syslog, append-only object storage with Object Lock), run file-integrity monitoring (auditd, AIDE) on the local log, and send Vault's audit device output to a sink the target admin cannot reach.
  4. Bypass. Operator connects directly to legacy01:22 instead of through the proxy. Detect: firewall rules that only allow the broker's IP to reach the admin port, plus flow logs alerting on direct connections.

When brokering is not worth it. If the account is used by an automated batch job, JIT human approval is the wrong tool: give the job its own credential in the broker with a machine identity and keep the human path separate. If the system is an appliance with only a web console and no SSH, you are down to PSM-style screen recording or a network-level proxy. Replacing the shared account with named or federated administration is the real fix; brokering buys you evidence and time while you do it.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

How do you discover unmanaged privileged service accounts across a hybrid estate and rotate their credentials without breaking the dependencies that use them?

Answer

You can't rotate what you can't enumerate, and asking owners doesn't enumerate it: the accounts that hurt are the ones nobody remembers. So discovery runs off evidence of authentication, and rotation is gated on a consumer map built from that same evidence.

Discovery: three passes, then reconcile.

  1. Declared inventory: CMDB, AD service accounts (including gMSAs and accounts holding SPNs), cloud IAM users with access keys, GCP service accounts with user-managed keys, Entra service principals and app registrations, Kubernetes ServiceAccounts, vault entries, CI/CD secret stores.
  2. Observed use: authentication logs are the ground truth: Windows 4769/4624, SSH auth logs, database audit logs, cloud trail events, and EDR or network telemetry showing a process authenticating outbound. Anything authenticating that isn't in pass 1 is unmanaged by definition.
  3. Static material: repo and image scanning (gitleaks, trufflehog), config sweeps, and filesystem checks for non-login accounts with shells in /etc/passwd, credentials in systemd unit files, cron, and sudoers.

Reconcile the three into one record per credential: secret identifier, target, and the set of consumers (host, workload identity, human). The consumers are what decide whether rotation is safe.

SourceFindsBlind spot
Directory / cloud IAM exportDeclared accounts, key agesAccounts created outside IaC
Auth logs (4769, SSH, DB audit)Who actually authenticatesLong-lived pooled sessions that never re-auth
Repo / image scanningHardcoded stringsSecrets injected at deploy time, vendor appliances

Rotation: eliminate first, then overlap.

The cheapest rotation is the one you delete. Replace static secrets with gMSAs (AD rotates the password every 30 days automatically), cloud workload identity federation or IRSA, OIDC, short-lived certificates, or dynamic secrets with a TTL (Vault's database engine at 1 hour). Nothing to rotate, nothing to break.

Where a static secret must stay, rotate with overlap, never in place:

  1. Create credential version N+1 alongside N.
  2. Distribute to every consumer in the map via config management or an agent pull.
  3. Reload or restart consumers, or wait out their cache: the grace window must exceed the longest token or ticket lifetime in play (AD Kerberos tickets default to 10 hours; a DB connection pool can hold a session indefinitely).
  4. Verify with a synthetic authentication as each consumer.
  5. Revoke N, then alert on any authentication with N. Use after revocation means an undiscovered consumer: that alert is the discovery loop closing.

Failure modes. A monthly batch job rotated on a 7-day cycle breaks silently until month end: the grace window must exceed the longest consumer period, not the shortest. Connection pools keep working on the old credential until the pool recycles, so revocation looks clean and fails at 03:00. Vendor appliances and embedded binaries can't take a new secret: those get a documented exception, network restriction to known source addresses, and a compensating control, not a fake rotation. And a rotation that fails halfway leaves two live credentials; the runbook must be able to revoke N+1 and roll back.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Design PAM controls for workloads and automation.

Answer

Core answer (first 90 seconds)

Assume workloads run on Kubernetes and cloud VMs, CI is GitHub Actions, and humans already have SSO with MFA. The goal: no workload ever holds a long-lived secret, and every privileged action traces to an attested identity.

The answer is a three-stage chain: attest, federate, expire.

  1. Attest. The platform proves what the workload is. On Kubernetes, SPIRE node attestation (k8s_psat) plus workload attestation on namespace, service account, and pod label yields a SPIFFE ID like spiffe://prod.acme/payments/api. On EC2, IAM Roles Anywhere uses the instance's X.509 certificate.
  2. Federate. That attested identity exchanges for a credential at the target system: SPIFFE JWT-SVID into Vault auth for dynamic DB credentials, or a GitHub OIDC token into sts:AssumeRoleWithWebIdentity.
  3. Expire. TTLs are short and renewal is automatic. SPIRE X.509-SVIDs default to a 1-hour TTL; Kubernetes bound service-account tokens default to 1 hour and the kubelet rotates at 80% of lifetime; Vault dynamic secrets live for the role's TTL, commonly 1 hour.

PAM controls sit on top: no human keys in CI variables, impersonation into the workload role restricted to named principals, deploy-time and runtime authority split into separate roles, trust roots rotated, owners inventoried, revocation on retirement.

Why it works

The security property is that the credential is bound to claims the issuer re-checks at exchange time. A stolen token is useful only until TTL and only from a context matching the audience and subject condition. That is the difference from a static key: blast radius is bounded in time and in claims.

Trade-offs

  • Attestation infrastructure is a hard dependency. If the SPIRE server is down, new SVIDs cannot be issued; existing ones survive until TTL. TTL is therefore an availability/security dial: 1 hour is a sane default, 5 minutes tightens blast radius but multiplies issuer load and demands clock sync.
  • Federation versus direct trust: OIDC federation avoids distributing keys but couples you to the IdP's availability and claim format.
  • Break-glass: keep one audited, alerting human path rather than pretending it does not exist.

Failure modes and detection

  • Over-broad trust policy. A GitHub OIDC condition on aud alone, or a wildcarded sub, lets any repo in the org assume the prod role. Detect via CloudTrail AssumeRoleWithWebIdentity events whose sub does not match the expected repo/environment.
  • Token replay. A leaked JWT used from an unexpected IP or region before TTL. Detect via source-IP/ASN anomaly on AssumeRole.
  • Attestation selector spoofing. A pod that can set arbitrary labels obtains a privileged SPIFFE ID. Detect via SPIRE registration-entry review.
  • A long-lived key sneaks back in. A CI secret or .env with a static key. Detect via secret scanning plus alerting on non-federated credential use.

Artefact: GitHub Actions to AWS, scoped by subject

JSON
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"Federated": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com"},
    "Action": "sts:AssumeRoleWithWebIdentity",
    "Condition": {
      "StringEquals": {
        "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
        "token.actions.githubusercontent.com:sub": "repo:acme/payments:environment:prod"
      }
    }
  }]
}

Trace: the workflow requests an OIDC token with audience sts.amazonaws.com; GitHub signs it with sub: repo:acme/payments:environment:prod; the call to AssumeRoleWithWebIdentity succeeds only if both conditions match, returning credentials with a 1-hour default session (role max session duration caps this, up to 12 hours). A token from repo:acme/other fails the sub check and is denied.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

Secure PAM connectors, agents, and target integrations.

Answer

Assume the PAM platform itself is trusted; the question is the boundary between it and everything it touches. My answer: treat every connector and agent as a privileged identity in its own right, give it the narrowest credential that still reaches its targets, and make its trust root short-lived and independently revocable. The vault is not the risk: the connector's target list is.

Why agents are the high-risk surface. An agent runs as root or SYSTEM on every managed host, holds a bootstrap token or a local cache, and can fetch credentials for that host's accounts. Compromise one agent and the attacker gets the host's privileged accounts without ever touching the vault. So agents should be outbound-only (no inbound listener), authenticate with a per-host identity (an mTLS client cert or host key, not a shared service account) and cache nothing past a short TTL. The difference is blast radius: 200 hosts with per-host identities means one compromise is one host; 200 hosts sharing a domain service account means one compromise is 200.

Why the connector's trust root enables lateral movement. A connector holds a service account on the target (a domain account in the target AD, a local admin on a database) plus the CA that signed its client cert. If that CA key or the service account leaks, the attacker inherits every target the connector can reach. Lateral movement is the connector's target list, not the vault's. Keep the connector's CA separate from the platform's user-facing CA, scope the service account to the specific targets, and rotate it on its own schedule.

Trade-offs. Agent-based gives local enforcement and works where the target has no API, but puts code on every host and needs an update path. Agentless (SSH proxy, target API) leaves no host footprint but centralizes target credentials and needs network reachability. For a handful of targets, a jump host with an SSH CA is cheaper than deploying agents: the agent is not worth its cost below roughly a few dozen hosts. Short-lived SSH CA certs (5–15 minutes is typical) beat password rotation for Linux, but they need a working CA and clock sync; a skewed host fails closed and locks out.

Rotation without outage means dual accounts: A is live while B rotates, then swap. Trace it:

  1. Connector reads B's current password from the vault.
  2. Connector logs into the target as B and sets the new password.
  3. Connector verifies login with the new password.
  4. Vault stores the new value for B.
  5. Next cycle rotates A.

If step 3 fails, the vault keeps the old value and alerts; A is still live, so no outage. Single-account rotation cannot do this: that is the cost of the simpler design.

Failure modes and detection. Expired connector cert: onboarding fails for every target behind it. Caught by a connector health check, not by users. Partial rotation: some targets still on the old password. Caught by a reconciliation job diffing vault against target. Agent rollback: an old agent with a known CVE. Caught by a version-drift report. Target removal: an orphaned privileged account. Caught by account reconciliation. Ports to allow: SSH 22, RDP 3389, WinRM 5986, LDAPS 636, and the vault's own port (CyberArk Vault uses 1858). TLS connector certs are commonly 90 days to a year; pick the shorter end and automate renewal, because a manual renewal is the outage you were trying to avoid.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Prevent confused-deputy and target-substitution attacks.

Answer

Assume a multi-tenant system where a broker holds credentials and acts for callers, and the caller supplies the target's name. The core answer: the caller's name for the target must never be the thing you authorize on. Resolve it once to an immutable internal ID, authorize the tuple (requester, target ID, action, purpose), mint a credential whose audience is that ID, and connect to the address you resolved. A deputy that can only act on the target it was approved for cannot be confused.

Why each piece does work:

  • Audience binding. A token with aud=svc-7f3a is rejected by svc-9c1b, because the resource server compares aud to its own identifier. RFC 9068 requires aud in a JWT access token; RFC 8707 lets the client request the resource at the authorization server so the token is minted for it. Substitution fails at the first hop.
  • Canonical ID over name. Authorizing on reports.internal.example and connecting later is a TOCTOU: DNS can re-resolve between check and connect (rebinding). Resolve once, pin the IP, and check the resolved IP against an egress allowlist: link-local 169.254.169.254 and RFC 1918 ranges blocked unless explicitly allowed. That kills the metadata-endpoint variant.
  • Purpose and expiry. A grant scoped to purpose=invoice-export, exp=now+300, and a unique jti bounds blast radius and makes replay detectable.
  • Sender-constraining. Bearer tokens are replayable by anyone who reads them; DPoP (RFC 9449) or mTLS-bound tokens (RFC 8705) tie the credential to the caller's key.

Alternatives and cost. The cheap alternative is a static allowlist of target IDs checked in-process: fine when the target set is small, static, and the caller is fully trusted (a single-tenant internal service). It fails the moment targets are dynamic or callers are external. Token exchange (RFC 8693) is the general mechanism but adds a round trip to the authorization server, single-digit to low-tens of milliseconds intra-region in a typical deployment, and a hard dependency: if the AS is down, no new grants. Per-target tokens also fragment caches, so a hot path that used one broad token now holds N. If you cannot change the client, you cannot deploy DPoP; fall back to short expiry plus audience binding. And if the target set is genuinely one static endpoint, a broker is over-engineering: a config check is enough.

Failure modes and detection:

  • Sibling-tenant replay: token for A presented at B. Manifests as 401/403 with an aud mismatch. Alert on a spike in audience-mismatch rejections per target.
  • DNS rebinding: attacker hostname flips to 169.254.169.254. Manifests as an egress connect to link-local from a service that never does that. Alert on any connect to metadata IPs.
  • TOCTOU target swap: authorized ID ≠ connected peer ID. Log both; a mismatch is a page.
  • Replay: duplicate jti at the target. Reject and count.

Worked trace (hypothetical). Caller sends {target: "reports.internal.example", action: "read", purpose: "invoice-export"} with user token sub=alice, tenant=t1.

  1. Broker resolves the name once → ID svc-7f3a, IP 10.2.3.4; pins the IP.
  2. Policy check: alice@t1 may read svc-7f3a for invoice-export → pass.
  3. Broker exchanges the user token (RFC 8693) with audience=svc-7f3a; the AS returns a JWT aud=svc-7f3a, exp=+300s, jti=<uuid>.
  4. Broker connects to 10.2.3.4 and presents it. Target checks aud == svc-7f3a → pass.
  5. Attacker replays the same token at svc-9c1b: aud is svc-7f3a, the target's ID is svc-9c1b → 401, no data.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Design safe delegation and impersonation.

Answer

Assumptions. Two flows: a support engineer acting as a customer through an internal console, and service A calling service B on behalf of the end user. Identity is OIDC, one token service issues everything, and targets validate JWTs offline. If actor and subject are the same person, stop: use the actor's own token and skip this design entirely.

The 90-second answer. Never hand the actor the principal's credentials. Mint a derived credential that names both parties: sub is the effective principal, act is the actor, and act nests once per hop. Authorize the delegation where it starts, the actor must hold a grant saying "may act as customer 8812 for orders:read on billing-api", and have the target enforce the intersection of the actor's authority, the subject's authority, and the grant scope. Audience-bind the token, keep it under 15 minutes, and log both identities under one correlation ID.

Mechanism. RFC 8693 token exchange is the standard shape. The console presents the customer's token as subject_token and its own as actor_token:

POST /token HTTP/1.1
Host: as.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&subject_token=<customer access token>
&subject_token_type=urn:ietf:params:oauth:token-type:access_token
&actor_token=<support engineer token>
&actor_token_type=urn:ietf:params:oauth:token-type:access_token
&requested_token_type=urn:ietf:params:oauth:token-type:access_token
&audience=https://billing-api.example.com
&scope=orders:read

The result is a JWT whose payload carries the chain:

JSON
{
  "iss": "https://as.example.com",
  "sub": "customer:8812",
  "aud": "https://billing-api.example.com",
  "scope": "orders:read",
  "iat": 1735688700,
  "exp": 1735689600,
  "act": { "sub": "support:jdoe", "act": { "sub": "svc:support-console" } }
}

How the confused deputy actually unfolds. billing-api holds orders:read for every customer because batch jobs need it. The console calls GET /orders?customer=8812. If billing-api checks only its own permission, any caller who can reach it reads any customer's orders: the API is the deputy, confused by a caller-supplied parameter. The fix is that the target checks the caller's authority, not its own:

  1. Signature valid, aud == billing-api, exp not passed.
  2. sub == 8812, the customer named in the path.
  3. act.sub holds support:impersonate scoped to orders:read.

If the console instead sends its own token (sub=svc:support-console) with ?customer=8812, step 2 fails. The broad permission never gets spent on the caller's behalf.

Choosing a design.

DesignTarget learns actor viaOnward delegationRevocationUse when
Constrained delegation (Kerberos S4U2Proxy, AD msDS-AllowedToDelegateTo)Protocol, target list fixed on the delegating accountOnly to enumerated SPNsKDC-issued, TTL-boundWindows/AD estates, fixed service topology
Token exchange brokering (RFC 8693)act claimExplicit: each hop re-exchanges; may_act gates who mayShort TTL plus introspection or a revocation listCross-domain HTTP APIs, multi-tenant
Impersonation header (Kubernetes Impersonate-User)Header, honored only by the API serverNone; consumed at the API serverImmediate, nothing to revokeCluster-internal, single trust boundary

Failure modes. Unrestricted onward delegation: a service that can exchange any token for any audience becomes a token mint. Bind may_act and reject exchanges where the actor isn't in it. Header trust: X-On-Behalf-Of accepted from the network is forgeable; only the API server or gateway may honor it. Chain truncation: a hop that drops act erases the human from the audit trail. Revocation lag: stateless JWTs stay valid until exp, so cap TTL at 15 minutes or check a revocation list per request. AWS STS caps role-chained sessions at one hour regardless of DurationSeconds (default 3600, max 43200) and carries SourceIdentity across the chain; GCP generateAccessToken caps at 3600 s and needs roles/iam.serviceAccountTokenCreator.

When not to. If the target can't validate a chain, don't delegate: broker at a gateway that can. If the actor needs the subject's data only in aggregate, give them a scoped read role instead of impersonation; impersonation is for when the target must see the principal's own identity.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Design third-party privileged support access.

Answer

What I'd say first

Assume the vendor's engineers need interactive shell and database access to production to debug their own product, and that you can require them to federate. Then the answer is: no standing vendor credentials. Federate the vendor's IdP into yours, map one small group to one role, and let that role be granted only through a just-in-time broker that binds a ticket, a target, an action set, and a TTL. Network path, recording, and offboarding all hang off that one decision.

Mechanism

Identity: the vendor IdP federates via SAML or OIDC into your IdP (Okta, Entra ID). SCIM pushes group membership, so when the vendor removes an engineer the group shrinks within minutes and you never hold their password. Require phishing-resistant MFA (WebAuthn) for the privileged group specifically: TOTP is the weak link.

Authorization: JIT. The engineer files a request in your PAM (Teleport Access Request, StrongDM, CyberArk) naming the ticket, the exact host, the role, and a duration. An internal approver, not the vendor, approves. Approval mints a short-lived certificate. Teleport's default max session TTL is 8h; set vendors to 1–4h.

Network: access terminates at a session broker or bastion, not a VPN into the VPC. The target's security group accepts only the broker, and the vendor session has no route to other subnets or the internet.

Oversight: session recording plus command logging, with live join so an internal engineer can watch the session while it runs.

Trade-offs

Standing account vs JIT: standing is one less step, but you can't answer "who could touch prod at 3am" and offboarding lags. JIT costs an approval and needs an approver on call.

Federate the vendor IdP vs issue your own credentials: federation inherits their MFA and lifecycle, but also their compromise. If the vendor can't federate, issue credentials in your IdP with hardware keys you control and accept the lifecycle burden.

Full recording vs command-only: recording is heavier storage but gives forensic replay; command-only is cheaper and misses file transfers.

When not to: if the vendor only needs telemetry, give a scoped read-only role or a data export, not interactive access.

Failure modes

  • Vendor IdP compromise: an attacker authenticates as a vendor engineer. Detect by alerting on vendor-group logins outside the vendor's business hours or from new ASNs; per-session internal approval means a compromised IdP alone isn't enough.
  • Sponsor departs: nobody approves or attests. Detect with a quarterly attestation job that fails when the sponsor is deprovisioned.
  • Dormant access: engineer still in the group but idle 90 days. Detect via last-login report; auto-remove at 90 days.
  • Session left open: TTL expiry kills it; the broker audit shows the close.

Artefacts

TierIdentityGrantTTLNetwork
Read-only telemetryfederatedstanding rolen/adata export, no shell
Interactive debugfederated + WebAuthnJIT, ticket-bound4hbroker only, no egress
Break-glassfederated + WebAuthnJIT, two approvers1hbroker, full recording, page on use

Operational cost, real arithmetic: 40 vendor engineers × 3 sessions/week = 120 sessions/week ≈ 17 approvals/day at a 2h TTL. That is the price of JIT: staff an approver rota or the queue becomes the reason people share credentials.

Role sketch (illustrative shape; check your broker's schema):

YAML
kind: role
version: v6
metadata: {name: vendor-support}
spec:
  options:
    max_session_ttl: 4h
    require_session_mfa: true
  allow:
    logins: ['support']
    node_labels: {'support-scope': ['billing-api']}
  deny:
    node_labels: {'data-class': ['pci']}

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Design and test break-glass access.

Answer

Core answer (first 90 seconds)

Break-glass is the path that still works when the control plane you'd normally use to grant access is the thing that's broken. So the design question isn't "what's a powerful emergency account": it's "which dependencies does this path share with normal access, and how do I remove them."

State assumptions up front: the failure you're designing for is loss of the primary IdP, PAM, or the region holding them; a small number of engineers need this; and break-glass is a high-risk, low-frequency path that must be loud.

Two properties matter, and they're independent:

  1. The credential path must not traverse the failed component.
  2. The detection path must not traverse the failed component either: an alert that depends on the IdP you just lost is not an alert.

Why isolation beats rotation

Rotating a break-glass password on a schedule doesn't help if the retrieval path runs through the same IdP that's down. Isolation is structural: the credential lives somewhere the outage can't reach, and the retrieval mechanism is offline or in a separate trust domain.

Concrete design

  • Two emergency identities, cloud-only, in a dedicated account, not federated to the primary IdP. Microsoft's guidance for Entra ID is exactly this: two cloud-only accounts on the .onmicrosoft.com domain, excluded from every Conditional Access policy, with sign-in alerts. Two, not one, because one is a single point of failure and you need to test one while the other stays cold.
  • Scope: an SCP (or equivalent) that denies everything except the break-glass role ARN. The role's session is short: AWS STS AssumeRole defaults to 3600 s and you can cap MaxSessionDuration at 43200 s (12 h); set it to 1 h so a forgotten session dies on its own.
  • Custody: split the unseal/decrypt material with Shamir's Secret Sharing. Vault's operator init defaults to 5 shares with a threshold of 3. That gives you two-person control with arithmetic behind it: any 3 of 5 custodians can reconstruct; any 2 learn nothing (information-theoretic, not computational). C(5,2) = 10 pairs that cannot reconstruct.
  • Detection: CloudTrail (or the cloud audit log) delivered to a separate account with object lock, plus a pager alert on any use of the break-glass role. Target: page within 60 s. The alert must not depend on the IdP.

Worked trace

  1. Primary IdP is down; SSO fails for everyone.
  2. On-call retrieves their share; three custodians each submit a share; Vault unseals.
  3. Engineer assumes the break-glass role; STS issues a 1-hour session.
  4. CloudTrail event lands in the locked account; pager fires within 60 s.
  5. Engineer does the minimum, then the session expires at 1 h.
  6. Post-incident: rotate the credential, re-split shares, review the trace.

Failure modes

FailureDetectionBreak-glass response
IdP downSSO error rate spikesCloud-only accounts, not federated
PAM downVault/teleport health check failsShamir shares held offline
Region lossControl-plane API errorsBreak-glass in a second region/account
Logging tamperedCloudTrail gap alertLogs in a separate locked account
Alert path downPager test failsSecondary out-of-band channel

Testing

Test quarterly, and a test only counts if it exercises the real path: retrieve shares, unseal, assume the role, confirm the alert fires, confirm the session expires. Rotate after every test or use. Review every attempt, including failed ones, and verify that recovery doesn't depend on the component you just simulated losing. Never use break-glass for routine work; the moment it's routine, it's not break-glass.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Control irreducible root and tenant-owner credentials.

Answer

Assume a multi-account AWS organization plus an Entra ID tenant, one platform team, and no regulator demanding a standing named owner.

The 90-second answer. Root and tenant-owner credentials are recovery credentials, not admin credentials. The objective is not "protect them well": it is to make them unusable for daily work and provably usable in an emergency. Three moves: shrink the task list to what only root can do, make the credential unusable outside a declared window, and rehearse recovery until it is boring.

1. Shrink the list. In AWS, root is required for a short, closed set: closing the account, changing the support plan, changing the account name/email/root password, enabling MFA Delete on an S3 bucket, restoring an IAM policy that denies everything, and enabling a new region. Billing views, IAM administration, S3, RDS: all of it goes to IAM Identity Center permission sets or assumable roles. In Entra, the equivalent is Global Administrator; most of what people use it for is covered by narrower roles (Privileged Role Administrator, Application Administrator, User Administrator).

2. Make it unusable outside a window.

AWS account rootEntra ID Global Administrator
Irreducible tasksclose account, support plan, account name/email/root password, S3 MFA Delete, restore deny-all policy, enable regiontenant-wide settings with no narrower role; sign-in when Conditional Access or federation is broken
BoundarySCP denying everything except a NotAction list; no access keys; hardware MFAPIM: eligible, not active; approval + MFA + justification; 8-hour activation cap; two cloud-only break-glass accounts excluded from CA
DetectionGuardDuty Policy:IAMUser/RootCredentialUsage; CloudTrail userIdentity.type = RootEntra sign-in log alert on break-glass sign-in; PIM audit log

For member accounts, an SCP does the enforcement, and note SCPs do not apply to the management account, which is why that account's root gets no keys and a CloudTrail alarm instead:

JSON
{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "RootOnlyForBreakGlassTasks",
    "Effect": "Deny",
    "NotAction": [
      "account:CloseAccount",
      "account:EnableRegion",
      "iam:UpdateAccountPasswordPolicy",
      "iam:CreateVirtualMFADevice",
      "iam:EnableMFADevice",
      "iam:DeactivateMFADevice",
      "iam:DeleteVirtualMFADevice",
      "s3:PutBucketVersioning"
    ],
    "Resource": "*",
    "Condition": {"StringLike": {"aws:PrincipalArn": "arn:aws:iam::*:root"}}
  }]
}

Because iam:CreateAccessKey is not in the list, a compromised root session in a member account cannot mint a long-lived key. That is the mechanism, not a slogan.

3. Rehearse. Quarterly: sign in as root, rotate the password, confirm the recovery email and phone still reach a current employee, and confirm the break-glass accounts still work with Conditional Access on. An untested recovery path is a hypothesis.

Failure modes.

  • Root key created by a script. Detection: GuardDuty Policy:IAMUser/RootCredentialUsage plus a CloudTrail event with userIdentity.type = Root and a non-null accessKeyId. Cost: rotate, then audit every call the key made.
  • Break-glass becomes the daily admin because PIM approval is slow. Detection: sign-in count on the break-glass account exceeds one per quarter. Cost: that account is excluded from Conditional Access, so one phished password is tenant takeover.
  • Recovery path rots. Root email points at a departed contractor's mailbox. Detection: the quarterly game day fails. Cost: hours to days in an AWS account-recovery support case while production is down.

Trade-offs. JIT elevation (PIM, Identity Center permission sets) beats standing access because it shrinks the window an attacker can use, but it adds an approval hop that people route around if it is slow: measure activation latency, not just activation count. Hardware FIDO2 keys beat TOTP apps for root because TOTP is phishable in real time; passkeys are fine where the provider supports them. If a regulator requires a named human with standing owner access, keep it, but add dual control and session recording rather than pretending the risk is gone. In a single-account AWS setup with no organization, SCPs are unavailable: you fall back to no keys, hardware MFA, and CloudTrail alarms.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Design privileged joiner-mover-leaver controls.

Answer

Clarify and assumptions. I'll assume Workday as the authoritative source, an IGA/IdP layer (Okta or Entra ID + SailPoint), a PAM vault (CyberArk) for privileged credentials, and cloud IAM (AWS IAM Identity Center, Entra ID). "Privileged" means standing admin in a target system or custody of a shared secret. The design question is what makes a lifecycle event actually revoke authority, and in what order.

Core answer. The control is a pipeline, not a checklist: authoritative event → identity correlation → entitlement decision → enforcement in every target → reconciliation. The load-bearing decision is that eligibility and access are separate. HR group membership makes you eligible to request privileged access; it never grants it. Access is granted just-in-time, approved, time-boxed (say 8 hours), and recorded.

For a leaver, ordering matters because each step closes a different channel:

  1. Block new authentication: disable the account / set sign-in blocked. Closes password and new-token issuance.
  2. Kill live sessions and revoke tokens: terminate PAM sessions, revoke Entra ID refresh tokens, revoke AWS STS sessions. Disabling an account does not invalidate an already-issued Kerberos TGT (10-hour default lifetime in AD) or a 1-hour STS session. This is the step people skip.
  3. Revoke derived credentials: API keys, OAuth grants, client certificates, SSH keys.
  4. Rotate shared secrets the leaver could read: vault passwords, service-account credentials.
  5. Transfer ownership: automation, IaC pipelines, on-call, workload owners.
  6. Reconcile: compare authoritative active identities against every target; alert on drift.
stepcloseswhy it sits here
block sign-innew authcheap and immediate, but doesn't touch live sessions
kill sessions / revoke tokensexisting sessionsTGTs, STS sessions and refresh tokens outlive the disable
revoke derived credsnon-interactive accessAPI keys never traverse the IdP
rotate shared secretsknowledge-based accessthe leaver may have memorized the vault password
transfer ownershiporphaned automationpipelines break or run unowned
reconcilemissed targetsconnector failures are silent

Trade-off: feed cadence. A daily HR batch is cheap and simple but leaves up to 24 hours of exposure. Event-driven (SCIM/webhook) cuts that to minutes but needs per-target connectors and error handling. Deciding criteria: privileged headcount and blast radius. Arithmetic: 200 privileged identities at 20% annual attrition is 40 leavers a year. Daily feed plus 15 minutes of processing is up to 24h15m each, roughly 970 identity-hours of exposure; event-driven at 15 minutes is about 10 identity-hours. That is the argument for event-driven on privileged accounts only, batch on standard ones.

Alternatives. Quarterly access recertification as the primary control gives up to 90 days of exposure: use it as a backstop, not the mechanism. Delete versus disable: disable. Deleting an AD account leaves unresolvable SIDs in ACLs and orphans ownership; keep it disabled for audit. Rehire: don't reactivate the old account. Re-provision and re-certify, because the old grants are stale.

Failure modes. Failed connector: HR says terminated, the AWS connector fails silently, and the account survives. Detect with a reconciliation drift report that alerts when drift age exceeds the SLO (15 minutes for privileged). Mover creep: entitlements accumulate across role changes; detect by diffing current entitlements against the role baseline. Legal hold: disable but preserve data, which conflicts with "delete everything". The control must branch on the hold flag before any deletion. Emergency custody: the break-glass account must not depend on the leaver's MFA device; re-enroll hardware as part of the leaver run.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Implement end-to-end privileged-access revocation.

Answer

Core answer (first 90 seconds)

Revocation isn't one call. Privileged authority is copied at issuance into four places (issued credentials, live sessions, cached decisions, and the identity record) and each copy has its own kill switch and its own worst-case residual window. Implement it as a fan-out with a measured SLA: stop new issuance, invalidate credentials, terminate sessions, flush caches, then measure time-from-revoke to first-denied-request per target.

Assumptions I'd state: the IdP is the source of truth, targets are reachable from a control plane, and the business tolerates a residual window in minutes. If it doesn't, an attacker holding a live domain-admin session, you escalate to the nuclear options.

Mechanism per class

Issued credentials. OIDC/JWT access tokens are stateless: the resource server checks signature and exp and never calls back, so there is nothing to revoke. Entra ID's default access-token lifetime is 1 hour, Okta's is 1 hour. You either shorten the TTL or add a denylist check at the PDP keyed on jti. Refresh tokens are revocable: Entra ID's revokeSignInSessions invalidates them, with propagation in minutes. AWS STS session credentials can't be deleted; you attach a deny-all policy conditioned on aws:TokenIssueTime, so every session issued before the revocation timestamp loses access. Vault dynamic secrets revoke by lease prefix: vault lease revoke -prefix database/creds/readonly.

Live sessions. A PAM broker (CyberArk, BeyondTrust) proxies the connection, so its session-terminate API kills the channel immediately. That guarantee dies the moment the session is direct: an SSH jump host or agent-forwarded connection keeps running after the broker logs off. SSH certificates are bounded by TTL; a KRL is the only early kill. Kerberos is the hard case: a TGT stays valid for its lifetime (AD default 10 hours) and the only global kill is rotating the krbtgt key twice.

Cached decisions. Where most "we revoked it" claims are false. sudo caches auth for timestamp_timeout, default 5 minutes. SSSD and app-side LDAP group caches hold membership for their TTL. Policy decision caches in a sidecar PDP hold allow decisions. Each is a residual window you must enumerate.

Identity record. Disable the account, drop group and role assignments, stop issuance. This part is immediate.

AuthorityKill switchWorst-case residual
OIDC access token (JWT)none; denylist at PDP or shorter TTLremaining TTL (Entra ID default 1 h)
OIDC refresh tokenrevokeSignInSessionsminutes of propagation
AWS STS session credsdeny policy on aws:TokenIssueTimepolicy propagation
Vault dynamic secretvault lease revoke -prefixlease TTL (default 1 h)
SSH certificateKRL, else TTLcert TTL
Kerberos TGTkrbtgt rotation ×2ticket lifetime (AD default 10 h)
sudotimestamp_timeout5 min default
PAM broker sessionsession-terminate APIimmediate if proxied, unbounded if direct

Trade-off. Immediate revocation costs a synchronous check on every request: a denylist lookup or introspection call adds a hop to the hot path and a new availability dependency: PDP down means everything denied. Short TTLs buy the same bound without the hop, at the cost of token churn. The deciding criterion is residual-window cost against request volume. A 1-hour token with a 5-minute tolerance: cut the TTL to 5 minutes and accept 12× the issuance rate. A 10-hour Kerberos ticket: no TTL is short enough, so you need the denylist or the krbtgt rotation.

Failure modes. (a) IdP session revoked, target-side session alive: detect by reconciling active target sessions against the IdP and alerting on any session whose owner is disabled; cost is a reconciliation pass per target. (b) An app that never re-reads group membership: detect with a canary account added to and removed from a privileged group, alerting if the app still authorizes past the cache TTL. (c) A long-TTL JWT with no denylist: detect by measuring, per revocation event, time from revoke to first denied request. If you can't measure it, you don't have it.

Worked check. Contractor: 1-hour Entra ID access token, 1-hour Vault DB lease, live SSH session through a jump host. Revoke at T+0. Refresh tokens die in minutes; the Vault lease dies on the next lease revoke -prefix sweep; the jump-host session survives until the SSH cert expires. Residual = max(token TTL, lease TTL, cert TTL). Hitting a 5-minute SLA means three config changes (token TTL, lease TTL, cert TTL) not one revoke call.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Run a privileged-access recertification.

Answer

Scope first. I'll assume a 500-engineer org on AWS IAM and Okta, with CyberArk vaulting the credentials, and a quarterly campaign for production write access, annual for dev tooling. If the ask is one system, the same loop runs on a smaller population.

The core answer. Recertification is a loop that ends in verified removal, not a spreadsheet. Five steps.

  1. Build the population from effective permissions, not assignments. Nested groups and inline policies grant more than the role name suggests. Include human admins, workload identities, and break-glass accounts. Compute effective access with the IAM policy simulator; pull last-used data from Access Analyzer's unused-access findings, whose tracking period defaults to 90 days.
Shell
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::111122223333:role/AliceAdmin \
  --action-names dynamodb:DeleteItem s3:PutObject \
  --resource-arns arn:aws:dynamodb:us-east-1:111122223333:table/prod-billing

Each action comes back allowed, explicitDeny or implicitDeny. An implicitDeny on a resource the role appears to own is the nested-group case you're hunting.

  1. Assign each entitlement to the resource owner, not the user's manager. The database owner knows whether Alice still needs DeleteItem; her manager does not.

  2. Set a deadline and require an explicit decision: retain, narrow, or revoke. 30 days for production write, 45 for dev. Exceptions carry a justification and an expiry date and reappear next cycle.

  3. Block self-certification. Compare reviewer ID to entitlement owner ID and reject matches. Okta Identity Governance Access Certifications exposes this as a campaign setting, but verify it in the export rather than trusting the toggle.

  4. Execute, then verify effective access on the target. Removal from a group is not removal of access.

Trace. Alice holds standing admin on prod-billing through group db-admins. The owner sees last use 120 days ago, business need ended, and chooses revoke. Remove Alice from db-admins. Re-run the simulator: dynamodb:DeleteItem still returns allowed. She is also in oncall-escalation, which carries an inline policy granting it. Remove that membership, re-run: implicitDeny. Loop closes.

Trade-offs. Cost scales with the population: 1,000 privileged entitlements at 5 minutes each is about 83 person-hours per campaign. Annual-only is cheaper but lets privilege creep accumulate for twelve months; tiering by blast radius buys most of the risk reduction for a fraction of the hours. Automation can flag unused access but cannot judge business need: use it to build the candidate list and rank by last-used age, keep the decision human. Workload identities should be reviewed on last-used time automatically rather than through a human queue; human standing grants deserve the reviewer's attention, since just-in-time elevation (Entra ID PIM, CyberArk on-demand) only matters at activation.

Failure modes and detection.

  • Rubber-stamping: retain rate above 95% with zero revokes, or median decision time under 5 seconds. Both are visible in the campaign export.
  • Self-certification: reviewer ID equals entitlement owner ID.
  • Orphaned access: a leaver still holds a role. Cross-reference the HR feed against the entitlement list monthly, not only at campaign time.
  • Drift after removal: access reappears when a group is re-added. Re-run the simulator 7 days after the campaign closes.

Targets. 90% of decisions by day 30, 100% by day 45; a 20% reduction in standing production admin per cycle; every revoke confirmed by a simulator run.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Design degraded-mode behavior for PAM dependencies.

Answer

Assumptions I'd state first. 4,000 employees, ~900 privileged accounts, ~12k sessions/day. Stack: AD for identity (Kerberos/SSSD on Linux), CyberArk Vault + PSM for credential custody and brokering, Duo for MFA, Splunk for audit, ServiceNow for approvals. PCI DSS 4.0 req 8.4.2 requires MFA for all access into the CDE, so MFA and recording are compliance controls, not conveniences. The adversary I'm designing against is an insider or a compromised workstation, not someone holding the vault unseal keys.

Core answer. Classify each dependency on two axes: can its failure grant access that should have been denied, and can its failure deny access to something that keeps production or safety running. Then assign one of three modes with a hard bound. The rule: anything that is the authorization decision fails closed; anything that is a lookup of already-decided facts may serve last-known-good for a bounded window; anything whose outage stops revenue gets a break-glass path that is loud, time-boxed, and reviewed.

DependencyFailure symptomModeBoundDetection
Policy engine (Vault policy, AD group eval)cannot evaluatefail-closednone: denyVault 503 on all but sys/seal-status
Credential vaultcheckout failsfail-closed for new checkouts; existing leases honoredcap lease TTL at 8 h (Vault default max is 32 d)seal status, lease count
Session broker (PSM/jump host)cannot start sessionlast-known-good 15 min, then fail-closed15 minbroker health probe
Directory (AD/LDAP)auth failslast-known-good via SSSD cache + Kerberos TGTTGT 10 h, entry_cache_timeout 5400 sDC health, sssd logs
MFA (Duo/RADIUS)no Access-Acceptfail-closed for privileged; step-up to break-glassn/aRADIUS timeout rate (5 s, 3 retries)
Recordingcannot recordfail-closed: terminate covered sessionsn/arecorder heartbeat
Logging/SIEMevents not indexedlocal spool, never block4 h / 10 GBforwarder queue depth

How last-known-good actually works. Capture a signed policy bundle plus a credential-lease snapshot, refresh every 60 s, hard-expire at 15 min, and stamp each with a monotonic epoch so a stale bundle can't be replayed after a revocation. The TTL is the maximum revocation lag: that's the number you defend to an auditor, so pick it from the revocation SLA, not from convenience.

Worked trace. 09:14:00 an operator seals the vault by mistake. 09:14:03 new checkouts return 503 → fail-closed, page fires. Existing PSM sessions continue because their leases were already issued. 09:14:30 on-call acknowledges. 09:19:00 unseal with 3 of 5 keys. Exposure: zero new grants, 41 sessions continued, 5 minutes. Had we served last-known-good checkouts for 15 minutes instead, we'd have issued roughly 120 credential checkouts against a policy we could not evaluate.

Failure modes. Stale cache after a revocation: detect by comparing cache epoch to vault epoch and alerting when lag exceeds 2× the refresh interval. Cascading lockout: if AD is down and the SSSD cache is cold, everyone fails, including the people who fix it. Keep break-glass accounts in local files with hashed passwords, never in AD. Recording outage that silently marks sessions unrecorded: the recorder must emit a recording_failed event into the same audit stream and the session must be terminated, not continued.

Trade-offs. Fail-closed is right when the dependency is the authorization decision or a compliance control. Last-known-good is right for read-only lookups whose data changes slowly. Break-glass is right only when the outage stops revenue or safety, and only with dual control, a time box, and review within 24 h. Each is wrong in a specific way: fail-closed on the directory with no local break-glass builds a single point of failure that locks out the responders; last-known-good on the policy engine caches the one thing you must never cache; break-glass without review is a permanent backdoor.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Threat-model the PAM control plane.

Answer

Core answer (first 90 seconds). The PAM control plane is the highest-value target you own: it holds the material that unlocks everything else, so a compromise there isn't lateral movement, it's total. I'd threat-model it against one property: no single compromise should give an attacker both standing privilege and the ability to erase the evidence. Three assumptions up front: the control plane runs in its own administrative domain, separate from the systems it manages; audit lands outside that domain; break-glass material exists but is offline.

What's actually in scope. Policy store, the vault's root and unseal material, connector and plugin credentials, session brokers, endpoint agents, the signing key for agent updates, recovery material, backups, and the audit export. The signing key and the unseal shares are the two people forget: the first lets an attacker push a malicious agent to every host, the second lets them unseal the vault offline.

Attacker paths, controls, detection.

PathControlDetection signal
Vault admin edits policy to self-grantDual control / quorum approval on policy change (CyberArk dual control; Vault policy-as-code in Git with required review)Alert on a policy diff authored by the identity it grants to
Admin reads unseal sharesShamir split (Vault's init default is 5 shares, 3 threshold) custodians in different teams and locationsUnseal event outside a declared maintenance window
Audit deletionAppend-only sink in a separate account, S3 Object Lock in compliance modeSequence-number gap or missing heartbeat, not "no errors logged"
Agent update hijackOffline signing key, HSM-backedAgent version or signature mismatch on hosts
Cached credential harvestShort TTLs, no local cachingCredential used from an unexpected source IP

Trade-offs, and when not to apply a control. Dual control on every checkout is the strongest control and the one teams disable first: it adds a human approver to a 3 a.m. incident and turns a 30-second task into minutes. Tier it: quorum approval for domain-admin and root safes, self-service with a short TTL for a single read-only database account. TTL is the same trade: Vault's default lease TTL is 768 hours (32 days), fine for a dev token and indefensible for a control-plane credential; set minutes, and accept that long-running jobs now need re-authentication or a broker that renews. Break-glass is the third: sealed offline credentials are safe but slow, and if unsealing takes an hour you will keep a standing admin "just in case", which is the failure you were avoiding.

Failure modes worth naming. A self-grant is only visible if you alert on the author of the change, not just the change. An audit gap looks like silence, so detect on heartbeat and sequence numbers. In AD-backed estates, a stolen krbtgt hash yields a forged TGT that attackers routinely set to a 10-year lifetime: detect on anomalous ticket lifetimes and rotate krbtgt twice. Unseal-share collusion is a people failure: three of five custodians who report to the same manager is a 3-of-5 threshold on paper only.

Blast radius, in numbers. One standing domain-admin credential in a 5,000-host estate is 5,000 hosts. The same credential behind a 15-minute TTL and per-request approval is one session, one host, and a log line. That gap is the whole argument for the control plane being its own domain.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Respond to suspected privileged-session compromise.

Answer

First, I'd clarify the type of privileged session: is it a cloud IAM role, an SSH session to a bastion, a Kubernetes exec, or a database superuser? What's the suspected compromise vector? For this answer, I'll assume an AWS IAM role session compromised via a leaked access key, with CloudTrail enabled.

The immediate priority is to contain the actor and preserve evidence. For an IAM role, I'd attach a deny policy with a condition on aws:TokenIssueTime to invalidate all existing STS tokens issued before a chosen timestamp. That single action both prevents re-authentication and terminates active sessions, because the tokens become invalid immediately. Then I'd terminate any remaining sessions: for example, by terminating the EC2 instance or using AWS Session Manager to kill the session. Simultaneously, I'd preserve evidence: CloudTrail logs, VPC flow logs, and any session recordings, copied to a separate, locked S3 bucket to avoid tampering, with secrets redacted.

Why revoke before terminate? For IAM, the deny policy does both, so order is less critical. For other session types, revoking the grant first prevents re-authentication, but you must also terminate the session because existing tokens may remain valid until expiry. The tradeoff is between immediate containment and gathering intelligence. If the attacker is actively exfiltrating data, contain immediately. If you need to understand the attack, you might monitor with enhanced logging, but that risks further damage. The deciding criterion is whether the attacker has already escalated or is moving data.

Common failure modes: missing persistence. The attacker may have created a new IAM user, access key, or Lambda function. Detection: audit CloudTrail for CreateUser, CreateAccessKey, CreatePolicyVersion, and PutRolePolicy. Another failure: losing evidence by terminating the instance without snapshotting. Another: rotating the role's credentials but missing derived credentials like an RDS password stored in Secrets Manager. Detection: check for secret access and rotation.

For AWS, the deny policy condition uses aws:TokenIssueTime. The default STS token lifetime is 1 hour for role chaining, up to 12 hours for roles if configured. Here's the inline policy you'd attach to the role:

JSON
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Deny",
    "Action": "*",
    "Resource": "*",
    "Condition": {"DateLessThan": {"aws:TokenIssueTime": "2025-01-01T00:00:00Z"}}
  }]
}

This policy denies all actions for any token issued before the specified time, effectively revoking all existing sessions for that role.

For SSH, you'd remove the key from authorized_keys and kill the process. For Kubernetes, in 1.24+ ServiceAccount tokens are projected volumes with bound tokens, not stored as Secrets. Deleting a ServiceAccount token Secret does not revoke bound tokens. To revoke, delete the ServiceAccount (which invalidates bound tokens because they are bound to the ServiceAccount UID) or delete the pod to terminate the session. Tools: AWS CloudTrail, GuardDuty, Azure AD PIM, Teleport, HashiCorp Vault.

Here's a table comparing containment for different session types:

Session typeImmediate containmentEvidence preservationCommon failure
AWS IAM role (STS)Attach deny policy with aws:TokenIssueTime condition to revoke all sessions before now; delete any access keys created.CloudTrail logs to a separate S3 bucket with Object Lock; enable GuardDuty.Attacker created a new IAM user with its own access key; revoking the role doesn't remove that.
SSH to bastionRemove attacker's public key from ~/.ssh/authorized_keys; kill the SSH process (pkill -u user sshd).Capture auditd logs, ~/.bash_history, and a memory dump if possible.Attacker added a cron job or systemd service for persistence; killing the session doesn't remove it.
Kubernetes execDelete the pod (kubectl delete pod <pod>) to terminate the session; to revoke the token, delete the ServiceAccount (kubectl delete serviceaccount <sa>).Kubernetes audit logs, container logs, and kubectl get events.Attacker created a new ServiceAccount with cluster-admin; deleting the pod doesn't remove that.

After containment, I'd restore from known-good configuration, rotate all exposed credentials, notify owners, and monitor for reentry. Add regression tests to prevent recurrence.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Define PAM security and reliability metrics.

Answer

Assumptions I'd state first: PAM here means a vault plus a session broker plus an approval workflow plus a recorder (CyberArk, Delinea, Teleport, HashiCorp Vault, or the cloud-native equivalent in AWS IAM Identity Center / Entra PIM). The IdP is the source of truth for joiners, movers and leavers; a ticketing system supplies change IDs. Every metric below is a join of PAM audit logs against those two systems, if you can't join, you can't measure, and that's the first thing to fix.

The core answer. Split into two families and instrument four numbers before anything else.

Security answers: is privilege standing, broad, unapproved, or unrecorded?

  • Standing privilege ratio: privileged principals whose effective grant is active 24/7, divided by all privileged principals. For humans, target under 5%; service accounts are the exception and should be enumerated explicitly.
  • No-ticket activation rate: activations with no linked change or incident ID, over total activations. This is the single best proxy for whether the approval workflow is real or theatre.
  • Revocation latency: time from the IdP deprovision event to the grant no longer being effective, measured per event, reported as p50 and p95.
  • Recording coverage: sessions with a complete, retrievable recording over total brokered sessions.

Reliability answers: does the privileged path work when someone needs it at 03:00?

  • Checkout success rate: successful auth-plus-retrieval over attempts, split by target class.
  • Checkout latency: p50/p99 for credential retrieval and for session start.
  • Privileged task completion: the downstream job or change actually finished, not just that the vault handed over a credential.

Worked trace: revocation latency. Take 20 deprovision events in a month. For each, timestamp the IdP event and the moment the grant stops being effective (last successful use of the credential, or the vault's grant-expiry record). Sorted latencies in minutes:

1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9, 11, 14, 18, 22, 31, 41, 240

p50 is the mean of the 10th and 11th values = 6.5 min. p95 is the 19th value = 41 min. The 240-minute outlier is a service account whose grant was bound to an IdP group the sync job didn't cover: a real, findable defect, not noise. A target of p95 under 5 minutes is defensible for human accounts; the outlier is what you escalate on.

Thresholds (illustrative, tune to your estate):

MetricDefinitionSourceAlert
Standing privilege ratioAlways-active grants / privileged principalsVault + IdP>5% humans
No-ticket activationActivations without change IDPAM + ticketingAny, per event
Revocation latency p95IdP deprovision → grant ineffectiveIdP + vault>5 min
Recording coverageComplete recordings / sessionsRecorder<99.5%
Checkout successSuccessful retrievals / attemptsVault<99.9%
Orphan targetsManaged accounts with no live host or ownerVault + CMDBAny

Trade-offs. A full programme (per-event joins, recording coverage, recertification tracking) costs engineering time and a data pipeline. If you have under ~50 privileged principals, the standing-privilege ratio, no-ticket rate and revocation latency give you most of the signal; skip recertification analytics and do the review by hand. Prioritise by blast radius: a metric that catches a domain-admin credential outliving its owner beats one that counts vault entries.

Failure modes and how they show up. Recording coverage dropping below 100% usually means a connector lost its storage mount: alert on the gap, not the daily average. Orphan targets surface as checkout failures against decommissioned hosts. Emergency-use spikes cluster around change freezes, which tells you the normal approval path is too slow, not that people are malicious. And a healthy checkout success rate with a rising no-ticket rate means the vault is working and governance isn't.

Avoid: vault entry counts, prompt counts, and total sessions. They measure activity, not authority.

Curated: · Written: · Reviewed:

Difficulty: Medium