---
title: "CWE-272: Least Privilege Violation"
url: https://radicalnotion.ai/cwe/cwe-272
type: cwe
description: "The elevated privilege level required to perform operations such as chroot() should be dropped immediately after the operation is performed."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-272: Least Privilege Violation

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 43
- **Of those, in CISA KEV:** 0
- **New in 2026:** 26
- **CWE catalog version:** 4.21

## Description

The elevated privilege level required to perform operations such as chroot() should be dropped immediately after the operation is performed.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
| Operation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control, Confidentiality | Gain Privileges or Assume Identity, Read Application Data, Read Files or Directories | An attacker may be able to access resources with the elevated privilege that could not be accessed with the attacker's original privileges. This is particularly likely in conjunction with another flaw, such as a buffer overflow. |

## Potential mitigations

### Architecture and Design, Operation

Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.

### Architecture and Design (Separation of Privilege)

Follow the principle of least privilege when assigning access rights to entities in a software system.

### Architecture and Design (Separation of Privilege)

Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area.

Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

## Detection methods

### Automated Static Analysis - Binary or Bytecode

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Compare binary / bytecode to application permission manifest

Effectiveness: SOAR Partial

### Dynamic Analysis with Automated Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Host-based Vulnerability Scanners - Examine configuration for flaws, verifying that audit mechanisms work, ensure host configuration meets certain predefined criteria

Effectiveness: SOAR Partial

### Manual Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Manual Source Code Review (not inspections)
- Focused Manual Spotcheck - Focused manual analysis of source

Effectiveness: High

### Automated Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Source code Weakness Analyzer
- Context-configured Source Code Weakness Analyzer

Effectiveness: SOAR Partial

### Automated Static Analysis

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Permission Manifest Analysis

Effectiveness: SOAR Partial

### Architecture or Design Review

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)
- Formal Methods / Correct-By-Construction
- Attack Modeling

Effectiveness: High

## Demonstrative examples

### Example 1

The following example demonstrates the weakness.

Bad code:

```c
setuid(0);
// Do some important stuff
setuid(old_uid);
// Do some non privileged stuff.
```

### Example 2

The following example demonstrates the weakness.

Bad code:

```java
AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        // privileged code goes here, for example:
        System.loadLibrary("awt");
        return null;
        // nothing to return
    }
```

### Example 3

The following code calls chroot() to restrict the application to a subset of the filesystem below APP\_HOME in order to prevent an attacker from using the program to gain unauthorized access to files located elsewhere. The code then opens a file specified by the user and processes the contents of the file.

Bad code:

```c
chroot(APP_HOME);
chdir("/");
FILE* data = fopen(argv[1], "r+");
...
```

Constraining the process inside the application's home directory before opening any files is a valuable security measure. However, the absence of a call to setuid() with some non-zero value means the application is continuing to operate with unnecessary root privileges. Any successful exploit carried out by an attacker against the application can now result in a privilege escalation attack because any malicious operations will be performed with the privileges of the superuser. If the application drops to the privilege level of a non-root user, the potential for damage is substantially reduced.

## Real CVEs with this weakness (sample of 12 of 43)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-59106 | Web Server Running with Root Privileges in dormakaba access manager | high | 8.8 | - | No | 2026-01-26 |
| CVE-2025-7722 | Social Streams \<= 1.2.1 - Authenticated (Subscriber+) Privilege Escalation | high | 8.8 | - | No | 2025-07-23 |
| CVE-2024-28824 | Privilege escalation in mk\_informix plugin | high | 8.8 | - | No | 2024-03-22 |
| CVE-2026-130677 | Craft CMS 5.0.0 before 5.11.4 2FA Session Invalidation and Re-authentication Bypass | high | 8.7 | - | No | 2026-11-18 |
| CVE-2026-39459 | iControl REST and tmsh vulnerability | high | 8.6 | - | No | 2026-05-13 |
| CVE-2025-8181 | TOTOLINK N600R/X2000R FTP Service vsftpd.conf least privilege violation | high | 8.6 | - | No | 2025-07-26 |
| CVE-2025-9711 | Privilege escalation in Brocade Fabric OS before 9.2.1c3, and 9.2.2 though 9.2.2b | high | 8.5 | - | No | 2026-02-03 |
| CVE-2024-35204 | - | high | 8.4 | - | No | 2024-05-13 |
| CVE-2025-47809 | Privilege Escalation Through CodeMeter Installer on Windows | high | 8.2 | - | No | 2025-05-16 |
| CVE-2024-0638 | Privilege escalation in mk\_oracle plugins | high | 8.2 | - | No | 2024-03-22 |
| CVE-2026-103504 | Gitea API team demotion not applied to unit permissions | high | 8.1 | - | No | 2026-10-06 |
| CVE-2026-32655 | - | high | 7.8 | - | No | 2026-04-27 |

## Related attack patterns (CAPEC)

- [CAPEC-17](https://radicalnotion.ai/capec/capec-17): Using Malicious Files
- [CAPEC-35](https://radicalnotion.ai/capec/capec-35): Leverage Executable Code in Non-Executable Files
- [CAPEC-76](https://radicalnotion.ai/capec/capec-76): Manipulating Web Input to File System Calls

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-271](https://radicalnotion.ai/cwe/cwe-271) | Privilege Dropping / Lowering Errors |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 7 Pernicious Kingdoms | Least Privilege Violation | - | - |
| CLASP | Failure to drop privileges when reasonable | - | - |
| CERT C Secure Coding | Follow the principle of least privilege | POS02-C | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not allow privileged blocks to leak sensitive information across a trust boundary | SEC00-J | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not allow tainted variables in privileged blocks | SEC01-J | - |
| Software Fault Patterns | Privilege | SFP36 | - |

## Frequently asked questions

### What is CWE-272?

The elevated privilege level required to perform operations such as chroot() should be dropped immediately after the operation is performed.

### What CVEs are caused by CWE-272?

43 recorded CVEs are attributed to CWE-272, including CVE-2025-59106, CVE-2025-7722 and CVE-2024-28824.

### How do you prevent CWE-272?

Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.

### How is CWE-272 detected?

Automated Static Analysis - Binary or Bytecode: According to SOAR, the following detection techniques may be useful:

### What are the consequences of CWE-272?

Exploiting CWE-272 can lead to: Gain Privileges or Assume Identity, Read Application Data, Read Files or Directories.

### Is CWE-272 actively exploited?

43 recorded CVEs are caused by CWE-272; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/272.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-272). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
