Mandatory Access Control MAC: How It Works
- Average speed
- km/h
- Result
- Finish time
- 50 min
- You entered
- Distance
- 10 km
- You entered
Mandatory Access Control (MAC) is a security model in which the operating system or database enforces access permissions based on fixed security labels, and users cannot override or change those rules. You enter a system with a clearance label and an object (file, process, device) has a classification label; the system grants access only when the labels satisfy a defined policy. This article explains the core concepts, how MAC differs from other access control models, where it is used, and the practical trade-offs you need to know.
Formula
In the context of a running pace calculator, the formula is:
Pace (min/km) = Time (minutes) / Distance (km)
And speed in km/h is:
Speed (km/h) = Distance (km) / (Time (minutes) / 60)
Where:
- Time is the total time taken, in minutes.
- Distance is the distance covered, in kilometers.
- Pace is the time needed to cover one kilometer, in minutes per kilometer.
- Speed is the average speed, in kilometers per hour.
Worked Example
Using the default values from the calculator: Time = 50 minutes, Distance = 10 km.
Step 1: Calculate pace: Pace = 50 / 10 = 5.00 min/km.
Step 2: Calculate speed: Speed = 10 / (50 / 60) = 10 / 0.8333 = 12.00 km/h.
So the average pace is 5 minutes per kilometer, and the average speed is 12 km/h.
What Is Mandatory Access Control?
Mandatory Access Control (MAC) is a security policy enforced by a central authority, typically the operating system kernel or a security server. Unlike Discretionary Access Control (DAC), where the owner of a resource decides who can access it, MAC rules are defined by a system administrator and cannot be changed by users. Every subject (user, process) and every object (file, directory, device) has a security label, such as Top Secret, Secret, Confidential, and Unclassified. Access decisions are made by comparing these labels according to a fixed policy, such as the Bell-LaPadula model.
MAC is used in environments that require high confidentiality and integrity, such as military systems, government agencies, and financial institutions. It is also implemented in Linux through SELinux and AppArmor, and in Windows through mandatory integrity levels.
How MAC Works: Labels and Rules
The core of MAC is the security label. Each subject and object has a label that includes a classification level (e.g., Secret) and possibly categories (e.g., NATO, Nuclear). The access decision is based on two main rules:
- No Read Up (Simple Security Property): A subject can only read objects at or below its own classification level. A Secret user can read Secret and Confidential files, but not Top Secret.
- No Write Down (Star Property): A subject can only write to objects at or above its own level. A Secret user can write to Secret and Top Secret files, but not to Confidential files, to prevent leaking sensitive information to lower levels.
These rules prevent information flow from high to low, which is the fundamental goal of MAC. The system enforces these rules automatically, so even if a user tries to copy a Secret file to a Confidential directory, the operation is blocked.
MAC vs. DAC vs. RBAC
To understand MAC, it helps to compare it with other access control models:
- Discretionary Access Control (DAC): The owner of a file sets permissions (e.g., read, write, execute) for other users. This is what standard Unix and Windows file systems use. DAC is flexible but risky: a user can accidentally grant access to sensitive data.
- Role-Based Access Control (RBAC): Access is based on roles (e.g., manager, employee) rather than individual users. RBAC is common in enterprise applications. It is not necessarily mandatory; it can be implemented as a form of non-discretionary control, but the key difference is that RBAC focuses on roles, not labels.
- Mandatory Access Control: Access is based on labels and a central policy, and users cannot override it. Even the owner of a file cannot change its label or grant access to someone with a lower clearance.
In practice, many systems use a combination. For example, a Linux system might use DAC for normal file permissions and SELinux as a MAC layer on top.
Real-World Implementations
MAC is not just a theoretical concept. Several major operating systems and security frameworks implement it:
- SELinux (Security-Enhanced Linux): Developed by the NSA, SELinux enforces MAC on Linux. It labels every process and file, and uses policy rules to control interactions. It is used in Red Hat, Fedora, and Android (in part).
- AppArmor: Another Linux MAC implementation, but it uses path-based profiles rather than file labels. It is easier to configure than SELinux and is used in Ubuntu and SUSE.
- Windows Mandatory Integrity Control (MIC): Windows uses integrity levels (Low, Medium, High, System) to control access. Processes and files have an integrity level, and a process cannot write to a file with a higher integrity level unless it has the right privilege.
- FreeBSD and macOS: FreeBSD has a MAC framework, and macOS uses a combination of sandboxing (which is a form of MAC) and traditional Unix permissions.
Benefits and Drawbacks
MAC provides strong security, but it comes with costs:
- Pros: Prevents privilege escalation, contains malware, enforces data confidentiality, and ensures that users cannot accidentally or maliciously leak data. Even if a user is compromised, the attacker cannot access higher-classified data.
- Cons: Complex to configure and maintain. SELinux has a steep learning curve and can break applications if policies are too strict. Overhead in administration and potential performance impact. Users may find it restrictive because they cannot share files as easily.
For example, an SELinux policy might block a web server from reading a user’s home directory, even if the Unix permissions allow it, because the web server’s process label does not have access to that directory’s label.
Common Misconceptions
One common misconception is that MAC is the same as file permissions in Linux. File permissions (chmod) are DAC, not MAC. Another is that MAC only applies to government systems; in reality, many consumer devices use MAC-like controls. For instance, iOS apps are sandboxed, and Android uses SELinux to enforce app permissions. A third misconception is that MAC is always stricter than DAC; actually, a well-configured MAC can allow more flexibility because it can define fine-grained rules, but it is still mandatory in that users cannot override them.
How to Choose an Access Control Model
Choosing between MAC, DAC, and RBAC depends on your security requirements:
- If you need high confidentiality and have a clear classification hierarchy, MAC is appropriate (e.g., military, government, healthcare with strict privacy rules).
- If you need flexibility and user control, DAC is simpler (e.g., personal computers, small teams).
- If you need to manage access based on job functions, RBAC is a good fit (e.g., enterprise CRM, HR systems).
In many cases, you can layer them: use DAC as a base, add RBAC for roles, and apply MAC for the most sensitive data.
Frequently Asked Questions
Is MAC the same as SELinux?
No. SELinux is a specific implementation of MAC on Linux. MAC is the general security model; SELinux is one way to enforce it. Other implementations include AppArmor and Windows MIC.
Can a user change the security label of a file in MAC?
No. In a strict MAC system, labels are assigned by the system and cannot be changed by users, even the owner. This is what makes it “mandatory.” Some systems allow a trusted administrator to change labels, but that is outside the normal user role.
Does MAC protect against all attacks?
No. MAC protects against unauthorized access and information leakage, but it does not prevent all attacks. For example, it cannot stop a user with a Secret clearance from writing incorrect data to a Secret file (integrity is handled by other models like Biba). It also does not protect against social engineering or malware that runs at the same clearance level.
Why is MAC considered more secure than DAC?
Because MAC is centrally enforced and users cannot override it. In DAC, a user might accidentally give read access to a sensitive file to everyone. In MAC, even if the user tries, the system blocks it if the labels do not match. This reduces the risk of human error and malicious insider actions.
Can I use MAC on my personal computer?
Yes, you can. Linux distributions like Fedora enable SELinux by default, and Ubuntu uses AppArmor. Windows has mandatory integrity levels, though they are not as prominent. For a typical home user, these features run in the background and rarely cause issues, but they can be configured if you want more control.
What is the difference between MAC and a sandbox?
A sandbox is a restricted environment that limits what a program can do, often using MAC-like rules. For example, a web browser sandbox might prevent the browser from reading your personal files. Sandboxing is a practical application of MAC principles, but MAC is a broader concept that applies to the entire system, not just one program.
Related
Formula used
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.