Skip to content
Visual explainer 2h 30m to learn 4 steps

Least privilege, RBAC & privileged access

Design role-based access with least privilege and protect admin accounts.

By Invicly Tech, , in Cyber Security Fundamentals. About 10 minutes to read.

Topic 22 of 49

In short

Least privilege gives each account only the access it needs, no more. Role-based access control groups permissions into roles, separate admin accounts limit blast radius, and periodic reviews remove access that is no longer needed.

Explained simply

Least privilege means every person, program and service gets only the access it needs to do its job, and nothing more. A support agent can view customer records but not delete them. A backup job can read the database but not change user accounts.

Why does it matter so much? Because accounts get compromised. When an attacker takes over an account, they get exactly its permissions. If the account has little access, the damage (often called the blast radius) stays small. If it is an admin, the attacker owns everything.

Managing permissions person by person quickly becomes a mess. Role-based access control (RBAC) groups permissions into roles like "Support Agent" or "Billing Admin", and people get roles. When someone changes jobs, you change their role, not fifty separate permissions.

Access tends to grow over time: people collect permissions as they move between teams and nobody removes the old ones. This is called privilege creep. Regular access reviews, where managers confirm who still needs what, keep it under control.

Press Play on a diagram to walk through it one step at a time.

MapRBAC
Roles
  • Viewer
    • Read only
  • Editor
    • Read
    • Write
  • Admin
    • Manage users
    • Change config
CycleIdentity lifecycle that prevents privilege creep
  1. 1
    Joiner

    Access from role, not copied from a colleague

  2. 2
    Mover

    Old access removed when new is added

  3. 3
    Review

    Managers confirm access regularly

  4. 4
    Clean up

    Remove unused and dormant access

  5. 5
    Leaver

    Disabled on the last day

  6. Back to step 1

In depth

Applying least privilege in practice

Start from zero and add, rather than start from everything and remove. For each role, list the tasks it performs, then the exact actions and resources those tasks need. Prefer narrow actions (read one bucket) over broad ones (all storage) and scope by resource, environment and time where your platform allows.

Service accounts and machine identities deserve the same care as people. They often hold broad, never-expiring permissions and are rarely reviewed. Give each application its own identity, never share one across apps, and prefer short-lived credentials, such as cloud workload roles, over long-lived keys.

Use data to tighten permissions. Cloud providers show which permissions an identity actually used, for example AWS IAM Access Analyzer and last-accessed data. Permissions unused for 90 days are good candidates to remove. Separation of duties adds another layer: the person who requests a payment should not also approve it.

  • Deny by default; grant specific actions on specific resources
  • One identity per application
  • Remove permissions unused for a long period

RBAC and ABAC compared

RBAC (role-based access control) links users to roles, and roles to permissions. It is easy to understand and audit: "who has the Billing Admin role?" is one query. Its weakness is role explosion. When rules depend on details like region, project or data sensitivity, you end up with hundreds of roles such as Billing-Admin-EU-ProjectX.

ABAC (attribute-based access control) decides using attributes of the user, the resource, the action and the context, evaluated by a policy. For example: allow if user.department equals document.department and the request comes from a managed device during working hours. One policy can replace many roles, and new resources are covered automatically when they are tagged correctly. The trade-off is that it is harder to answer "who can access this?" and wrong tags quietly grant access.

Most real systems combine both: roles for the broad shape, attributes for fine-grained conditions. AWS IAM, for instance, supports roles plus conditions on tags.

CompareRBAC vs ABAC
RBAC
  • User gets roles; roles hold permissions
  • Simple to audit
  • Risk: role explosion
  • Good for stable job functions
ABAC
  • Policy checks user, resource and context attributes
  • Fine-grained and flexible
  • Risk: wrong tags grant access
  • Good for many similar resources

Protecting privileged accounts

Admins should have two accounts: a normal one for email, chat and browsing, and a separate admin account used only for admin tasks. Phishing emails and malicious websites then hit an account with no admin power. The admin account should require phishing-resistant MFA and, ideally, be used only from a dedicated, hardened device called a privileged access workstation (PAW).

Even better is to have no standing admin rights at all. Just-in-time (JIT) access tools, such as Microsoft Entra Privileged Identity Management, let a person request a role for a few hours, with a reason and sometimes an approval. When the time ends, the rights disappear. This turns admin access into logged, short events.

Keep one or two break-glass accounts for emergencies, such as an outage of your identity provider's MFA. Store their credentials securely, exclude them from conditions that could lock them out, and alert on every single use.

FlowJust-in-time admin access
  1. 1
    Request role

    With reason and ticket number

  2. 2
    Approve

    Manager or peer, if required

  3. 3
    Activate

    MFA, then role for e.g. 2 hours

  4. 4
    Work and log

    All actions recorded

  5. 5
    Expire

    Role removed automatically

