Sub topic 4
Access control and the principle of least privilege
This chapter assumes you know what authentication is, which the previous chapter covered, and that you can open an elevated command prompt in Windows. Authentication answers "who are you?" Access control answers "what are you allowed to do?"
The working model
Access control decides what an authenticated user can do with a resource. It has three parts:
- Identification and authentication establish who the user is.
- Authorization decides which resources and actions that identity may use.
- Accounting records what the user did, usually in logs.
The principle of least privilege says each user, program, or service gets only the access it needs for its task, and nothing more. If an account is compromised, the attacker inherits only that small set of rights.
Common access control practices
| Practice | What it does | Example |
|---|---|---|
| Least privilege | Limits rights to the minimum needed | Staff use standard accounts, not administrator accounts |
| Role-based access control (RBAC) | Assigns rights to roles or groups, not to individuals | All accountants join an Accounting group |
| Separation of duties | Splits a sensitive task between people | One person requests a payment and another approves it |
| Need to know | Limits data access to those who require it | Only HR staff can open personnel files |
| Account lifecycle | Removes access when it is no longer needed | Disable a leaver's account on their last day |
Applying least privilege in Windows
Remove unnecessary login paths first. The built-in Guest account should stay disabled:
net user guest /active:noThen give permissions to groups, not to individual users. This command gives the Accounting group Modify permission on the Finance folder. (OI) applies it to files in the folder, (CI) applies it to subfolders, and M means Modify:
icacls "C:\Finance" /grant "Accounting:(OI)(CI)M"Modify lets the group read, change, and delete files but not take ownership or change permissions. That is enough for daily work, so Full Control is not needed.
Common errors
- Daily use of an administrator account. Malware run by that user gets administrator rights. Use a standard account and elevate only when needed.
- Granting permissions to individuals. This is hard to audit. Use groups.
- Choosing Full Control "to make it work." Find the specific right that is missing instead.
- Privilege creep. A person who changes jobs keeps old rights and collects new ones. Review access regularly.
- Leaving accounts active. Disable accounts for departed staff and unused built-in accounts.
Exercises
Exercise
A new employee in the Accounting group reports that she can open files in C:\Finance but cannot save changes. Following least privilege, what should you do?
Show answer
Confirm the Accounting group has Modify permission on the folder, for example with icacls "C:\Finance" /grant "Accounting:(OI)(CI)M". Do not make her an administrator or grant Full Control, because Modify gives her the access she needs.
Exercise
A user moved from Sales to Support six months ago and still has access to Sales shares. Which problem is this, and how do you fix it?
Show answer
This is privilege creep. Remove the user from the Sales group and keep only the Support access. Review access regularly to catch it earlier.