pentesting, updated
Testing for IMAP/SMTP Injection
Check whether input reaches an IMAP or SMTP command unsanitized, letting you inject extra commands or headers.
Goal
Confirm mail-related input (recipient, subject, body used to build a message) can’t inject extra headers or commands.
How to test
Inject CRLF sequences into any field that ends up in an email header (contact forms, “share this page” features):
attacker@example.com%0ABcc:victim2@example.com
test%0D%0ASubject:%20injected
curl -s https://example.com/contact -d "email=attacker@test.com%0ABcc:spam-target@test.com&msg=hi"
What to look for
Extra headers (Bcc, Subject) or commands accepted, letting you redirect/duplicate mail or inject content.
References
- OWASP WSTG-INPV-10 — Testing for IMAP/SMTP Injection.