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

CWE-285: Improper Authorization

An application performs an action without correctly checking that the caller is permitted to perform it.

Also known as: Broken authorization, Improper access control, Missing permission check

Risk

Typically high. It lets users reach data or operations meant for others or for higher roles, and because it is missing logic rather than a crash, it often ships undetected.

Definition

What it is

CWE-285 occurs when an application does not correctly verify that the caller is authorized for the action or resource being requested. It covers checks that are missing, applied inconsistently, or based on the wrong signal, such as trusting a hidden field instead of the server's view of the user. Authentication confirms who the user is; authorization confirms what they may do, and this weakness is the failure of that second step. The gap lets a user perform operations or view data their role or ownership should forbid.

Use-cases

How it shows up in real code

Unprotected privileged action

A delete-user operation checks only that the caller is logged in. A standard user calls it directly and removes other accounts.

Inconsistent checks across routes

A record is protected in the web UI but the matching API route has no authorization check, so a user bypasses the UI and acts freely.

Client-side only enforcement

An admin button is hidden in the interface for non-admins, but the backend never re-checks, so anyone who crafts the request succeeds.

Wrong authorization signal

Access is granted based on a tenant value sent in the request rather than the session, letting a user set it to another tenant and read their data.

AI risk

Why AI-generated code has increased the exposure

  • Assistants implement the requested behavior and add an authentication guard, but the authorization rule depends on a policy the model cannot infer from the prompt, so it is often left out.
  • Who may do what is business context the model does not have, so generated handlers default to allowing any logged-in caller.
  • Models optimize for working code, and an endpoint that returns data for everyone looks correct in a demo while silently skipping the permission check.
  • Training data is full of handlers that check the session but not the permission, so that incomplete pattern is reproduced by default.
  • The more endpoints and actions the assistant scaffolds, the more authorization decisions exist, and each is a chance to omit or misplace the check.

Vibe coding

How vibe coding amplifies the risk

  • Vibe coding ships endpoints whose missing permission check is invisible in an unread diff.
  • Single-account demo testing never exercises a second role, so a user reaching another's action goes unnoticed.
  • Prompt-and-ship skips the review where someone asks whether this caller is actually allowed to do this.
  • Enforcement added only in the UI during a prototype is treated as done, leaving the backend open.
  • Fast endpoint growth outpaces any audit that would confirm each route checks permission consistently.

Detection

How to find it

  • For every action and resource, confirm the server checks the caller is permitted, not merely authenticated.
  • Compare UI-facing and API routes for the same operation and confirm both enforce the same authorization.
  • Treat any authorization signal taken from client input (role, tenant, owner) as untrusted and verify it server-side.
  • Test each sensitive action with accounts of different roles and ownership and confirm the unauthorized ones are refused.

Remediation

How to fix it

  • Enforce an authorization check on every action and resource at the server, based on the authenticated session.
  • Centralize authorization in one layer so every route is checked consistently and none is missed.
  • Deny by default and grant access only when an explicit permission rule allows it.
  • Never derive permission from client-supplied values; take identity, role, and tenant from the session.
  • Add automated tests that attempt each sensitive action as an unauthorized user and fail the build if any succeeds.

Frequently asked questions

What is CWE-285 (improper authorization)?
CWE-285 is when an application performs an action or returns a resource without correctly checking that the caller is permitted to do so. Authentication confirms who the user is; authorization confirms what they may do, and this weakness is the failure of that second check, whether it is missing, inconsistent, or based on the wrong signal.
How have AI assistants and vibe coding increased improper authorization risk?
Assistants add an authentication guard but omit the permission rule because who may do what is business context they lack. Vibe coding ships those handlers unread, and because single-account demo testing never exercises a second role, the missing authorization check stays invisible until a real user acts outside their rights.
How do I fix improper authorization?
Enforce an authorization check on every action at the server, centralize it in one layer, deny by default, take identity and role from the session rather than client input, and add tests that attempt sensitive actions as unauthorized users.

Related weaknesses

Catch CWE-285 before you ship

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

See Tethlyn Audit