-
Notifications
You must be signed in to change notification settings - Fork 942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need patch for OSVDB-131677 against 2.5.x #944
Comments
+1, would also be great to have a 2.4.x backport as well for rails 3.1. |
Here's a monkey patch. require 'mail'
if Gem::Version.new(Mail::VERSION.version) < Gem::Version.new('2.6')
Mail::Field.class_exec do
original_method = instance_method(:create_field)
define_method(:create_field) do |name, value, charset|
value = value.gsub(/[\r\n \t]+/m, ' ') if value.is_a?(String)
original_method.bind(self).call(name, value, charset)
end
end
end |
Is there anything preventing this from being fixed and released? |
This adresses mikel/mail#944 until we can upgrade to rails 4.x
This is backporting a change that's not meant to fix the underlying vuln (with input validation on net/smtp) but happens to mask it with a coincidental behavior change. It was called out the sec advisory only because it bisected as the fix. We can introduce stronger input validation at the mail handling layer and backport it without breaking compat, but 1. this isn't that change and 2. it won't conclusively address the original vuln, SMTP injection via email address. Will keep this issue open to track resolution. |
@jeremy: Could you elaborate on what other input validations would be needed to address the vulnerability in older versions of the mail gem? I'd be happy to try and lend a hand getting things back-ported, since I'd also find this very useful in dealing with older Rails version In reading the whitepaper, it seems like stripping the line break characters (as @wktk's original patches did) would largely mitigate the primary issue, or am I missing something else? The one other item I see is "CRLF-less attack" in section 4.2, which seems like it could be mitigated by enforcing length limits on the input. Are there other issues you're aware of that would need to be addressed in the older mail versions? They do recommend validating for compliance with RFC 5321, but I'm not sure that's strictly necessary as long as line breaks are rejected or stripped, since they also mention:
|
A security advisory was issued for the mail gem recently: https://github.com/rubysec/ruby-advisory-db/blob/master/gems/mail/OSVDB-131677.yml
It indicates that the vulnerability was fixed in 2.6.0. However, actionmailer 3.2 (part of rails 3.2) has a dependency on
~> 2.5.4
. See https://github.com/rails/rails/blob/3-2-stable/actionmailer/actionmailer.gemspec#L23According to rails/rails#22631, the rails project is unwilling to bump the version to 2.6.0.
How hard would it be to backport that fix to 2.5 and cut a new release?
The text was updated successfully, but these errors were encountered: