Input Validation / SMTP Header Injection
SMTP Header Injection (CWE-113) is an input validation vulnerability that occurs when an application or system fails to properly validate user input contained in the header of an email message. This can result in the injection of malicious code into the header of a legitimate email message. This vulnerability is most commonly found in web applications that allow users to compose and send email messages. The OWASP Testing Guide states that this vulnerability can be exploited by an attacker who is able to modify the headers of an email message before it is sent.
The risk associated with this vulnerability is that it can be used to inject malicious code into the header of a legitimate email message. This can be used to spoof the sender of the message, modify the content of the message, and even execute arbitrary code on the target system.
The best way to prevent this vulnerability is to validate all user input contained in an email header. This can be done by using filtering techniques such as checking for dangerous characters, enforcing a maximum length, and rejecting any unexpected patterns. In addition, the application should also reject any input that looks suspicious.