CWE-862OWASP API5:2023OWASP A01:2021CWE-285

CWE-862: Missing Authorization

A privileged action runs without a server-side check that the caller is allowed to perform it, so hiding the button in the UI is the only thing stopping anyone from calling it.

Also known as: Missing authorization, Missing function-level access control, Broken function level authorization, BFLA

Risk

Typically high to critical. A missing check on an admin or destructive endpoint lets a standard or anonymous caller perform privileged actions, delete records, change roles, access every tenant.

Definition

What it is

CWE-862 occurs when the application does not perform an authorization check before granting access to a function or resource. The endpoint exists and works; it simply never asks whether this caller is permitted. Because the restriction is often enforced only by not showing the control in the interface, anyone who calls the API directly, bypassing the UI, invokes the action. This is distinct from object-level flaws (IDOR): here the whole function is unguarded, not a specific object.

Use-cases

How it shows up in real code

Admin endpoint with no role check

An admin-only user-management API relies on the admin UI to hide the link. A standard user discovers the route and calls it directly, listing and deleting users without being an admin.

Destructive action reachable by anyone

A 'delete project' endpoint checks that the caller is logged in but not that they have permission on the project. Any authenticated user can delete projects by calling it.

Hidden-but-live internal API

An internal reporting endpoint is 'hidden' by not linking to it. It is still served, unauthenticated, and returns company-wide data to anyone who finds the path.

Privilege change with no guard

A role-assignment endpoint has no check that the caller may grant roles, so a low-privilege user promotes their own account to admin.

AI risk

Why AI-generated code has increased the exposure

  • Assistants generate the endpoint the prompt asked for and commonly add only authentication, not a role or permission check, because who may call it is policy the model was not told.
  • The authorization policy (which roles may do what) lives outside the code the assistant sees, so a generically 'working' endpoint ships with no gate.
  • Generated admin and internal endpoints are often secured in the UI during the same session, creating the false impression they are protected, while the API stays open.
  • The common training-data pattern, guard the page, not the endpoint, is reproduced by default.
  • More generated privileged endpoints means more authorization gates to remember, each an independent chance to omit one.

Vibe coding

How vibe coding amplifies the risk

  • Vibe coding ships privileged endpoints whose only protection is a hidden UI control, because the missing server-side role check is invisible in an unread diff.
  • Hiding the button during vibe-coded development feels like securing the feature, so prompt-and-ship moves on while the API remains callable by anyone.
  • The review that would ask 'is there a role check on the server?' is exactly the step prompt-and-ship skips.
  • Admin panels and internal tools are frequently vibe-coded, and they are the highest-value targets when the function-level check is missing.
  • Fast feature growth adds privileged routes faster than anyone verifies each enforces the right permission server-side.

Detection

How to find it

  • Enumerate privileged routes, admin actions, internal APIs, destructive operations, and confirm each enforces the required role or permission on the server.
  • Verify the check is server-side and independent of the UI; hiding a control is presentation, not authorization.
  • Test privileged endpoints with a low-privilege and an anonymous caller and confirm they are refused.
  • Watch for 'hidden' endpoints assumed safe because nothing links to them, unlinked is not unprotected.

Remediation

How to fix it

  • Enforce an explicit authorization check on every privileged function, server-side, before the action runs.
  • Default to deny: require endpoints to opt into the permissions they need, so a new route is closed until a check is added, rather than open until someone remembers to guard it.
  • Centralize authorization (middleware, a policy layer) so coverage is consistent and a missing check is visible, rather than scattering ad-hoc checks.
  • Never treat UI hiding or an unlinked path as access control; the server must enforce it independently.
  • Add tests that call privileged endpoints as unauthorized users and fail the build if they succeed.

Frequently asked questions

What is CWE-862 (missing authorization)?
CWE-862 is when an application grants access to a function or resource without checking the caller is permitted. The endpoint works and is often 'protected' only by hiding the control in the UI, so anyone calling the API directly invokes the action.
How have AI assistants and vibe coding increased missing-authorization risk?
Assistants add authentication but not a role or permission check, because the authorization policy lives outside the code they see. Vibe coding hides the button during development, which feels like securing the feature, so prompt-and-ship moves on while the API stays callable by anyone, and the review that would ask about a server-side role check is skipped.
How do I fix missing authorization?
Enforce an explicit server-side authorization check on every privileged function before it runs, default to deny so new routes are closed until a check is added, centralize authorization in middleware or a policy layer, never treat UI hiding as access control, and add tests that call privileged endpoints as unauthorized users.

Related weaknesses

Catch CWE-862 before you ship

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

See Tethlyn Audit