Comprehensive Categorization: Poor Coding Practices
A category in the Common Weakness Enumeration published by The MITRE Corporation.
Summary
Categories in the Common Weakness Enumeration (CWE) group entries based on some common characteristic or attribute.
Weaknesses in this category are related to poor coding practices.
Weaknesses
The product is deployed to unauthorized actors with debugging code still enabled or active, which can create unintended entry points or expose sensitive information.
The product's architecture contains too many - or too few - horizontal layers.
Debugging messages help attackers learn about the system and plan a form of attack.
The variable's value is assigned but never used, making it a dead store.
The product uses an API function that does not exist on all versions of the target platform. This could cause portability problems or inconsistencies that allow denial...
The code contains a function or method whose signature and/or associated inline documentation does not sufficiently describe the callable's inputs, outputs, ...
The code contains a class instance that calls the method or function to delete or destroy itself.
A class contains an unnecessarily large number of children.
A class has an inheritance level that is too high, i.e., it has a large number of parent classes.
A class contains a virtual method, but the method does not have an associated virtual destructor.
The code is compiled without sufficient warnings enabled, which may prevent the detection of subtle bugs or quality issues.
The product declares a critical variable, field, or member to be public when intended security policy requires it to be private.
The product is intended to manage data access through a particular data manager component such as a relational or non-SQL database, but it contains code that performs ...
The product uses a dedicated, central data manager component as required by design, but it contains code that performs data-access operations that do not use this data...
The product uses a data element that has an excessively large number of sub-elements with non-primitive data types such as structures or aggregated objects.
The code contains a data element with a pointer that does not have an associated copy or constructor method.
The product contains dead code, which can never be executed.
The source code declares a variable in one scope, but the variable is only used within a narrower scope.
When a Java application uses the Java Native Interface (JNI) to call code written in another programming language, it can expose the application to weaknesses in that ...
Duplicate keys in associative lists can lead to non-unique keys being mistaken for an error.
The product violates the Enterprise JavaBeans (EJB) specification by using AWT/Swing.
The product violates the Enterprise JavaBeans (EJB) specification by using the class loader.
The product violates the Enterprise JavaBeans (EJB) specification by using the java.io package.
The product violates the Enterprise JavaBeans (EJB) specification by using sockets.
The product contains code that appears to be malicious in nature.
The source code contains a block that does not contain any code, i.e., the block is empty.
An invokable code block contains an exception handling block that does not contain any code, i.e. is empty.
The product contains an empty synchronized block.
The product has an attack surface whose quantitative measurement exceeds a desirable maximum.
The code is too complex, as calculated using a well-defined, quantitative measure.
The code is structured in a way that a Halstead complexity measure exceeds a desirable maximum.
The code contains McCabe cyclomatic complexity that exceeds a desirable maximum.
The product performs too many data queries without using efficient data processing functionality such as stored procedures.
The code is structured in a way that relies too much on using or setting global variables throughout various points in the code, instead of preserving the as...
The product uses too much self-modifying code.
The code uses too many unconditional branches (such as "goto").
The product uses an unnecessarily complex internal representation for its data structures or interrelationships between those structures.
The code contains a callable or other code grouping in which the nesting / branching is too deep.
A feature, API, or function does not perform according to its specification.
The product makes an explicit call to the finalize() method from outside the finalizer.
The product contains an expression that will always evaluate to false.
The product contains an expression that will always evaluate to true.
The reserved bits in a hardware design are not disabled prior to production. Typically, reserved bits are used for future capabilities and should not support any funct...
The product calls a function, procedure, or routine, but the caller specifies an argument that is the wrong data type, which may lead to resultant weaknesses.
The product calls a function, procedure, or routine, but the caller specifies too many arguments, or too few arguments, which may lead to undefined behavior and result...
The product calls a function, procedure, or routine, but the caller specifies the arguments in an incorrect order, leading to resultant weaknesses.
The product calls a function, procedure, or routine, but the caller specifies the wrong variable or reference as one of the arguments, which may lead to undefined beha...
The product calls a function, procedure, or routine, but the caller specifies an argument that contains the wrong value, which may lead to resultant weaknesses.
The product calls a function, procedure, or routine with arguments that are not correctly specified, leading to always-incorrect behavior and resultant weaknesses.
The product contains functionality that is not documented, not part of the specification, and not accessible through an interface or command sequence that is obvious t...
The product does not follow certain coding rules for development, which can lead to resultant weaknesses or increase the severity of the associated vulnerabilities.
Faulty finite state machines (FSMs) in the hardware logic allow an attacker to put the system in an undefined state, to cause a denial of service (DoS) or gain privile...
The product does not follow or incorrectly follows the specifications as required by the implementation language, environment, framework, protocol, or platform.
The product does not implement or incorrectly implements one or more security-relevant checks as specified by the design of a standardized algorithm, protocol, or tech...
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.
The source code uses comment styles or formats that are inconsistent or do not follow expected standards for the product.
The source code does not follow desired style or formatting for indentation, white space, comments, etc.
The source code contains whitespace that is inconsistent across the code or does not follow expected standards for the product.
The product's design documentation does not adequately describe control flow, data flow, system initialization, relationships between tasks, components, rati...
The document does not fully define all mechanisms that are used to control or influence how product-specific programs are executed.
The product's documentation does not adequately define inputs, outputs, or system/software interfaces.
The implementation of the product is not consistent with the design as described within the relevant documentation.
The product's code, documentation, or other artifacts do not consistently use the same naming conventions for variables, callables, groups of related callabl...
The product incorrectly checks a return value from a function, which prevents it from detecting errors or exceptional conditions.
The code does not function according to its published specifications, potentially leading to incorrect usage.
The product's architecture, source code, design, documentation, or other artifact does not follow required conventions.
The documentation does not sufficiently describe the techniques that are used for error handling, exception processing, or similar mechanisms.
The product does not sufficiently hide the internal representation and implementation details of data or methods, which might allow external components or modules to m...
The product or code uses machine-dependent functionality, but it does not sufficiently encapsulate or isolate this functionality from the rest of the code.
The source code uses symbolic constants, but it does not sufficiently place the definitions of these constants into a more centralized or isolated location.
The product or code does not isolate system-dependent functionality into separate standalone modules.
The product does not contain sufficient technical or engineering documentation (whether on paper or in electronic form) that contains descriptions of...
The source code uses literal constants that may need to change or evolve over time, instead of using symbolic constants.
The product displays information or identifiers to a user, but the display mechanism does not make it easy for the user to distinguish between visually similar or iden...
The code at one architectural layer invokes code that resides at a deeper layer than the adjacent layer, i.e., the invocation skips at least one layer, and t...
A function, method, procedure, etc. contains an excessive amount of code that has been commented out within its body.
The code contains callable control elements that contain an excessively large number of references to other application objects external to the conte...
The product contains a function, subroutine, or method whose signature has an unnecessarily large number of parameters/arguments.
A named-callable or method control element has a signature that supports a variable (variadic) number of parameters or arguments.
The product contains code that is not essential for execution, i.e. makes no state changes and has no side effects that alter data or control flow, such th...
The J2EE application directly manages connections, instead of using the container's connection management facilities.
The J2EE application directly uses sockets instead of using framework method calls.
Thread management in a Web application is forbidden in some circumstances and is always highly error prone.
The product stores a non-serializable object as an HttpSession attribute, which can hurt reliability.
When the J2EE container attempts to write unserializable objects to disk there is no guarantee that the process will complete successfully.
The product contains code that is designed to disrupt the legitimate operation of the product (or its environment) when a certain time passes, or when a certain logica...
The product uses a loop with a control flow condition based on a value that is updated within the body of the loop.
A method for a class performs an operation that directly accesses a member element from another class.
The product does not have documentation that represents how it is designed.
The product encounters an error but does not provide a status code or return value to indicate that an error has occurred.
The product contains a serializable data element that does not have an associated serialization method.
The product contains modules in which one module has references that cycle back to itself, i.e., there are circular dependencies.
When multiple sockets are allowed to bind to the same port, other services on that port may be stolen or spoofed.
The product contains a class with inheritance from more than one concrete class.
The product performs the same operation on a resource two or more times, when the operation should only be applied once.
The product attempts to close or release a resource or handle more than once, without any successful open between the close operations.
Non-replicating malicious code only resides on the target system or product that is attacked; it does not attempt to spread to other systems.
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
The product does not maintain equal hashcodes for equal objects.
A UI function is obsolete and the product does not warn the user.
The product omits a break statement within a switch or similar construct, causing code associated with multiple conditions to execute. This can cause problems when the...
A parent class has a virtual destructor method, but the parent has a child class that does not have a virtual destructor.
The code has a parent class that contains references to a child class, its methods, or its members.
A parent class contains one or more child classes, but the parent class does not have a virtual destructor method.
The product uses a storable data element that does not have all of the associated functions or methods that are necessary to support comparison.
The product is built from multiple separate components, but it uses a component that is not sufficiently trusted to meet expectations for security, reliability, update...
The code uses a data representation that relies on low-level data representation or constructs that may vary across different processors, physical machines, ...
The product uses automatically-generated code that cannot be executed without a specific runtime support component.
The product uses an API function, data structure, or other entity in a way that relies on properties that are not always guaranteed to hold for that entity.
Replicating malicious code, including viruses and worms, will attempt to attack other systems once it has successfully compromised the target system or the product.
A function or operation returns an incorrect return value or status code that does not indicate an error, but causes the product to modify its behavior based on the in...
The product uses deployed components from application servers, but it also uses low-level functions/methods for management of resources, instead of the API provided by...
The product contains a serializable, storable data element such as a field or member, but the data element contains member elements that are not serializable.
The source code contains elements such as source files that do not consistently provide a prologue or header that has been standardized for the project.
A source code file has too many lines of code.
The product collects personally identifiable information about a human user or the user's activities, but the product accesses this information using other resources b...
If a form bean does not extend an ActionForm subclass of the Validator framework, it can expose the application to other weaknesses related to insufficient input valid...
The product has a validator form that either does not define a validate() method, or defines a validate() method but does not call super.validate().
An unused validation form indicates that validation logic is not up-to-date.
Validation fields that do not appear in forms they are associated with indicate that the validation logic is out of date.
The code contains comments that suggest the presence of bugs, incomplete functionality, or weaknesses.
The UI performs the wrong action with respect to the user's request.
A trapdoor is a hidden piece of code that responds to a special input, allowing its user access to resources without passing through the normal security enforcement me...
The product appears to contain benign or useful functionality, but it also contains code that is hidden from normal operation that violates the intended security polic...
The user interface does not correctly enable or configure a security feature, but the interface provides feedback that causes the user to believe that the feature is i...
The product performs unconditional control transfer (such as a "goto") in code outside of a branching structure such as a switch block.
The behavior of this function is undefined unless its control parameter is set to a specific value.
The code uses a function that has inconsistent implementations across operating systems and versions.
The product uses hard-coded constants instead of symbolic names for security-critical values, which increases the likelihood of mistakes during code maintenance or sec...
The product calls a function that can never be guaranteed to work safely.
The product uses low-level functionality that is explicitly prohibited by the framework or specification under which the product is supposed to operate.
The code uses deprecated or obsolete functions, which suggests that the code has not been actively reviewed or maintained.
The product invokes a function for normalizing paths or file names, but it provides an output buffer that is smaller than the maximum possible size, such as PATH_MAX.
The product relies on third-party components that do not provide equivalent functionality across all desirable platforms.
The product invokes a potentially dangerous function that could introduce a vulnerability if it is used incorrectly, but the function can also be used safely.
The product uses a function, library, or third party component that has been explicitly prohibited, whether by the developer or the customer.
The product has multiple functions, methods, procedures, macros, etc. that contain the same code.
The product uses the same control element across multiple architectural layers.
The code contains a callable, block, or other code element in which the same variable is used to control more than one unique task or store more than one ins...
The product calls umask() with an incorrect argument that is specified as if it is an argument to chmod().
The user interface (UI) does not properly represent critical information to the user, allowing the information - or its source - to be obscured or spoofed. This is oft...
Concepts
This view organizes weaknesses around categories that are of interest to large-scale software assurance research to support the elimination of weaknesses using ta...
See Also
Common Weakness Enumeration content on this website is copyright of The MITRE Corporation unless otherwise specified. Use of the Common Weakness Enumeration and the associated references on this website are subject to the Terms of Use as specified by The MITRE Corporation.