COMMON WEAKNESS ENUMERATIONDraft

CWE-489

Active Debug Code

The product is released with debugging code still enabled or active.

Abstraction

Base

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

The product is released with debugging code still enabled or active.

Terminology

Alternate terms and usages

Leftover debug code

This term originates from Seven Pernicious Kingdoms

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

In web-based applications, debug code is used to test and modify web application properties, configuration information, and functions. If a debug application is left on a production server, this oversight during the "software process" allows attackers access to debug functionality.

Lifecycle phase

Implementation

A common development practice is to add "back door" code specifically designed for debugging or testing purposes that is not intended to be shipped or deployed with the product. These back door entry points create security risks because they are not considered during design or testing and fall outside of the expected operating conditions of the product.

Lifecycle phase

Build and Compilation

Lifecycle phase

Operation

Risk

What does successful exploitation lead to?

Bypass Protection MechanismRead Application DataGain Privileges or Assume IdentityVaries by Context

Affected security scopes: Confidentiality, Integrity, Availability, Access Control, Other

Active debug code can create unintended entry points or expose sensitive information. The severity of the exposed debug code will depend on the particular instance. At the least, it will give an attacker sensitive information about the settings and mechanics of web applications on the server. At worst, as is often the case, the debug code will allow an attacker complete control over the web application and server, as well as confidential information that either of these access.

Defence

How is it prevented and fixed?

Build and Compilation · Distribution

Defence to apply across several lifecycle phases

Detail
Remove debug code before deploying the application.

Verification

How is it detected?

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 searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

MITRE diagram

Weakness relationships and flow

CWE-489 MITRE diagramı