CWE-413: Improper Resource Locking
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product does not lock or does not correctly lock a resource when the product must have exclusive access to the resource.
扩展描述
When a resource is not properly locked, an attacker could modify the resource while it is being operated on by the product. This might violate the product's assumption that the resource will not change, potentially leading to unexpected behaviors.
常见后果
影响范围: Integrity Availability
技术影响: Modify Application Data DoS: Instability DoS: Crash, Exit, or Restart
潜在缓解措施
阶段: Architecture and Design
描述: Use a non-conflicting privilege scheme.
阶段: Architecture and Design Implementation
描述: Use synchronization when locking a resource.
检测方法
方法: Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
有效性: High
观察示例
参考: CVE-2022-20141
Chain: an operating system kernel has insufficent resource locking (CWE-413) leading to a use after free (CWE-416).
引入模式
| 阶段 | 说明 |
|---|---|
| Architecture and Design | - |
| Implementation | - |
适用平台
编程语言
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| PLOVER | - | Insufficient Resource Locking | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | VNA00-J | Ensure visibility when accessing shared primitive variables | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | VNA02-J | Ensure that compound operations on shared variables are atomic | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | LCK00-J | Use private final lock objects to synchronize classes that may interact with untrusted code | - |
| Software Fault Patterns | SFP19 | Missing Lock | - |