Privileged access, escalation and service accounts

8 min 6 sections 5 practice questions 14 sources citedISC2 objectives 5.2, 5.5

Some accounts can change the system itself: create users, switch off protections, read every file. Administrators need that power some of the time, attackers want it all of the time, and many programs quietly hold it too. No background is assumed. A security professional decides who may raise their privileges, how that is recorded, how long the power lasts, and how the accounts that programs use are kept under control.

By the end of this unit you will be able to:

  • Tell apart su and sudo, and explain how each is audited
  • Tell apart vertical and horizontal privilege escalation in a described attack
  • Choose between standing privilege and just-in-time elevation
  • Choose controls for a service account
  • Tell apart just-in-time privilege and just-in-time provisioning

The administrator who read his email

An illustrative example

The IT officer of a chain of six dental surgeries has one account. It is an administrator on every server and every computer, because that saves him signing in twice.

One morning he opens an attachment that claims to be an invoice. The hidden program in it runs with his rights. Within an hour it has installed itself on every server and switched off the antivirus software. A receptionist who opened the same email could have damaged only her own files.

The same attachment did far more harm on his computer than on hers. What arrangement of his accounts would have limited it to her level of damage?

Privileged accounts can change the rules

A privileged account can perform functions that ordinary users cannot: creating accounts, changing permissions, altering security settings, installing software or reading other people's data. On Unix-like systems such as Linux the all-powerful account is called root, also known as the superuser. On Windows it is a member of the Administrators group.

Whatever such an account runs inherits its power, including a malicious attachment. Five rules follow from that.

  • Give privileged access to as few people as the work allows.
  • Give each administrator a separate privileged account, and use an ordinary account for email and the web.
  • Require stronger authentication for privileged sign-in.
  • Log every use of a privileged function.
  • Review privileged access more often than ordinary access.

The second rule is the answer to the story. Read on an ordinary account, the attachment gets ordinary rights. This is applied to one person's own day: the power is used only for the moments that need it.

Raising privilege on purpose: su, sudo and administrator groups

Administrators on Unix-like systems often type instructions into a command line, a text window that runs each command typed into it. Two commands let them act as root.

Two ways to act as root
Pointsusudo
What it doesSwitches the whole session to another user, root by defaultRuns one command as root or another user
Password asked forThe target account's, such as root'sThe user's own, by default
Who may use itAnyone who knows the password; often limited to the wheel groupOnly users and commands listed in the sudoers file
What the record showsThat someone became rootWho ran which command, allowed or refused
Main riskA shared root password and no individual recordA sudoers rule wider than intended

The sudoers file is the that says which users may run which commands, as whom, on which computers. By default sudo remembers a correct password for five minutes and logs both successful and refused attempts.

A program file can also carry the setuid mark, short for set user ID. It then runs with the rights of the file's owner, not of the person who starts it. A setuid program owned by root is a favourite target, because a flaw in it hands root to anyone.

Windows works differently. An administrator's programs run with ordinary rights until a task needs more. User Account Control (UAC) then shows a prompt: an administrator gives consent, and a standard user must enter an administrator's credentials.

Privilege escalation as an attack

Privilege escalation is gaining permissions beyond those granted. It comes in two directions.

Vertical escalation
Moving up to a higher level, such as an ordinary user becoming root or an administrator. Typical routes are a flaw in a setuid program, an over-generous sudoers rule or abuse of the elevation prompt.
Horizontal escalation
Moving sideways to another user's resources at the same level. A bank customer who changes the account number in a web address and sees someone else's statement has escalated horizontally.

Defences differ by direction. Vertical escalation is narrowed by least privilege, prompt fixes for flawed programs, few setuid files and tight sudoers rules. Horizontal escalation is stopped by checking, on every request, that the object belongs to the requester, and by refusing by default.

Auditing privileged use turns elevation into . The record must show the person, not just root: sudo and individual administrator accounts give that, and a shared root password does not. Logs of privileged actions go to a place the administrators cannot alter, and the people who administer access do not also administer the logs. Repeated refused sudo attempts are a warning sign worth an alert.

Privileged access management and just-in-time elevation

Privileged access management (PAM) is the set of tools and processes that grant, watch and record privileged access. A PAM system can release an administrator password from a vault for one task. It can require approval and a reason before elevation, demand , notify others and record the whole session for later review.

Its central idea is just-in-time (JIT) elevation. An administrator is eligible for a privileged role but holds it only once activated, for a set period, and then it lapses on its own.

Standing privilege against just-in-time elevation
PointStanding privilegeJust-in-time elevation
When the power existsAll the timeOnly while activated, then it expires
What a stolen password givesFull privilege at onceAn ordinary account, plus a request someone must approve
Record keptSign-ins onlyWho activated, why, for how long, with whose approval
CostNone in daily workA short wait and a reason each time

An emergency account, often called , is the exception: a powerful account kept for when normal administration cannot work, such as an outage of the sign-in service. Its credentials are locked away, every use raises an alert and is reviewed afterwards, and it is tested regularly.

Service accounts: identities that belong to programs

A service account is an account used by a program, not a person: the backup software that copies every folder, or the web application that reads the customer database. These accounts often hold wide rights, rarely change their passwords and have no one watching them. An attacker who finds a service account's password can use it for years.

  • One account for each service, named so its purpose is plain, such as svc-backup.
  • A named human owner who answers for it in every access review.
  • Only the permissions the service needs, and no membership of administrator groups.
  • No interactive sign-in: nobody can use the account to sign in at a keyboard.
  • Credentials changed regularly, and at once when anyone who knew them leaves.

