CWE-266 特权授予不正确

Incorrect Privilege Assignment

结构: Simple

Abstraction: Base

状态: Draft

被利用可能性: unkown

基本描述

A product incorrectly assigns a privilege to a particular actor, creating an unintended sphere of control for that actor.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 269 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: CanAlsoBe cwe_CWE_ID: 286 cwe_View_ID: 1000

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Access Control Gain Privileges or Assume Identity A user can access restricted functionality and/or sensitive information that may include administrative functionality and user accounts.

可能的缓解方案

MIT-1 ['Architecture and Design', 'Operation']

策略:

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

MIT-17 ['Architecture and Design', 'Operation']

策略: Environment Hardening

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.

示例代码

Evidence of privilege change:

bad C

seteuid(0);
/ do some stuff /

seteuid(getuid());

bad Java

AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {

// privileged code goes here, for example:
System.loadLibrary("awt");
return null;
// nothing to return
}

This application sends a special intent with a flag that allows the receiving application to read a data file for backup purposes.

bad Java

Intent intent = new Intent();
intent.setAction("com.example.BackupUserData");
intent.setData(file_uri);
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
sendBroadcast(intent);

attack Java

public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Uri userData = intent.getData();
stealUserData(userData);
}
}

Any malicious application can register to receive this intent. Because of the FLAG_GRANT_READ_URI_PERMISSION included with the intent, the malicious receiver code can read the user's data.

分析过的案例

标识 说明 链接
CVE-1999-1193 untrusted user placed in unix "wheel" group https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-1193
CVE-2005-2741 Product allows users to grant themselves certain rights that can be used to escalate privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2741
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. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2496
CVE-2004-0274 Product mistakenly assigns a particular status to an entity, leading to increased privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0274

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
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

引用