You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 53 Next »

Including user input in log files can result in log forging. For example, a user might split a legitimate log entry into two log entries by entering a carriage return and line feed (CRLF) sequence, either of which might be misleading. To prevent such attacks, user input must be sanitized before being used or logged.

Logging unsanitized user input can also result in leaking sensitive data across a trust boundary, or storing sensitive data in a manner that is contrary to local law or regulation. See rule IDS00-J. Sanitize untrusted data passed across a trust boundary for more details on input sanitization.

Noncompliant Code Example

This noncompliant code example logs the user's login user name when an invalid request is received. No input sanitization is performed.

logger.severe("Invalid username:" + getUserName());

This is noncompliant because ????

Compliant Solution

This compliant solution sanitizes the user name input before logging it. Refer to rule IDS00-J. Sanitize untrusted data passed across a trust boundary for more details on input sanitization.

String username = getUserName();
sanitize(username);
logger.severe("Invalid username:" + username);

Risk Assessment

Allowing unvalidated user input to be logged can result in forging of log entries, leaking secure information, or storing sensitive data in a manner that is contrary to local law.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

IDS04-J

medium

probable

medium

P8

L2

Related Guidelines

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0341b694-1876-4eec-8a97-2c3dd374d6e6"><ac:plain-text-body><![CDATA[

[[MITRE 2009

AA. Bibliography#MITRE 09]]

[CWE ID 144

http://cwe.mitre.org/data/definitions/144.html] "Improper Neutralization of Line Delimiters"

]]></ac:plain-text-body></ac:structured-macro>

 

CWE ID 150 "Improper Neutralization of Escape, Meta, or Control Sequences"

Bibliography

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8ece7b2e-bebf-4b46-82df-6eb89a24f080"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

]]></ac:plain-text-body></ac:structured-macro>


IDS03-J. Validate all data passed in through environment variables and non-default properties            IDS05-J. Limit the size of files passed to ZipInputStream

  • No labels