CWE-306 Base Draft High likelihood

Missing Authentication for Critical Function

This vulnerability occurs when a software feature that performs a sensitive action or uses significant system resources does not verify the user's identity before executing. Attackers can exploit…

Definition

What is CWE-306?

This vulnerability occurs when a software feature that performs a sensitive action or uses significant system resources does not verify the user's identity before executing. Attackers can exploit this to trigger critical functions without any credentials.
Missing authentication for critical functions is a common security flaw where developers protect the main application entry point but forget to verify identity for specific, powerful features within it. These unprotected functions might include administrative actions like user account deletion, financial transactions, data exports, or system configuration changes. Since no login check or session validation is performed, attackers can directly call these functions, often by manipulating URLs, API requests, or hidden form fields, leading to immediate compromise. To prevent this, implement consistent authentication checks across all application layers for any function that performs privileged operations or consumes high resources. Use a centralized security mechanism or middleware to enforce identity verification, avoiding scattered checks that are easy to miss. Always apply the principle of least privilege, ensuring every request is authenticated and authorized, not just those coming from the expected user interface.
Vulnerability Diagram CWE-306
Missing Authentication for Critical Function Anonymous user curl /admin/reset Endpoint POST /admin/reset // no @RequiresAuth // no role check runs immediately DB wiped / privileged action done Sensitive function reachable with no identity established.
Real-world impact

Real-world CVEs caused by CWE-306

  • File-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.

  • Chain: a digital asset management program has an undisclosed backdoor in the legacy version of a PHP script (CWE-912) that could allow an unauthenticated user to export metadata (CWE-306)

  • TCP-based protocol in Programmable Logic Controller (PLC) has no authentication.

  • Condition Monitor firmware uses a protocol that does not require authentication.

  • SCADA-based protocol for bridging WAN and LAN traffic has no authentication.

  • Safety Instrumented System uses proprietary TCP protocols with no authentication.

  • Distributed Control System (DCS) uses a protocol that has no authentication.

  • Chain: Cloud computing virtualization platform does not require authentication for upload of a tar format file (CWE-306), then uses .. path traversal sequences (CWE-23) in the file to access unexpected files, as exploited in the wild per CISA KEV.

How attackers exploit it

Step-by-step attacker path

  1. 1

    In the following Java example the method createBankAccount is used to create a BankAccount object for a bank management application.

  2. 2

    However, there is no authentication mechanism to ensure that the user creating this bank account object has the authority to create new bank accounts. Some authentication mechanisms should be used to verify that the user has the authority to create bank account objects.

  3. 3

    The following Java code includes a boolean variable and method for authenticating a user. If the user has not been authenticated then the createBankAccount will not create the bank account object.

  4. 4

    In 2022, the OT:ICEFALL study examined products by 10 different Operational Technology (OT) vendors. The researchers reported 56 vulnerabilities and said that the products were "insecure by design" [REF-1283]. If exploited, these vulnerabilities often allowed adversaries to change how the products operated, ranging from denial of service to changing the code that the products executed. Since these products were often used in industries such as power, electrical, water, and others, there could even be safety implications.

  5. 5

    Multiple vendors did not use any authentication for critical functionality in their OT products.

Vulnerable code example

Vulnerable Java

In the following Java example the method createBankAccount is used to create a BankAccount object for a bank management application.

Vulnerable Java
public BankAccount createBankAccount(String accountNumber, String accountType,
  String accountName, String accountSSN, double balance) {
  		BankAccount account = new BankAccount();
  		account.setAccountNumber(accountNumber);
  		account.setAccountType(accountType);
  		account.setAccountOwnerName(accountName);
  		account.setAccountOwnerSSN(accountSSN);
  		account.setBalance(balance);
  		return account;
  }
Secure code example

Secure Java

The following Java code includes a boolean variable and method for authenticating a user. If the user has not been authenticated then the createBankAccount will not create the bank account object.

Secure Java
private boolean isUserAuthentic = false;
```
// authenticate user,* 
  
  
   *// if user is authenticated then set variable to true* 
  
  
   *// otherwise set variable to false* 
  public boolean authenticateUser(String username, String password) {
  ```
  	...
  }
  public BankAccount createNewBankAccount(String accountNumber, String accountType,
  String accountName, String accountSSN, double balance) {
  		BankAccount account = null;
  		if (isUserAuthentic) {
  			account = new BankAccount();
  			account.setAccountNumber(accountNumber);
  			account.setAccountType(accountType);
  			account.setAccountOwnerName(accountName);
  			account.setAccountOwnerSSN(accountSSN);
  			account.setBalance(balance);
  		}
  		return account;
  }
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Prevention checklist

