ThisCalculator

Everyday

Mandatory Access Control (MAC) Definition & How It Works

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Mandatory access control (MAC) is a security model in which the operating system or security kernel enforces access decisions based on fixed, system-wide policies, and individual users cannot override or change those policies. You enter a subject (user or process), an object (file or resource), and the system checks its label against the policy to grant or deny access. The result is a strict, centrally controlled environment where even the owner of a file cannot share it if the policy forbids it.

Formula

The core MAC decision is a simple comparison of security labels. In a Bell–LaPadula style system (the classic MAC model), a subject may read an object only if the subject’s clearance level is greater than or equal to the object’s classification level. The formula is:

Access allowed = (subject clearance ≥ object classification) ? 1 : 0

Where:

  • Subject clearance level – a numeric rank (e.g., 1=Unclassified, 2=Confidential, 3=Secret, 4=Top Secret) assigned to a user or process.
  • Object classification level – the same numeric scale applied to a file or resource.

Worked Example

Using the default values from the calculator: subject clearance = 3 (Secret), object classification = 2 (Confidential).

  1. Compare: 3 ≥ 2? Yes.
  2. Result: access allowed = 1 (yes).

If the object were classified 4 (Top Secret), the comparison would be 3 ≥ 4? No, so access would be denied (0).

Background and Origin

MAC emerged from military and government security needs in the 1960s and 1970s. The U.S. Department of Defense sponsored research that led to the Bell–LaPadula model (1973) for confidentiality and the Biba model (1975) for integrity. These models formalized the idea that access decisions should be based on labels and clearances, not on user discretion. The term “mandatory” distinguishes it from discretionary access control (DAC), where the owner of a resource decides who can access it.

How MAC Works in Practice

Modern operating systems implement MAC through a security kernel or a reference monitor that intercepts every access request. The process typically involves:

  1. Labeling – Every subject (user, process) and object (file, device, socket) gets a security label, such as “Secret” or “Top Secret.”
  2. Policy enforcement – The kernel checks each request against the system policy. For example, SELinux uses a policy language that defines allowed operations (read, write, execute) on labeled objects.
  3. No override – Users cannot change labels or grant permissions outside the policy, even if they own the resource.

Common MAC implementations include SELinux (on many Linux distributions), AppArmor (on Ubuntu and SUSE), and Windows Mandatory Integrity Control (a limited form). These systems are often used to confine processes, such as web servers or database daemons, so that a compromised service cannot access unrelated files.

When to Use MAC vs. DAC

Choose MAC when you need strict, centralized control and protection against data leakage, especially in multi-user or high-security environments. It is ideal for:

  • Government or military systems handling classified data.
  • Corporate servers that hold sensitive customer or financial information.
  • Systems that face high risk of malware or insider threats.

Use DAC (the default on most personal operating systems) when users need flexibility to share files freely and the data is not highly sensitive. MAC is generally more complex to administer, so it may be overkill for a home computer.

Common Problems and Misconceptions

A frequent misconception is that MAC and DAC are mutually exclusive – in reality, many systems use both. For example, SELinux can enforce MAC while the traditional Unix permissions (DAC) still apply. Another common issue is misconfiguration: overly strict MAC policies can break legitimate applications, forcing administrators to debug policy rules. Also, MAC does not protect against all threats; it cannot prevent a user with high clearance from intentionally leaking data, nor does it stop malware that runs within the allowed policy. Finally, some believe MAC is only for military use, but it is widely used in Linux servers and Android devices (via SELinux).

Alternatives and Related Models

Besides MAC and DAC, there are other access control models:

  • Role-based access control (RBAC) – Access is based on roles (e.g., “manager”) rather than individual users or labels. RBAC is common in business applications.
  • Attribute-based access control (ABAC) – Decisions use attributes of the subject, object, and environment (e.g., time of day, user location). ABAC is flexible but can be complex to manage.
  • Rule-based access control – Uses a set of rules (e.g., “allow all during business hours”) often combined with other models.

Each model has trade-offs. MAC offers the strongest enforcement but less flexibility; RBAC and ABAC are more adaptable but require careful policy design.

Costs and Practical Considerations

Implementing MAC involves significant administrative overhead. You must define labels, write policies, and test them thoroughly. In a large organization, this can require dedicated security staff. Training is also necessary because users may be confused when they cannot access files they “own.” However, the cost is often justified for regulated industries (e.g., healthcare, finance) that must protect sensitive data. Open-source tools like SELinux and AppArmor are free, but the labor cost of configuration and maintenance is the primary expense.

Safety and Best Practices

To avoid breaking applications, start with a permissive policy and gradually tighten it. Use audit logs to monitor denials and adjust rules. Always test policy changes in a non-production environment. For Linux systems, tools like audit2why (with SELinux) can help diagnose denials. Remember that MAC is one layer of defense; combine it with encryption, strong authentication, and regular patching.

Frequently Asked Questions

Is MAC the same as a firewall? No. A firewall controls network traffic between networks, while MAC controls access to local system resources (files, processes, devices). They are complementary security layers.

Can a user override MAC? No, that is the defining feature. Even the system administrator (root) cannot bypass MAC policies unless the policy explicitly allows it. This is why MAC is considered more secure than DAC.

What is the difference between MAC and RBAC? MAC uses labels and clearances, while RBAC uses roles. In RBAC, a user with a certain role can access resources based on that role, but the role assignment is often managed by an administrator. MAC is typically more rigid and enforced by the kernel.

Does Windows have MAC? Windows has a limited form called Mandatory Integrity Control (MIC), which adds integrity levels (Low, Medium, High, System) to processes and objects. It is not as comprehensive as SELinux, but it does restrict certain operations based on those levels.

Why does Android use MAC? Android uses SELinux (a MAC implementation) to confine apps and system processes. This limits the damage a malicious app can do by preventing it from accessing sensitive files or system resources outside its designated domain.

Can MAC prevent all data breaches? No. MAC reduces the risk of unauthorized access, but it cannot stop a user with legitimate high clearance from copying data, nor can it prevent phishing or social engineering. It is a powerful control, but not a complete security solution.

Related

Formula used
in s | Subject clearance level | 1-4 | 3 | 1
in o | Object classification level | 1-4 | 2 | 1
out allowed | Access allowed (1=yes, 0=no) | - | if(s >= o, 1, 0) | 0

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.