CWE-271 特权放弃/降低错误

admin 2022年1月5日21:05:11评论45 views字数 4813阅读16分2秒阅读模式

CWE-271 特权放弃/降低错误

Privilege Dropping / Lowering Errors

结构: Simple

Abstraction: Class

状态: Incomplete

被利用可能性: High

基本描述

The software does not drop privileges before passing control of a resource to an actor that does not have those privileges.

扩展描述

In some contexts, a system executing with elevated permissions will hand off a process/file/etc. to another process or user. If the privileges of an entity are not reduced, then elevated privileges are spread throughout a system and possibly to an attacker.

相关缺陷

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

适用平台

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

常见的影响

范围 影响 注释
Access Control Gain Privileges or Assume Identity If privileges are not dropped, neither are access rights of the user. Often these rights can be prevented from being dropped.
['Access Control', 'Non-Repudiation'] ['Gain Privileges or Assume Identity', 'Hide Activities'] If privileges are not dropped, in some cases the system may record actions as the user which is being impersonated rather than the impersonator.

可能的缓解方案

MIT-46 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 that the compartmentalization serves to allow for and further reinforce privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide when it is appropriate to use and to drop system privileges.

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

策略:

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

MIT-49 Architecture and Design

策略: Separation of Privilege

Consider following the principle of separation of privilege. Require multiple conditions to be met before permitting access to a system resource.

示例代码

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 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.

分析过的案例

标识 说明 链接
CVE-2000-1213 Program does not drop privileges after acquiring the raw socket. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-1213
CVE-2001-0559 Setuid program does not drop privileges after a parsing error occurs, then calls another program to handle the error. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0559
CVE-2001-0787 Does not drop privileges in related groups when lowering privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-0787
CVE-2002-0080 Does not drop privileges in related groups when lowering privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0080
CVE-2001-1029 Does not drop privileges before determining access to certain files. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1029
CVE-1999-0813 Finger daemon does not drop privileges when executing programs on behalf of the user being fingered. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-0813
CVE-1999-1326 FTP server does not drop privileges if a connection is aborted during file transfer. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-1326
CVE-2000-0172 Program only uses seteuid to drop privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0172
CVE-2004-2504 Windows program running as SYSTEM does not drop privileges before executing other programs (many others like this, especially involving the Help facility). https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2504
CVE-2004-0213 Utility Manager launches winhlp32.exe while running with raised privileges, which allows local users to gain system privileges. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0213
CVE-2004-0806 Setuid program does not drop privileges before executing program specified in an environment variable. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0806
CVE-2004-0828 Setuid program does not drop privileges before processing file specified on command line. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0828
CVE-2004-2070 Service on Windows does not drop privileges before using "view file" option, allowing code execution. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2070

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Privilege Dropping / Lowering Errors

引用

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月5日21:05:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-271 特权放弃/降低错误http://cn-sec.com/archives/612802.html

发表评论

匿名网友 填写信息