COMMON WEAKNESS ENUMERATIONIncomplete

CWE-1116

Inaccurate Source Code Comments

The source code contains comments that do not accurately describe or explain aspects of the portion of the code with which the comment is associated.

Abstraction

Base

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

The source code contains comments that do not accurately describe or explain aspects of the portion of the code with which the comment is associated.

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

Risk

What does successful exploitation lead to?

Reduce Maintainability

Affected security scopes: Other

This issue makes it more difficult to maintain the product, which indirectly affects security by making it more difficult or time-consuming to find and/or fix vulnerabilities. It also might make it easier to introduce vulnerabilities.
Increase Analytical Complexity

Affected security scopes: Other

When a comment does not accurately reflect the associated code elements, this can introduce confusion to a reviewer (due to inconsistencies) or make it more difficult and less efficient to validate that the code is implementing the intended behavior correctly.

Defence

How is it prevented and fixed?

Implementation

Implementation-phase defence

Detail
Verify that each comment accurately reflects what is intended to happen during execution of the code.

Verification

How is it detected?

Manual Static Analysis

Moderate
Compare the comments to the actual code itself to ensure the comment is consistent with the code. If an inconsistency exists, consult available documentation for developers of the product (design, libraries, APIs, etc.) Note that documentation might be stored in different places than the code repository.