CWE

Common Weakness Enumeration

社区开发的软件和硬件弱点类型清单

2021 CWE最重要的硬件弱点
CWE前25个最危险的弱点
Home>CWEList> cwe-单个字典定义(4.10)
ID

CWE-772: Missing Release of Resource after Effective Lifetime

弱点ID:772
Abstraction:Base
结构:简单的
查看自定义信息:
+描述
The product does not release a resource after its effective lifetime has ended, i.e., after the resource is no longer needed.
+Extended Description
当使用后未发布资源时,它可以允许攻击者通过在不触发其释放的情况下导致资源分配来引起拒绝服务。经常影响的资源包括内存,CPU,磁盘空间,电源或电池等。
+Relationships
Section HelpThis table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
+与观点“研究概念”相关(CWE-1000)
自然 类型 ID 姓名
Childof Class班级 - 以非常抽象的方式描述的弱点,通常与任何特定的语言或技术无关。比支柱弱点更具体,但比基本弱点更一般。班级弱点通常用以下维度的1或2来描述问题:行为,属性和资源。 404 Improper Resource Shutdown or Release
父母 变体变体- a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. 401 Missing Release of Memory after Effective Lifetime
父母 变体变体- a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. 775 有效终生后缺少释放文件描述符或处理
父母 Base基础 - 仍然主要独立于资源或技术的弱点,但有足够的细节来提供特定的检测和预防方法。基本水平的弱点通常用以下维度的2或3来描述问题:行为,财产,技术,语言和资源。 1091 使用对象而无需调用破坏者法
可以按照 Base基础 - 仍然主要独立于资源或技术的弱点,但有足够的细节来提供特定的检测和预防方法。基本水平的弱点通常用以下维度的2或3来描述问题:行为,财产,技术,语言和资源。 911 参考数量不正确的更新
Section HelpThis table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
+与“软件开发”视图相关(CWE-699)
自然 类型 ID 姓名
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 399 Resource Management Errors
Section HelpThis table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
+与“简化已发表漏洞的简化映射”(CWE-1003)相关的视图相关(CWE-1003)
自然 类型 ID 姓名
Childof Class班级 - 以非常抽象的方式描述的弱点,通常与任何特定的语言或技术无关。比支柱弱点更具体,但比基本弱点更一般。班级弱点通常用以下维度的1或2来描述问题:行为,属性和资源。 404 Improper Resource Shutdown or Release
Section HelpThis table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
+Relevant to the view "CISQ Quality Measures (2020)" (CWE-1305)
自然 类型 ID 姓名
Childof Class班级 - 以非常抽象的方式描述的弱点,通常与任何特定的语言或技术无关。比支柱弱点更具体,但比基本弱点更一般。班级弱点通常用以下维度的1或2来描述问题:行为,属性和资源。 404 Improper Resource Shutdown or Release
Section HelpThis table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.
+与“ CISQ数据保护措施”(CWE-1340)有关
自然 类型 ID 姓名
Childof Class班级 - 以非常抽象的方式描述的弱点,通常与任何特定的语言或技术无关。比支柱弱点更具体,但比基本弱点更一般。班级弱点通常用以下维度的1或2来描述问题:行为,属性和资源。 404 Improper Resource Shutdown or Release
+介绍模式
Section Help引言的不同模式提供了有关如何以及何时引入这种弱点的信息。该阶段识别可能发生介绍的生命周期中的一个点,而音符提供了与给定阶段中引言有关的典型情况。
阶段 笔记
建筑和设计
执行
+Applicable Platforms
Section Help该清单显示了可能出现的弱点的可能区域。这些可能适用于特定的命名语言,操作系统,体系结构,范式,技术或一类此类平台。该平台与给定弱点出现在该实例的频率一起列出。

技术

课程:移动设备(Undetermined Prevalence)

+常见后果
Section Help该表指定与弱点相关的不同个人后果。该范围确定了违反的应用程序安全区域,而影响描述了如果对手成功利用这一弱点,就会产生负面的技术影响。其可能性提供了有关预期相对于列表中其他后果的特定后果的可能性的信息。例如,可能会利用弱点来实现一定的影响,但很可能会利用它来实现不同的影响。
Scope 影响 可能性
可用性

技术影响:DOS:资源消耗(其他)

An attacker that can influence the allocation of resources that are not properly released could deplete the available resource pool and prevent all other processes from accessing the same type of resource.
+可能性Of Exploit
高的
+示例的例子

示例1

以下方法永远不会关闭新文件句柄。如果有足够的时间,BufferReader的finalize()方法最终应调用Close(),但是不能保证此操作将需要多长时间。实际上,无法保证最终确定()将永远被调用。在繁忙的环境中,操作系统可以在调用Close()函数之前用尽所有可用的文件句柄。

