CWE-273 对于放弃特权的检查不恰当

admin 2022年1月5日21:05:14CWE(弱点枚举)评论12 views3156字阅读10分31秒阅读模式

CWE-273 对于放弃特权的检查不恰当

Improper Check for Dropped Privileges

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: Medium

基本描述

The software attempts to drop privileges but does not check or incorrectly checks to see if the drop succeeded.

扩展描述

If the drop fails, the software will continue to run with the raised privileges, which might provide additional access to unprivileged users.

相关缺陷

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

  • cwe_Nature: ChildOf cwe_CWE_ID: 754 cwe_View_ID: 1003 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 271 cwe_View_ID: 1000

  • cwe_Nature: ChildOf cwe_CWE_ID: 271 cwe_View_ID: 699 cwe_Ordinal: Primary

  • cwe_Nature: PeerOf cwe_CWE_ID: 252 cwe_View_ID: 1000

适用平台

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-53 Implementation

策略:

Check the results of all functions that return a value and verify that the value is expected.

Implementation

策略:

In Windows, make sure that the process token has the SeImpersonatePrivilege(Microsoft Server 2003). Code that relies on impersonation for security must ensure that the impersonation succeeded, i.e., that a proper privilege demotion happened.

示例代码

This code attempts to take on the privileges of a user before creating a file, thus avoiding performing the action with unnecessarily high privileges:

bad C++

bool DoSecureStuff(HANDLE hPipe) {

bool fDataWritten = false;
ImpersonateNamedPipeClient(hPipe);
HANDLE hFile = CreateFile(...);
/../
RevertToSelf()
/../

}

The call to ImpersonateNamedPipeClient may fail, but the return value is not checked. If the call fails, the code may execute with higher privileges than intended. In this case, an attacker could exploit this behavior to write a file to a location that the attacker does not have access to.

分析过的案例

标识 说明 链接
CVE-2006-4447 Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-4447
CVE-2006-2916 Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-2916

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Failure to check whether privileges were dropped successfully
CERT C Secure Coding POS37-C Exact Ensure that privilege relinquishment is successful
Software Fault Patterns SFP4 Unchecked Status Condition

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

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月5日21:05:14
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  CWE-273 对于放弃特权的检查不恰当 http://cn-sec.com/archives/612801.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: