CWE
Home > CWE List > CWE-602 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-602 Individual Dictionary Definition (Draft 9)

Design Principle Violation: Client-Side Enforcement of Server-Side Security
Weakness ID
Status: Draft

602 (Weakness Base)

Description

Summary

The client can be modified by an attacker in a way that bypasses protection mechanisms that are not common to both the client and server.

Weakness Ordinality

Primary (Weakness exists independent of other weaknesses)

Enabling Factors for Exploitation

Consider a product that consists of two or more processes or nodes that must interact closely, such as a client/server model. If the product uses protection schemes in the client in order to defend from attacks against the server, and the server does not use the same schemes, then an attacker could modify the client in a way that bypasses those schemes. This is a fundamental design flaw that is primary to many weaknesses.

Potential Mitigations

Protection schemes must be implemented on the server side; no interactions or inputs from the client can be assumed to be safe. Some protection schemes can still be duplicated in the client such as input validation, because they are frequently useful for general error-checking.

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 implementor will mistakenly omit a check in a single code path.

Demonstrative
Examples

$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):

$sock = acceptSocket(1234);
                        ($cmd, $args) = ParseClientRequest($sock);
                        if ($cmd eq "AUTH") {
                            ($username, $pass) = split(/\s+/, $args, 2);
                            $ex = AuthenticateUser($username, $pass);
                            writeSocket($sock, "$ex\n");
                        }
                        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 commenting out the code that sends the "AUTH" command and simply executing the CHANGE-ADDRESS.

Observed Examples
ReferenceDescription
CVE-2006-6994ASP program allows upload of .asp files by bypassing client-side checks.
CVE-2007-0163, 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.
Context Notes

"server-side enforcement of client-side security" is conceptually likely to occur, but some architectures might have these strong dependencies as part of legitimate behavior, such as thin clients.

This is a design error, not implementation.

Relationships
NatureTypeIDName
ChildOfCategoryCategory254Security Features
ChildOfWeakness ClassWeakness ClassWeakness Class669Incorrect Resource Transfer Between Spheres
CanPrecedeWeakness BaseWeakness BaseWeakness Base471Modification of Assumed-Immutable Data (MAID)
PeerOfWeakness BaseWeakness BaseWeakness Base290Authentication Bypass by Spoofing
PeerOfWeakness ClassWeakness ClassWeakness Class300Channel Accessible by Non-Endpoint (aka 'Man-in-the-Middle')
ParentOfWeakness BaseWeakness BaseWeakness Base603Use of Client-Side Authentication
Applicable Platforms

All

Page Last Updated: April 22, 2008