CWE-684 Classe Rascunho

Incorrect Provision of Specified Functionality

This weakness occurs when software behaves differently than its documented specifications, which can mislead users and create security risks.

Definição

What is CWE-684?

This weakness occurs when software behaves differently than its documented specifications, which can mislead users and create security risks.
When your code's actual behavior doesn't match its promised functionality, it creates a trust gap. Developers and systems relying on your published specs—like API contracts, security guarantees, or performance claims—will make incorrect assumptions. This mismatch often becomes the starting point for security vulnerabilities, as callers use the component in ways you didn't anticipate. To prevent this, treat your specifications as a critical part of your security design. Clearly document all behavioral nuances, edge cases, and security-relevant limitations. Actively test that your implementation aligns perfectly with this documentation, because even minor deviations can be exploited when attackers notice the gap between what you promise and what you actually deliver.
Impacto no mundo real

Real-world CVEs caused by CWE-684

  • Error checking routine in PKCS#11 library returns "OK" status even when invalid signature is detected, allowing spoofed messages.

  • Chain: System call returns wrong value (CWE-393), leading to a resultant NULL dereference (CWE-476).

  • Program uses large timeouts on unconfirmed connections resulting from inconsistency in linked lists implementations.

  • UI inconsistency; visited URLs list not cleared when "Clear History" option is selected.

Como os atacantes a exploram

Trajeto do atacante passo a passo

  1. 1

    Identificar um caminho de código que trata input não confiável sem validação.

  2. 2

    Criar um payload que explora o comportamento inseguro — injeção, traversal, overflow ou abuso de lógica.

  3. 3

    Entregar o payload através de um pedido normal e observar a reação da aplicação.

  4. 4

    Iterar até que a resposta exponha dados, execute código do atacante ou escale privilégios.

Exemplo de código vulnerável

Vulnerable Java

In the following snippet from a doPost() servlet method, the server returns "200 OK" (default) even if an error occurs.

Vulnerável Java
try {
```
// Something that may throw an exception.* 
  		...} catch (Throwable t) {
  ```
  	logger.error("Caught: " + t.toString());
  	return;
  }
Exemplo de código seguro

Secure pseudo

Seguro pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Lista de verificação de prevenção

How to prevent CWE-684

  • Implementation Ensure that your code strictly conforms to specifications.
Sinais de deteção

How to detect CWE-684

SAST High

Executar análise estática (SAST) na base de código à procura do padrão inseguro no fluxo de dados.

DAST Moderate

Executar testes dinâmicos de segurança de aplicações (DAST) contra o endpoint em execução.

Runtime Moderate

Monitorizar os registos em tempo de execução para traços de exceção invulgares, input malformado ou tentativas de contornar a autorização.

Code review Moderate

Revisão de código: sinalizar qualquer novo código que trate input desta superfície sem usar os ajudantes validados do framework.

Correção automática do Plexicus

O Plexicus deteta automaticamente o CWE-684 e abre um PR de correção em menos de 60 segundos.

O Codex Remedium analisa cada commit, identifica esta fraqueza exata e entrega um pull request pronto para revisão com o patch. Sem tickets. Sem transferências.

Perguntas frequentes

Frequently asked questions

O que é o CWE-684?

This weakness occurs when software behaves differently than its documented specifications, which can mislead users and create security risks.

Qual a gravidade do CWE-684?

A MITRE não publicou uma classificação de probabilidade de exploração para esta fraqueza. Trate-a como impacto médio até o seu modelo de ameaças provar o contrário.

Que linguagens ou plataformas são afetadas pelo CWE-684?

A MITRE não especificou as plataformas afetadas por este CWE — pode aplicar-se à maioria das stacks de aplicações.

Como posso prevenir o CWE-684?

Ensure that your code strictly conforms to specifications.

Como é que o Plexicus deteta e corrige o CWE-684?

O motor SAST do Plexicus correlaciona a assinatura de fluxo de dados do CWE-684 em cada commit. Quando é encontrada uma correspondência, o nosso agente Codex Remedium abre um PR de correção com o código corrigido, testes e um resumo de uma linha para o revisor.

Onde posso saber mais sobre o CWE-684?

A MITRE publica a definição canónica em https://cwe.mitre.org/data/definitions/684.html. Pode também consultar a documentação da OWASP e do NIST para orientações adjacentes.

Fraquezas relacionadas

Weaknesses related to CWE-684

CWE-710 Pai

Improper Adherence to Coding Standards

This weakness occurs when developers don't consistently follow established coding standards and best practices, which can introduce…

CWE-1041 Irmão

Use of Redundant Code

This weakness occurs when a codebase contains identical or nearly identical logic duplicated across multiple functions, methods, or…

CWE-1044 Irmão

Architecture with Number of Horizontal Layers Outside of Expected Range

This occurs when a software system is built with either too many or too few distinct architectural layers, falling outside a recommended…

CWE-1048 Irmão

Invokable Control Element with Large Number of Outward Calls

This weakness occurs when a single function, method, or callable code block makes an excessively high number of calls to other objects or…

CWE-1059 Irmão

Insufficient Technical Documentation

This weakness occurs when a software or hardware product lacks comprehensive technical documentation. Missing or incomplete details about…

CWE-1061 Irmão

Insufficient Encapsulation

This weakness occurs when a software component exposes too much of its internal workings, such as data structures or implementation logic.…

CWE-1065 Irmão

Runtime Resource Management Control Element in a Component Built to Run on Application Servers

This weakness occurs when an application built to run on a managed application server bypasses the server's high-level APIs and instead…

CWE-1066 Irmão

Missing Serialization Control Element

This weakness occurs when a class or data structure is marked as serializable but lacks the required control methods to properly handle…

CWE-1068 Irmão

Inconsistency Between Implementation and Documented Design

This weakness occurs when the actual code implementation deviates from the intended design described in its official documentation,…

Pronto quando você estiver

Pare de pagar por desenvolvedor.
Comece a fechar o ciclo.

O Plexicus é o ASPM nativo de IA que verifica, filtra, corrige, pentesta e explica — de forma autónoma. Programadores ilimitados, repos ilimitados, ações de IA de utilização justa. Nível gratuito real, €269/mo anual quando estiver pronto.