Running an access review

An access review (also called recertification) asks the people who understand the work to confirm that each access is still needed. A good review is scoped and regular: privileged roles every quarter, normal application access every six or twelve months, plus event-driven checks when people change teams or leave.

Steps: export who has what from each system, with last-used dates where available. Send each manager a short list for their team, not a 5,000-row spreadsheet. Ask for a decision on each line: keep or remove. Then actually remove what was rejected, record who decided and when, and follow up on items nobody answered.

The joiner, mover, leaver process is the daily version of this. Joiners get access from their role, movers lose old access when they gain new access, and leavers are disabled on their last day, ideally automatically from the HR system. Orphaned accounts (no matching person) and dormant accounts (no login for 90 days) should be disabled.

Learn it in 4 short steps

About 40m each. Track them with a timer in your plan.

  1. 1
    Apply least privilege to roles~40m
  2. 2
    Compare RBAC and ABAC~40m
  3. 3
    Separate admin and daily accounts~40m
  4. 4
    Run a periodic access review~40m

Key points

  • Grant only the access each task requires.
  • RBAC assigns permissions through roles, not individuals.
  • Keep admin and daily-use accounts separate.
  • Review access regularly and revoke what is unused.

Key terms

Tap a card to flip it. 0/4 known

Examples

A least-privilege cloud policy for a reporting app

A reporting service only needs to read files from one storage bucket. Step 1: list its tasks: list the bucket and download reports. Step 2: grant exactly those two actions. Step 3: scope them: ListBucket applies to the bucket ARN, GetObject to objects inside it (the /* form). Step 4: attach the policy to a role the service assumes, not to a long-lived user key. Step 5: after a month, check last-accessed data to confirm nothing else is needed.

json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": "arn:aws:s3:::reports-bucket"
    },
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": "arn:aws:s3:::reports-bucket/*"
    }
  ]
}

Finding leavers and dormant accounts

Step 1: export active employees from HR as a CSV of email addresses. Step 2: export accounts from the application, with their last login date. Step 3: compare the two. Accounts with no matching employee are orphans, often leavers whose access was never removed. Accounts with no login for over 90 days are dormant. Step 4: send the lists to the application owner, disable the confirmed ones, and record the decisions as evidence for audits.

python
import csv
from datetime import datetime, timedelta

staff = {r["email"].lower() for r in csv.DictReader(open("hr_active.csv"))}
cutoff = datetime.now() - timedelta(days=90)
for a in csv.DictReader(open("app_accounts.csv")):
    email, last = a["email"].lower(), datetime.fromisoformat(a["last_login"])
    if email not in staff:
        print("ORPHAN ", email, a["role"])
    elif last < cutoff:
        print("DORMANT", email, a["role"], last.date())

Quick reference

  • Start with no access and add only what each task needs
  • Give each app its own identity; prefer short-lived roles over long-lived keys
  • RBAC: users to roles to permissions; ABAC: policies on attributes and context
  • Admins use a separate admin account with phishing-resistant MFA
  • Just-in-time access removes standing admin rights
  • Alert on every use of a break-glass account
  • Review privileged roles quarterly and remove what managers reject
  • Disable leavers on the last day; disable accounts with no login for 90 days

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1An attacker phishes a developer who reads email with an account that is also a global admin. Which principle was broken?

Question 2

2A company has 400 roles like Sales-EU-Read and Sales-US-Read. Which approach could reduce this?

Question 3

3What does just-in-time access provide?

Question 4

4A user moved from Finance to Marketing two years ago and still has the Finance payment role. What is this called?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Design three roles for a small blog platform (Reader, Author, Editor) and list the permissions each needs. Make sure no role has more than it requires.

  2. Exercise 2medium

    Write an AWS IAM policy that allows starting and stopping EC2 instances only when the instance's project tag matches the caller's project tag.

  3. Exercise 3hard

    Plan a quarterly access review for privileged roles in a company with 20 admins across cloud, Active Directory and the HR system. Include scope, owners, evidence and what happens to unanswered items.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

What is the difference between least privilege and zero trust?
Least privilege is about how much access each identity has. Zero trust is a wider approach that also means checking identity, device and context on every request instead of trusting the network, and least privilege is one of its core parts.
Should developers have admin access to production?
Usually not standing access. Give them read access for troubleshooting and use just-in-time elevation, with approval and logging, for the rare cases where they need to change production.
What is a break-glass account?
An emergency admin account kept for when normal sign-in fails, for example during an MFA or identity provider outage. Its credentials are locked away, its use is rare, and every login should trigger an alert.

Go deeper

ShareXLinkedInWhatsApp