Class · High

CWE-1076: Insufficient Adherence to Expected Conventions

The product's architecture, source code, design, documentation, or other artifact does not follow required conventions.

CWE-1076 · Class Level

Description

The product's architecture, source code, design, documentation, or other artifact does not follow required conventions.

Potential Impact

Other

Reduce Maintainability

Demonstrative Examples

The usage of symbolic names instead of hard-coded constants is preferred.
The following is an example of using a hard-coded constant instead of a symbolic name.
Bad
char buffer[1024];...fgets(buffer, 1024, stdin);
If the buffer value needs to be changed, then it has to be altered in more than one place. If the developer forgets or does not find all occurrences, in this example it could lead to a buffer overflow.
Good
enum { MAX_BUFFER_SIZE = 1024 };...char buffer[MAX_BUFFER_SIZE];...fgets(buffer, MAX_BUFFER_SIZE, stdin);
In this example the developer will only need to change one value and all references to the buffer size are updated, as a symbolic name is used instead of a hard-coded constant.
The following code fragment calls finalize() explicitly:
Bad
// time to clean up
                     widget.finalize();

Detection Methods

  • Automated Static Analysis — 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 sea

Frequently Asked Questions

What is CWE-1076?

CWE-1076 (Insufficient Adherence to Expected Conventions) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product's architecture, source code, design, documentation, or other artifact does not follow required conventions.

How can CWE-1076 be exploited?

Attackers can exploit CWE-1076 (Insufficient Adherence to Expected Conventions) to reduce maintainability. This weakness is typically introduced during the Architecture and Design, Implementation, Documentation phase of software development.

How do I prevent CWE-1076?

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-1076?

CWE-1076 is classified as a Class-level weakness (High abstraction). Its actual severity depends on the specific context and how the weakness manifests in your application.