CWE-602: Client-Side Enforcement of Server-Side Security

Description:
The product is composed of a server that relies on the client to implement a mechanism that is intended to protect the server.

Extended Description:
When the server relies on protection mechanisms placed on the client side, an attacker can modify the client-side behavior to bypass the protection mechanisms, resulting in potentially unexpected interactions between the client and server. The consequences will vary, depending on what the mechanisms are trying to protect.

Affected languages: Not Language-Specific
Affected technologies: ICS/OT, Mobile
Parent weaknesses: CWE-693

Consequences:
  - Access Control: Bypass Protection Mechanism
  - Access Control: Bypass Protection Mechanism

Detection methods:
  - Fuzzing: 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 injec
  - Manual Analysis: 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 m

Mitigations:
  - [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, 
  - [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 commu

Demonstrative examples:
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.
CLIENT-SIDE (client.pl)
$server = "server.example.com"; $username = AskForUserName(); $[CREDENTIAL_REDACTED](); $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

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.
Multiple vendors used client-side authentication in their OT products.

Real-world examples:
  - CVE-2024-50653: Chain: e-commerce product has a "front-end restriction" for coupon use (CWE-602), but the server does not restrict the number of requests for the same coupon (CWE-799)
  - CVE-2022-33139: SCADA system only uses client-side authentication, allowing adversaries to impersonate other users.
  - CVE-2006-6994: ASP program allows upload of .asp files by bypassing client-side checks.
  - CVE-2007-0163: steganography products embed password information in the carrier file, which can be extracted from a modified client.
  - CVE-2007-0164: steganography products embed password information in the carrier file, which can be extracted from a modified client.