How to prevent CWE-306

  • Architecture and Design Divide the software into anonymous, normal, privileged, and administrative areas. Identify which of these areas require a proven user identity, and use a centralized authentication capability. Identify all potential communication channels, or other means of interaction with the software, to ensure that all channels are appropriately protected, including those channels that are assumed to be accessible only by authorized parties. Developers sometimes perform authentication at the primary channel, but open up a secondary channel that is assumed to be private. For example, a login mechanism may be listening on one network port, but after successful authentication, it may open up a second port where it waits for the connection, but avoids authentication because it assumes that only the authenticated party will connect to the port. In general, if the software or protocol allows a single session or user state to persist across multiple connections or channels, authentication and appropriate credential management need to be used throughout.
  • Architecture and Design For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
  • Architecture and Design Where possible, avoid implementing custom, "grow-your-own" authentication routines and consider using authentication capabilities as provided by the surrounding framework, operating system, or environment. These capabilities may avoid common weaknesses that are unique to authentication; support automatic auditing and tracking; and make it easier to provide a clear separation between authentication tasks and authorization tasks. In environments such as the World Wide Web, the line between authentication and authorization is sometimes blurred. If custom authentication routines are required instead of those provided by the server, then these routines must be applied to every single page, since these pages could be requested directly.
  • Architecture and Design Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using libraries with authentication capabilities such as OpenSSL or the ESAPI Authenticator [REF-45].
  • Implementation / System Configuration / Operation When storing data in the cloud (e.g., S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to require strong authentication for users who should be allowed to access the data [REF-1297] [REF-1298] [REF-1302].
Detection signals

How to detect CWE-306

Manual Analysis

This 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. Specifically, manual static analysis is useful for evaluating the correctness of custom authentication mechanisms.

Automated Static Analysis Limited

Automated static analysis is useful for detecting commonly-used idioms for 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 difficulty detecting custom authentication schemes. In addition, the software's design may include some functionality that is accessible to any user and does not require an established identity; an automated technique that detects the absence of authentication may report false positives.

Manual Static Analysis - Binary or Bytecode SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Dynamic Analysis with Automated Results Interpretation SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Web Application Scanner Web Services Scanner Database Scanners

Dynamic Analysis with Manual Results Interpretation SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Host Application Interface Scanner Fuzz Tester Framework-based Fuzzer

Manual Static Analysis - Source Code SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections)

Plexicus auto-fix

Plexicus auto-detects CWE-306 and opens a fix PR in under 60 seconds.

Codex Remedium scans every commit, identifies this exact weakness, and ships a reviewer-ready pull request with the patch. No tickets. No hand-offs.

Frequently asked questions

Frequently asked questions

What is CWE-306?

This vulnerability occurs when a software feature that performs a sensitive action or uses significant system resources does not verify the user's identity before executing. Attackers can exploit this to trigger critical functions without any credentials.

How serious is CWE-306?

MITRE rates the likelihood of exploit as High — this weakness is actively exploited in the wild and should be prioritized for remediation.

What languages or platforms are affected by CWE-306?

MITRE lists the following affected platforms: Cloud Computing, ICS/OT.

How can I prevent CWE-306?

Divide the software into anonymous, normal, privileged, and administrative areas. Identify which of these areas require a proven user identity, and use a centralized authentication capability. Identify all potential communication channels, or other means of interaction with the software, to ensure that all channels are appropriately protected, including those channels that are assumed to be accessible only by authorized parties. Developers sometimes perform authentication at the primary…

How does Plexicus detect and fix CWE-306?

Plexicus's SAST engine matches the data-flow signature for CWE-306 on every commit. When a match is found, our Codex Remedium agent opens a fix PR with the corrected code, tests, and a one-line summary for the reviewer.

Where can I learn more about CWE-306?

MITRE publishes the canonical definition at https://cwe.mitre.org/data/definitions/306.html. You can also reference OWASP and NIST documentation for adjacent guidance.

Related weaknesses

Weaknesses related to CWE-306

CWE-287 Parent

Improper Authentication

Improper Authentication occurs when a system fails to properly verify a user's claimed identity, allowing access without sufficient proof…

CWE-1390 Sibling

Weak Authentication

This vulnerability occurs when a system's login or identity verification process is too easy to bypass or fool. While it attempts to check…

CWE-290 Sibling

Authentication Bypass by Spoofing

This weakness occurs when an application's authentication system can be tricked into accepting forged or manipulated credentials, allowing…

CWE-294 Sibling

Authentication Bypass by Capture-replay

This vulnerability occurs when an attacker can intercept and record legitimate authentication traffic, then replay it later to gain…

CWE-295 Sibling

Improper Certificate Validation

This vulnerability occurs when an application fails to properly verify the authenticity of a digital certificate, or performs the…

CWE-307 Sibling

Improper Restriction of Excessive Authentication Attempts

This vulnerability occurs when an application fails to properly limit how many times someone can attempt to log in or verify their…

CWE-521 Sibling

Weak Password Requirements

This vulnerability occurs when an application fails to enforce strong password policies, making user accounts easier to compromise through…

CWE-522 Sibling

Insufficiently Protected Credentials

This vulnerability occurs when an application handles sensitive credentials like passwords or API keys in an insecure way, making them…

CWE-640 Sibling

Weak Password Recovery Mechanism for Forgotten Password

This vulnerability occurs when an application's password reset or recovery feature is poorly designed or implemented, allowing attackers…

Ready when you are

Don't Let Security
Weigh You Down.

Stop choosing between AI velocity and security debt. Plexicus is the only platform that runs Vibe Coding Security and ASPM in parallel — one workflow, every codebase.