Exécuter une analyse statique (SAST) sur le code source à la recherche du motif non sécurisé dans le flux de données.
Incomplete Comparison with Missing Factors
This weakness occurs when a program compares two items but fails to check all the necessary attributes that define their true relationship. The incomplete check can cause the software to treat…
What is CWE-1023?
Real-world CVEs caused by CWE-1023
-
PHP remote file inclusion in web application that filters "http" and "https" URLs, but not "ftp".
-
Product does not prevent access to restricted directories due to partial string comparison with a public directory
Parcours de l'attaquant étape par étape
- 1
Consider an application in which Truck objects are defined to be the same if they have the same make, the same model, and were manufactured in the same year.
- 2
Here, the equals() method only checks the make and model of the Truck objects, but the year of manufacture is not included.
- 3
This example defines a fixed username and password. The AuthenticateUser() function is intended to accept a username and a password from an untrusted user, and check to ensure that it matches the username and password. If the username and password match, AuthenticateUser() is intended to indicate that authentication succeeded.
- 4
In AuthenticateUser(), the strncmp() call uses the string length of an attacker-provided inPass parameter in order to determine how many characters to check in the password. So, if the attacker only provides a password of length 1, the check will only examine the first byte of the application's password before determining success.
- 5
As a result, this partial comparison leads to improper authentication (CWE-287).
Vulnerable Java
Consider an application in which Truck objects are defined to be the same if they have the same make, the same model, and were manufactured in the same year.
public class Truck {
private String make;
private String model;
private int year;
public boolean equals(Object o) {
if (o == null) return false;
if (o == this) return true;
if (!(o instanceof Truck)) return false;
Truck t = (Truck) o;
return (this.make.equals(t.getMake()) && this.model.equals(t.getModel()));
}
} Any of these passwords would still cause authentication to succeed for the "admin" user:
p
pa
pas
pass Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
const safe = validateAndEscape(input);
return executeWithGuards(safe);
} How to prevent CWE-1023
- Testing Thoroughly test the comparison scheme before deploying code into production. Perform positive testing as well as negative testing.
How to detect CWE-1023
Exécuter des tests de sécurité applicative dynamique (DAST) contre le point de terminaison en ligne.
Surveiller les journaux runtime pour détecter des traces d'exception inhabituelles, des entrées malformées ou des tentatives de contournement d'autorisation.
Revue de code : signaler tout nouveau code qui traite les entrées de cette surface sans utiliser les helpers du framework validés.
Plexicus détecte automatiquement CWE-1023 et ouvre une PR de correction en moins de 60 secondes.
Codex Remedium analyse chaque commit, identifie cette faiblesse précise et livre une pull request prête à être relue avec le correctif. Pas de tickets. Pas de transferts.
Frequently asked questions
Qu'est-ce que CWE-1023 ?
This weakness occurs when a program compares two items but fails to check all the necessary attributes that define their true relationship. The incomplete check can cause the software to treat different items as identical or make incorrect security decisions.
Quelle est la gravité de CWE-1023 ?
MITRE n'a pas publié de note de probabilité d'exploitation pour cette faiblesse. Traitez-la comme un impact moyen jusqu'à ce que votre modèle de menace prouve le contraire.
Quels langages ou plateformes sont affectés par CWE-1023 ?
MITRE n'a pas spécifié les plateformes affectées pour ce CWE — il peut s'appliquer à la plupart des stacks applicatives.
Comment puis-je prévenir CWE-1023 ?
Thoroughly test the comparison scheme before deploying code into production. Perform positive testing as well as negative testing.
Comment Plexicus détecte et corrige CWE-1023 ?
Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-1023 à chaque commit. Lorsqu'une correspondance est trouvée, notre agent Codex Remedium ouvre une PR de correction avec le code corrigé, les tests et un résumé d'une ligne pour le relecteur.
Où puis-je en savoir plus sur CWE-1023 ?
MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/1023.html. Vous pouvez également consulter la documentation OWASP et NIST pour des conseils adjacents.
Weaknesses related to CWE-1023
Incorrect Comparison
This weakness occurs when a security-critical decision relies on a flawed comparison between two pieces of data. The incorrect logic can…
Comparison of Incompatible Types
This vulnerability occurs when code directly compares two values of fundamentally different data types, which can lead to unreliable or…
Comparison Using Wrong Factors
This weakness occurs when a program compares two items but checks the wrong properties or attributes. This flawed comparison leads to…
Inadequate Detection or Handling of Adversarial Input Perturbations in Automated Recognition Mechanism
This vulnerability occurs when a system uses automated AI or machine learning to classify complex inputs like images, audio, or text, but…
Floating Point Comparison with Incorrect Operator
This vulnerability occurs when code compares two floating-point numbers using direct equality operators (like == or !=) without accounting…
Incorrect Comparison Logic Granularity
This vulnerability occurs when a system compares sensitive data, like passwords or authentication tokens, piece-by-piece instead of as a…
Permissive List of Allowed Inputs
This vulnerability occurs when an application's security filter uses an allowlist that is too broad, mistakenly permitting dangerous…
Incorrect Regular Expression
This vulnerability occurs when a regular expression is written incorrectly, causing it to match or validate data in unintended and…
Object Model Violation: Just One of Equals and Hashcode Defined
This vulnerability occurs when a Java class defines either the equals() method or the hashCode() method, but not both, breaking a…
Further reading
Arrêtez de payer par développeur.
Commencez à fermer la boucle.
Plexicus est l'ASPM natif IA qui scanne, filtre, corrige, penteste et explique — de façon autonome. Développeurs illimités, dépôts illimités, actions IA à usage équitable. Vrai niveau gratuit, €269/mo annuel quand vous êtes prêt.