Executar análise estática (SAST) na base de código à procura do padrão inseguro no fluxo de dados.
Externally-Generated Error Message Containing Sensitive Information
This vulnerability occurs when an application triggers an error message from an external component—like a database, interpreter, or operating system—and that error reveals sensitive details about…
What is CWE-211?
Real-world CVEs caused by CWE-211
-
chain: product does not protect against direct request of an include file, leading to resultant path disclosure when the include file does not successfully execute.
-
Single "'" inserted into SQL query leads to invalid SQL query execution, triggering full path disclosure. Possibly resultant from more general SQL injection issue.
-
chain: product does not protect against direct request of a library file, leading to resultant path disclosure when the file does not successfully execute.
-
invalid parameter triggers a failure to find an include file, leading to infoleak in error message.
-
Various invalid requests lead to information leak in verbose error messages describing the failure to instantiate a class, open a configuration file, or execute an undefined function.
-
Improper handling of filename request with trailing "/" causes multiple consequences, including information leak in Visual Basic error message.
Trajeto do atacante passo a passo
- 1
The following servlet code does not catch runtime exceptions, meaning that if such an exception were to occur, the container may display potentially dangerous information (such as a full stack trace).
- 2
In the following Java example the class InputFileRead enables an input file to be read using a FileReader object. In the constructor of this class a default input file path is set to some directory on the local file system and the method setInputFile must be called to set the name of the input file to be read in the default directory. The method readInputFile will create the FileReader object and will read the contents of the file. If the method setInputFile is not called prior to calling the method readInputFile then the File object will remain null when initializing the FileReader object. A Java RuntimeException will be raised, and an error message will be output to the user.
- 3
However, the error message output to the user contains information regarding the default directory on the local file system. This information can be exploited and may lead to unauthorized access or use of the system. Any Java RuntimeExceptions that are handled should not expose sensitive information to the user.
Vulnerable Java
The following servlet code does not catch runtime exceptions, meaning that if such an exception were to occur, the container may display potentially dangerous information (such as a full stack trace).
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String username = request.getParameter("username");
```
// May cause unchecked NullPointerException.*
if (username.length() < 10) {
```
...
}
} Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
const safe = validateAndEscape(input);
return executeWithGuards(safe);
} How to prevent CWE-211
- System Configuration Configure the application's environment in a way that prevents errors from being generated. For example, in PHP, disable display_errors.
- Implementation / Build and Compilation Debugging information should not make its way into a production release.
- Implementation / Build and Compilation Debugging information should not make its way into a production release.
- Implementation Handle exceptions internally and do not display errors containing potentially sensitive information to a user. Create default error pages if necessary.
- Implementation The best way to prevent this weakness during implementation is to avoid any bugs that could trigger the external error message. This typically happens when the program encounters fatal errors, such as a divide-by-zero. You will not always be able to control the use of error pages, and you might not be using a language that handles exceptions.
How to detect CWE-211
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-211 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-211?
This vulnerability occurs when an application triggers an error message from an external component—like a database, interpreter, or operating system—and that error reveals sensitive details about the system's internal workings, configuration, or data.
Qual a gravidade do CWE-211?
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-211?
MITRE lists the following affected platforms: PHP.
Como posso prevenir o CWE-211?
Configure the application's environment in a way that prevents errors from being generated. For example, in PHP, disable display_errors. Debugging information should not make its way into a production release.
Como é que o Plexicus deteta e corrige o CWE-211?
O motor SAST do Plexicus correlaciona a assinatura de fluxo de dados do CWE-211 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-211?
A MITRE publica a definição canónica em https://cwe.mitre.org/data/definitions/211.html. Pode também consultar a documentação da OWASP e do NIST para orientações adjacentes.
Weaknesses related to CWE-211
Generation of Error Message Containing Sensitive Information
This vulnerability occurs when an application reveals sensitive details about its internal systems, user data, or environment within error…
Self-generated Error Message Containing Sensitive Information
This vulnerability occurs when an application detects a problem and generates its own error messages that accidentally expose sensitive…
Server-generated Error Message Containing Sensitive Information
This vulnerability occurs when a web application or server returns detailed error messages that reveal sensitive internal information…
Exposure of Information Through Shell Error Message
This vulnerability occurs when a web application's command shell returns detailed error messages to users. Attackers can analyze these…
Servlet Runtime Error Message Containing Sensitive Information
This vulnerability occurs when a Java servlet application displays detailed runtime error messages that reveal sensitive information about…
Java Runtime Error Message Containing Sensitive Information
This vulnerability occurs when a Java application's runtime error messages reveal sensitive details about the system, such as file paths,…
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.