Least Privilege: Why 'Admin for Everything' Is a Breach Waiting to Happen
The Principle That Limits Blast Radius
Least privilege means granting every user, service, and process only the minimum permissions required to perform its legitimate function — and no more. It is the single most effective principle for limiting the damage when an account is compromised, yet it is routinely violated in production environments.
Why Least Privilege Matters
Consider two scenarios:
Scenario A: A developer's laptop is compromised by malware. The developer's account has local administrator privileges. The malware can install a keylogger, disable the EDR agent, extract cached credentials, and pivot to other systems using those credentials. The blast radius is the entire organization.
Scenario B: The same laptop is compromised, but the developer's account has only standard user privileges. The malware can read the developer's files and browser session, but it cannot install system-level persistence, cannot disable security tools, and cannot extract credentials from other users' sessions. The blast radius is one user's data.
The difference is least privilege. It does not prevent the initial compromise, but it constrains what the attacker can do after they are inside.
Least Privilege in Practice
Least privilege applies at every layer:
User accounts: Developers do not need local admin rights on their workstations. Database administrators do not need root on application servers. Each role gets exactly the permissions its tasks require — nothing more.
Service accounts: A web application that reads from a database should connect with a database account that has SELECT permission on the specific tables it needs — not db_owner. A backup service should have read access to the data it backs up and write access to the backup destination — not full control of the entire server.
Cloud IAM: An AWS Lambda function that reads from one S3 bucket should have a policy granting s3:GetObject on that bucket's ARN — not s3:* on *. The principle is identical across Azure, GCP, and on-premises systems.
File system: A configuration file that only the nginx process needs to read should be owned by root with mode 640, not world-readable.
The Standing Access Problem
The most common violation of least privilege is standing access — permissions that remain granted long after they are needed. A developer who needed temporary admin rights to debug a production issue still has those rights six months later. An employee who transferred from finance to marketing still has access to the financial system.
The fix is just-in-time (JIT) access: permissions are granted for a specific task, for a specific duration, and automatically revoked when the time expires. Tools like Azure PIM, AWS IAM Identity Center, and CyberArk implement this pattern. The operational overhead is minimal compared to the risk reduction.
Implementing Least Privilege
Inventory current permissions: You cannot reduce what you have not mapped. Use tools like
accesschkon Windows,find -permon Linux, or cloud IAM access analyzers to document who has what.Start with a deny-all baseline: Remove all existing grants and add back only what is proven necessary. This is disruptive but effective. A less disruptive approach is to start with high-risk groups (domain admins, service accounts) and work down.
Use role-based access control (RBAC): Define roles by job function, not by individual. When someone changes roles, you update their group memberships, not dozens of individual ACL entries.
Audit regularly: Permissions tend to accumulate over time. Schedule quarterly access reviews where managers certify that their direct reports still need their current access levels.
Monitor for privilege escalation: Alert when a user adds themselves to a privileged group, when a service account's permissions are modified, or when a new SUID binary appears on a Linux system.
Defense in Depth: Stacking Independent Controls
Why One Firewall Is Never Enough
Defense in depth is the practice of layering multiple independent security controls so that the failure of any single control does not result in a breach. The concept comes from military strategy: a castle does not rely on a single wall — it has a moat, an outer wall, an inner wall, a keep, and guards at each level.
The critical word is independent. Two copies of the same firewall from the same vendor with the same rules are not independent — a single vulnerability or misconfiguration affects both. True defense in depth uses different control types at different layers.
The Layers of Defense in Depth
A mature defense-in-depth strategy spans the entire attack chain:
Perimeter layer: Network firewalls, DDoS protection, and web application firewalls filter traffic before it reaches internal systems. These are the first line of defense but should never be the only line.
Network layer: Internal segmentation divides the network into zones (production, development, management) with firewall rules controlling traffic between them. VLANs, microsegmentation, and zero-trust network access (ZTNA) implement this layer.
Host layer: Endpoint detection and response (EDR), host-based firewalls, and OS hardening protect individual machines even if the network perimeter is breached.
Application layer: Secure coding practices, input validation, parameterized queries, and output encoding prevent application-level attacks like SQL injection and XSS.
Data layer: Encryption at rest and in transit, data loss prevention (DLP), and database activity monitoring protect the data itself even if all other layers fail.
Identity layer: Multi-factor authentication, privileged access management (PAM), and conditional access policies ensure that even valid credentials cannot be used from untrusted locations or devices.
Separation of Duties: The Human Layer
Separation of duties is a specific application of defense in depth to human processes. It ensures that no single person can complete a sensitive action alone — the action requires collaboration, which creates a natural check.
Examples:
- Financial transactions: The person who creates a vendor payment is not the same person who approves it.
- Code deployment: The developer who writes code is not the person who approves its deployment to production.
- Key management: A cryptographic key requires two of three administrators to reconstruct (M-of-N control).
- Database administration: The DBA can manage the database server but cannot read the encrypted application data; the application team can read the data but cannot modify the database schema.
Separation of duties prevents both fraud and error. A single person with too much power can make a mistake that goes undetected or can act maliciously without a co-conspirator.
Designing Independent Layers
When designing a defense-in-depth strategy, ask these questions about each layer:
What happens if this layer fails completely? If the answer is "the attacker reaches the data," you need another layer behind it.
Are the layers truly independent? If a single misconfiguration or vulnerability can bypass multiple layers, they are not independent. A WAF and an application-layer input validator are independent — a bug in the WAF does not affect the input validator.
Does each layer have its own monitoring? A control that is not monitored is not a control — it is a hope. Each layer should generate alerts when it blocks something or when it fails.
What is the cost of failure at each layer? The cost is not just financial — it is also operational. A layer that generates too many false positives will be tuned until it is ineffective, or it will be bypassed entirely.
Common Failure Modes
- The single point of failure: One firewall, one admin account, one backup. If it fails, everything fails.
- The correlated failure: Two controls that share a dependency. Two firewalls from the same vendor with the same firmware vulnerability are not independent.
- The monitoring gap: Controls that block attacks but do not alert. You do not know you are under attack until the data is exfiltrated.
- The usability failure: Controls so restrictive that users find workarounds. If the security policy requires a 30-character password changed every day, users will write it on a sticky note.
Practice Problems
Solution
With local admin rights, the attacker can: install kernel-level persistence, disable EDR, extract cached credentials from LSASS, install a keylogger, and pivot using the developer's domain credentials. Without local admin rights, the attacker is limited to the user's own session — they can read the user's files and browser cookies but cannot install system-level tools or extract other users' credentials.
Implementation steps: (1) Remove local admin rights from all developer accounts. (2) Create a separate 'Developer Admin' group for users who occasionally need elevated rights, with just-in-time access via a PAM tool. (3) Use application whitelisting to control what software can be installed. (4) Deploy EDR that runs as a protected service, not as a user-mode process. (5) Monitor for privilege escalation attempts. Solution
No, this does not represent a failure of defense in depth — it demonstrates why defense in depth works. The WAF was the first layer; the host-based firewall is an independent second layer. The attacker bypassing the WAF does not automatically bypass the host firewall, which may block the attack at the network level. The key question is whether the layers are truly independent: if the WAF and host firewall are the same product with the same rules, a single bypass could affect both. True defense in depth requires different control types (e.g., WAF + input validation + parameterized queries) so that a vulnerability in one does not compromise the others. Quiz
1. A web application connects to a database using an account with db_owner privileges. The application only needs to read from three tables. What is the specific risk, and what principle does this violate?
2. Why are two firewalls from the same vendor with identical rules NOT considered true defense in depth?
3. What is the primary security benefit of just-in-time (JIT) access compared to standing administrative privileges?
Flashcards
Question
What is least privilege?
Click to reveal answer
Answer
Granting every user, service, and process only the minimum permissions required to perform its legitimate function — and no more. Limits blast radius when an account is compromised.
Question
What is standing access and why is it dangerous?
Click to reveal answer
Answer
Permissions that remain granted long after they are needed. Dangerous because former employees, transferred staff, or compromised accounts retain access they no longer require. Fix with just-in-time access.
Question
What is defense in depth?
Click to reveal answer
Answer
Layering multiple independent security controls so that the failure of any single control does not result in a breach. The key word is independent — controls must not share vulnerabilities or dependencies.
Question
What is separation of duties?
Click to reveal answer
Answer
Ensuring that no single person can complete a sensitive action alone. The action requires collaboration, which creates a natural check against both fraud and error.
Question
What are the layers of a defense-in-depth strategy?
Click to reveal answer
Answer
Perimeter (firewalls, WAF), network (segmentation), host (EDR, hardening), application (secure coding), data (encryption, DLP), identity (MFA, PAM).
Question
What is just-in-time (JIT) access?
Click to reveal answer
Answer
Permissions granted for a specific task, for a specific duration, and automatically revoked when the time expires. Reduces the window of opportunity compared to standing privileges.
Revision Notes
Key Takeaways
- 1. Least privilege limits blast radius — it does not prevent initial compromise but constrains post-compromise activity
- 2. Standing access is the most common least-privilege violation; fix with just-in-time access
- 3. Defense in depth requires independent controls — two copies of the same control are not independent
- 4. Each layer of defense must have its own monitoring; a control that does not alert is not a control
- 5. Separation of duties applies the defense-in-depth concept to human processes
- 6. The cost of a security control includes operational cost — if it is too restrictive, users will bypass it
Interview Tips
- • When discussing least privilege, give a concrete example of how it limited damage in a real incident
- • Be ready to explain how you would implement least privilege in a legacy environment where everyone has admin rights
- • For defense in depth, emphasize independence — interviewers will probe whether you understand that two identical controls are not defense in depth
- • Discuss the operational cost of security controls — a control that generates too many false positives will be tuned until ineffective
- • Connect separation of duties to a real process you have implemented or audited
Cheat Sheet
Least Privilege and Defense in Depth Cheat Sheet
Phase: Security Principles and Threat Modeling | Level: beginner
Least Privilege:
- Grant minimum permissions needed — no more
- Applies to user accounts, service accounts, cloud IAM, file systems
- Standing access is the most common violation
- Fix with just-in-time (JIT) access: grant for a task, auto-revoke after
- Implement: inventory → deny-all baseline → RBAC → audit quarterly → monitor escalation
Defense in Depth:
- Layer independent controls so one failure ≠ breach
- Layers: perimeter → network → host → application → data → identity
- Independent = different control types, not two copies of the same control
- Each layer needs its own monitoring
- Cost of failure includes operational cost, not just financial
Separation of Duties:
- No single person completes a sensitive action alone
- Examples: payment creator ≠ approver, developer ≠ deployer, M-of-N key reconstruction
- Prevents both fraud and error
Common Failure Modes:
- Single point of failure (one firewall, one admin, one backup)
- Correlated failure (two controls sharing a dependency)
- Monitoring gap (controls that block but do not alert)
- Usability failure (controls so restrictive users find workarounds)
Continue Learning
Before You Start
- No prerequisites listed.