You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Applications that do not provide sufficient validation on some fields used to compose emails may be vulnerable to unwanted header injection when sending emails.
In particular, when an application allows the user to specify a "from" name and that name has a newline character embeded, the raw email stream arriving at the destination may see the line following the newline character as a header within the email stream.
For example:
MimeMessage msg = new MimeMessage(someSession);
InternetAddress fromAddress = new InternetAddress("My Name \nX-SomeHeader: somedata", "myrealaddress@foo.com");
msg.setFrom(fromAddress);
msg.send();
When Javamail emits the "from" header into the stream, it will look like this:
This will give the receiving system a bogus "From" header as well as an injected "X-SomeHeader" header.
Depending on how the receiving system behaves and the injected header itself, it may be possible for an attacker to cause unwanted or unauthorized behavior on the receiving system.
Affected Versions
1.5.5
Environment
PC
Linux
The text was updated successfully, but these errors were encountered:
@glassfishrobot Commented @bshannon said:
The JavaMail javadocs have always made it clear that applications are responsible
for validating input before passing it to JavaMail API methods. Still, some
developers are confused about this or never read the documentation.
I've enhanced JavaMail for 1.5.6 to ensure that newlines in headers that are
folded (address headers, Subject, Content-Type, Content-Description, ...)
are always followed by whitespace to prevent possible header injection.
Applications that manipulate headers directly will still need to handle this
themselves.
Applications that do not provide sufficient validation on some fields used to compose emails may be vulnerable to unwanted header injection when sending emails.
In particular, when an application allows the user to specify a "from" name and that name has a newline character embeded, the raw email stream arriving at the destination may see the line following the newline character as a header within the email stream.
For example:
MimeMessage msg = new MimeMessage(someSession);
InternetAddress fromAddress = new InternetAddress("My Name \nX-SomeHeader: somedata", "myrealaddress@foo.com");
msg.setFrom(fromAddress);
msg.send();
When Javamail emits the "from" header into the stream, it will look like this:
From: "My Name
X-SomeHeader: somedata" myrealaddress@foo.com
This will give the receiving system a bogus "From" header as well as an injected "X-SomeHeader" header.
Depending on how the receiving system behaves and the injected header itself, it may be possible for an attacker to cause unwanted or unauthorized behavior on the receiving system.
Affected Versions
1.5.5
Environment
PC
Linux
The text was updated successfully, but these errors were encountered: