COMMON WEAKNESS ENUMERATIONDraft

CWE-14

Compiler Removal of Code to Clear Buffers

Sensitive memory is cleared according to the source code, but compiler optimizations leave the memory untouched when it is not read from again, aka "dead store removal."

Soyutlama

Variant

Yapı

Simple

Sömürü İhtimali

Medium

Problemi anla

Problem nedir?

Sensitive memory is cleared according to the source code, but compiler optimizations leave the memory untouched when it is not read from again, aka "dead store removal."

Genişletilmiş açıklama

This compiler optimization error occurs when: 1. Secret data are stored in memory. 1. The secret data are scrubbed from memory by overwriting its contents. 1. The source code is compiled using an optimizing compiler, which identifies and removes the function that overwrites the contents as a dead store because the memory is not used subsequently.

Kök neden

Problem nasıl ve ne zaman oluşur?

Yaşam döngüsü evresi

Implementation

Yaşam döngüsü evresi

Build and Compilation

Risk

Başarılı sömürü neye yol açar?

Read MemoryBypass Protection Mechanism

Etkilenen güvenlik alanları: Confidentiality, Access Control

This weakness will allow data that has not been cleared from memory to be read. If this data contains sensitive password information, then an attacker can read the password and use the information to bypass protection mechanisms.

Savunma

Nasıl önlenir ve çözülür?

Implementation

Uygulama aşaması savunması

Detay
Store the sensitive data in a "volatile" memory location if available.

Build and Compilation

Build and Compilation aşaması savunması

Detay
If possible, configure your compiler so that it does not remove dead stores.

Architecture and Design

Mimari ve tasarım yaklaşımı

Detay
Where possible, encrypt sensitive data that are used by a software system.

Doğrulama

Nasıl tespit edilir?

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 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.