Bug 959495 (CVE-2015-7551) - VUL-0: CVE-2015-7551: ruby19,ruby: Unsafe tainted string usage in Fiddle and DL
Summary: VUL-0: CVE-2015-7551: ruby19,ruby: Unsafe tainted string usage in Fiddle and DL
Status: RESOLVED FIXED
Alias: CVE-2015-7551
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/159938/
Whiteboard: CVSSv2:SUSE:CVE-2015-7551:6.8:(AV:N/A...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-17 09:53 UTC by Marcus Meissner
Modified: 2017-10-26 05:40 UTC (History)
4 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2015-12-17 09:53:07 UTC
CVE-2015-7551

https://www.ruby-lang.org/en/news/2015/12/16/unsafe-tainted-string-usage-in-fiddle-and-dl-cve-2015-7551/

There is an unsafe tainted string usage vulnerability in Fiddle and DL. This vulnerability has been assigned the CVE identifier CVE-2015-7551.
Details

There is an unsafe tainted string vulnerability in Fiddle and DL. This issue was originally reported and fixed with CVE-2009-5147 in DL, but reappeared after DL was reimplemented using Fiddle and libffi.

And, about DL, CVE-2009-5147 was fixed at Ruby 1.9.1, but not fixed at other branches, then rubies which bundled DL except Ruby 1.9.1 are still vulnerable.

Impacted code looks something like this:

handle = Fiddle::Handle.new(dangerous_user_input)

Or:

handle = Fiddle::Handle.new(some_library)
function_pointer = handle[dangerous_user_input]

All users running an affected release should either upgrade or use one of the work arounds immediately.
Affected Versions

    All patch releases of Ruby 1.9.2 and Ruby 1.9.3 (DL and Fiddle).
    All patch releases of Ruby 2.0.0 prior to Ruby 2.0.0 patchlevel 648 (DL and Fiddle).
    All versions of Ruby 2.1 prior to Ruby 2.1.8 (DL and Fiddle).
    All versions of Ruby 2.2 prior to Ruby 2.2.4 (Fiddle).
    Ruby 2.3.0 preview 1 and preview 2 (Fiddle).
    prior to trunk revision 53153 (Fiddle).

Workarounds

If you cannot upgrade, the following monkey patch can be applied as a workaround for Fiddle:

class Fiddle::Handle
  alias :old_initialize :initialize

  def initialize file, *args
    raise SecurityError if file.tainted? && $SAFE > 0
    old_initialize file, *args
  end

  alias :sym :[]
  alias :old_call :[]

  def [] fun
    raise SecurityError if fun.tainted? && $SAFE > 0
    old_call fun
  end
end

If you are using DL, use Fiddle instead of it.
Credits

Thanks to Christian Hofstaedtler zeha@debian.org for reporting this issue!
History

    Originally published at 2015-12-16 12:00:00 UTC
Comment 1 SMASH SMASH 2015-12-17 11:00:36 UTC
An update workflow for this issue was started.

This issue was rated as "important".
Please submit fixed packages until "Dec. 24, 2015".

When done, reassign the bug to "security-team@suse.de".
/update/121177/.
Comment 2 Swamp Workflow Management 2015-12-17 23:00:23 UTC
bugbot adjusting priority
Comment 3 Jordi Massaguer 2015-12-24 10:25:15 UTC
ruby19 is not affected.

Fiddle::Handle was copied from DL::Handle in commit

4600cf725a86ce31266153647ae5aa1197b1215b

which is not included in ruby_1_9_3 branch.

DL::Handle was already patched with

https://github.com/ruby/ruby/commit/4600cf725a86ce31266153647ae5aa1197b1215b

which had already been applied to ruby19 RPM when fixing CVE-2009-5147

See:

https://bugzilla.novell.com/show_bug.cgi?id=939860
Comment 4 Marcus Rückert 2017-03-10 14:59:06 UTC
do we have a POC for this?
Comment 5 Victor Pereira 2017-03-14 09:13:58 UTC
(In reply to Marcus Rückert from comment #4)
> do we have a POC for this?

Yes: https://github.com/vpereira/CVE-2009-5147

File foo2.rb abuses the CVE-2015-7551
Comment 7 Swamp Workflow Management 2017-04-05 13:08:36 UTC
openSUSE-SU-2017:0933-1: An update that fixes two vulnerabilities is now available.

Category: security (important)
Bug References: 1018808,959495
CVE References: CVE-2015-7551,CVE-2016-2339
Sources used:
openSUSE Leap 42.2 (src):    ruby2.2-2.2.6-6.3.1, ruby2.3-2.3.3-2.3.1
openSUSE Leap 42.1 (src):    ruby2.2-2.2.6-6.1
Comment 8 Swamp Workflow Management 2017-04-06 13:11:06 UTC
SUSE-SU-2017:0948-1: An update that solves two vulnerabilities and has one errata is now available.

Category: security (moderate)
Bug References: 926974,959495,986630
CVE References: CVE-2015-1855,CVE-2015-7551
Sources used:
SUSE Webyast 1.3 (src):    ruby-1.8.7.p357-0.9.19.1
SUSE Studio Onsite 1.3 (src):    ruby-1.8.7.p357-0.9.19.1
SUSE Linux Enterprise Software Development Kit 11-SP4 (src):    ruby-1.8.7.p357-0.9.19.1
SUSE Linux Enterprise Server 11-SP4 (src):    ruby-1.8.7.p357-0.9.19.1
SUSE Linux Enterprise Debuginfo 11-SP4 (src):    ruby-1.8.7.p357-0.9.19.1
SUSE Lifecycle Management Server 1.3 (src):    ruby-1.8.7.p357-0.9.19.1
Comment 9 Swamp Workflow Management 2017-04-20 10:10:26 UTC
SUSE-SU-2017:1067-1: An update that solves 5 vulnerabilities and has three fixes is now available.

Category: security (important)
Bug References: 1014863,1018808,887877,909695,926974,936032,959495,986630
CVE References: CVE-2014-4975,CVE-2015-1855,CVE-2015-3900,CVE-2015-7551,CVE-2016-2339
Sources used:
SUSE Linux Enterprise Software Development Kit 12-SP2 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Software Development Kit 12-SP1 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Server 12-SP2 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Server 12-SP1 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Desktop 12-SP2 (src):    ruby2.1-2.1.9-15.1
SUSE Linux Enterprise Desktop 12-SP1 (src):    ruby2.1-2.1.9-15.1
OpenStack Cloud Magnum Orchestration 7 (src):    ruby2.1-2.1.9-15.1
Comment 10 Swamp Workflow Management 2017-04-28 16:12:50 UTC
openSUSE-SU-2017:1128-1: An update that solves 5 vulnerabilities and has three fixes is now available.

Category: security (important)
Bug References: 1014863,1018808,887877,909695,926974,936032,959495,986630
CVE References: CVE-2014-4975,CVE-2015-1855,CVE-2015-3900,CVE-2015-7551,CVE-2016-2339
Sources used:
openSUSE Leap 42.2 (src):    ruby2.1-2.1.9-8.3.2
openSUSE Leap 42.1 (src):    ruby2.1-2.1.9-10.2
Comment 11 Marcus Meissner 2017-10-26 05:40:37 UTC
released