Skip to content

Sanitize CRLF characters in SMTPAppender header fields#672

Merged
swebb2066 merged 1 commit into
apache:masterfrom
metsw24-max:smtp-crlf-injection
May 16, 2026
Merged

Sanitize CRLF characters in SMTPAppender header fields#672
swebb2066 merged 1 commit into
apache:masterfrom
metsw24-max:smtp-crlf-injection

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

Strip CR/LF characters from SMTPAppender Subject and address-related fields to prevent SMTP header injection.

Values configured through setSubject, setFrom, setTo, setCc, and setBcc previously allowed embedded CR/LF characters to flow into SMTP header construction unchanged. Since SMTP headers are CRLF-delimited, this allowed injection of additional headers such as Bcc:.

The fix introduces centralized CR/LF stripping in the public setters and emits a warning when sanitization occurs.

Tests

Added regression tests covering:

  • Subject CRLF sanitization
  • Address-field CRLF sanitization
  • Preservation of valid non-malicious input

@swebb2066 swebb2066 merged commit 22a5fc8 into apache:master May 16, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants