Executar análise estática (SAST) na base de código à procura do padrão inseguro no fluxo de dados.
Improper Handling of Exceptional Conditions
This vulnerability occurs when software fails to properly manage unexpected situations or errors, leaving it in an unstable or insecure state.
What is CWE-755?
Real-world CVEs caused by CWE-755
-
SDK for OPC Unified Architecture (OPC UA) server has uncaught exception when a socket is blocked for writing but the server tries to send an error
-
Chain: JavaScript-based cryptocurrency library can fall back to the insecure Math.random() function instead of reporting a failure (CWE-392), thus reducing the entropy (CWE-332) and leading to generation of non-unique cryptographic keys for Bitcoin wallets (CWE-1391)
-
virtual interrupt controller in a virtualization product allows crash of host by writing a certain invalid value to a register, which triggers a fatal error instead of returning an error code
-
Chain: OS kernel does not properly handle a failure of a function call (CWE-755), leading to an unlock of a resource that was not locked (CWE-832), with resultant crash.
Trajeto do atacante passo a passo
- 1
The following example attempts to resolve a hostname.
- 2
A DNS lookup failure will cause the Servlet to throw an exception.
- 3
The following example attempts to allocate memory for a character. After the call to malloc, an if statement is used to check whether the malloc function failed.
- 4
The conditional successfully detects a NULL return value from malloc indicating a failure, however it does not do anything to handle the problem. Unhandled errors may have unexpected results and may cause the program to crash or terminate.
- 5
Instead, the if block should contain statements that either attempt to fix the problem or notify the user that an error has occurred and continue processing or perform some cleanup and gracefully terminate the program. The following example notifies the user that the malloc function did not allocate the required memory resources and returns an error code.
Vulnerable Java
The following example attempts to resolve a hostname.
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws IOException {
String ip = req.getRemoteAddr();
InetAddress addr = InetAddress.getByName(ip);
...
out.println("hello " + addr.getHostName());
} Secure C
Instead, the if block should contain statements that either attempt to fix the problem or notify the user that an error has occurred and continue processing or perform some cleanup and gracefully terminate the program. The following example notifies the user that the malloc function did not allocate the required memory resources and returns an error code.
foo=malloc(sizeof(char)); //the next line checks to see if malloc failed
if (foo==NULL) {
printf("Malloc failed to allocate memory resources");
return -1;
} How to prevent CWE-755
- Architecture Use safe-by-default frameworks and APIs that prevent the unsafe pattern from being expressible.
- Implementation Validate input at trust boundaries; use allowlists, not denylists.
- Implementation Apply the principle of least privilege to credentials, file paths, and runtime permissions.
- Testing Cover this weakness in CI: SAST rules + targeted unit tests for the data flow.
- Operation Monitor logs for the runtime signals listed in the next section.
How to detect CWE-755
Executar testes dinâmicos de segurança de aplicações (DAST) contra o endpoint em execução.
Monitorizar os registos em tempo de execução para traços de exceção invulgares, input malformado ou tentativas de contornar a autorização.
Revisão de código: sinalizar qualquer novo código que trate input desta superfície sem usar os ajudantes validados do framework.
O Plexicus deteta automaticamente o CWE-755 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.
Frequently asked questions
O que é o CWE-755?
This vulnerability occurs when software fails to properly manage unexpected situations or errors, leaving it in an unstable or insecure state.
Qual a gravidade do CWE-755?
A MITRE classifica a probabilidade de exploração como Média — a exploração é realista mas normalmente requer condições específicas.
Que linguagens ou plataformas são afetadas pelo CWE-755?
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-755?
Use safe-by-default frameworks, validate untrusted input at trust boundaries, and apply the principle of least privilege. Cover the data-flow signature in CI with SAST.
Como é que o Plexicus deteta e corrige o CWE-755?
O motor SAST do Plexicus correlaciona a assinatura de fluxo de dados do CWE-755 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-755?
A MITRE publica a definição canónica em https://cwe.mitre.org/data/definitions/755.html. Pode também consultar a documentação da OWASP e do NIST para orientações adjacentes.
Weaknesses related to CWE-755
Improper Check or Handling of Exceptional Conditions
This vulnerability occurs when software fails to properly plan for or manage rare but possible error scenarios, leaving it unprepared for…
Improper Handling of Physical or Environmental Conditions
This weakness occurs when a hardware device fails to manage unexpected physical or environmental situations, whether they happen naturally…
Improper Handling of Syntactically Invalid Structure
This vulnerability occurs when software fails to properly reject or process input that doesn't follow the expected format or structure,…
Uncaught Exception
This vulnerability occurs when a function throws an error or exception, but the calling code does not have a proper handler to catch and…
Unchecked Error Condition
This vulnerability occurs when a program fails to properly check or handle error conditions, such as exceptions or return codes. By…
Missing Report of Error Condition
This vulnerability occurs when a system fails to properly signal that an error has happened. Instead of returning a clear error code,…
Return of Wrong Status Code
This vulnerability occurs when a function returns an inaccurate status code or value that misrepresents the actual outcome of an…
Declaration of Throws for Generic Exception
This vulnerability occurs when a method is declared to throw an overly broad exception type, such as a generic 'Exception' or 'Throwable'.…
Improper Check for Unusual or Exceptional Conditions
This weakness occurs when software fails to properly anticipate and handle rare or unexpected runtime situations that fall outside normal…
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.