CWE-306 Base Borrador 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…

Definición

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.
Impacto en el mundo real

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.

Cómo lo explotan los atacantes

Ruta del atacante paso a paso

  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.

Ejemplo de código vulnerable

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;
  }
Ejemplo de código seguro

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.

Seguro 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.
Lista de prevención

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].
Señales de detección

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)

Auto-corrección de Plexicus

Plexicus detecta automáticamente CWE-306 y abre un PR de corrección en menos de 60 segundos.

Codex Remedium escanea cada commit, identifica esta debilidad concreta y entrega un pull request listo para revisión con el parche. Sin tickets. Sin traspasos.

Preguntas frecuentes

Frequently asked questions

¿Qué es 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.

¿Qué gravedad tiene CWE-306?

MITRE califica la probabilidad de explotación como Alta — esta debilidad se explota activamente en la práctica y debe priorizarse para su remediación.

¿Qué lenguajes o plataformas se ven afectados por CWE-306?

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

¿Cómo puedo prevenir 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…

¿Cómo detecta y corrige Plexicus CWE-306?

El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-306 en cada commit. Cuando hay coincidencia, nuestro agente Codex Remedium abre un PR de corrección con el código corregido, las pruebas y un resumen de una línea para el revisor.

¿Dónde puedo aprender más sobre CWE-306?

MITRE publica la definición canónica en https://cwe.mitre.org/data/definitions/306.html. También puedes consultar la documentación de OWASP y NIST para guías relacionadas.

Debilidades relacionadas

Weaknesses related to CWE-306

CWE-287 Padre

Improper Authentication

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

CWE-1390 Hermano

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 Hermano

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 Hermano

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 Hermano

Improper Certificate Validation

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

CWE-307 Hermano

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 Hermano

Weak Password Requirements

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

CWE-522 Hermano

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 Hermano

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…

Listo cuando tú lo estés

Deja de pagar por desarrollador.
Empieza a cerrar el bucle.

Plexicus es el ASPM nativo de IA que escanea, filtra, corrige, pentestea y explica — de forma autónoma. Desarrolladores ilimitados, repos ilimitados, acciones de IA de uso justo. Nivel gratuito real, €269/mo anual cuando estés listo.