Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Insufficient Logging
This weakness occurs when an application fails to properly record important security events or captures them with insufficient detail, making it hard to spot and investigate suspicious activity.
What is CWE-778?
Real-world CVEs caused by CWE-778
-
server does not log failed authentication attempts, making it easier for attackers to perform brute force password guessing without being detected
-
admin interface does not log failed authentication attempts, making it easier for attackers to perform brute force password guessing without being detected
-
default configuration for POP server does not log source IP or username for login attempts
-
proxy does not log requests without "http://" in the URL, allowing web surfers to access restricted web content without detection
-
web server does not log requests for a non-standard request type
Trajeto do atacante passo a passo
- 1
The example below shows a configuration for the service security audit feature in the Windows Communication Foundation (WCF).
- 2
The previous configuration file has effectively disabled the recording of security-critical events, which would force the administrator to look to other sources during debug or recovery efforts.
- 3
Logging failed authentication attempts can warn administrators of potential brute force attacks. Similarly, logging successful authentication events can provide a useful audit trail when a legitimate account is compromised. The following configuration shows appropriate settings, assuming that the site does not have excessive traffic, which could fill the logs if there are a large number of success or failure events (CWE-779).
- 4
In the following Java example the code attempts to authenticate the user. If the login fails a retry is made. Proper restrictions on the number of login attempts are of course part of the retry functionality. Unfortunately, the failed login is not recorded and there would be no record of an adversary attempting to brute force the program.
- 5
It is recommended to log the failed login action. Note that unneutralized usernames should not be part of the log message, and passwords should never be part of the log message.
Vulnerable XML
The example below shows a configuration for the service security audit feature in the Windows Communication Foundation (WCF).
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceSecurityAudit auditLogLocation="Default"
suppressAuditFailure="false"
serviceAuthorizationAuditLevel="None"
messageAuthenticationAuditLevel="None" />
...
</system.serviceModel> Secure XML
Logging failed authentication attempts can warn administrators of potential brute force attacks. Similarly, logging successful authentication events can provide a useful audit trail when a legitimate account is compromised. The following configuration shows appropriate settings, assuming that the site does not have excessive traffic, which could fill the logs if there are a large number of success or failure events (CWE-779).
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceSecurityAudit auditLogLocation="Default"
suppressAuditFailure="false"
serviceAuthorizationAuditLevel="SuccessAndFailure"
messageAuthenticationAuditLevel="SuccessAndFailure" />
...
</system.serviceModel> How to prevent CWE-778
- Architecture and Design Use a centralized logging mechanism that supports multiple levels of detail.
- Implementation Ensure that all security-related successes and failures can be logged. When storing data in the cloud (e.g., AWS S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to enable and capture detailed logging information.
- Operation Be sure to set the level of logging appropriately in a production environment. Sufficient data should be logged to enable system administrators to detect attacks, diagnose errors, and recover from attacks. At the same time, logging too much data (CWE-779) can cause the same problems, including unexpected costs when using a cloud environment.
- Operation To enable storage logging using Azure's Portal, navigate to the name of the Storage Account, locate Monitoring (CLASSIC) section, and select Diagnostic settings (classic). For each of the various properties (blob, file, table, queue), ensure the status is properly set for the desired logging data. If using PowerShell, the Set-AzStorageServiceLoggingProperty command could be called using appropriate -ServiceType, -LoggingOperations, and -RetentionDays arguments.
How to detect CWE-778
O Plexicus deteta automaticamente o CWE-778 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-778?
This weakness occurs when an application fails to properly record important security events or captures them with insufficient detail, making it hard to spot and investigate suspicious activity.
Qual a gravidade do CWE-778?
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-778?
MITRE lists the following affected platforms: Cloud Computing.
Como posso prevenir o CWE-778?
Use a centralized logging mechanism that supports multiple levels of detail. Ensure that all security-related successes and failures can be logged. When storing data in the cloud (e.g., AWS S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to enable and capture detailed logging information.
Como é que o Plexicus deteta e corrige o CWE-778?
O motor SAST do Plexicus correlaciona a assinatura de fluxo de dados do CWE-778 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-778?
A MITRE publica a definição canónica em https://cwe.mitre.org/data/definitions/778.html. Pode também consultar a documentação da OWASP e do NIST para orientações adjacentes.
Weaknesses related to CWE-778
Omission of Security-relevant Information
This vulnerability occurs when an application fails to capture or present crucial security-related details, such as the origin of a…
Missing Security-Relevant Feedback for Unexecuted Operations in Hardware Interface
This vulnerability occurs when a hardware interface discards operations without providing any security-relevant feedback, such as error…
Further reading
- MITRE — CWE-778 oficial https://cwe.mitre.org/data/definitions/778.html
- CIS Microsoft Azure Foundations Benchmark version 1.5.0 https://www.cisecurity.org/benchmark/azure
- Enable and manage Azure Storage Analytics logs (classic) https://learn.microsoft.com/en-us/azure/storage/common/manage-storage-analytics-logs
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.