Security in depth · Unit 22 · Lesson 1 of 44
Linux privilege escalation
Understand who can do what: identities, permissions, delegation, and the dependencies that make Linux privilege boundaries work.
ATT&CK TA0004 Privilege Escalation
Helpful before thisPrivilege escalation
After this lesson you can
- explain how process identity and resource policy shape Linux access
- distinguish ordinary permissions from explicit privileged delegation
- describe a service boundary and a practical way to verify its protection
Lessons in this unit
Browse 21 lessons in this topic
- Linux process identityUse a process credential snapshot to explain a file-access decision.4 min
- Owner, group, and otherChoose the applicable class before evaluating a requested operation.3 min
- Directories control names and traversalSeparate listing a directory from resolving a file within it.3 min
- ACLs add named permissionsCalculate effective named-user rights from an entry and its mask.3 min
- Special bits need a purposeSeparate directory sticky-bit protection from file content permissions.4 min
- Capabilities split privileged authorityDistinguish a capability boundary setting from authority currently held.4 min
- Delegation is more than a command nameReview the task, target identity, and trusted inputs behind a delegation rule.4 min
- Give services their own identityCheck whether separate service identities actually have separate data access.4 min
- Scheduled work inherits a trust chainSeparate a timer firing from a successful job and a verified output.4 min
- Search paths are trust decisionsExplain what an explicit dependency location proves and what it leaves unresolved.4 min
- Loaded libraries share process authorityReview a native plugin separately from the trusted program that loads it.4 min
- Local secrets need a lifecycleSeparate deleting a local secret from ending the access it grants.3 min
- Container isolation has dimensionsJudge a container by its actual resource grants, not its isolation label.3 min
- Mandatory policy adds another boundaryCheck whether mandatory policy actually constrains the process in your record.3 min
- Kernel updates need completion evidenceConnect a vendor correction to the kernel code actually running.3 min
- Review a Linux boundary as a wholeRead a hardening score alongside the checks and identities it actually covers.3 min
- New files begin with a permission decisionWork out a new file’s permissions and identify what a default change leaves untouched.3 min
- A local socket is still an access boundarySeparate permission to contact a local service from permission to change its policy.3 min
- A management group can carry broad powerTreat management-group membership as delegated authority, including existing sessions.3 min
- Mount options have specific jobsMatch mount restrictions to the exact path and operation being reviewed.4 min
- Case: review an archive's Linux permissionsRead an ACL, separate old files from new defaults, and propose the smallest justified correction.10 min
A fictional museum runs a Linux service that makes nightly copies of its collection catalog. The service needs to read the catalog and write backups. It does not need to manage every account on the machine. Understanding that difference is the foundation of privilege security: give useful work enough authority, then protect the places where that authority is assigned or changed.
Start with the process, not its name
A process carries user and group credentials. Its Effective user ID helps determine authority; Linux also has filesystem IDs that normally follow effective IDs. A friendly service name does not tell you these values. Supplementary groups can provide important access even when the account is not root.
For an ordinary file without additional controls, the matching owner, group, or other class supplies the relevant mode permissions. These classes are not added together. Follow process identity and file permissions before exploring ACLs.
Separate the file from its location
Reading file content, writing it, and changing its directory entry are different operations. A directory governs names and traversal; a file governs its contents. Protecting the museum’s configuration file therefore includes reviewing its containing directories and the process that creates replacements.
Default permissions influence newly created objects, while existing files retain their own settings. Continue with directory permissions and creation masks.
EXPLORE THE CONCEPT
Try a Linux permission decision
Explore the cases, then change the identity and permissions. This model covers read and write access to an ordinary file with no ACLs, extra capabilities, or additional policy.
The owner cannot borrow the group grant
In the ordinary mode-bit model, a matching owner uses the owner class. If owner write is off, a group write grant does not supply a second attempt, even when the owner also belongs to that group.
A directory is a different kind of object
Directory read lists names; search permits traversal. Changing directory entries normally needs write and search. This file simulator does not decide directory deletion, renaming, or traversal.
Real systems include more controls
ACLs, process capabilities, mount restrictions, and mandatory security policy can affect actual access. Use the simulator to understand one mechanism, then examine the full context when reviewing a system.
A simplified learning model. It connects to no systems and uses no real data.
Understand deliberate changes in authority
SUID on a supported executable can change the effective user ID to the file owner’s ID. It does not unconditionally make every program run with every owner privilege. Linux ignores these bits on interpreter scripts, and restrictions such as no_new_privs or a nosuid mount can prevent the transition. Ask what purpose a privileged helper serves and how its authority is constrained.
sudo applies policy to delegated tasks: who may perform which work, as whom, and under what conditions. Review arguments, environment, configuration, and dependencies alongside the task itself. A Capability separates particular privileged operations, but a short list of capabilities can still grant substantial power. Explore special permissions, delegation policy, and capability boundaries.
Follow the service’s trusted dependencies
The museum’s backup identity is only one part of its Trust boundary. Its schedule, program, configuration, libraries, management interface, and destination also influence the work it performs. Changing a trusted dependency may alter the behavior of a powerful service. Give each component an owner and limit who may maintain it.
Local sockets still need authorization. Container management groups may carry considerable host authority. Mount restrictions and mandatory policy address particular operations, with defined limits. The short lessons on scheduled work, local sockets, and mandatory controls unpack those boundaries.
Verify a useful boundary
State the requirement plainly: “The backup worker may read the catalog and create backups; only the maintenance role may change its configuration.” Remove unnecessary grants, verify ordinary work still succeeds, and confirm that disallowed actions are rejected. Review the running configuration after updates. Supported software, timely maintenance, change records, and tested recovery complement permission design; none makes the others unnecessary.
Apply these ideas in the Linux permission-review case. Work from supplied access records, distinguish old files from new-file policy, and write a justified correction with clear acceptance evidence.
Terms you met
Check yourself
No timer. No penalties. Read the explanation and try again whenever you like.
This lesson’s questions have changed. Your reading progress is saved; review the updated questions.
-
What can SUID change on supported Linux execution?
Show the answer
Correct answer: The effective user ID, subject to execution restrictions. The executable owner's ID can become the effective ID when applicable restrictions do not prevent the change.
-
What makes a sudo delegation review complete?
Show the answer
Correct answer: Reviewing the allowed task, target identity, inputs, and trusted dependencies. The task's effective authority depends on its entire execution context.
-
Can a non-root service still hold sensitive authority?
Show the answer
Correct answer: Yes; its groups, data access, and delegated rights may be powerful. Root is not the only identity that can read valuable data or change important behavior.
-
What should follow removal of an unnecessary service permission?
Show the answer
Correct answer: Verify intended work succeeds and the unwanted operation is denied. A useful boundary must preserve required behavior while enforcing the intended limit.
Try it
- WriteSketch a fictional backup service. Name its identity, the data it reads, the output it writes, and who may change its configuration. Choose one unnecessary permission to remove and describe a harmless check that useful work still succeeds.