CWE-287: Broken authentication | Causes and Fixes Skip to content

Security weakness

CWE-287 Broken authentication

Your site accepts someone’s claim about who they are without properly proving it, so attackers can pose as real users.

  • Senior security engineers
  • 540+ projects delivered
  • Reply within one business day

Quick answer

What is CWE-287?

Improper Authentication: When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

Business impact

What CWE-287 could cost your business

MITRE documents what this weakness can do. Here is what that means for a website, store or app.

Confidentiality

Private data exposed

Customer records, credentials, orders or internal files can be read by people who should never see them.

  • Read Application Data
  • Gain Privileges or Assume Identity
  • Execute Unauthorized Code or Commands

Integrity

Data, pages or code changed

Prices, orders, content or the code your site runs can be altered without your approval.

  • Read Application Data
  • Gain Privileges or Assume Identity
  • Execute Unauthorized Code or Commands

Availability

Downtime and lost sales

Crashes, slowdowns or exhausted resources can take your site, store or app offline.

  • Read Application Data
  • Gain Privileges or Assume Identity
  • Execute Unauthorized Code or Commands

Access Control

Accounts and admin areas exposed

Logins and permission checks can be bypassed, putting admin and customer accounts at risk.

  • Read Application Data
  • Gain Privileges or Assume Identity
  • Execute Unauthorized Code or Commands

In plain English

What Broken authentication means for your business

  • 540+projects delivered
  • 9+years in business
  • 23+certified experts
Get a free security check

A senior engineer replies within one business day.

Authentication is the step where your site proves a visitor is who they claim to be, through a password, a one-time code, a token or a sign-in provider. Improper authentication means that proof is weak, incomplete or can be skipped. The login form may look fine while a flaw elsewhere, such as in password reset, session handling or token checking, lets someone in without the right credentials.

When authentication fails, everything built on top of it fails too. An attacker who can pose as a customer sees that customer’s orders, addresses and saved details. An attacker who can pose as an administrator controls the site. Account takeovers lead to fraud, refund costs, support work and lost trust. These flaws often sit in custom login code, so using well-tested frameworks and identity services removes much of the risk.

Where it shows up

  • Custom login systems that trust a value the browser sends, such as a cookie or hidden field saying the user is already signed in.
  • Password reset flows with guessable or long-lived reset links, or security questions that can be answered from public information.
  • APIs behind mobile apps and single-page sites that accept access tokens without verifying the signature, expiry date or intended audience.
  • Social sign-in and single sign-on integrations that skip validation steps, or two-step verification that can be bypassed by calling a later page directly.

Free security check

Is CWE-287 hiding in your site?

A senior engineer checks your site, store or app for this weakness and the rest of the CWE Top 25, then sends a prioritized fix plan within one business day. No obligation.

Official definition

How MITRE defines CWE-287

Improper Authentication

When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

Also known as: authentification, AuthN, AuthC

Weakness ID
CWE-287
Type
Class
Status
Draft
Likelihood of exploit
High
Applies to
Web Based, ICS/OT
Introduced during
Architecture and Design, Implementation

Fix it

How to fix Broken authentication

Practical steps in priority order. Share them with your developer or agency.

  1. Use a proven authentication framework

    Replace hand-written login code with your platform’s built-in authentication, a maintained library or a managed identity provider. These handle password checks, sessions and token validation in ways that have been widely reviewed and tested.

  2. Add multi-factor authentication

    Require a second factor, such as an authenticator app code or a passkey, for administrators and staff, and offer it to customers. Make sure the second step cannot be skipped by requesting later pages directly.

  3. Manage sessions safely

    Generate long random session IDs on the server and issue a new one at login. Set cookies as Secure, HttpOnly and SameSite. Expire idle sessions, and invalidate all sessions on logout and password change.

  4. Secure password reset and recovery

    Send single-use reset links built from long random tokens that expire quickly. Do not rely on security questions. Notify the account owner of resets and require the current password for email or password changes.

  5. Validate tokens fully on the server

    For API tokens and single sign-on, verify the signature, issuer, audience and expiry on every request using a standard library. Reject unsigned tokens, and never trust identity claims that arrive only from the browser.

Signs you may be affected

  • Customers report logins, orders or profile changes on their accounts that they did not make.
  • Sessions stay valid after logout or a password change, or never expire at all.
  • Your site uses login or password reset code written from scratch instead of a maintained framework.

Questions to ask your developer

  • Is our login built on a maintained framework or on custom code?
  • Is multi-factor authentication enforced for every administrator and staff account?
  • Do sessions end on logout, password change and after a period of inactivity?

Prevention

What MITRE recommends, phase by phase

Every mitigation from the CWE entry, in the order a project runs: plan, build, test, operate.

  1. 01

    Architecture and Design

    • Use an authentication framework or library such as the OWASP ESAPI Authentication feature.

Detection and evidence

How CWE-287 is found, and where it has hit

The testing methods MITRE recommends, and real vulnerabilities this weakness has caused.

