CWE-602OWASP A01:2021CWE-285CWE-862

CWE-602: Client-Side Security Enforcement

A security check is performed only in the client, which an attacker controls, so it can be skipped or altered before the request reaches the server.

Also known as: Client-side only validation, Client-side enforcement of server-side security, Trusting the client

Risk

Typically high. Any browser tool, proxy, or crafted request bypasses the client, so a check that lives only there offers no real protection for the data or action behind it.

Definition

What it is

CWE-602 occurs when an application relies on the client to enforce a security decision such as authorization, input validation, price, or quantity, and the server trusts whatever the client sends. Because the user fully controls the browser or app, they can disable the check, edit the page, or send a request directly. The server must treat every client as hostile and re-check security decisions itself. The weakness is trusting a boundary the attacker owns.

Use-cases

How it shows up in real code

Hidden admin control only

An admin action is hidden in the UI for non-admins but the server does not re-check the role. A user crafts the request and performs the action.

Price set by the client

A checkout sends the item price from the browser and the server charges that value. A user edits the request and pays an amount they chose.

Validation only in JavaScript

Form rules like length and allowed values run only in client script. A direct request skips them and sends malformed or malicious data straight to the server.

Disabled field trusted

A field is marked read-only or disabled in the page to lock a value, but the server accepts whatever arrives, so the user re-enables it and changes the value.

AI risk

Why AI-generated code has increased the exposure

  • Assistants generate the client validation or UI gating the prompt describes and often stop there, because the matching server-side check is separate context the prompt did not spell out.
  • The model cannot see that the client and server are different trust boundaries from a short prompt, so it treats a single client-side check as sufficient.
  • Models optimize for a working demo, and client-only enforcement makes the feature look correct in the browser while leaving the server open.
  • Tutorials and training data frequently show validation or gating in the front end only, and that pattern is reproduced as the default.
  • As the assistant builds more forms and gated controls, each one may ship with enforcement only on the client, and volume multiplies the exposed requests.

Vibe coding

How vibe coding amplifies the risk

  • Vibe coding ships front-end checks without the server counterpart, a gap an unread diff never surfaces.
  • Clicking through the app in a normal browser, every check appears to work, so the missing server check stays hidden.
  • Prompt-and-ship skips the review where someone would ask whether the server re-validates what the client sent.
  • A prototype that enforced rules only in the UI is promoted to production unchanged.
  • Rapid growth adds client-gated features faster than anyone verifies each has a server-side check behind it.

Detection

How to find it

  • For each client-side check, confirm the server independently re-validates the same rule before acting.
  • Send requests directly, bypassing the UI, and confirm the server rejects values the client would have blocked.
  • Never trust prices, quantities, roles, or identifiers sent from the client; recompute or look them up server-side.
  • Treat disabled, hidden, or read-only fields as fully editable by the user and check them on the server.

Remediation

How to fix it

  • Re-enforce every security decision on the server, treating all client input as untrusted.
  • Keep client-side checks for user experience only, never as the sole enforcement of a rule.
  • Derive sensitive values such as price, role, and ownership on the server rather than accepting them from the client.
  • Validate inputs server-side against an allowlist regardless of any client validation.
  • Add tests that send requests bypassing the UI and fail the build if the server accepts what the client would reject.

Frequently asked questions

What is CWE-602 (client-side security enforcement)?
CWE-602 is when a security check such as authorization, validation, or pricing runs only in the client and the server trusts whatever the client sends. Because the user controls the browser or app, they can disable the check or send a request directly, so the protection is trivially bypassed.
How have AI assistants and vibe coding increased client-side enforcement risk?
Assistants generate the client validation or UI gating the prompt describes and often stop there, because the separate server-side check is context the prompt did not spell out. Vibe coding ships that front-end-only code unread, and because clicking through a normal browser makes every check appear to work, the missing server check stays hidden until someone sends a direct request.
How do I fix client-side security enforcement?
Re-enforce every security decision on the server and treat all client input as untrusted, keep client-side checks for user experience only, derive sensitive values server-side, and add tests that bypass the UI to confirm the server rejects what the client would block.

Related weaknesses

Catch CWE-602 before you ship

Tethlyn Audit scans your codebase and its git history for CWE-602 and the rest of the broken access control & authorization class, then ranks each finding by real exploitability and data sensitivity.

See Tethlyn Audit