Vulnerabilities > CVE-2016-4303 - Classic Buffer Overflow vulnerability in multiple products

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
iperf3-project
novell
opensuse
debian
CWE-120
nessus

Summary

The parse_string function in cjson.c in the cJSON library mishandles UTF8/16 strings, which allows remote attackers to cause a denial of service (crash) or execute arbitrary code via a non-hex character in a JSON string, which triggers a heap-based buffer overflow.

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 familyFedora Local Security Checks
    NASL idFEDORA_2016-9693E82A25.NASL
    descriptionNew upstream release. Fixes CVE-2016-4303. ---- update to iperf3-3.1b3 Note that Tenable Network Security has extracted the preceding description block directly from the Fedora update system website. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-05
    modified2016-07-14
    plugin id92129
    published2016-07-14
    reporterThis script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/92129
    titleFedora 23 : iperf3 (2016-9693e82a25)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from Fedora Security Advisory FEDORA-2016-9693e82a25.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(92129);
      script_version("1.5");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/04");
    
      script_cve_id("CVE-2016-4303");
      script_xref(name:"FEDORA", value:"2016-9693e82a25");
    
      script_name(english:"Fedora 23 : iperf3 (2016-9693e82a25)");
      script_summary(english:"Checks rpm output for the updated package.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Fedora host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "New upstream release. Fixes CVE-2016-4303.
    
    ----
    
    update to iperf3-3.1b3
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the Fedora update system website.
    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://bodhi.fedoraproject.org/updates/FEDORA-2016-9693e82a25"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Update the affected iperf3 package."
      );
      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:fedoraproject:fedora:iperf3");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:fedoraproject:fedora:23");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/09/26");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/06/17");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/07/14");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Fedora Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/RedHat/release", "Host/RedHat/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/RedHat/release");
    if (isnull(release) || "Fedora" >!< release) audit(AUDIT_OS_NOT, "Fedora");
    os_ver = pregmatch(pattern: "Fedora.*release ([0-9]+)", string:release);
    if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Fedora");
    os_ver = os_ver[1];
    if (! preg(pattern:"^23([^0-9]|$)", string:os_ver)) audit(AUDIT_OS_NOT, "Fedora 23", "Fedora " + os_ver);
    
    if (!get_kb_item("Host/RedHat/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, "Fedora", cpu);
    
    
    flag = 0;
    if (rpm_check(release:"FC23", reference:"iperf3-3.1.3-1.fc23")) 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, "iperf3");
    }
    
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2016-45402A6F3B.NASL
    descriptionNew upstream release. Fixes CVE-2016-4303. ---- update to iperf3-3.1b3 Note that Tenable Network Security has extracted the preceding description block directly from the Fedora update system website. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-05
    modified2016-07-14
    plugin id92089
    published2016-07-14
    reporterThis script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/92089
    titleFedora 22 : iperf3 (2016-45402a6f3b)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from Fedora Security Advisory FEDORA-2016-45402a6f3b.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(92089);
      script_version("1.5");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/04");
    
      script_cve_id("CVE-2016-4303");
      script_xref(name:"FEDORA", value:"2016-45402a6f3b");
    
      script_name(english:"Fedora 22 : iperf3 (2016-45402a6f3b)");
      script_summary(english:"Checks rpm output for the updated package.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Fedora host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "New upstream release. Fixes CVE-2016-4303.
    
    ----
    
    update to iperf3-3.1b3
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the Fedora update system website.
    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://bodhi.fedoraproject.org/updates/FEDORA-2016-45402a6f3b"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Update the affected iperf3 package."
      );
      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:fedoraproject:fedora:iperf3");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:fedoraproject:fedora:22");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/09/26");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/06/17");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/07/14");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Fedora Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/RedHat/release", "Host/RedHat/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/RedHat/release");
    if (isnull(release) || "Fedora" >!< release) audit(AUDIT_OS_NOT, "Fedora");
    os_ver = pregmatch(pattern: "Fedora.*release ([0-9]+)", string:release);
    if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Fedora");
    os_ver = os_ver[1];
    if (! preg(pattern:"^22([^0-9]|$)", string:os_ver)) audit(AUDIT_OS_NOT, "Fedora 22", "Fedora " + os_ver);
    
    if (!get_kb_item("Host/RedHat/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, "Fedora", cpu);
    
    
    flag = 0;
    if (rpm_check(release:"FC22", reference:"iperf3-3.1.3-1.fc22")) 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, "iperf3");
    }
    
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DLA-2080.NASL
    descriptionAn issue has been found in iperf3, an Internet Protocol bandwidth measuring tool. Bad handling of UTF8/16 strings in an embedded library could cause a denial of service (crash) or execution of arbitrary code by putting special characters in a JSON string, which triggers a heap-based buffer overflow. For Debian 8
    last seen2020-06-01
    modified2020-06-02
    plugin id133277
    published2020-01-28
    reporterThis script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/133277
    titleDebian DLA-2080-1 : iperf3 security update
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were
    # extracted from Debian Security Advisory DLA-2080-1. The text
    # itself is copyright (C) Software in the Public Interest, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(133277);
      script_version("1.2");
      script_cvs_date("Date: 2020/01/30");
    
      script_cve_id("CVE-2016-4303");
    
      script_name(english:"Debian DLA-2080-1 : iperf3 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:
    "An issue has been found in iperf3, an Internet Protocol bandwidth
    measuring tool. Bad handling of UTF8/16 strings in an embedded library
    could cause a denial of service (crash) or execution of arbitrary code
    by putting special characters in a JSON string, which triggers a
    heap-based buffer overflow.
    
    For Debian 8 'Jessie', this problem has been fixed in version
    3.0.7-1+deb8u1.
    
    We recommend that you upgrade your iperf3 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/2020/01/msg00023.html"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://packages.debian.org/source/jessie/iperf3"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Upgrade the affected iperf3, libiperf-dev, and libiperf0 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:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:iperf3");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:libiperf-dev");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:debian:debian_linux:libiperf0");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:debian:debian_linux:8.0");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/09/26");
      script_set_attribute(attribute:"patch_publication_date", value:"2020/01/27");
      script_set_attribute(attribute:"plugin_publication_date", value:"2020/01/28");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2020 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:"iperf3", reference:"3.0.7-1+deb8u1")) flag++;
    if (deb_check(release:"8.0", prefix:"libiperf-dev", reference:"3.0.7-1+deb8u1")) flag++;
    if (deb_check(release:"8.0", prefix:"libiperf0", reference:"3.0.7-1+deb8u1")) 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 familyFedora Local Security Checks
    NASL idFEDORA_2016-D67864115D.NASL
    descriptionNew upstream release. Fixes CVE-2016-4303. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora update system website. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-05
    modified2016-07-14
    plugin id92176
    published2016-07-14
    reporterThis script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/92176
    titleFedora 24 : iperf3 (2016-d67864115d)
    code
    #%NASL_MIN_LEVEL 80502
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from Fedora Security Advisory FEDORA-2016-d67864115d.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(92176);
      script_version("1.5");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/04");
    
      script_cve_id("CVE-2016-4303");
      script_xref(name:"FEDORA", value:"2016-d67864115d");
    
      script_name(english:"Fedora 24 : iperf3 (2016-d67864115d)");
      script_summary(english:"Checks rpm output for the updated package.");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote Fedora host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "New upstream release. Fixes CVE-2016-4303.
    
    Note that Tenable Network Security has extracted the preceding
    description block directly from the Fedora update system website.
    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://bodhi.fedoraproject.org/updates/FEDORA-2016-d67864115d"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Update the affected iperf3 package."
      );
      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:fedoraproject:fedora:iperf3");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:fedoraproject:fedora:24");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/09/26");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/06/18");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/07/14");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-2020 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"Fedora Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/RedHat/release", "Host/RedHat/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/RedHat/release");
    if (isnull(release) || "Fedora" >!< release) audit(AUDIT_OS_NOT, "Fedora");
    os_ver = pregmatch(pattern: "Fedora.*release ([0-9]+)", string:release);
    if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Fedora");
    os_ver = os_ver[1];
    if (! preg(pattern:"^24([^0-9]|$)", string:os_ver)) audit(AUDIT_OS_NOT, "Fedora 24", "Fedora " + os_ver);
    
    if (!get_kb_item("Host/RedHat/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, "Fedora", cpu);
    
    
    flag = 0;
    if (rpm_check(release:"FC24", reference:"iperf3-3.1.3-1.fc24")) 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, "iperf3");
    }
    
  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_D6BBF2D82CFC11E6800B080027468580.NASL
    descriptionESnet reports : A malicious process can connect to an iperf3 server and, by sending a malformed message on the control channel, corrupt the server process
    last seen2020-06-01
    modified2020-06-02
    plugin id91527
    published2016-06-09
    reporterThis script is Copyright (C) 2016-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/91527
    titleFreeBSD : iperf3 -- buffer overflow (d6bbf2d8-2cfc-11e6-800b-080027468580)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from the FreeBSD VuXML database :
    #
    # Copyright 2003-2018 Jacques Vidrine and contributors
    #
    # Redistribution and use in source (VuXML) and 'compiled' forms (SGML,
    # HTML, PDF, PostScript, RTF and so forth) with or without modification,
    # are permitted provided that the following conditions are met:
    # 1. Redistributions of source code (VuXML) must retain the above
    #    copyright notice, this list of conditions and the following
    #    disclaimer as the first lines of this file unmodified.
    # 2. Redistributions in compiled form (transformed to other DTDs,
    #    published online in any format, converted to PDF, PostScript,
    #    RTF and other formats) must reproduce the above copyright
    #    notice, this list of conditions and the following disclaimer
    #    in the documentation and/or other materials provided with the
    #    distribution.
    # 
    # THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
    # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
    # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION,
    # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(91527);
      script_version("2.4");
      script_cvs_date("Date: 2018/11/10 11:49:45");
    
      script_cve_id("CVE-2016-4303");
    
      script_name(english:"FreeBSD : iperf3 -- buffer overflow (d6bbf2d8-2cfc-11e6-800b-080027468580)");
      script_summary(english:"Checks for updated packages in pkg_info output");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:
    "The remote FreeBSD host is missing one or more security-related
    updates."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "ESnet reports :
    
    A malicious process can connect to an iperf3 server and, by sending a
    malformed message on the control channel, corrupt the server process's
    heap area. This can lead to a crash (and a denial of service), or
    theoretically a remote code execution as the user running the iperf3
    server. A malicious iperf3 server could potentially mount a similar
    attack on an iperf3 client."
      );
      # https://raw.githubusercontent.com/esnet/security/master/cve-2016-4303/esnet-secadv-2016-0001.txt.asc
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?7b116c0a"
      );
      # https://vuxml.freebsd.org/freebsd/d6bbf2d8-2cfc-11e6-800b-080027468580.html
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?20ec0ec8"
      );
      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_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:freebsd:freebsd:iperf3");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/06/08");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/06/08");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/06/09");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");
      script_family(english:"FreeBSD Local Security Checks");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/FreeBSD/release", "Host/FreeBSD/pkg_info");
    
      exit(0);
    }
    
    
    include("audit.inc");
    include("freebsd_package.inc");
    
    
    if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    if (!get_kb_item("Host/FreeBSD/release")) audit(AUDIT_OS_NOT, "FreeBSD");
    if (!get_kb_item("Host/FreeBSD/pkg_info")) audit(AUDIT_PACKAGE_LIST_MISSING);
    
    
    flag = 0;
    
    if (pkg_test(save_report:TRUE, pkg:"iperf3>=3.1<3.1.3")) flag++;
    if (pkg_test(save_report:TRUE, pkg:"iperf3>=3.0<3.0.12")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_hole(port:0, extra:pkg_report_get());
      else security_hole(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    
  • NASL familySuSE Local Security Checks
    NASL idOPENSUSE-2016-1006.NASL
    descriptioniperf was updated to the the following vulnerability : - CVE-2016-4303: A malicious client could have triggered a buffer overflow / heap corruption issue by sending a specially crafted JSON string, and possibly execute arbitrary code (boo#984453)
    last seen2020-06-05
    modified2016-08-22
    plugin id93066
    published2016-08-22
    reporterThis script is Copyright (C) 2016-2020 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/93066
    titleopenSUSE Security Update : iperf (openSUSE-2016-1006)
    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-2016-1006.
    #
    # The text description of this plugin is (C) SUSE LLC.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(93066);
      script_version("2.4");
      script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/04");
    
      script_cve_id("CVE-2016-4303");
    
      script_name(english:"openSUSE Security Update : iperf (openSUSE-2016-1006)");
      script_summary(english:"Check for the openSUSE-2016-1006 patch");
    
      script_set_attribute(
        attribute:"synopsis", 
        value:"The remote openSUSE host is missing a security update."
      );
      script_set_attribute(
        attribute:"description", 
        value:
    "iperf was updated to the the following vulnerability :
    
      - CVE-2016-4303: A malicious client could have triggered a
        buffer overflow / heap corruption issue by sending a
        specially crafted JSON string, and possibly execute
        arbitrary code (boo#984453)"
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://bugzilla.opensuse.org/show_bug.cgi?id=984453"
      );
      script_set_attribute(
        attribute:"solution", 
        value:"Update the affected iperf 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:iperf");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:iperf-debuginfo");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:iperf-debugsource");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:iperf-devel");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libiperf0");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:novell:opensuse:libiperf0-debuginfo");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:novell:opensuse:13.2");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:novell:opensuse:42.1");
    
      script_set_attribute(attribute:"patch_publication_date", value:"2016/08/19");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/08/22");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2016-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 !~ "^(SUSE13\.2|SUSE42\.1)$") audit(AUDIT_OS_RELEASE_NOT, "openSUSE", "13.2 / 42.1", 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:"SUSE13.2", reference:"iperf-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE13.2", reference:"iperf-debuginfo-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE13.2", reference:"iperf-debugsource-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE13.2", reference:"iperf-devel-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE13.2", reference:"libiperf0-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE13.2", reference:"libiperf0-debuginfo-3.0.12-2.6.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"iperf-3.0.12-5.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"iperf-debuginfo-3.0.12-5.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"iperf-debugsource-3.0.12-5.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"iperf-devel-3.0.12-5.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"libiperf0-3.0.12-5.1") ) flag++;
    if ( rpm_check(release:"SUSE42.1", reference:"libiperf0-debuginfo-3.0.12-5.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, "iperf / iperf-debuginfo / iperf-debugsource / iperf-devel / etc");
    }
    

Seebug

bulletinFamilyexploit
description### DESCRIPTION An exploitable remote code execution vulnerability exists in the JSON handling functionality of ESnet iPerf3. A specially crafted JSON string can lead to buffer overflow on the heap resulting in remote code execution. An attacker can send an unauthenticated packet to any reachable iPerf3 server to trigger this vulnerability. Note a list of iPerf3 servers are listed here that are currently vulnerable to this attack https://iperf.fr/iperf-servers.php ### TESTED VERSIONS iperf 3.1.1 ### DETAILS ESnet iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, protocols, and buffers. For each test it reports the bandwidth, loss, and other parameters. The vulnerability centers around the mishandling of UTF8/16 strings within cjson.c. When attempting to allocate room for the resulting cstring, a logic error occurs when sscanf reaches a non-hex character ('"'), however the pointer is incremented by 4 bytes regardless of the result. This skips the quote character causing the while loop to miss the first quote and continue writing until the second quote is found. This results in an overflow into the next heap structure, clobbering the heap block header. The "key" found in this JSON string does not match any known keys and is later freed. I have commented some of the lines below: ``` 236 static const char *parse_string( cJSON *item, const char *str ) 237 { [...snip...] 250 /* Skip escaped quotes. */ 251 while ( *ptr != '\"' && *ptr && ++len ) // extract key from 'ptr' 252 if ( *ptr++ == '\\' ) 253 ptr++; 254 255 if ( ! ( out = (char*) cJSON_malloc( len + 1 ) ) ) // Malloc Block Size of 0x3 (actually reserves 0x20 bytes) 256 return 0; 257 258 ptr = str + 1; // move ptr past the first quote of the key ("\uC" in this case) 259 ptr2 = out; // ptr2 will store the resulting cstring 260 while ( *ptr != '\"' && *ptr ) { // until the second quote or backslash is found 261 if ( *ptr != '\\' ) // the slash in \uC is found 262 *ptr2++ = *ptr++; // ptr2 will store the unescaped contents of ptr overflowing the block allocated for only 3 bytes 263 else { 264 ptr++; // skip the slash found and check the escaped char 265 switch ( *ptr ) { 266 case 'b': *ptr2++ ='\b'; break; 267 case 'f': *ptr2++ ='\f'; break; 268 case 'n': *ptr2++ ='\n'; break; 269 case 'r': *ptr2++ ='\r'; break; 270 case 't': *ptr2++ ='\t'; break; 271 case 'u': // UTF8/16 found 272 /* Transcode utf16 to utf8. */ 273 /* Get the unicode char. */ 274 sscanf( ptr + 1,"%4x", &uc ); // sscanf stops at non-hex char '"' 275 ptr += 4; // ptr inc'd by 4 regardless of sscanf result // making ptr point out of bounds of the buffer [...snip...] 302 switch ( len ) { [...snip...] 306 case 1: *--ptr2 = ( uc | firstByteMark[len] ); 307 } 308 ptr2 += len; 309 break; 310 default: *ptr2++ = *ptr; break; 311 } 312 ++ptr; 313 } 314 } 315 *ptr2 = 0; // terminate cstring 316 if ( *ptr == '\"' ) 317 ++ptr; 318 item->valuestring = out; // item is a cJSON struct 319 item->type = cJSON_String; 320 return ptr; 321 } ``` This object is then compared against a list of keys, the JSON object is deleted and the string is freed. ``` perf_api.c 1336 static int 1337 get_parameters(struct iperf_test *test) 1338 { 1339 int r = 0; 1340 cJSON *j; 1341 cJSON *j_p; 1342 1343 j = JSON_read(test->ctrl_sck); 1344 if (j == NULL) { 1345 i_errno = IERECVPARAMS; 1346 r = -1; 1347 } else { 1348 if (test->debug) { 1349 printf("get_parameters:\n%s\n", cJSON_Print(j)); 1350 } 1351 1352 if ((j_p = cJSON_GetObjectItem(j, "tcp")) != NULL) 1353 set_protocol(test, Ptcp); 1354 if ((j_p = cJSON_GetObjectItem(j, "udp")) != NULL) 1355 set_protocol(test, Pudp); [...snip...] 1392 if ((j_p = cJSON_GetObjectItem(j, "get_server_output")) != NULL) 1393 iperf_set_test_get_server_output(test, 1); 1394 if ((j_p = cJSON_GetObjectItem(j, "udp_counters_64bit")) != NULL) 1395 iperf_set_test_udp_counters_64bit(test, 1); 1396 if (test->sender && test->protocol->id == Ptcp && has_tcpinfo_retransmits()) 1397 test->sender_has_retransmits = 1; 1398 cJSON_Delete(j); // delete the object 1399 } 1400 return r; 1401 } ``` When attempting to delete the object cJSON->valuestring, the corrupted chunk is read in and then freed: ``` 3833 static void 3834 _int_free (mstate av, mchunkptr p, int have_lock) 3835 { 3836 INTERNAL_SIZE_T size; /* its size */ 3837 mfastbinptr *fb; /* associated fastbin */ 3838 mchunkptr nextchunk; /* next contiguous chunk */ 3839 INTERNAL_SIZE_T nextsize; /* its size */ 3840 int nextinuse; /* true if nextchunk is used */ 3841 INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */ 3842 mchunkptr bck; /* misc temp for linking */ 3843 mchunkptr fwd; /* misc temp for linking */ 3844 3845 const char *errstr = NULL; 3846 int locked = 0; 3847 3848 size = chunksize (p); [...] 3960 nextchunk = chunk_at_offset(p, size); __GI___libc_free (malloc.c:3848) 3848 size = chunksize (p); >>> p/x size $70 = 0x20 >>> p/x *p $71 = { prev_size = 0x0, size = 0x21, fd = 0x454545454545440c, bk = 0x4646464646464545, fd_nextsize = 0x4747474747474646, bk_nextsize = 0x7d4747 } ``` ### Crash Information ``` *** Error in `./iperf3': free(): invalid next size (fast): 0x00000000026165b0 *** ======= Backtrace: ========= /usr/lib/libc.so.6(+0x72055)[0x7fc9bc8cc055] /usr/lib/libc.so.6(+0x779a6)[0x7fc9bc8d19a6] /usr/lib/libc.so.6(+0x7818e)[0x7fc9bc8d218e] ./iperf3[0x437525] ./iperf3[0x40d545] ./iperf3[0x40ac35] ./iperf3[0x423891] ./iperf3[0x426495] ./iperf3[0x40274d] ./iperf3[0x402301] /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7fc9bc87a610] ./iperf3[0x402049] ======= Memory map: ======== 00400000-00448000 r-xp 00000000 fe:02 30935253 /home/bcake/src/iperf/fuzzing/iperf3 00648000-00649000 rw-p 00048000 fe:02 30935253 /home/bcake/src/iperf/fuzzing/iperf3 00649000-0064a000 rw-p 00000000 00:00 0 02612000-02633000 rw-p 00000000 00:00 0 [heap] 7fc9b8000000-7fc9b8021000 rw-p 00000000 00:00 0 7fc9b8021000-7fc9bc000000 ---p 00000000 00:00 0 7fc9bc644000-7fc9bc65a000 r-xp 00000000 fe:00 265363 /usr/lib/libgcc_s.so.1 7fc9bc65a000-7fc9bc859000 ---p 00016000 fe:00 265363 /usr/lib/libgcc_s.so.1 7fc9bc859000-7fc9bc85a000 rw-p 00015000 fe:00 265363 /usr/lib/libgcc_s.so.1 7fc9bc85a000-7fc9bc9f5000 r-xp 00000000 fe:00 264223 /usr/lib/libc-2.22.so 7fc9bc9f5000-7fc9bcbf4000 ---p 0019b000 fe:00 264223 /usr/lib/libc-2.22.so 7fc9bcbf4000-7fc9bcbf8000 r--p 0019a000 fe:00 264223 /usr/lib/libc-2.22.so 7fc9bcbf8000-7fc9bcbfa000 rw-p 0019e000 fe:00 264223 /usr/lib/libc-2.22.so 7fc9bcbfa000-7fc9bcbfe000 rw-p 00000000 00:00 0 7fc9bcbfe000-7fc9bcc20000 r-xp 00000000 fe:00 264184 /usr/lib/ld-2.22.so 7fc9bcdec000-7fc9bcdef000 rw-p 00000000 00:00 0 7fc9bce1d000-7fc9bce1f000 rw-p 00000000 00:00 0 7fc9bce1f000-7fc9bce20000 r--p 00021000 fe:00 264184 /usr/lib/ld-2.22.so 7fc9bce20000-7fc9bce21000 rw-p 00022000 fe:00 264184 /usr/lib/ld-2.22.so 7fc9bce21000-7fc9bce22000 rw-p 00000000 00:00 0 7fff0b656000-7fff0b677000 rw-p 00000000 00:00 0 [stack] 7fff0b6d7000-7fff0b6d9000 r--p 00000000 00:00 0 [vvar] 7fff0b6d9000-7fff0b6db000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted (core dumped) >>> bt #0 0x00007ffff7a6a5f8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55 #1 0x00007ffff7a6ba7a in __GI_abort () at abort.c:89 #2 0x00007ffff7aa905a in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff7ba0e10 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #3 0x00007ffff7aae9a6 in malloc_printerr (action=3, str=0x7ffff7ba0f20 "free(): invalid next size (fast)", ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5000 #4 0x00007ffff7aaf18e in _int_free (av=0x7ffff7dd5b40 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:3861 #5 0x0000000000437525 in cJSON_Delete (c=c@entry=0x64e560) at cjson.c:119 #6 0x000000000040d545 in get_parameters (test=test@entry=0x64a010) at iperf_api.c:1398 #7 0x000000000040ac35 in iperf_exchange_parameters (test=test@entry=0x64a010) at iperf_api.c:1209 #8 0x0000000000423891 in iperf_accept (test=test@entry=0x64a010) at iperf_server_api.c:161 #9 0x0000000000426495 in iperf_run_server (test=test@entry=0x64a010) at iperf_server_api.c:496 #10 0x000000000040274d in run (test=test@entry=0x64a010) at main.c:154 #11 0x0000000000402301 in main (argc=2, argv=0x7fffffffe7a8) at main.c:111 ``` ### TIMELINE * 2016-04-20 - Initial Vendor Contact * 2016-06-08 - Patch Released
idSSV:96766
last seen2017-11-19
modified2017-10-20
published2017-10-20
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-96766
titleESnet iPerf3 JSON parse_string UTF Code Execution Vulnerability(CVE-2016-4303)

Talos

idTALOS-2016-0164
last seen2019-05-29
published2016-06-08
reporterTalos Intelligence
sourcehttp://www.talosintelligence.com/vulnerability_reports/TALOS-2016-0164
titleESnet iPerf3 JSON parse_string UTF Code Execution Vulnerability