Description
The product uses a mechanism that automatically optimizes code, e.g. to improve a characteristic such as performance, but the optimizations can have an unintended side effect that might violate an intended security assumption.
Potential Impact
Integrity
Alter Execution Logic
Demonstrative Examples
void GetData(char *MFAddr) {
char pwd[64];
if (GetPasswordFromUser(pwd, sizeof(pwd))) {
if (ConnectToMainframe(MFAddr, pwd)) {
// Interaction with mainframe
}
}
memset(pwd, 0, sizeof(pwd));
}Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2017-5715 | Intel, ARM, and AMD processor optimizations related to speculative execution and branch prediction cause access control checks to be bypassed when placing data into the cache. Often known as "Spectre" |
| CVE-2008-1685 | C compiler optimization, as allowed by specifications, removes code that is used to perform checks to detect integer overflows. |
Related Weaknesses
Frequently Asked Questions
What is CWE-1038?
CWE-1038 (Insecure Automated Optimizations) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product uses a mechanism that automatically optimizes code, e.g. to improve a characteristic such as performance, but the optimizations can have an unintended side effect that might violate an int...
How can CWE-1038 be exploited?
Attackers can exploit CWE-1038 (Insecure Automated Optimizations) to alter execution logic. This weakness is typically introduced during the Architecture and Design phase of software development.
How do I prevent CWE-1038?
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-1038?
CWE-1038 is classified as a Class-level weakness (High abstraction). It has been observed in 2 real-world CVEs.