Description
A product incorrectly assigns a privilege to a particular actor, creating an unintended sphere of control for that actor.
Potential Impact
Access Control
Gain Privileges or Assume Identity
Demonstrative Examples
seteuid(0);
/* do some stuff */
seteuid(getuid());AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// privileged code goes here, for example:
System.loadLibrary("awt");return null;
// nothing to return
}Intent intent = new Intent();intent.setAction("com.example.BackupUserData");intent.setData(file_uri);intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);sendBroadcast(intent);public class CallReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {Uri userData = intent.getData();stealUserData(userData);}}Mitigations & Prevention
Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-1999-1193 | untrusted user placed in unix "wheel" group |
| CVE-2005-2741 | Product allows users to grant themselves certain rights that can be used to escalate privileges. |
| CVE-2005-2496 | Product uses group ID of a user instead of the group, causing it to run with different privileges. This is resultant from some other unknown issue. |
| CVE-2004-0274 | Product mistakenly assigns a particular status to an entity, leading to increased privileges. |
Related Weaknesses
Taxonomy Mappings
- PLOVER: — Incorrect Privilege Assignment
- The CERT Oracle Secure Coding Standard for Java (2011): SEC00-J — Do not allow privileged blocks to leak sensitive information across a trust boundary
- The CERT Oracle Secure Coding Standard for Java (2011): SEC01-J — Do not allow tainted variables in privileged blocks
Frequently Asked Questions
What is CWE-266?
CWE-266 (Incorrect Privilege Assignment) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. A product incorrectly assigns a privilege to a particular actor, creating an unintended sphere of control for that actor.
How can CWE-266 be exploited?
Attackers can exploit CWE-266 (Incorrect Privilege Assignment) to gain privileges or assume identity. This weakness is typically introduced during the Implementation phase of software development.
How do I prevent CWE-266?
Key mitigations include: Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.
What is the severity of CWE-266?
CWE-266 is classified as a Base-level weakness (Medium abstraction). It has been observed in 4 real-world CVEs.