Weakness · Medium
CWE-664: Improper Control of a Resource Through its Lifetime
What it is
The product does not maintain or incorrectly maintains control over a resource throughout its lifetime of creation, use, and release.
- Severity (our rating)
- Medium
- Likelihood of exploit
- Not rated by MITRE
- Introduced during
- Implementation
- Exploited in the wild
- 1 known exploited CVE
In more detail
Resources often have explicit instructions on how to be created, used and destroyed. When code does not follow these instructions, it can lead to unexpected behaviors and potentially exploitable states. Even without explicit instructions, various principles are expected to be adhered to, such as "Do not use an object until after its creation is complete," or "do not use an object after it has been slated for destruction."
What an attacker can do
- Other (Other)
How to prevent it
MITRE lists no specific mitigation for this weakness. Treat it like its parent weaknesses below: validate input, keep the design simple and review the code where it could appear.
How to find it
- Automated Static Analysis. Use Static analysis tools to check for unreleased resources.
Exploited in the wild: 1 CVE
Vulnerabilities caused by CWE-664 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.
H2 Security
Found it in your code?
We review where it appears, fix it with your team, and check it was not already used against you.
Talk to our teamT Academy
Stop writing it in the first place
Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.
Start freeSource: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.