Avoid debug forging | CAST Appmarq

Avoid debug forging


Rule Definition
Writing unvalidated, unsanitized user input to log files can allow an attacker to forge log entries or inject malicious content into the logs. Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually or sometimes automated with a tool that automatically gathers log data for important events or trending information. Interpretation of the log files may be hindered or misdirected if an attacker can supply data to the application that is subsequently logged verbatim. Anyway, this should not be a problem as per debug level should not appear in production.

Remediation
Use authorized sanitization methods.

Violation Code Sample
String login = request.getParameter("login");
log.debug("Login=" + login);
Fixed Code Sample
String login = request.getParameter("login");
log.debug("Login=" + ESAPI.encoder().encodeForHTML(login));

Reference
CWE-117: Improper Output Neutralization for Logs https://cwe.mitre.org/data/definitions/117.html

Related Technologies

Health Factor

  Total Quality Index


Technical Criterion
Secure Coding - Input Validation

About CAST Appmarq

CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.

Benchmark Statistics

Global Compliance

nan%

Total Violations
0
Total Opportunities
0
Average Violations / App.
nan
The compliance score represents 1 minus the ratio between the number of times a rule has been violated compared to the number of opportunities in a set of applications that the rule could have been violated.

Industry Insights

Select from drop-down

99.83%

Government

99.66%

Financial Services

99.87%