How it is detected

  • Automated Static AnalysisAutomated static analysis is useful for detecting certain types of authentication. A tool may be able to analyze related configuration files, such as .htaccess in Apache web servers, or detect the usage of commonly-used authentication libraries. Generally, automated static analysis tools have.
  • Manual Static AnalysisThis weakness can be detected using 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. Manual static analysis is useful for evaluating the correctness of custom.
  • Manual Static Analysis – Binary or BytecodeAccording to SOAR [REF-1479], the following detection techniques may be useful: Binary / Bytecode disassembler – then use manual analysis for vulnerabilities & anomalies
  • Dynamic Analysis with Automated Results InterpretationAccording to SOAR [REF-1479], the following detection techniques may be useful: Web Application Scanner Web Services Scanner Database Scanners
  • Dynamic Analysis with Manual Results InterpretationAccording to SOAR [REF-1479], the following detection techniques may be useful: Fuzz Tester Framework-based Fuzzer

Real vulnerabilities it caused

  • CVE-2024-11680File-sharing PHP product does not check if user is logged in during requests for PHP library files under an includes/ directory, allowing configuration changes, code execution, and other impacts.
  • CVE-2022-35248Chat application skips validation when Central Authentication Service (CAS) is enabled, effectively removing the second factor from two-factor authentication
  • CVE-2022-36436Python-based authentication proxy does not enforce password authentication during the initial handshake, allowing the client to bypass authentication by specifying a ‘None’ authentication type.
  • CVE-2022-30034Chain: Web UI for a Python RPC framework does not use regex anchors to validate user login emails (CWE-777), potentially allowing bypass of OAuth (CWE-1390).
  • CVE-2022-29951TCP-based protocol in Programmable Logic Controller (PLC) has no authentication.
  • CVE-2022-29952Condition Monitor firmware uses a protocol that does not require authentication.

How we fix it

From finding to fixed: how Codefreex closes CWE-287

  1. 01

    Scan and confirm

    We test your site, store or app for this weakness and the rest of the CWE Top 25 with automated scanning and manual review, and confirm what is actually exploitable.

  2. 02

    Fix at the source

    We change the code, configuration or dependency that causes it, not just the symptom, and plan the changes to avoid downtime.

  3. 03

    Verify the fix

    We retest every finding, check that nothing else broke and hand you a short report you can share with your team, client or auditor.

  4. 04

    Keep it fixed

    Updates, monitoring and maintenance so the weakness does not return with the next plugin, theme, app or code change.

Related weaknesses

FAQ

CWE-287: FAQs

Short answers for owners and developers. Not sure whether your site is affected? Ask us to check.

How serious is broken authentication?

It is high impact, because authentication guards everything else. If someone can sign in as another user, they gain that user’s access, up to full control of the site for an administrator account. Consequences include data exposure, fraudulent orders and loss of customer trust. MITRE rates the likelihood of exploitation as high.

How do I prevent authentication weaknesses?

Avoid writing your own login system. Use the authentication built into your platform or a managed identity service, and keep it updated. Turn on multi-factor authentication for privileged accounts. Review the less obvious paths, including password reset, remember-me features, API tokens and single sign-on, because these are where bypasses are often found.

Is a strong password policy enough?

No. Strong passwords help against guessing, but many authentication flaws do not involve the password at all. A weak reset link, a session that never expires or a token that is not verified can let someone in regardless of password strength. Combine good passwords with multi-factor authentication, safe session handling and tested recovery flows.

What is CWE-287?

CWE-287, “Improper Authentication”, is a software weakness catalogued by MITRE in the Common Weakness Enumeration. When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.

How serious is CWE-287?

MITRE rates the likelihood of exploit as High. It can affect integrity, confidentiality, availability, access control, with impacts such as read application data, gain privileges or assume identity, execute unauthorized code or commands. The real risk depends on where the weakness sits and what data or functions it exposes.

How do you prevent CWE-287?

Use an authentication framework or library such as the OWASP ESAPI Authentication feature.

Can Codefreex check my site for CWE-287?

Yes. A senior engineer reviews your site, store or app for CWE-287 and the rest of the CWE Top 25, confirms what is exploitable and sends a prioritized fix plan within one business day. Start with the free security check form on this page.

Free security check

Find out if CWE-287 affects your site

Send your URL. A senior engineer checks for this weakness and the rest of the CWE Top 25, and replies within one business day with what to fix first.

  • A senior strategist reviews your request, not a sales bot
  • Clear scope, timeline and estimate within one business day
  • Free 30-minute discovery call, no obligation
  • NDA available on request

Weakness data from the Common Weakness Enumeration (CWE®) version 5.0, Copyright © 2006–2026, The MITRE Corporation. CWE is free to use by any organization or individual for any research, development, and/or commercial purposes under the CWE Terms of Use. CWE is a registered trademark of The MITRE Corporation. The business impact, risk profile and plain-English guidance on this page are written by Codefreex and are general information, not a security assessment of your system.