背景详情
引入方式
Implementation : The programmer may assume that certain events or conditions will never occur or do not need to be worried about, such as low memory conditions, lack of access to resources due to restrictive permissions, or misbehaving clients or components. Attackers may intentionally trigger these unusual conditions, thus violating the programmer's assumptions.
Implementation : REALIZATION: This weakness is caused during implementation of an architectural security tactic.
适用平台
编程语言
类: Not Language-Specific (Undetermined)
名称: Python (Undetermined)
技术
类: Not Technology-Specific (Undetermined)
常见后果
| 影响范围 |
影响 |
可能性 |
Integrity Availability | DoS: Crash, Exit, or Restart, Unexpected State
注意: This could lead to instability, incorrect behavior, or a vulnerability. Any data that was produced as a result of a function call could be in a bad state upon return. If the return value is not checked, then this bad data may be used in operations, possibly leading to a crash or other unintended behaviors. | |
观察示例
| 参考资料 |
描述 |
| Chain: function in web caching proxy does not correctly check a return value (CWE-253) leading to a reachable assertion (CWE-617) |
| Unchecked return value leads to resultant integer overflow and code execution. |
| 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. |
| 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. |
潜在缓解措施
Phases : Requirements
Phases : Implementation
Check the results of all functions that return a value and verify that the value is expected.
Phases : Implementation
If using exception handling, catch and throw specific exceptions instead of overly-general exceptions (CWE-396, CWE-397). Catch and handle exceptions as locally as possible so that exceptions do not propagate too far up the call stack (CWE-705). Avoid unchecked or uncaught exceptions where feasible (CWE-248).
Phases : Implementation
Phases : Implementation
Phases : Architecture and Design // Implementation
If the program must fail, ensure that it fails gracefully (fails closed). There may be a temptation to simply let the program fail poorly in cases such as low memory conditions, but an attacker may be able to assert control before the software has fully exited. Alternately, an uncontrolled failure could cause cascading problems with other downstream components; for example, the program could send a signal to a downstream process so the process immediately knows that a problem has occurred and has a better chance of recovery.
Phases : Architecture and Design
Use system limits, which should help to prevent resource exhaustion. However, the product should still handle low resource conditions since they may still occur.
检测方法
Automated Static Analysis
Automated static analysis may be useful for detecting unusual conditions involving system resources or common programming idioms, but not for violations of business rules.
有效性 : Moderate
Manual Dynamic Analysis
Identify error conditions that are not likely to occur during normal usage and trigger them. For example, run the program under low memory conditions, run with insufficient privileges or permissions, interrupt a transaction before it is completed, or disable connectivity to basic network services such as DNS. Monitor the software for any unexpected behavior. If you trigger an unhandled exception or similar error that was discovered and handled by the application's environment, it may still indicate unexpected conditions that were not handled by the application itself.
漏洞映射说明
依据 : This CWE entry is a Class and might have Base-level children that would be more appropriate
备注 : Important: This entry is not exclusively about the use of exceptions and exception handling, which are just one type of mechanism for both checking and handling unusual or unexpected conditions. Examine children of this entry to see if there is a better fit.
备注
Sometimes, when a return value can be used to indicate an error, an unchecked return value is a code-layer instance of a missing application-layer check for exceptional conditions. However, return values are not always needed to communicate exceptional conditions. For example, expiration of resources, values passed by reference, asynchronously modified data, sockets, etc. may indicate exceptional conditions without the use of a return value.
参考资料
REF-62
The Art of Software Security Assessment
Mark Dowd, John McDonald, Justin Schuh.
REF-62
The Art of Software Security Assessment
Mark Dowd, John McDonald, Justin Schuh.
REF-44
24 Deadly Sins of Software Security
Michael Howard, David LeBlanc, John Viega.
REF-622
Top 25 Series - Rank 15 - Improper Check for Unusual or Exceptional Conditions
Frank Kim.
https://www.sans.org/blog/top-25-series-rank-15-improper-check-for-unusual-or-exceptional-conditions/ REF-1541
Secure Coding Guide for Python
OpenSSF.
https://best.openssf.org/Secure-Coding-Guide-for-Python/ REF-1550
Secure PLC Coding Practices: Top 20 List
Secure PLC Programming project.
https://plc-security.com/
提交记录
| 名称 |
组织 |
日期 |
发布日期 |
Version |
| CWE Content Team |
MITRE |
2009-03-03 +00:00 |
2009-03-10 +00:00 |
1.3 |
修改记录
| 名称 |
组织 |
日期 |
备注 |
| CWE Content Team |
MITRE |
2009-07-27 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2009-12-28 +00:00 |
updated Applicable_Platforms, Likelihood_of_Exploit, Time_of_Introduction |
| CWE Content Team |
MITRE |
2010-02-16 +00:00 |
updated Background_Details, Common_Consequences, Demonstrative_Examples, Description, Detection_Factors, Name, Observed_Examples, Potential_Mitigations, References, Related_Attack_Patterns, Relationship_Notes, Relationships |
| CWE Content Team |
MITRE |
2010-04-05 +00:00 |
updated Demonstrative_Examples, Related_Attack_Patterns |
| CWE Content Team |
MITRE |
2010-06-21 +00:00 |
updated Common_Consequences, Detection_Factors, Potential_Mitigations, References |
| CWE Content Team |
MITRE |
2010-09-27 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2010-12-13 +00:00 |
updated Relationship_Notes |
| CWE Content Team |
MITRE |
2011-03-29 +00:00 |
updated Description, Relationships |
| CWE Content Team |
MITRE |
2011-06-01 +00:00 |
updated Common_Consequences |
| CWE Content Team |
MITRE |
2011-06-27 +00:00 |
updated Common_Consequences, Related_Attack_Patterns, Relationships |
| CWE Content Team |
MITRE |
2011-09-13 +00:00 |
updated Relationships, Taxonomy_Mappings |
| CWE Content Team |
MITRE |
2012-05-11 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2012-10-30 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2013-02-21 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2014-07-30 +00:00 |
updated Demonstrative_Examples, Relationships |
| CWE Content Team |
MITRE |
2015-12-07 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2017-01-19 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2017-11-08 +00:00 |
updated Modes_of_Introduction, References, Relationships, Taxonomy_Mappings |
| CWE Content Team |
MITRE |
2019-01-03 +00:00 |
updated Relationships, Taxonomy_Mappings |
| CWE Content Team |
MITRE |
2019-06-20 +00:00 |
updated Description, Relationships |
| CWE Content Team |
MITRE |
2020-02-24 +00:00 |
updated Potential_Mitigations, Relationships |
| CWE Content Team |
MITRE |
2020-06-25 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2020-12-10 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2021-03-15 +00:00 |
updated Demonstrative_Examples, Relationships |
| CWE Content Team |
MITRE |
2021-07-20 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2022-04-28 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2023-01-31 +00:00 |
updated Description, Potential_Mitigations |
| CWE Content Team |
MITRE |
2023-04-27 +00:00 |
updated References, Relationships, Taxonomy_Mappings |
| CWE Content Team |
MITRE |
2023-06-29 +00:00 |
updated Mapping_Notes |
| CWE Content Team |
MITRE |
2024-02-29 +00:00 |
updated Observed_Examples |
| CWE Content Team |
MITRE |
2024-07-16 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2025-12-11 +00:00 |
updated Applicable_Platforms, Relationships, Weakness_Ordinalities |
| CWE Content Team |
MITRE |
2026-10-28 +00:00 |
updated Applicable_Platforms, Common_Consequences, Description, Mapping_Notes, Modes_of_Introduction, References, Relationships, Taxonomy_Mappings |