Better still, remove the password from human hands. A Windows managed service account has its password generated and changed by the operating system. A cloud managed identity is given to a program by the cloud platform and obtains short-lived tokens with no secret anyone has to store.

Two meanings of just-in-time

Just-in-time has a second meaning, in federation, where one organisation's sign-in is trusted by another's application. Just-in-time provisioning creates a user's account at the application the first time it receives a valid assertion for someone it does not know. It needs the least coordination, because nothing is set up before the first sign-in.

Its alternative is pre-provisioning, in which accounts are created in bulk before anyone signs in, often through SCIM. Pre-provisioning needs planning, and the two sides must keep their lists in step.

Just-in-time provisioning leaves a trace. The account and any details cached with it stay at the application after the person leaves, unless the application removes them.

Common misconception

“Just-in-time always means temporary administrator rights.”

In privileged access it does. In federation it means creating an account at the application on first sign-in, and that account is not temporary. Read the context: elevation and expiry point to privilege, assertions and first sign-in point to provisioning.

A question, worked through

A hosting company's eight engineers each hold permanent administrator rights over every customer server, though each uses them about once a week. Last month an attacker stole one engineer's password through a fake sign-in page and used those rights at once. The operations director wants the engineers to keep doing their work without delay.

Which change BEST reduces the harm a stolen engineer password can do?

  1. Remove the rights and route every change through the security team
  2. Make the rights eligible, activated for a set time with MFA and approval
  3. Record every administrator session for review after the fact
  4. Require longer passwords on all the administrator accounts
Decide on your answer, then open the reasoning
  1. The harm came from rights that existed all the time. The director also wants no delay to the engineers' work.
  2. Rule out d: the password was stolen through a fake page, so its length made no difference.
  3. Rule out c: recordings help an investigation but stop nothing while the attacker acts.
  4. Between a and b: option a removes standing rights but turns every weekly task into a request to another team, which the director has ruled out.
  5. Option b is just-in-time elevation. A stolen password yields an ordinary account, activation needs a second factor and an approver, and the rights lapse on their own. Option b is the best answer.

Answer: B. Make the rights eligible, activated for a set time with MFA and approval

Choosing between good answers

An answer offers a shared root password and another offers sudo with individual accounts
choose sudo. It records who ran which command, which a shared password cannot.
A user reaches another user's data at the same level
the escalation is horizontal. Becoming an administrator is vertical.
Privileged rights are held permanently but used rarely
choose just-in-time elevation through privileged access management.
A service account is involved
look for a named owner, least privilege, no interactive sign-in and rotated or managed credentials.
Just-in-time appears beside assertions or first sign-in
it means just-in-time provisioning of an account, not temporary privilege.

Check your understanding

5 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 5

Match each mechanism for raising privilege to what it does.

Choose the match for each entry. Every match has to be right.

What to remember

  • Privileged accounts can change the system's rules, so they are few, separate from everyday accounts, strongly authenticated, logged and reviewed often.
  • su switches the whole session to another user with that user's password. sudo runs permitted commands with the user's own password and records each one.
  • Vertical escalation gains a higher level of privilege; horizontal escalation reaches another user's resources at the same level.
  • Privileged access management grants privilege just in time, with approval, a time limit and recording, and keeps a monitored emergency account for outages.
  • A service account belongs to a program. It needs an owner, least privilege, no interactive sign-in and managed or rotated credentials.
  • Just-in-time provisioning creates an account at an application on first federated sign-in. It is unrelated to temporary privilege.

Say it from memory

  1. How do su, sudo and administrator groups raise privilege, how is that audited, and what are vertical and horizontal escalation?

    su switches the session to another user, root by default, with that user's password. sudo runs listed commands as root with the user's own password and logs each attempt. On Windows, User Account Control asks administrators for consent and others for administrator credentials. Logs must name the person and be beyond administrators' reach. Vertical escalation gains a higher level; horizontal reaches another user's resources. Least privilege limits both.

    Read this part again

  2. How should service accounts be managed?

    One account per service, clearly named, with a named human owner who answers for it in reviews. Only the permissions the service needs and no administrator group membership. No interactive sign-in. Credentials rotated regularly and when anyone who knew them leaves, or replaced by managed service accounts and managed identities whose credentials no person handles.

    Read this part again

  3. What are the two meanings of just-in-time in identity and access management?

    Just-in-time privilege: a user is eligible for a privileged role and activates it only when needed, for a set time, usually with approval and multi-factor authentication, after which it lapses. Just-in-time provisioning: in federation, an application creates a user's account the first time it receives a valid assertion for that user, instead of creating accounts in advance.

    Read this part again

  4. What five rules apply to privileged accounts?

    Give privileged access to as few people as the work allows. Give each administrator a separate privileged account, and use an ordinary account for email and the web. Require stronger authentication for privileged sign-in. Log every use of a privileged function, and review privileged access more often than ordinary access.

    Read this part again

  5. Which defences narrow vertical privilege escalation, and which stop horizontal escalation?

    Vertical escalation is narrowed by least privilege, prompt fixes for flawed programs, few setuid files and tight sudoers rules. Horizontal escalation is stopped by checking, on every request, that the object belongs to the requester, and by refusing by default.

    Read this part again

  6. What is an emergency or break-glass account, and how is it controlled?

    It is a powerful account kept for when normal administration cannot work, such as an outage of the sign-in service. Its credentials are locked away. Every use raises an alert and is reviewed afterwards, and the account is tested regularly.

    Read this part again

Sources