CWE-602 Classe Brouillon Medium likelihood

Client-Side Enforcement of Server-Side Security

This vulnerability occurs when a server incorrectly trusts the client to enforce critical security rules, such as input validation or access controls, instead of performing these checks itself.

Définition

What is CWE-602?

This vulnerability occurs when a server incorrectly trusts the client to enforce critical security rules, such as input validation or access controls, instead of performing these checks itself.
This flaw creates a fundamental trust issue. Since an attacker has full control over their own client—whether it's a browser, mobile app, or API client—they can easily bypass, remove, or manipulate any client-side security checks. The server, operating under the false assumption that these checks are reliable, then processes malicious or unauthorized requests. The impact depends entirely on what the client was supposed to protect. Common consequences include unauthorized data access, privilege escalation, data corruption, or complete system compromise. The root cause is a design error: security must always be enforced at the point where trust is established and data is ultimately processed—the server.
Impact réel

Real-world CVEs caused by CWE-602

  • SCADA system only uses client-side authentication, allowing adversaries to impersonate other users.

  • ASP program allows upload of .asp files by bypassing client-side checks.

  • steganography products embed password information in the carrier file, which can be extracted from a modified client.

  • steganography products embed password information in the carrier file, which can be extracted from a modified client.

  • client allows server to modify client's configuration and overwrite arbitrary files.

Comment les attaquants l'exploitent

Parcours de l'attaquant étape par étape

  1. 1

    This example contains client-side code that checks if the user authenticated successfully before sending a command. The server-side code performs the authentication in one step, and executes the command in a separate step.

  2. 2

    CLIENT-SIDE (client.pl)

  3. 3

    SERVER-SIDE (server.pl):

  4. 4

    The server accepts 2 commands, "AUTH" which authenticates the user, and "CHANGE-ADDRESS" which updates the address field for the username. The client performs the authentication and only sends a CHANGE-ADDRESS for that user if the authentication succeeds. Because the client has already performed the authentication, the server assumes that the username in the CHANGE-ADDRESS is the same as the authenticated user. An attacker could modify the client by removing the code that sends the "AUTH" command and simply executing the CHANGE-ADDRESS.

  5. 5

    In 2022, the OT:ICEFALL study examined products by 10 different Operational Technology (OT) vendors. The researchers reported 56 vulnerabilities and said that the products were "insecure by design" [REF-1283]. If exploited, these vulnerabilities often allowed adversaries to change how the products operated, ranging from denial of service to changing the code that the products executed. Since these products were often used in industries such as power, electrical, water, and others, there could even be safety implications.

Exemple de code vulnérable

Vulnerable Perl

SERVER-SIDE (server.pl):

Vulnérable Perl
$sock = acceptSocket(1234);
  ($cmd, $args) = ParseClientRequest($sock);
  if ($cmd eq "AUTH") {
  		($username, $pass) = split(/\s+/, $args, 2);
  		$result = AuthenticateUser($username, $pass);
  		writeSocket($sock, "$result\n");
```
# does not close the socket on failure; assumes the* 
  		
  		
  		 *# user will try again* 
  		}
  elsif ($cmd eq "CHANGE-ADDRESS") {
  ```
  	if (validateAddress($args)) {
  		$res = UpdateDatabaseRecord($username, "address", $args);
  		writeSocket($sock, "SUCCESS\n");
  	}
  	else {
  		writeSocket($sock, "FAILURE -- address is malformed\n");
  	}
  }
Exemple de code sécurisé

Secure Perl

CLIENT-SIDE (client.pl)

Sécurisé Perl
$server = "server.example.com";
  $username = AskForUserName();
  $password = AskForPassword();
  $address = AskForAddress();
  $sock = OpenSocket($server, 1234);
  writeSocket($sock, "AUTH $username $password\n");
  $resp = readSocket($sock);
  if ($resp eq "success") {
```
# username/pass is valid, go ahead and update the info!* 
  		writeSocket($sock, "CHANGE-ADDRESS $username $address\n";}
  else {
  ```
  	print "ERROR: Invalid Authentication!\n";
  }
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Liste de contrôle de prévention

