Description
The product uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked.
Potential Impact
Integrity, Confidentiality
Modify Application Data, Read Application Data
Other, Availability
Other, DoS: Crash, Exit, or Restart
Demonstrative Examples
char* ptr = (char*)malloc (SIZE);if (err) {abrt = 1;free(ptr);}...if (abrt) {logError("operation aborted before commit", ptr);}char* ptr = (char*)malloc (SIZE);...if (abrt) {free(ptr);}...free(ptr);#define FAIL 0#define SUCCESS 1#define ERROR -1#define MAX_MESSAGE_SIZE 32
int processMessage(char **message){
int result = SUCCESS;
int length = getMessageLength(message[0]);char *messageBody;
if ((length > 0) && (length < MAX_MESSAGE_SIZE)) {
messageBody = (char*)malloc(length*sizeof(char));messageBody = &message[1][0];
int success = processMessageBody(messageBody);
if (success == ERROR) {result = ERROR;free(messageBody);}
}else {printf("Unable to process message; invalid message length");result = FAIL;}
if (result == ERROR) {logError("Error processing message", messageBody);}
return result;
}...messageBody = (char*)malloc(length*sizeof(char));messageBody = &message[1][0];
int success = processMessageBody(messageBody);
if (success == ERROR) {result = ERROR;logError("Error processing message", messageBody);free(messageBody);}...Detection Methods
- Automated Static Analysis High — 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 sea
Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2009-3547 | Chain: race condition (CWE-362) might allow resource to be released before operating on it, leading to NULL dereference (CWE-476) |
Related Weaknesses
Taxonomy Mappings
- Software Fault Patterns: SFP15 — Faulty Resource Use
- CERT C Secure Coding: FIO46-C — Do not access a closed file
- CERT C Secure Coding: MEM30-C — Do not access freed memory
- OMG ASCSM: ASCSM-CWE-672 —
Frequently Asked Questions
What is CWE-672?
CWE-672 (Operation on a Resource after Expiration or Release) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product uses, accesses, or otherwise operates on a resource after that resource has been expired, released, or revoked.
How can CWE-672 be exploited?
Attackers can exploit CWE-672 (Operation on a Resource after Expiration or Release) to modify application data, read application data. This weakness is typically introduced during the Implementation, Operation phase of software development.
How do I prevent CWE-672?
Follow secure coding practices, conduct code reviews, and use automated security testing tools (SAST/DAST) to detect this weakness early in the development lifecycle.
What is the severity of CWE-672?
CWE-672 is classified as a Class-level weakness (High abstraction). It has been observed in 1 real-world CVEs.