CWE-12 Variante Rascunho

ASP.NET Misconfiguration: Missing Custom Error Page

This vulnerability occurs when an ASP.NET application fails to configure custom error pages, allowing attackers to extract sensitive information from the framework's default error messages.

Definição

What is CWE-12?

This vulnerability occurs when an ASP.NET application fails to configure custom error pages, allowing attackers to extract sensitive information from the framework's default error messages.
When an ASP.NET application encounters an error, it can reveal detailed technical information in its default response, such as stack traces, server file paths, database connection details, or snippets of source code. Attackers actively probe for these errors to gather intelligence about your application's internal structure, which they can then use to plan more targeted and damaging attacks. To prevent this, you must configure custom error pages in your web.config file. This ensures that any runtime errors display a generic, user-friendly message to visitors while logging the full technical details securely on the server. This simple configuration step acts as a critical layer of defense, stopping information leaks that could compromise your entire application.
Impacto no mundo real

Real-world CVEs caused by CWE-12

Ainda não há referências CVE públicas associadas a este CWE no catálogo da MITRE.

Como os atacantes a exploram

Trajeto do atacante passo a passo

  1. 1

    The mode attribute of the tag in the Web.config file defines whether custom or default error pages are used.

  2. 2

    In the following insecure ASP.NET application setting, custom error message mode is turned off. An ASP.NET error message with detailed stack trace and platform versions will be returned.

  3. 3

    A more secure setting is to set the custom error message mode for remote users only. No defaultRedirect error page is specified. The local user on the web server will see a detailed stack trace. For remote users, an ASP.NET error message with the server customError configuration setting and the platform version will be returned.

  4. 4

    Another secure option is to set the mode attribute of the tag to use a custom page as follows:

Exemplo de código vulnerável

Vulnerable ASP.NET

In the following insecure ASP.NET application setting, custom error message mode is turned off. An ASP.NET error message with detailed stack trace and platform versions will be returned.

Vulnerável ASP.NET
<customErrors mode="Off" />
Exemplo de código seguro

Secure ASP.NET

A more secure setting is to set the custom error message mode for remote users only. No defaultRedirect error page is specified. The local user on the web server will see a detailed stack trace. For remote users, an ASP.NET error message with the server customError configuration setting and the platform version will be returned.

Seguro ASP.NET
<customErrors mode="RemoteOnly" />
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-12

  • System Configuration Handle exceptions appropriately in source code. ASP .NET applications should be configured to use custom error pages instead of the framework default page.
  • Architecture and Design Do not attempt to process an error or attempt to mask it.
  • Implementation Verify return values are correct and do not supply sensitive information about the system.
Sinais de deteção

How to detect CWE-12

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-12 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-12?

This vulnerability occurs when an ASP.NET application fails to configure custom error pages, allowing attackers to extract sensitive information from the framework's default error messages.

Qual a gravidade do CWE-12?

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-12?

MITRE lists the following affected platforms: ASP.NET.

Como posso prevenir o CWE-12?

Handle exceptions appropriately in source code. ASP .NET applications should be configured to use custom error pages instead of the framework default page. Do not attempt to process an error or attempt to mask it.

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

O motor SAST do Plexicus correlaciona a assinatura de fluxo de dados do CWE-12 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-12?

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

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.