How to prevent CWE-602

  • Architecture and Design For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server. Even though client-side checks provide minimal benefits with respect to server-side security, they are still useful. First, they can support intrusion detection. If the server receives input that should have been rejected by the client, then it may be an indication of an attack. Second, client-side error-checking can provide helpful feedback to the user about the expectations for valid input. Third, there may be a reduction in server-side processing time for accidental input errors, although this is typically a small savings.
  • Architecture and Design If some degree of trust is required between the two entities, then use integrity checking and strong authentication to ensure that the inputs are coming from a trusted source. Design the product so that this trust is managed in a centralized fashion, especially if there are complex or numerous communication channels, in order to reduce the risks that the implementer will mistakenly omit a check in a single code path.
  • Testing Use dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
  • Testing Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.
Signaux de détection

How to detect CWE-602

SAST High

Exécuter une analyse statique (SAST) sur le code source à la recherche du motif non sécurisé dans le flux de données.

DAST Moderate

Exécuter des tests de sécurité applicative dynamique (DAST) contre le point de terminaison en ligne.

Runtime Moderate

Surveiller les journaux runtime pour détecter des traces d'exception inhabituelles, des entrées malformées ou des tentatives de contournement d'autorisation.

Code review Moderate

Revue de code : signaler tout nouveau code qui traite les entrées de cette surface sans utiliser les helpers du framework validés.

Correction automatique Plexicus

Plexicus détecte automatiquement CWE-602 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.

Questions fréquentes

Frequently asked questions

Qu'est-ce que CWE-602 ?

This vulnerability occurs when a server incorrectly trusts the client to enforce critical security rules, such as input validation or access controls, instead of performing these checks itself.

Quelle est la gravité de CWE-602 ?

MITRE évalue la probabilité d'exploitation comme Moyenne — l'exploitation est réaliste mais nécessite généralement des conditions spécifiques.

Quels langages ou plateformes sont affectés par CWE-602 ?

MITRE lists the following affected platforms: ICS/OT, Mobile.

Comment puis-je prévenir CWE-602 ?

For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server. Even though client-side checks provide minimal benefits with respect to server-side security, they are still useful. First, they can support…

Comment Plexicus détecte et corrige CWE-602 ?

Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-602 à 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-602 ?

MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/602.html. Vous pouvez également consulter la documentation OWASP et NIST pour des conseils adjacents.

Faiblesses associées

Weaknesses related to CWE-602

CWE-693 Parent

Protection Mechanism Failure

This weakness occurs when software either lacks a necessary security control, implements one that is too weak, or fails to activate an…

CWE-1039 Frère

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…

CWE-1248 Frère

Semiconductor Defects in Hardware Logic with Security-Sensitive Implications

A security-critical hardware component contains physical flaws in its semiconductor material, which can cause it to malfunction and…

CWE-1253 Frère

Incorrect Selection of Fuse Values

This vulnerability occurs when a hardware security fuse is incorrectly programmed to represent a 'secure' state as logic 0 (unblown). An…

CWE-1269 Frère

Product Released in Non-Release Configuration

This vulnerability occurs when a product ships to customers while still configured with its pre-production or manufacturing settings,…

CWE-1278 Frère

Missing Protection Against Hardware Reverse Engineering Using Integrated Circuit (IC) Imaging Techniques

This vulnerability occurs when hardware lacks safeguards against physical inspection, allowing attackers to extract sensitive data by…

CWE-1291 Frère

Public Key Re-Use for Signing both Debug and Production Code

This vulnerability occurs when the same cryptographic key is used to sign both development/debug software builds and final production…

CWE-1318 Frère

Missing Support for Security Features in On-chip Fabrics or Buses

This vulnerability occurs when the communication channels (fabrics or buses) within a chip lack built-in or enabled security features,…

CWE-1319 Frère

Improper Protection against Electromagnetic Fault Injection (EM-FI)

This vulnerability occurs when a hardware device lacks sufficient shielding against electromagnetic interference, allowing attackers to…

Prêt quand vous l'êtes

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.