(bad code)
示例语言:爪哇
private void processFile(string fName)
{
BufferReader fil = new BufferReader(new FileReader(fName));
字符串线;
while(((line = fil.readline())!= null)
{
processLine(line);
}
}

好的代码示例只需在系统完成文件完成时,将一个明确的调用添加到CLOSE()函数。在这样的简单示例中,问题很容易看到和解决。在实际系统中,问题可能更加晦涩。

(好代码)
示例语言:爪哇
private void processFile(string fName)
{
BufferReader fil = new BufferReader(new FileReader(fName));
字符串线;
while(((line = fil.readline())!= null)
{
processLine(line);
}
fil.close();
}

示例2

以下代码尝试打开与数据库的新连接,处理数据库返回的结果,并关闭分配的SQLConnection对象。

(bad code)
示例语言:C#
sqlConnection conn = new SQLConnection(connstring);
sqlcommand cmd = new sqlCommand(querystring);
cmd.connection = conn;
conn.open();
sqldatareader rdr = cmd.executereader();
HarvestResults(RDR);
conn.connection.close();

上述代码的问题是,如果执行SQL或处理结果时发生异常,则SQLConnection对象未关闭。如果经常发生这种情况,数据库将用完可用的光标,并且无法执行更多的SQL查询。

示例3

This code attempts to open a connection to a database and catches any exceptions that may occur.

(bad code)
示例语言:爪哇
尝试 {
连接con = drivermanager.getConnection(some_connection_string);
}
catch ( Exception e ) {
log(e);
}

如果在建立数据库连接后并在相同的连接关闭之前发生异常,则数据库连接池可能会耗尽。如果超过可用连接的数量,其他用户将无法访问此资源,从而有效拒绝访问该应用程序。

示例4

在正常情况下,以下C#代码执行数据库查询,处理数据库返回的结果,并关闭分配的SQLConnection对象。但是,如果执行SQL或处理结果时发生异常,则SQLConnection对象未关闭。如果经常发生这种情况,数据库将用完可用的光标,并且无法执行更多的SQL查询。

(bad code)
示例语言:C#
...
sqlConnection conn = new SQLConnection(connstring);
sqlcommand cmd = new sqlCommand(querystring);
cmd.connection = conn;
conn.open();
sqldatareader rdr = cmd.executereader();
HarvestResults(RDR);
conn.connection.close();
...

示例5

The following C function does not close the file handle it opens if an error occurs. If the process is long-lived, the process can run out of file handles.

(bad code)
示例语言:C
int decodeFile(char* fName) {
char buf[BUF_SZ];
文件* f = fopen(fname,“ r”);
如果(!f){
printf(“不能打开%s \ n”,fname);
return DECODE_FAIL;
}
别的 {
while(fgets(buf,buf_sz,f)){
如果(!checkCheckSum(buf)){
return DECODE_FAIL;
}
别的 {
去塑解(buf);
}
}
}
fclose(f);
return DECODE_SUCCESS;
}
+观察到的例子
参考 描述
链:反病毒产品遇到错误的文件,但从函数返回而无需关闭文件描述符(CWE-775)导致文件描述符消耗(CWE-400)和扫描失败。
当攻击者反复连接和断开服务器时,插座无法正确关闭。
如果发送畸形数据,则不会关闭命名的管道连接。
Chain: memory leak (CWE-404)导致资源精疲力尽。
Product allows exhaustion of file descriptors when processing a large number of TCP packets.
端口扫描触发CPU消耗的过程,这些过程试图读取封闭插座的数据。
Product allows resource exhaustion via a large number of calls that do not complete a 3-way handshake.
未检查文件/套接字操作的返回值,从而允许消耗文件描述符。
+潜在的缓解

阶段:要求

Strategy: Language Selection

使用一种不允许这种弱点的语言,或提供使这种弱点更容易避免的构造。

例如,诸如Java,Ruby和LISP之类的语言执行自动垃圾收集,以释放已交易的对象的内存。

阶段:实施

It is good practice to be responsible for freeing all resources you allocate and to be consistent with how and where you free resources in a function. If you allocate resources that you intend to free upon completion of the function, you must be sure to free the resources at all exit points for that function including error conditions.

阶段s: Operation; Architecture and Design

策略:资源限制

Use resource-limiting settings provided by the operating system or environment. For example, when managing system resources in POSIX, setrlimit() can be used to set limits for certain types of resources, and getrlimit() can determine how many resources are available. However, these functions are not available on all operating systems.

当当前级别接近为应用程序定义的最大值时(请参阅CWE-770), then limit the allocation of further resources to privileged users; alternately, begin releasing resources for less-privileged users. While this mitigation may protect the system from attack, it will not necessarily stop attackers from adversely impacting other users.

Ensure that the application performs the appropriate error checks and error handling in case resources become unavailable (CWE-703)。

+会员资格
Section HelpThis MemberOf Relationships table shows additional CWE Categories and Views that reference this weakness as a member. This information is often useful in understanding where a weakness fits within the context of external information sources.
自然 类型 ID 姓名
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 808 2010 Top 25 - Weaknesses On the Cusp
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 867 2011 Top 25 - Weaknesses On the Cusp
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 882 CERT C ++安全编码第14节 - 并发(CON)
MemberOf View查看 - CWE条目的子集,提供了一种检查CWE内容的方法。两个主视图结构是切片(平面列表)和图(包含条目之间的关系)。 884 CWE横截面
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 982 SFP Secondary Cluster: Failure to Release Resource
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 1129 CISQ Quality Measures (2016) - Reliability
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 1131 CISQ质量措施(2016年) - 安全性
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 1162 SEI CERT C Coding Standard - Guidelines 08. Memory Management (MEM)
MemberOf 类别类别 - 包含共享共同特征的其他条目的CWE条目。 1163 SEI CERT C编码标准 - 指南09.输入输出(FIO)
MemberOf View查看 - CWE条目的子集,提供了一种检查CWE内容的方法。两个主视图结构是切片(平面列表)和图(包含条目之间的关系)。 1200 2019年CWE前25个最危险的软件错误中的弱点
+笔记s

理论

脆弱性理论在很大程度上是关于行为和资源如何相互作用的。根据观点,“资源耗尽”可以视为结果或攻击。该条目是试图反映出能够发生这些攻击(或后果)的潜在弱点之一。

Maintenance

“资源耗尽”(CWE-400) is currently treated as a weakness, although it is more like a category of weaknesses that all have the same type of consequence. While this entry treatsCWE-400作为观点1000的父母,这种关系可能更恰当地描述为链。
+分类映射
Mapped Taxonomy Name Node ID 合身 Mapped Node Name
证书C安全编码 FIO42-C CWE更抽象 不再需要的文件关闭文件
证书C安全编码 MEM31-C CWE更抽象 不再需要的自由动态分配的内存
OMG ASCSM ASCSM-CWE-772
OMG ASCRM ASCRM-CWE-772
软件故障模式 SFP14 无法发布资源
+参考
[REF-961] Object Management Group (OMG). "Automated Source Code Reliability Measure (ASCRM)". ASCRM-CWE-772. 2016-01. <http://www.omg.org/spec/ascrm/1.0/>。
[Ref-962]对象管理组(OMG)。“自动源代码安全度量(ASCSM)”。ASCSM-CWE-772。2016-01。<http://www.omg.org/spec/ASCSM/1.0/>。
+内容历史记录
+提交
提交日期 Submitter 组织
2009-05-13 CWEContent Team MITER
+修改
修改日期 修饰符 组织
2010-02-16 CWEContent Team MITER
更新了示范示例,势_METIGATIONS,关系
2010-04-05 CWEContent Team MITER
更新的势_MINEIGATIONS
2010-06-21 CWEContent Team MITER
更新的势_MINEIGATIONS
2011-06-01 CWEContent Team MITER
updated Common_Consequences, Relationships, Taxonomy_Mappings
2011-06-27 CWEContent Team MITER
已更新的观察_examples,Ressact_attack_patterns,关系
2011-09-13 CWEContent Team MITER
更新的关系,分类_mappings
2012-05-11 CWEContent Team MITER
更新的示范_examples,关系,分类_mappings
2012-10-30 CWEContent Team MITER
更新的势_MINEIGATIONS
2013-02-21 CWEContent Team MITER
更新的关系
2014-02-18 CWEContent Team MITER
更新了适用的_platforms,示例_examples
2014-07-30 CWEContent Team MITER
更新的关系,分类_mappings
2017-01-19 CWEContent Team MITER
更新的关系
2017-11-08 CWEContent Team MITER
updated Likelihood_of_Exploit, Taxonomy_Mappings
2019-01-03 CWEContent Team MITER
更新的common_conconcencences,参考,关系,分类_mappings
2019-06-20 CWEContent Team MITER
更新的关系
2019-09-19 CWEContent Team MITER
更新的描述,关系
2020-02-24 CWEContent Team MITER
更新了适用的_platforms,关系,分类_mappings
2020-08-20 CWEContent Team MITER
更新的关系
2020-12-10 CWEContent Team MITER
更新的关系
2021-03-15 CWEContent Team MITER
更新了示范_examples
2022-10-13 CWEContent Team MITER
更新的关系,分类_mappings
2023-01-31 CWEContent Team MITER
updated Description
提供更多信息 - 请选择其他过滤器。
页面最后更新:2023年1月31日