Vulnerabilities > CVE-2016-2339 - Improper Restriction of Operations within the Bounds of a Memory Buffer vulnerability in Ruby-Lang Ruby 2.2.2/2.3.0

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
ruby-lang
CWE-119
nessus

Summary

An exploitable heap overflow vulnerability exists in the Fiddle::Function.new "initialize" function functionality of Ruby. In Fiddle::Function.new "initialize" heap buffer "arg_types" allocation is made based on args array length. Specially constructed object passed as element of args array can increase this array size after mentioned allocation and cause heap overflow.

Vulnerable Configurations

Part Description Count
Application
Ruby-Lang
2

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Overflow Buffers
    Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an attacker. As a consequence, an attacker is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the attackers' choice.
  • Client-side Injection-induced Buffer Overflow
    This type of attack exploits a buffer overflow vulnerability in targeted client software through injection of malicious content from a custom-built hostile service.
  • Filter Failure through Buffer Overflow
    In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. the user input is let into the system unfiltered).
  • MIME Conversion
    An attacker exploits a weakness in the MIME conversion routine to cause a buffer overflow and gain control over the mail server machine. The MIME system is designed to allow various different information formats to be interpreted and sent via e-mail. Attack points exist when data are converted to MIME compatible format and back.

Nessus

  • NASL familySuSE Local Security Checks
    NASL idSUSE_SU-2017-1067-1.NASL
    descriptionThis ruby2.1 update to version 2.1.9 fixes the following issues: Security issues fixed : - CVE-2016-2339: heap overflow vulnerability in the Fiddle::Function.new
    last seen2020-06-01
    modified2020-06-02
    plugin id99578
    published2017-04-21
    reporterThis script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/99578
    titleSUSE SLED12 / SLES12 Security Update : ruby2.1 (SUSE-SU-2017:1067-1)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from SUSE update advisory SUSE-SU-2017:1067-1.
    # The text itself is copyright (C) SUSE.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(99578);
      script_version("3.7");
      script_cvs_date("Date: 2019/09/11 11:22:15");
    
      script_cve_id("CVE-2014-4975", "CVE-2015-1855", "CVE-2015-3900", "CVE-2015-7551", "CVE-2016-2339");
      script_bugtraq_id(68474, 74446, 75482);
    
      script_name(english:"SUSE SLED12 / SLES12 Security Update : ruby2.1 (SUSE-SU-2017:1067-1)");
      script_summary(english:"Checks rpm output for the updated packages.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote SUSE host is missing one or more security updates."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "This ruby2.1 update to version 2.1.9 fixes the following issues:
    Security issues fixed :
    
      - CVE-2016-2339: heap overflow vulnerability in the
        Fiddle::Function.new'initialize' (bsc#1018808)
    
      - CVE-2015-7551: Unsafe tainted string usage in Fiddle and
        DL (bsc#959495)
    
      - CVE-2015-3900: hostname validation does not work when
        fetching gems or making API requests (bsc#936032)
    
      - CVE-2015-1855: Ruby'a OpenSSL extension suffers a
        vulnerability through overly permissive matching of
        hostnames (bsc#926974)
    
      - CVE-2014-4975: off-by-one stack-based buffer overflow in
        the encodes() function (bsc#887877) Bugfixes :
    
      - SUSEconnect doesn't handle domain wildcards in no_proxy
        environment variable properly (bsc#1014863)
    
      - Segmentation fault after pack & ioctl & unpack
        (bsc#909695)
    
      - Ruby:HTTP Header injection in 'net/http' (bsc#986630)
        ChangeLog :
    
    - http://svn.ruby-lang.org/repos/ruby/tags/v2_1_9/ChangeLog
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the SUSE security advisory. Tenable
    has attempted to automatically clean and format it as much as possible
    without introducing additional issues."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"http://svn.ruby-lang.org/repos/ruby/tags/v2_1_9/ChangeLog"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=1014863"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=1018808"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=887877"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=909695"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=926974"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=936032"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=959495"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.suse.com/show_bug.cgi?id=986630"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.suse.com/security/cve/CVE-2014-4975/"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.suse.com/security/cve/CVE-2015-1855/"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.suse.com/security/cve/CVE-2015-3900/"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.suse.com/security/cve/CVE-2015-7551/"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://www.suse.com/security/cve/CVE-2016-2339/"
      );
      # https://www.suse.com/support/update/announcement/2017/suse-su-20171067-1/
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?b050ba23"
      );
      script_set_attribute(
        attribute:"solution", 
        value:
    "To install this SUSE Security Update use YaST online_update.
    Alternatively you can run the command listed for your product :
    
    SUSE Linux Enterprise Software Development Kit 12-SP2:zypper in -t
    patch SUSE-SLE-SDK-12-SP2-2017-624=1
    
    SUSE Linux Enterprise Software Development Kit 12-SP1:zypper in -t
    patch SUSE-SLE-SDK-12-SP1-2017-624=1
    
    SUSE Linux Enterprise Server for Raspberry Pi 12-SP2:zypper in -t
    patch SUSE-SLE-RPI-12-SP2-2017-624=1
    
    SUSE Linux Enterprise Server 12-SP2:zypper in -t patch
    SUSE-SLE-SERVER-12-SP2-2017-624=1
    
    SUSE Linux Enterprise Server 12-SP1:zypper in -t patch
    SUSE-SLE-SERVER-12-SP1-2017-624=1
    
    SUSE Linux Enterprise Desktop 12-SP2:zypper in -t patch
    SUSE-SLE-DESKTOP-12-SP2-2017-624=1
    
    SUSE Linux Enterprise Desktop 12-SP1:zypper in -t patch
    SUSE-SLE-DESKTOP-12-SP1-2017-624=1
    
    OpenStack Cloud Magnum Orchestration 7:zypper in -t patch
    SUSE-OpenStack-Cloud-Magnum-Orchestration-7-2017-624=1
    
    To bring your system up-to-date, use 'zypper patch'."
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"false");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:libruby2_1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:libruby2_1-2_1-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:ruby2.1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:ruby2.1-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:ruby2.1-debugsource");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:ruby2.1-stdlib");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:suse_linux:ruby2.1-stdlib-debuginfo");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:novell:suse_linux:12");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2014/11/15");
      script_set_attribute(attribute:"patch_publication_date", value:"2017/04/20");
      script_set_attribute(attribute:"plugin_publication_date", value:"2017/04/21");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"SuSE Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/cpu", "Host/SuSE/release", "Host/SuSE/rpm-list");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    release = get_kb_item("Host/SuSE/release");
    if (isnull(release) || release !~ "^(SLED|SLES)") audit(AUDIT_OS_NOT, "SUSE");
    os_ver = pregmatch(pattern: "^(SLE(S|D)\d+)", string:release);
    if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "SUSE");
    os_ver = os_ver[1];
    if (! preg(pattern:"^(SLED12|SLES12)$", string:os_ver)) audit(AUDIT_OS_NOT, "SUSE SLED12 / SLES12", "SUSE " + os_ver);
    
    if (!get_kb_item("Host/SuSE/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if (cpu !~ "^i[3-6]86$" && "x86_64" >!< cpu && "s390x" >!< cpu) audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "SUSE " + os_ver, cpu);
    
    sp = get_kb_item("Host/SuSE/patchlevel");
    if (isnull(sp)) sp = "0";
    if (os_ver == "SLES12" && (! preg(pattern:"^(1|2)$", string:sp))) audit(AUDIT_OS_NOT, "SLES12 SP1/2", os_ver + " SP" + sp);
    if (os_ver == "SLED12" && (! preg(pattern:"^(1|2)$", string:sp))) audit(AUDIT_OS_NOT, "SLED12 SP1/2", os_ver + " SP" + sp);
    
    
    flag = 0;
    if (rpm_check(release:"SLES12", sp:"1", reference:"libruby2_1-2_1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"libruby2_1-2_1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"ruby2.1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"ruby2.1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"ruby2.1-debugsource-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"ruby2.1-stdlib-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"1", reference:"ruby2.1-stdlib-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"libruby2_1-2_1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"libruby2_1-2_1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"ruby2.1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"ruby2.1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"ruby2.1-debugsource-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"ruby2.1-stdlib-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLES12", sp:"2", cpu:"x86_64", reference:"ruby2.1-stdlib-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"libruby2_1-2_1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"libruby2_1-2_1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"ruby2.1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"ruby2.1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"ruby2.1-debugsource-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"ruby2.1-stdlib-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"1", cpu:"x86_64", reference:"ruby2.1-stdlib-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"libruby2_1-2_1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"libruby2_1-2_1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"ruby2.1-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"ruby2.1-debuginfo-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"ruby2.1-debugsource-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"ruby2.1-stdlib-2.1.9-15.1")) flag++;
    if (rpm_check(release:"SLED12", sp:"2", cpu:"x86_64", reference:"ruby2.1-stdlib-debuginfo-2.1.9-15.1")) flag++;
    
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get());
      else security_hole(0);
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "ruby2.1");
    }
    
  • NASL familyPhotonOS Local Security Checks
    NASL idPHOTONOS_PHSA-2017-0002_RUBY.NASL
    descriptionAn update of the ruby package has been released.
    last seen2020-03-17
    modified2019-02-07
    plugin id121666
    published2019-02-07
    reporterThis script is Copyright (C) 2019-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/121666
    titlePhoton OS 1.0: Ruby PHSA-2017-0002
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    
    # The descriptive text and package checks in this plugin were
    # extracted from VMware Security Advisory PHSA-2017-0002. The text
    # itself is copyright (C) VMware, Inc.
    
    
    include('compat.inc');
    
    if (description)
    {
      script_id(121666);
      script_version("1.2");
      script_set_attribute(attribute:"plugin_modification_date", value:"2019/02/07");
    
      script_cve_id("CVE-2016-2339");
    
      script_name(english:"Photon OS 1.0: Ruby PHSA-2017-0002");
      script_summary(english:"Checks the rpm output for the updated packages.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote PhotonOS host is missing multiple security updates.");
      script_set_attribute(attribute:"description", value:
    "An update of the ruby package has been released.");
      script_set_attribute(attribute:"see_also", value:"https://github.com/vmware/photon/wiki/Security-Updates-18.md");
      script_set_attribute(attribute:"solution", value:
    "Update the affected Linux packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
      script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-2339");
    
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2017/01/23");
      script_set_attribute(attribute:"patch_publication_date", value:"2017/01/23");
      script_set_attribute(attribute:"plugin_publication_date", value:"2019/02/07");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:vmware:photonos:ruby");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:vmware:photonos:1.0");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"PhotonOS Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2019-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/PhotonOS/release", "Host/PhotonOS/rpm-list");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    
    release = get_kb_item("Host/PhotonOS/release");
    if (isnull(release) || release !~ "^VMware Photon") audit(AUDIT_OS_NOT, "PhotonOS");
    if (release !~ "^VMware Photon (?:Linux|OS) 1\.0(\D|$)") audit(AUDIT_OS_NOT, "PhotonOS 1.0");
    
    if (!get_kb_item("Host/PhotonOS/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "PhotonOS", cpu);
    
    flag = 0;
    
    if (rpm_check(release:"PhotonOS-1.0", reference:"ruby-2.4.0-1.ph1")) flag++;
    if (rpm_check(release:"PhotonOS-1.0", reference:"ruby-debuginfo-2.4.0-1.ph1")) flag++;
    
    if (flag)
    {
      security_report_v4(
        port       : 0,
        severity   : SECURITY_HOLE,
        extra      : rpm_report_get()
      );
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "ruby");
    }
    
  • NASL familyPhotonOS Local Security Checks
    NASL idPHOTONOS_PHSA-2017-0002.NASL
    descriptionAn update of [ruby] packages for PhotonOS has been released.
    last seen2019-02-08
    modified2019-02-07
    plugin id111851
    published2018-08-17
    reporterTenable
    sourcehttps://www.tenable.com/plugins/index.php?view=single&id=111851
    titlePhoton OS 1.0: Ruby PHSA-2017-0002 (deprecated)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # @DEPRECATED@
    #
    # Disabled on 2/7/2019
    #
    
    # The descriptive text and package checks in this plugin were
    # extracted from VMware Security Advisory PHSA-2017-0002. The text
    # itself is copyright (C) VMware, Inc.
    
    include("compat.inc");
    
    if (description)
    {
      script_id(111851);
      script_version("1.2");
      script_cvs_date("Date: 2019/02/07 18:59:50");
    
      script_cve_id("CVE-2016-2339");
    
      script_name(english:"Photon OS 1.0: Ruby PHSA-2017-0002 (deprecated)");
      script_summary(english:"Checks the rpm output for the updated packages.");
    
      script_set_attribute(attribute:"synopsis", value:
    "This plugin has been deprecated.");
      script_set_attribute(attribute:"description", value:
    "An update of [ruby] packages for PhotonOS has been released.");
      # https://github.com/vmware/photon/wiki/Security-Updates-18
      script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?a9d89ba7");
      script_set_attribute(attribute:"solution", value:"n/a.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-2339");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2017/01/23");
      script_set_attribute(attribute:"plugin_publication_date", value:"2018/08/17");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:vmware:photonos:ruby");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:vmware:photonos:1.0");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"PhotonOS Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/PhotonOS/release", "Host/PhotonOS/rpm-list");
    
      exit(0);
    }
    
    exit(0, "This plugin has been deprecated.");
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    
    release = get_kb_item("Host/PhotonOS/release");
    if (isnull(release) || release !~ "^VMware Photon") audit(AUDIT_OS_NOT, "PhotonOS");
    if (release !~ "^VMware Photon (?:Linux|OS) 1\.0(\D|$)") audit(AUDIT_OS_NOT, "PhotonOS 1.0");
    
    if (!get_kb_item("Host/PhotonOS/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "PhotonOS", cpu);
    
    flag = 0;
    
    pkgs = [
      "ruby-2.4.0-1.ph1",
      "ruby-debuginfo-2.4.0-1.ph1"
    ];
    
    foreach (pkg in pkgs)
      if (rpm_check(release:"PhotonOS-1.0", reference:pkg)) flag++;
    
    if (flag)
    {
      security_report_v4(
        port       : 0,
        severity   : SECURITY_HOLE,
        extra      : rpm_report_get()
      );
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "ruby");
    }
    
  • NASL familyUbuntu Local Security Checks
    NASL idUBUNTU_USN-3365-1.NASL
    descriptionIt was discovered that Ruby DL::dlopen incorrectly handled opening libraries. An attacker could possibly use this issue to open libraries with tainted names. This issue only applied to Ubuntu 14.04 LTS. (CVE-2009-5147) Tony Arcieri, Jeffrey Walton, and Steffan Ullrich discovered that the Ruby OpenSSL extension incorrectly handled hostname wildcard matching. This issue only applied to Ubuntu 14.04 LTS. (CVE-2015-1855) Christian Hofstaedtler discovered that Ruby Fiddle::Handle incorrectly handled certain crafted strings. An attacker could use this issue to cause a denial of service, or possibly execute arbitrary code. This issue only applied to Ubuntu 14.04 LTS. (CVE-2015-7551) It was discovered that Ruby Net::SMTP incorrectly handled CRLF sequences. A remote attacker could possibly use this issue to inject SMTP commands. (CVE-2015-9096) Marcin Noga discovered that Ruby incorrectly handled certain arguments in a TclTkIp class method. An attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 14.04 LTS. (CVE-2016-2337) It was discovered that Ruby Fiddle::Function.new incorrectly handled certain arguments. An attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 14.04 LTS. (CVE-2016-2339) It was discovered that Ruby incorrectly handled the initialization vector (IV) in GCM mode. An attacker could possibly use this issue to bypass encryption. (CVE-2016-7798). Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-01
    modified2020-06-02
    plugin id101974
    published2017-07-26
    reporterUbuntu Security Notice (C) 2017-2019 Canonical, Inc. / NASL script (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/101974
    titleUbuntu 14.04 LTS / 16.04 LTS / 17.04 : ruby1.9.1, ruby2.0, ruby2.3 vulnerabilities (USN-3365-1)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from Ubuntu Security Notice USN-3365-1. The text 
    # itself is copyright (C) Canonical, Inc. See 
    # <http://www.ubuntu.com/usn/>. Ubuntu(R) is a registered 
    # trademark of Canonical, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(101974);
      script_version("3.7");
      script_cvs_date("Date: 2019/09/18 12:31:47");
    
      script_cve_id("CVE-2009-5147", "CVE-2015-1855", "CVE-2015-7551", "CVE-2015-9096", "CVE-2016-2337", "CVE-2016-2339", "CVE-2016-7798");
      script_xref(name:"USN", value:"3365-1");
    
      script_name(english:"Ubuntu 14.04 LTS / 16.04 LTS / 17.04 : ruby1.9.1, ruby2.0, ruby2.3 vulnerabilities (USN-3365-1)");
      script_summary(english:"Checks dpkg output for updated packages.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:
    "The remote Ubuntu host is missing one or more security-related
    patches."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "It was discovered that Ruby DL::dlopen incorrectly handled opening
    libraries. An attacker could possibly use this issue to open libraries
    with tainted names. This issue only applied to Ubuntu 14.04 LTS.
    (CVE-2009-5147)
    
    Tony Arcieri, Jeffrey Walton, and Steffan Ullrich discovered that the
    Ruby OpenSSL extension incorrectly handled hostname wildcard matching.
    This issue only applied to Ubuntu 14.04 LTS. (CVE-2015-1855)
    
    Christian Hofstaedtler discovered that Ruby Fiddle::Handle incorrectly
    handled certain crafted strings. An attacker could use this issue to
    cause a denial of service, or possibly execute arbitrary code. This
    issue only applied to Ubuntu 14.04 LTS. (CVE-2015-7551)
    
    It was discovered that Ruby Net::SMTP incorrectly handled CRLF
    sequences. A remote attacker could possibly use this issue to inject
    SMTP commands. (CVE-2015-9096)
    
    Marcin Noga discovered that Ruby incorrectly handled certain arguments
    in a TclTkIp class method. An attacker could possibly use this issue
    to execute arbitrary code. This issue only affected Ubuntu 14.04 LTS.
    (CVE-2016-2337)
    
    It was discovered that Ruby Fiddle::Function.new incorrectly handled
    certain arguments. An attacker could possibly use this issue to
    execute arbitrary code. This issue only affected Ubuntu 14.04 LTS.
    (CVE-2016-2339)
    
    It was discovered that Ruby incorrectly handled the initialization
    vector (IV) in GCM mode. An attacker could possibly use this issue to
    bypass encryption. (CVE-2016-7798).
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the Ubuntu security advisory. Tenable
    has attempted to automatically clean and format it as much as possible
    without introducing additional issues."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://usn.ubuntu.com/3365-1/"
      );
      script_set_attribute(attribute:"solution", value:"Update the affected packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"false");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libruby1.9.1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libruby2.0");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:libruby2.3");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:ruby1.9.1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:ruby2.0");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:canonical:ubuntu_linux:ruby2.3");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:14.04");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:16.04");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:canonical:ubuntu_linux:17.04");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/03/24");
      script_set_attribute(attribute:"patch_publication_date", value:"2017/07/25");
      script_set_attribute(attribute:"plugin_publication_date", value:"2017/07/26");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"Ubuntu Security Notice (C) 2017-2019 Canonical, Inc. / NASL script (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Ubuntu Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/cpu", "Host/Ubuntu", "Host/Ubuntu/release", "Host/Debian/dpkg-l");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("ubuntu.inc");
    include("misc_func.inc");
    
    if ( ! get_kb_item("Host/local_checks_enabled") ) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    release = get_kb_item("Host/Ubuntu/release");
    if ( isnull(release) ) audit(AUDIT_OS_NOT, "Ubuntu");
    release = chomp(release);
    if (! preg(pattern:"^(14\.04|16\.04|17\.04)$", string:release)) audit(AUDIT_OS_NOT, "Ubuntu 14.04 / 16.04 / 17.04", "Ubuntu " + release);
    if ( ! get_kb_item("Host/Debian/dpkg-l") ) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "Ubuntu", cpu);
    
    flag = 0;
    
    if (ubuntu_check(osver:"14.04", pkgname:"libruby1.9.1", pkgver:"1.9.3.484-2ubuntu1.3")) flag++;
    if (ubuntu_check(osver:"14.04", pkgname:"libruby2.0", pkgver:"2.0.0.484-1ubuntu2.4")) flag++;
    if (ubuntu_check(osver:"14.04", pkgname:"ruby1.9.1", pkgver:"1.9.3.484-2ubuntu1.3")) flag++;
    if (ubuntu_check(osver:"14.04", pkgname:"ruby2.0", pkgver:"2.0.0.484-1ubuntu2.4")) flag++;
    if (ubuntu_check(osver:"16.04", pkgname:"libruby2.3", pkgver:"2.3.1-2~16.04.2")) flag++;
    if (ubuntu_check(osver:"16.04", pkgname:"ruby2.3", pkgver:"2.3.1-2~16.04.2")) flag++;
    if (ubuntu_check(osver:"17.04", pkgname:"libruby2.3", pkgver:"2.3.3-1ubuntu0.1")) flag++;
    if (ubuntu_check(osver:"17.04", pkgname:"ruby2.3", pkgver:"2.3.3-1ubuntu0.1")) flag++;
    
    if (flag)
    {
      security_report_v4(
        port       : 0,
        severity   : SECURITY_HOLE,
        extra      : ubuntu_report_get()
      );
      exit(0);
    }
    else
    {
      tested = ubuntu_pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "libruby1.9.1 / libruby2.0 / libruby2.3 / ruby1.9.1 / ruby2.0 / etc");
    }
    
  • NASL familyHuawei Local Security Checks
    NASL idEULEROS_SA-2017-1050.NASL
    descriptionAccording to the versions of the ruby packages installed, the EulerOS installation on the remote host is affected by the following vulnerabilities : - An exploitable heap overflow vulnerability exists in the Fiddle::Function.new
    last seen2020-05-06
    modified2017-05-01
    plugin id99895
    published2017-05-01
    reporterThis script is Copyright (C) 2017-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/99895
    titleEulerOS 2.0 SP1 : ruby (EulerOS-SA-2017-1050)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(99895);
      script_version("1.15");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/05/04");
    
      script_cve_id(
        "CVE-2015-3900",
        "CVE-2016-2337",
        "CVE-2016-2339"
      );
      script_bugtraq_id(
        75482
      );
    
      script_name(english:"EulerOS 2.0 SP1 : ruby (EulerOS-SA-2017-1050)");
      script_summary(english:"Checks the rpm output for the updated packages.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote EulerOS host is missing multiple security updates.");
      script_set_attribute(attribute:"description", value:
    "According to the versions of the ruby packages installed, the EulerOS
    installation on the remote host is affected by the following
    vulnerabilities :
    
      - An exploitable heap overflow vulnerability exists in
        the Fiddle::Function.new 'initialize' function
        functionality of Ruby. In Fiddle::Function.new
        'initialize' heap buffer 'arg_types' allocation is made
        based on args array length. Specially constructed
        object passed as element of args array can increase
        this array size after mentioned allocation and cause
        heap overflow.(CVE-2016-2339)
    
      - Type confusion exists in _cancel_eval Ruby's TclTkIp
        class method. Attacker passing different type of object
        than String as 'retval' argument can cause arbitrary
        code execution.(CVE-2016-2337)
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the EulerOS security advisory. Tenable
    has attempted to automatically clean and format it as much as possible
    without introducing additional issues.");
      # https://developer.huaweicloud.com/ict/en/site-euleros/euleros/security-advisories/EulerOS-SA-2017-1050
      script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?b233fe7d");
      script_set_attribute(attribute:"solution", value:
    "Update the affected ruby packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss_temporal_vector("CVSS2#E:ND/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"false");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2017/03/14");
      script_set_attribute(attribute:"plugin_publication_date", value:"2017/05/01");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby-irb");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby-libs");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-bigdecimal");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-io-console");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-json");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-psych");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-rdoc");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygems");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:huawei:euleros:2.0");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"Huawei Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2017-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/EulerOS/release", "Host/EulerOS/rpm-list", "Host/EulerOS/sp");
      script_exclude_keys("Host/EulerOS/uvp_version");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    
    release = get_kb_item("Host/EulerOS/release");
    if (isnull(release) || release !~ "^EulerOS") audit(AUDIT_OS_NOT, "EulerOS");
    if (release !~ "^EulerOS release 2\.0(\D|$)") audit(AUDIT_OS_NOT, "EulerOS 2.0");
    
    sp = get_kb_item("Host/EulerOS/sp");
    if (isnull(sp) || sp !~ "^(1)$") audit(AUDIT_OS_NOT, "EulerOS 2.0 SP1");
    
    uvp = get_kb_item("Host/EulerOS/uvp_version");
    if (!empty_or_null(uvp)) audit(AUDIT_OS_NOT, "EulerOS 2.0 SP1", "EulerOS UVP " + uvp);
    
    if (!get_kb_item("Host/EulerOS/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$" && "aarch64" >!< cpu) audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "EulerOS", cpu);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_ARCH_NOT, "i686 / x86_64", cpu);
    
    flag = 0;
    
    pkgs = ["ruby-2.0.0.353-23.h4",
            "ruby-irb-2.0.0.353-23.h4",
            "ruby-libs-2.0.0.353-23.h4",
            "rubygem-bigdecimal-1.2.0-23.h4",
            "rubygem-io-console-0.4.2-23.h4",
            "rubygem-json-1.7.7-23.h4",
            "rubygem-psych-2.0.0-23.h4",
            "rubygem-rdoc-4.0.0-23.h4",
            "rubygems-2.0.14-23.h4"];
    
    foreach (pkg in pkgs)
      if (rpm_check(release:"EulerOS-2.0", sp:"1", reference:pkg)) flag++;
    
    if (flag)
    {
      security_report_v4(
        port       : 0,
        severity   : SECURITY_HOLE,
        extra      : rpm_report_get()
      );
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "ruby");
    }
    
  • NASL familyHuawei Local Security Checks
    NASL idEULEROS_SA-2017-1051.NASL
    descriptionAccording to the versions of the ruby packages installed, the EulerOS installation on the remote host is affected by the following vulnerabilities : - An exploitable heap overflow vulnerability exists in the Fiddle::Function.new
    last seen2020-05-06
    modified2017-05-01
    plugin id99896
    published2017-05-01
    reporterThis script is Copyright (C) 2017-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/99896
    titleEulerOS 2.0 SP2 : ruby (EulerOS-SA-2017-1051)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(99896);
      script_version("1.15");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/05/04");
    
      script_cve_id(
        "CVE-2015-3900",
        "CVE-2016-2337",
        "CVE-2016-2339"
      );
      script_bugtraq_id(
        75482
      );
    
      script_name(english:"EulerOS 2.0 SP2 : ruby (EulerOS-SA-2017-1051)");
      script_summary(english:"Checks the rpm output for the updated packages.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote EulerOS host is missing multiple security updates.");
      script_set_attribute(attribute:"description", value:
    "According to the versions of the ruby packages installed, the EulerOS
    installation on the remote host is affected by the following
    vulnerabilities :
    
      - An exploitable heap overflow vulnerability exists in
        the Fiddle::Function.new 'initialize' function
        functionality of Ruby. In Fiddle::Function.new
        'initialize' heap buffer 'arg_types' allocation is made
        based on args array length. Specially constructed
        object passed as element of args array can increase
        this array size after mentioned allocation and cause
        heap overflow.(CVE-2016-2339)
    
      - Type confusion exists in _cancel_eval Ruby's TclTkIp
        class method. Attacker passing different type of object
        than String as 'retval' argument can cause arbitrary
        code execution.(CVE-2016-2337)
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the EulerOS security advisory. Tenable
    has attempted to automatically clean and format it as much as possible
    without introducing additional issues.");
      # https://developer.huaweicloud.com/ict/en/site-euleros/euleros/security-advisories/EulerOS-SA-2017-1051
      script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?d7ccee39");
      script_set_attribute(attribute:"solution", value:
    "Update the affected ruby packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss_temporal_vector("CVSS2#E:ND/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"false");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2017/03/14");
      script_set_attribute(attribute:"plugin_publication_date", value:"2017/05/01");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby-irb");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:ruby-libs");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-bigdecimal");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-io-console");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-json");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-psych");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygem-rdoc");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:huawei:euleros:rubygems");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:huawei:euleros:2.0");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"Huawei Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2017-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/EulerOS/release", "Host/EulerOS/rpm-list", "Host/EulerOS/sp");
      script_exclude_keys("Host/EulerOS/uvp_version");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    
    release = get_kb_item("Host/EulerOS/release");
    if (isnull(release) || release !~ "^EulerOS") audit(AUDIT_OS_NOT, "EulerOS");
    if (release !~ "^EulerOS release 2\.0(\D|$)") audit(AUDIT_OS_NOT, "EulerOS 2.0");
    
    sp = get_kb_item("Host/EulerOS/sp");
    if (isnull(sp) || sp !~ "^(2)$") audit(AUDIT_OS_NOT, "EulerOS 2.0 SP2");
    
    uvp = get_kb_item("Host/EulerOS/uvp_version");
    if (!empty_or_null(uvp)) audit(AUDIT_OS_NOT, "EulerOS 2.0 SP2", "EulerOS UVP " + uvp);
    
    if (!get_kb_item("Host/EulerOS/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    cpu = get_kb_item("Host/cpu");
    if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$" && "aarch64" >!< cpu) audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "EulerOS", cpu);
    if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_ARCH_NOT, "i686 / x86_64", cpu);
    
    flag = 0;
    
    pkgs = ["ruby-2.0.0.598-25.h3",
            "ruby-irb-2.0.0.598-25.h3",
            "ruby-libs-2.0.0.598-25.h3",
            "rubygem-bigdecimal-1.2.0-25.h3",
            "rubygem-io-console-0.4.2-25.h3",
            "rubygem-json-1.7.7-25.h3",
            "rubygem-psych-2.0.0-25.h3",
            "rubygem-rdoc-4.0.0-25.h3",
            "rubygems-2.0.14-25.h3"];
    
    foreach (pkg in pkgs)
      if (rpm_check(release:"EulerOS-2.0", sp:"2", reference:pkg)) flag++;
    
    if (flag)
    {
      security_report_v4(
        port       : 0,
        severity   : SECURITY_HOLE,
        extra      : rpm_report_get()
      );
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "ruby");
    }
    
  • NASL familySuSE Local Security Checks
    NASL idOPENSUSE-2017-435.NASL
    descriptionThis update for ruby2.2, ruby2.3 fixes the following issues : Security issues fixed : - CVE-2016-2339: heap overflow vulnerability in the Fiddle::Function.new
    last seen2020-06-05
    modified2017-04-06
    plugin id99208
    published2017-04-06
    reporterThis script is Copyright (C) 2017-2020 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/99208
    titleopenSUSE Security Update : ruby2.2 / ruby2.3 (openSUSE-2017-435)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from openSUSE Security Update openSUSE-2017-435.
    #
    # The text description of this plugin is (C) SUSE LLC.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(99208);
      script_version("3.3");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/04");
    
      script_cve_id("CVE-2015-7551", "CVE-2016-2339");
    
      script_name(english:"openSUSE Security Update : ruby2.2 / ruby2.3 (openSUSE-2017-435)");
      script_summary(english:"Check for the openSUSE-2017-435 patch");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote openSUSE host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "This update for ruby2.2, ruby2.3 fixes the following issues :
    
    Security issues fixed :
    
      - CVE-2016-2339: heap overflow vulnerability in the
        Fiddle::Function.new'initialize' (boo#1018808)
    
      - CVE-2015-7551: Unsafe tainted string usage in Fiddle and
        DL (boo#959495)
    
    Detailed ChangeLog :
    
    - http://svn.ruby-lang.org/repos/ruby/tags/v2_2_6/ChangeLog
    
    - http://svn.ruby-lang.org/repos/ruby/tags/v2_3_3/ChangeLog"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"http://svn.ruby-lang.org/repos/ruby/tags/v2_2_6/ChangeLog"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"http://svn.ruby-lang.org/repos/ruby/tags/v2_3_3/ChangeLog"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.opensuse.org/show_bug.cgi?id=1018808"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.opensuse.org/show_bug.cgi?id=959495"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Update the affected ruby2.2 / ruby2.3 packages."
      );
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libruby2_2-2_2");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libruby2_2-2_2-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libruby2_3-2_3");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libruby2_3-2_3-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-debugsource");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-devel");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-devel-extra");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-doc-ri");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-stdlib");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-stdlib-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-tk");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.2-tk-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-debugsource");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-devel");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-devel-extra");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-doc-ri");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-stdlib");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-stdlib-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-tk");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:ruby2.3-tk-debuginfo");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:novell:opensuse:42.1");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:novell:opensuse:42.2");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2017/04/05");
      script_set_attribute(attribute:"plugin_publication_date", value:"2017/04/06");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2017-2020 Tenable Network Security, Inc.");
      script_family(english:"SuSE Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/SuSE/release", "Host/SuSE/rpm-list", "Host/cpu");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("global_settings.inc");
    include("rpm.inc");
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    release = get_kb_item("Host/SuSE/release");
    if (isnull(release) || release =~ "^(SLED|SLES)") audit(AUDIT_OS_NOT, "openSUSE");
    if (release !~ "^(SUSE42\.1|SUSE42\.2)$") audit(AUDIT_OS_RELEASE_NOT, "openSUSE", "42.1 / 42.2", release);
    if (!get_kb_item("Host/SuSE/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    ourarch = get_kb_item("Host/cpu");
    if (!ourarch) audit(AUDIT_UNKNOWN_ARCH);
    if (ourarch !~ "^(i586|i686|x86_64)$") audit(AUDIT_ARCH_NOT, "i586 / i686 / x86_64", ourarch);
    
    flag = 0;
    
    if ( rpm_check(release:"SUSE42.1", reference:"libruby2_2-2_2-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"libruby2_2-2_2-debuginfo-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-debuginfo-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-debugsource-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-devel-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-devel-extra-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-doc-ri-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-stdlib-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-stdlib-debuginfo-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-tk-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"ruby2.2-tk-debuginfo-2.2.6-6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"libruby2_2-2_2-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"libruby2_2-2_2-debuginfo-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"libruby2_3-2_3-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"libruby2_3-2_3-debuginfo-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-debuginfo-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-debugsource-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-devel-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-devel-extra-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-doc-ri-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-stdlib-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-stdlib-debuginfo-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-tk-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.2-tk-debuginfo-2.2.6-6.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-debuginfo-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-debugsource-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-devel-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-devel-extra-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-doc-ri-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-stdlib-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-stdlib-debuginfo-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-tk-2.3.3-2.3.1") ) flag++;
    if ( rpm_check(release:"SUSE42.2", reference:"ruby2.3-tk-debuginfo-2.3.3-2.3.1") ) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get());
      else security_hole(0);
      exit(0);
    }
    else
    {
      tested = pkg_tests_get();
      if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
      else audit(AUDIT_PACKAGE_NOT_INSTALLED, "libruby2_2-2_2 / libruby2_2-2_2-debuginfo / ruby2.2 / etc");
    }
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DLA-1421.NASL
    descriptionMultiple vulnerabilities were found in the interpreter for the Ruby language. The Common Vulnerabilities and Exposures project identifies the following issues : CVE-2015-9096 SMTP command injection in Net::SMTP via CRLF sequences in a RCPT TO or MAIL FROM command. CVE-2016-2339 Exploitable heap overflow in Fiddle::Function.new. CVE-2016-7798 Incorrect handling of initialization vector in the GCM mode in the OpenSSL extension. CVE-2017-0898 Buffer underrun vulnerability in Kernel.sprintf. CVE-2017-0899 ANSI escape sequence vulnerability in RubyGems. CVE-2017-0900 DoS vulnerability in the RubyGems query command. CVE-2017-0901 gem installer allowed a malicious gem to overwrite arbitrary files. CVE-2017-0902 RubyGems DNS request hijacking vulnerability. CVE-2017-0903 Max Justicz reported that RubyGems is prone to an unsafe object deserialization vulnerability. When parsed by an application which processes gems, a specially crafted YAML formatted gem specification can lead to remote code execution. CVE-2017-10784 Yusuke Endoh discovered an escape sequence injection vulnerability in the Basic authentication of WEBrick. An attacker can take advantage of this flaw to inject malicious escape sequences to the WEBrick log and potentially execute control characters on the victim
    last seen2020-06-01
    modified2020-06-02
    plugin id111081
    published2018-07-16
    reporterThis script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/111081
    titleDebian DLA-1421-1 : ruby2.1 security update
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from Debian Security Advisory DLA-1421-1. The text
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(111081);
      script_version("1.4");
      script_cvs_date("Date: 2019/07/15 14:20:30");
    
      script_cve_id("CVE-2015-9096", "CVE-2016-2339", "CVE-2016-7798", "CVE-2017-0898", "CVE-2017-0899", "CVE-2017-0900", "CVE-2017-0901", "CVE-2017-0902", "CVE-2017-0903", "CVE-2017-10784", "CVE-2017-14033", "CVE-2017-14064", "CVE-2017-17405", "CVE-2017-17742", "CVE-2017-17790", "CVE-2018-1000075", "CVE-2018-1000076", "CVE-2018-1000077", "CVE-2018-1000078", "CVE-2018-1000079", "CVE-2018-6914", "CVE-2018-8777", "CVE-2018-8778", "CVE-2018-8779", "CVE-2018-8780");
    
      script_name(english:"Debian DLA-1421-1 : ruby2.1 security update");
      script_summary(english:"Checks dpkg output for the updated packages.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Debian host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "Multiple vulnerabilities were found in the interpreter for the Ruby
    language. The Common Vulnerabilities and Exposures project identifies
    the following issues :
    
    CVE-2015-9096
    
    SMTP command injection in Net::SMTP via CRLF sequences in a RCPT TO or
    MAIL FROM command.
    
    CVE-2016-2339
    
    Exploitable heap overflow in Fiddle::Function.new.
    
    CVE-2016-7798
    
    Incorrect handling of initialization vector in the GCM mode in the
    OpenSSL extension.
    
    CVE-2017-0898
    
    Buffer underrun vulnerability in Kernel.sprintf.
    
    CVE-2017-0899
    
    ANSI escape sequence vulnerability in RubyGems.
    
    CVE-2017-0900
    
    DoS vulnerability in the RubyGems query command.
    
    CVE-2017-0901
    
    gem installer allowed a malicious gem to overwrite arbitrary files.
    
    CVE-2017-0902
    
    RubyGems DNS request hijacking vulnerability.
    
    CVE-2017-0903
    
    Max Justicz reported that RubyGems is prone to an unsafe object
    deserialization vulnerability. When parsed by an application which
    processes gems, a specially crafted YAML formatted gem specification
    can lead to remote code execution.
    
    CVE-2017-10784
    
    Yusuke Endoh discovered an escape sequence injection vulnerability in
    the Basic authentication of WEBrick. An attacker can take advantage of
    this flaw to inject malicious escape sequences to the WEBrick log and
    potentially execute control characters on the victim's terminal
    emulator when reading logs.
    
    CVE-2017-14033
    
    asac reported a buffer underrun vulnerability in the OpenSSL
    extension. A remote attacker could take advantage of this flaw to
    cause the Ruby interpreter to crash leading to a denial of service.
    
    CVE-2017-14064
    
    Heap memory disclosure in the JSON library.
    
    CVE-2017-17405
    
    A command injection vulnerability in Net::FTP might allow a malicious
    FTP server to execute arbitrary commands.
    
    CVE-2017-17742
    
    Aaron Patterson reported that WEBrick bundled with Ruby was vulnerable
    to an HTTP response splitting vulnerability. It was possible for an
    attacker to inject fake HTTP responses if a script accepted an
    external input and output it without modifications.
    
    CVE-2017-17790
    
    A command injection vulnerability in lib/resolv.rb's lazy_initialze
    might allow a command injection attack. However untrusted input to
    this function is rather unlikely.
    
    CVE-2018-6914
    
    ooooooo_q discovered a directory traversal vulnerability in the
    Dir.mktmpdir method in the tmpdir library. It made it possible for
    attackers to create arbitrary directories or files via a .. (dot dot)
    in the prefix argument.
    
    CVE-2018-8777
    
    Eric Wong reported an out-of-memory DoS vulnerability related to a
    large request in WEBrick bundled with Ruby.
    
    CVE-2018-8778
    
    aerodudrizzt found a buffer under-read vulnerability in the Ruby
    String#unpack method. If a big number was passed with the specifier @,
    the number was treated as a negative value, and an out-of-buffer read
    occurred. Attackers could read data on heaps if an script accepts an
    external input as the argument of String#unpack.
    
    CVE-2018-8779
    
    ooooooo_q reported that the UNIXServer.open and UNIXSocket.open
    methods of the socket library bundled with Ruby did not check for NUL
    bytes in the path argument. The lack of check made the methods
    vulnerable to unintentional socket creation and unintentional socket
    access.
    
    CVE-2018-8780
    
    ooooooo_q discovered an unintentional directory traversal in some
    methods in Dir, by the lack of checking for NUL bytes in their
    parameter.
    
    CVE-2018-1000075
    
    A negative size vulnerability in ruby gem package tar header that
    could cause an infinite loop.
    
    CVE-2018-1000076
    
    RubyGems package improperly verifies cryptographic signatures. A
    mis-signed gem could be installed if the tarball contains multiple gem
    signatures.
    
    CVE-2018-1000077
    
    An improper input validation vulnerability in RubyGems specification
    homepage attribute could allow malicious gem to set an invalid
    homepage URL.
    
    CVE-2018-1000078
    
    Cross Site Scripting (XSS) vulnerability in gem server display of
    homepage attribute.
    
    CVE-2018-1000079
    
    Path Traversal vulnerability during gem installation.
    
    For Debian 8 'Jessie', these problems have been fixed in version
    2.1.5-2+deb8u4.
    
    We recommend that you upgrade your ruby2.1 packages.
    
    NOTE: Tenable Network Security has extracted the preceding description
    block directly from the DLA security advisory. Tenable has attempted
    to automatically clean and format it as much as possible without
    introducing additional issues."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://lists.debian.org/debian-lts-announce/2018/07/msg00012.html"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://packages.debian.org/source/jessie/ruby2.1"
      );
      script_set_attribute(attribute:"solution", value:"Upgrade the affected packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:C/I:C/A:C");
      script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C");
      script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
      script_set_cvss3_temporal_vector("CVSS:3.0/E:P/RL:O/RC:C");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:libruby2.1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:ruby2.1");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:ruby2.1-dev");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:ruby2.1-doc");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:ruby2.1-tcltk");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:8.0");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2017/01/06");
      script_set_attribute(attribute:"patch_publication_date", value:"2018/07/14");
      script_set_attribute(attribute:"plugin_publication_date", value:"2018/07/16");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Debian Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/Debian/release", "Host/Debian/dpkg-l");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("debian_package.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/Debian/release")) audit(AUDIT_OS_NOT, "Debian");
    if (!get_kb_item("Host/Debian/dpkg-l")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    if (deb_check(release:"8.0", prefix:"libruby2.1", reference:"2.1.5-2+deb8u4")) flag++;
    if (deb_check(release:"8.0", prefix:"ruby2.1", reference:"2.1.5-2+deb8u4")) flag++;
    if (deb_check(release:"8.0", prefix:"ruby2.1-dev", reference:"2.1.5-2+deb8u4")) flag++;
    if (deb_check(release:"8.0", prefix:"ruby2.1-doc", reference:"2.1.5-2+deb8u4")) flag++;
    if (deb_check(release:"8.0", prefix:"ruby2.1-tcltk", reference:"2.1.5-2+deb8u4")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:deb_report_get());
      else security_hole(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    
  • NASL familySuSE Local Security Checks
    NASL idOPENSUSE-2017-527.NASL
    descriptionThis ruby2.1 update to version 2.1.9 fixes the following issues : Security issues fixed : - CVE-2016-2339: heap overflow vulnerability in the Fiddle::Function.new
    last seen2020-06-05
    modified2017-05-01
    plugin id99753
    published2017-05-01
    reporterThis script is Copyright (C) 2017-2020 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/99753
    titleopenSUSE Security Update : ruby2.1 (openSUSE-2017-527)

Seebug

bulletinFamilyexploit
description### DESCRIPTION An exploitable heap overflow vulnerability exists in the Fiddle::Function.new "initialize" function functionality of Ruby. In Fiddle::Function.new "initialize" heap buffer "arg_types" allocation is made based on args array length. Specially constructed object passed as element of args array can increase this array size after mentioned allocation and cause heap overflow. ### TESTED VERSIONS Ruby 2.3.0 dev Ruby 2.2.2 ### PRODUCT URLs https://www.ruby-lang.org ### DETAILS ``` Line 86 static VALUE Line 87 initialize(int argc, VALUE argv[], VALUE self) Line 88 { Line 89 ffi_cif * cif; Line 90 ffi_type **arg_types; Line 91 ffi_status result; Line 92 VALUE ptr, args, ret_type, abi, kwds; Line 93 int i; Line 94 Line 95 rb_scan_args(argc, argv, "31:", &ptr, &args, &ret_type, &abi, &kwds); Line 96 if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI); Line 97 Line 98 Check_Type(args, T_ARRAY); Line 99 Check_Max_Args("args", RARRAY_LENINT(args)); (...) Line 110 arg_types = xcalloc(RARRAY_LEN(args) + 1, sizeof(ffi_type *)); Line 111 Line 112 for (i = 0; i < RARRAY_LEN(args); i++) { Line 113 int type = NUM2INT(RARRAY_PTR(args)[i]); Line 114 arg_types[i] = INT2FFI_TYPE(type); Line 115 } Line 116 arg_types[RARRAY_LEN(args)] = NULL; ``` In Line 110 based on length of passed by user args array, xcalloc allocates buffer for ffitype structures. Later in for loop we see that each element from this array is first converted to int and later to ffitype structure. Results of this conversions are stored in previous allocated array "arg_types". ``` Exploiting knowledge that in Line 113 NUM2INT for non Integer object will call "to_int" method we can create properly constructed object which will ``` implement this method and it's responsible will be to increase size of args array. Increased size of args array inside for loop just after space allocation for argtypes will cause during next iteration heap overflow in Line 114 and later in Line 116 during storing another ffitype structures. ### CRASH ANALYSIS ``` (15dc.16b8): Break instruction exception - code 80000003 (first chance) eax=00000000 ebx=00000000 ecx=bf8d0000 edx=0008e3c8 esi=fffffffe edi=00000000 eip=77b612fb esp=0028fb08 ebp=0028fb34 iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 ntdll!LdrpDoDebuggerBreak+0x2c: 77b612fb cc int 3 0:000> bu fiddle!Init_fiddle 0:000> g ModLoad: 75dc0000 75e20000 C:\Windows\SysWOW64\IMM32.DLL ModLoad: 75ce0000 75dac000 C:\Windows\syswow64\MSCTF.dll ModLoad: 72b10000 72b3b000 C:\Windows\SysWOW64\nvinit.dll ModLoad: 72b00000 72b09000 C:\Windows\SysWOW64\VERSION.dll ModLoad: 0f000000 0f006000 C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\detoured.dll ModLoad: 6e480000 6e4a9000 C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll ModLoad: 76740000 768dd000 C:\Windows\syswow64\SETUPAPI.dll ModLoad: 765a0000 765c7000 C:\Windows\syswow64\CFGMGR32.dll ModLoad: 762c0000 7634f000 C:\Windows\syswow64\OLEAUT32.dll ModLoad: 76440000 7659c000 C:\Windows\syswow64\ole32.dll ModLoad: 75490000 754a2000 C:\Windows\syswow64\DEVOBJ.dll ModLoad: 6e460000 6e47e000 C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll ModLoad: 72a90000 72aa7000 C:\Windows\SysWOW64\CRYPTSP.dll ModLoad: 72a50000 72a8b000 C:\Windows\SysWOW64\rsaenh.dll ModLoad: 71280000 7128c000 C:\Ruby22\lib\ruby\2.2.0\i386-mingw32\enc\encdb.so ModLoad: 6dd40000 6dd4c000 C:\Ruby22\lib\ruby\2.2.0\i386- mingw32\enc\trans\transdb.so ModLoad: 6fbc0000 6fbcb000 C:\Ruby22\lib\ruby\2.2.0\i386-mingw32\enc\iso_8859_2.so ModLoad: 70b40000 70b4c000 C:\Ruby22\lib\ruby\2.2.0\i386-mingw32\thread.so *** ERROR: Symbol file could not be found. Defaulted to export symbols for C: \Ruby22\lib\ruby\2.2.0\i386-mingw32\fiddle.so - ModLoad: 70a40000 70a50000 C:\Ruby22\lib\ruby\2.2.0\i386-mingw32\fiddle.so ModLoad: 6b740000 6b76a000 C:\Ruby22\bin\libffi-6.dll Breakpoint 0 hit *** ERROR: Symbol file could not be found. Defaulted to export symbols for C: \Ruby22\bin\msvcrt-ruby220.dll - eax=70a42270 ebx=70a4b068 ecx=70a40000 edx=70a40000 esi=70a4b4ed edi=64105061 eip=70a42270 esp=0028ee5c ebp=0028f2d8 iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 fiddle!Init_fiddle: 70a42270 55 push ebp 0:000> bp 70A42ADD ".printf \" xcalloc( 0x%x )\",edx;.echo;g " 0:000> bp 70A42AE2 ".printf \"arg_types addr : 0x%x\",eax;.echo" 0:000> g Start args array size : 1 xcalloc( 0x2 ) arg_types addr : 0x2b81b50 eax=02b81b50 ebx=00000000 ecx=75e2f489 edx=00000018 esi=00000003 edi=0035003c eip=70a42ae2 esp=0028f7a0 ebp=0028f808 iopl=0 nv up ei pl nz na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000206 fiddle!Init_fiddle+0x872: 70a42ae2 89c7 mov edi,eax 0:000> !heap -p -a 0x2b81b50 address 02b81b50 found in _HEAP @ 510000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - state 02b81b48 0004 0000 [00] 02b81b50 00008 - (busy) 0:000> !heap -p -a 02b81b48+20 address 02b81b68 found in _HEAP @ 510000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - state 02b81b68 0290 0000 [00] 02b81b70 01478 - (free) 0:000> dd 02b81b48+20 02b81b68 fad1ca73 000ae511 005100c4 00514668 02b81b78 feeefeee feeefeee feeefeee feeefeee 02b81b88 feeefeee feeefeee feeefeee feeefeee 02b81b98 feeefeee feeefeee feeefeee feeefeee 02b81ba8 feeefeee feeefeee feeefeee feeefeee 02b81bb8 feeefeee feeefeee feeefeee feeefeee 02b81bc8 feeefeee feeefeee feeefeee feeefeee 02b81bd8 feeefeee feeefeee feeefeee feeefeee 0:000> g increase size of array New args array size is : 11 HEAP[ruby.exe]: Heap block at 02B81B48 modified at 02B81B58 past requested size of 8 (15dc.16b8): Break instruction exception - code 80000003 (first chance) eax=02b81b48 ebx=02b81b58 ecx=77b2f861 edx=0028f969 esi=02b81b48 edi=00000008 eip=77b9087c esp=0028fbb0 ebp=0028fbb0 iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 ntdll!RtlpBreakPointHeap+0x23: 77b9087c cc int 3 0:000> !heap -p -a 02b81b48+20 address 02b81b68 found in _HEAP @ 510000 HEAP_ENTRY Size Prev Flags UserPtr UserSize - state 02b81b68 b8ab 0000 [00] 02b81b70 4c66a - (busy) *** ERROR: Symbol file could not be found. Defaulted to export symbols for C: \Ruby22\bin\libffi-6.dll - libffi_6!ffi_type_pointer 0:000> !heap -x 02b81b48+20 ERROR: Block 02b81b68 previous size 955d does not match previous block size 4 HEAP 00510000 (Seg 02af0000) At 02b81b68 Error: invalid block Previous 0:000> dd 02b81b48+20 02b81b68 6b747048 6b747048 6b747048 6b747048 02b81b78 6b747048 00000000 00000003 00000003 02b81b88 00000003 00000003 00000003 00000003 02b81b98 00000003 baadf00d baadf00d baadf00d 02b81ba8 baadf00d baadf00d baadf00d baadf00d 02b81bb8 baadf00d baadf00d abababab abababab 02b81bc8 00000000 00000000 66d2c8ee 180ae518 02b81bd8 02b6c4d0 02b6c4d0 02b6c4d0 02b6c4d0 0:000> g HEAP[ruby.exe]: Invalid address specified to RtlSizeHeap( 00510000, 02B81B50 ) (15dc.16b8): Break instruction exception - code 80000003 (first chance) eax=02b81b48 ebx=02b81b48 ecx=77b2f861 edx=0028f985 esi=00510000 edi=02b81b50 eip=77b9087c esp=0028fbcc ebp=0028fbcc iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 ntdll!RtlpBreakPointHeap+0x23: 77b9087c cc int 3 0:000> g HEAP[ruby.exe]: Heap block at 02B81B48 modified at 02B81B58 past requested size of 8 (15dc.16b8): Break instruction exception - code 80000003 (first chance) eax=02b81b48 ebx=02b81b58 ecx=77b2f861 edx=0028f871 esi=02b81b48 edi=00000008 eip=77b9087c esp=0028fab8 ebp=0028fab8 iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 ntdll!RtlpBreakPointHeap+0x23: 77b9087c cc int 3 0:000> g HEAP[ruby.exe]: Invalid address specified to RtlFreeHeap( 00510000, 02B81B50 ) (15dc.16b8): Break instruction exception - code 80000003 (first chance) eax=02b81b48 ebx=02b81b48 ecx=77b2f861 edx=0028f88d esi=00510000 edi=00510000 eip=77b9087c esp=0028fad4 ebp=0028fad4 iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000202 ntdll!RtlpBreakPointHeap+0x23: 77b9087c cc int 3 0:000> g eax=00000000 ebx=00000000 ecx=0028f88c edx=0028f88d esi=77bc2100 edi=77bc20c0 eip=77adfd0e esp=0028fe40 ebp=0028fe5c iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 ntdll!ZwTerminateProcess+0x12: 77adfd0e 83c404 add esp,4 0:000> ``` ### TIMELINE * 2015-06-11 - Initial Discovery * 2015-06-30 - Vendor Notification * 2016-06-14 - Public Disclosure
idSSV:96759
last seen2017-11-19
modified2017-10-20
published2017-10-20
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-96759
titleRuby Fiddle::Function.new Heap Overflow Vulnerability(CVE-2016-2339)

Talos

idTALOS-2016-0034
last seen2019-05-29
published2016-06-14
reporterTalos Intelligence
sourcehttp://www.talosintelligence.com/vulnerability_reports/TALOS-2016-0034
titleRuby Fiddle::Function.new Heap Overflow Vulnerability