CWEweakness
CWE-733 Compiler Optimization Removal or Modification of Security-critical Code
- Abstraction
- Base
- Structure
- Simple
- Status
- Incomplete
- Languages
- C, C++, Compiled
- CWE version
- 5.0
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.
Common consequences
• Access Control, Other: Bypass Protection Mechanism, Alter Execution Logic
Detection methods
• Black Box: 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 whether the programmer intended to clear the memory or not, so this weakness is indistinguishable from others.
• 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.
Observed examples
• 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
Attack pattern · CAPEC (5)
- CAPEC-10 Buffer Overflow via Environment Variables attack pattern
- CAPEC-24 Filter Failure through Buffer Overflow attack pattern
- CAPEC-46 Overflow Variables and Tags attack pattern
- CAPEC-8 Buffer Overflow in an API Call attack pattern
- CAPEC-9 Buffer Overflow in Local Command-Line Utilities attack pattern
Observed example · CVE (2)
- CVE-2019-1010006 Evince 3.26.0 is affected by buffer overflow. vulnerability
- CVE-2008-1685 gcc 4.2.0 through 4.3.0 in GNU Compiler Collection, when casts are not used, considers the sum of a pointer and an int to be greater than… vulnerability
Child of · CWE (1)
- CWE-1038 Insecure Automated Optimizations weakness
Referenced by CAPEC · weakness (5)
- CAPEC-10 Buffer Overflow via Environment Variables attack pattern
- CAPEC-24 Filter Failure through Buffer Overflow attack pattern
- CAPEC-46 Overflow Variables and Tags attack pattern
- CAPEC-8 Buffer Overflow in an API Call attack pattern
- CAPEC-9 Buffer Overflow in Local Command-Line Utilities attack pattern
Referenced by CVE · weakness (9)
- CVE-2026-12299 JIT miscompilation in the DOM: Core & HTML component. vulnerability
- CVE-2026-10702 JIT miscompilation in the JavaScript Engine: JIT component. vulnerability
- CVE-2026-8389 JIT miscompilation in the JavaScript Engine: JIT component. vulnerability
- CVE-2026-4698 JIT miscompilation in the JavaScript Engine: JIT component. vulnerability
- CVE-2025-13024 JIT miscompilation in the JavaScript Engine: JIT component. vulnerability
- CVE-2025-20241 A vulnerability in the Intermediate System-to-Intermediate System (IS-IS) feature of Cisco NX-OS Software for Cisco Nexus 3000 Series… vulnerability
- CVE-2024-58262 The curve25519-dalek crate before 4.1.3 for Rust has a constant-time operation on elliptic curve scalars that is removed by LLVM. vulnerability
- CVE-2025-52496 Mbed TLS before 3.6.4 has a race condition in AESNI detection if certain compiler optimizations occur. vulnerability
- CVE-2020-15294 Compiler Optimization Removal or Modification of Security-critical Code vulnerability in IntPeParseUnwindData() results in multiple… vulnerability
Referenced by CWE · child of (1)
- CWE-14 Compiler Removal of Code to Clear Buffers weakness