Class · High

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

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

CWE-602 · Class Level ·6 CVEs ·2 Mitigations

Description

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

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.

Potential Impact

Access Control, Availability

Bypass Protection Mechanism, DoS: Crash, Exit, or Restart

Access Control

Bypass Protection Mechanism, Gain Privileges or Assume Identity

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)
Good
$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";}
SERVER-SIDE (server.pl):
Bad
$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");}}
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.
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.

Mitigations & Prevention

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,

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.

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 injection. The software's operation may slow down, but it should not become unstable, crash,
  • 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 may be more effective than strictly automated techniques. This is especially the case with weaknesses

Real-World CVE Examples

CVE IDDescription
CVE-2024-50653Chain: 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-33139SCADA system only uses client-side authentication, allowing adversaries to impersonate other users.
CVE-2006-6994ASP program allows upload of .asp files by bypassing client-side checks.
CVE-2007-0163steganography products embed password information in the carrier file, which can be extracted from a modified client.
CVE-2007-0164steganography products embed password information in the carrier file, which can be extracted from a modified client.
CVE-2007-0100client allows server to modify client's configuration and overwrite arbitrary files.

Taxonomy Mappings

  • OWASP Top Ten 2004: A1 — Unvalidated Input

Frequently Asked Questions

What is CWE-602?

CWE-602 (Client-Side Enforcement of Server-Side Security) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product is composed of a server that relies on the client to implement a mechanism that is intended to protect the server.

How can CWE-602 be exploited?

Attackers can exploit CWE-602 (Client-Side Enforcement of Server-Side Security) to bypass protection mechanism, dos: crash, exit, or restart. This weakness is typically introduced during the Architecture and Design, Architecture and Design phase of software development.

How do I prevent CWE-602?

Key mitigations include: 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 che

What is the severity of CWE-602?

CWE-602 is classified as a Class-level weakness (High abstraction). It has been observed in 6 real-world CVEs.