Description
The developer builds a security-critical protection mechanism into the software, but the compiler optimizes the program such that the mechanism is removed or modified.
Potential Impact
Access Control, Other
Bypass Protection Mechanism, 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));
}Detection Methods
- Black Box Limited — This specific weakness is impossible to detect using black box methods. While an analyst could examine memory to see that it has not been scrubbed, an analysis of the executable would not be successful. This is because the compiler has already removed the relevant code. Only the source code shows wh
- White Box — This weakness is only detectable using white box methods (see black box detection factor). Careful analysis is required to determine if the code is likely to be removed by the compiler.
Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2008-1685 | C compiler optimization, as allowed by specifications, removes code that is used to perform checks to detect integer overflows. |
| CVE-2019-1010006 | Chain: compiler optimization (CWE-733) removes or modifies code used to detect integer overflow (CWE-190), allowing out-of-bounds write (CWE-787). |
Related Weaknesses
Frequently Asked Questions
What is CWE-733?
CWE-733 (Compiler Optimization Removal or Modification of Security-critical Code) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The developer builds a security-critical protection mechanism into the software, but the compiler optimizes the program such that the mechanism is removed or modified.
How can CWE-733 be exploited?
Attackers can exploit CWE-733 (Compiler Optimization Removal or Modification of Security-critical Code) to bypass protection mechanism, alter execution logic. This weakness is typically introduced during the Build and Compilation phase of software development.
How do I prevent CWE-733?
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-733?
CWE-733 is classified as a Base-level weakness (Medium abstraction). It has been observed in 2 real-world CVEs.