Possible CLRF injection detected

Description

A CRLF (Carriage Return Line Feed) injection occurs when an attacker injects a sequence of line termination characters into a log message, allowing them to forge log entries.

Remediations

✅ Strip any carriage return and line feed characters from user input data before logging it.

logger.info(userInput.replaceAll("[\r\n]+", ""));

Resources

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=java_lang_crlf_injection

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=java_lang_crlf_injection

Ready to take the next step? Learn more about Bearer Cloud.