Vulnerabilities > CVE-2016-4630 - Improper Restriction of Operations within the Bounds of a Memory Buffer vulnerability in Apple mac OS X

047910
CVSS 6.8 - MEDIUM
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
apple
CWE-119
nessus

Summary

ImageIO in Apple OS X before 10.11.6 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted EXR image with B44 compression.

Vulnerable Configurations

Part Description Count
OS
Apple
98

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 familyMacOS X Local Security Checks
    NASL idMACOSX_10_11_6.NASL
    descriptionThe remote host is running a version of Mac OS X that is 10.11.x prior to 10.11.6. It is, therefore, affected by multiple vulnerabilities in the following components : - apache_mod_php - Audio - bsdiff - CFNetwork - CoreGraphics - FaceTime - Graphics Drivers - ImageIO - Intel Graphics Driver - IOHIDFamily - IOKit - IOSurface - Kernel - libc++abi - libexpat - LibreSSL - libxml2 - libxslt - Login Window - OpenSSL - QuickTime - Safari Login AutoFill - Sandbox Profiles Note that successful exploitation of the most serious issues can result in arbitrary code execution.
    last seen2020-06-01
    modified2020-06-02
    plugin id92496
    published2016-07-21
    reporterThis script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/92496
    titleMac OS X 10.11.x < 10.11.6 Multiple Vulnerabilities
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(92496);
      script_version("1.13");
      script_cvs_date("Date: 2019/11/19");
    
      script_cve_id(
        "CVE-2013-7456",
        "CVE-2014-9862",
        "CVE-2016-0718",
        "CVE-2016-1684",
        "CVE-2016-1836",
        "CVE-2016-1863",
        "CVE-2016-1864",
        "CVE-2016-1865",
        "CVE-2016-2105",
        "CVE-2016-2106",
        "CVE-2016-2107",
        "CVE-2016-2108",
        "CVE-2016-2109",
        "CVE-2016-2176",
        "CVE-2016-4447",
        "CVE-2016-4448",
        "CVE-2016-4449",
        "CVE-2016-4483",
        "CVE-2016-4582",
        "CVE-2016-4594",
        "CVE-2016-4595",
        "CVE-2016-4596",
        "CVE-2016-4597",
        "CVE-2016-4598",
        "CVE-2016-4599",
        "CVE-2016-4600",
        "CVE-2016-4601",
        "CVE-2016-4602",
        "CVE-2016-4607",
        "CVE-2016-4608",
        "CVE-2016-4609",
        "CVE-2016-4610",
        "CVE-2016-4612",
        "CVE-2016-4614",
        "CVE-2016-4615",
        "CVE-2016-4616",
        "CVE-2016-4619",
        "CVE-2016-4621",
        "CVE-2016-4625",
        "CVE-2016-4626",
        "CVE-2016-4629",
        "CVE-2016-4630",
        "CVE-2016-4631",
        "CVE-2016-4632",
        "CVE-2016-4633",
        "CVE-2016-4634",
        "CVE-2016-4635",
        "CVE-2016-4637",
        "CVE-2016-4638",
        "CVE-2016-4639",
        "CVE-2016-4640",
        "CVE-2016-4641",
        "CVE-2016-4645",
        "CVE-2016-4646",
        "CVE-2016-4647",
        "CVE-2016-4648",
        "CVE-2016-4649",
        "CVE-2016-4650",
        "CVE-2016-4652",
        "CVE-2016-5093",
        "CVE-2016-5094",
        "CVE-2016-5096"
      );
      script_bugtraq_id(
        90856,
        90857,
        90859,
        90861,
        90864,
        90865,
        90876,
        90946,
        91824,
        91826,
        91828,
        91829,
        91834,
        92034
      );
      script_xref(name:"APPLE-SA", value:"APPLE-SA-2016-07-18-1");
    
      script_name(english:"Mac OS X 10.11.x < 10.11.6 Multiple Vulnerabilities");
      script_summary(english:"Checks the version of Mac OS X.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote host is missing a Mac OS X security update that fixes
    multiple vulnerabilities.");
      script_set_attribute(attribute:"description", value:
    "The remote host is running a version of Mac OS X that is 10.11.x prior
    to 10.11.6. It is, therefore, affected by multiple vulnerabilities in
    the following components :
    
      - apache_mod_php
      - Audio
      - bsdiff
      - CFNetwork
      - CoreGraphics
      - FaceTime
      - Graphics Drivers
      - ImageIO
      - Intel Graphics Driver
      - IOHIDFamily
      - IOKit
      - IOSurface
      - Kernel
      - libc++abi
      - libexpat
      - LibreSSL
      - libxml2
      - libxslt
      - Login Window
      - OpenSSL
      - QuickTime
      - Safari Login AutoFill
      - Sandbox Profiles
    
    Note that successful exploitation of the most serious issues can
    result in arbitrary code execution.");
      script_set_attribute(attribute:"see_also", value:"http://support.apple.com/en-us/HT206903");
      # http://lists.apple.com/archives/security-announce/2016/Jul/msg00000.html
      script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?5da74f53");
      script_set_attribute(attribute:"solution", value:
    "Upgrade to Mac OS X 10.11.6 or later.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      script_set_cvss_temporal_vector("CVSS2#E:H/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:H/RL:O/RC:C");
      script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-4629");
    
      script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"true");
      script_set_attribute(attribute:"exploited_by_malware", value:"true");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2016/07/18");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/07/18");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/07/21");
    
      script_set_attribute(attribute:"plugin_type", value:"combined");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:apple:mac_os_x");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"MacOS X Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("ssh_get_info.nasl", "os_fingerprint.nasl");
      script_require_ports("Host/MacOSX/Version", "Host/OS");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("misc_func.inc");
    
    os = get_kb_item("Host/MacOSX/Version");
    if (!os)
    {
      os = get_kb_item_or_exit("Host/OS");
      if ("Mac OS X" >!< os) audit(AUDIT_OS_NOT, "Mac OS X");
    
      c = get_kb_item("Host/OS/Confidence");
      if (c <= 70) exit(1, "Can't determine the host's OS with sufficient confidence.");
    }
    if (!os) audit(AUDIT_OS_NOT, "Mac OS X");
    
    
    match = eregmatch(pattern:"Mac OS X ([0-9]+(\.[0-9]{1,2})+)", string:os);
    if (isnull(match)) exit(1, "Failed to parse the Mac OS X version ('" + os + "').");
    
    version = match[1];
    if (!ereg(pattern:"^10\.11([^0-9]|$)", string:version)) audit(AUDIT_OS_NOT, "Mac OS X 10.11", "Mac OS X "+version);
    
    fixed_version = "10.11.6";
    if (ver_compare(ver:version, fix:fixed_version, strict:FALSE) == -1)
    {
          report = '\n  Installed version : ' + version +
                   '\n  Fixed version     : ' + fixed_version +
                   '\n';
          security_report_v4(port:0, extra:report, severity:SECURITY_HOLE);
    }
    else exit(0, "The host is not affected as it is running Mac OS X "+version+".");
    
  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_SECUPD2016-004.NASL
    descriptionThe remote host is running a version of Mac OS X that is 10.9.5 or 10.10.5 and is missing Security Update 2016-004. It is, therefore, affected by multiple vulnerabilities in the following components : - apache_mod_php (affects 10.10.5 only) - CoreGraphics - ImageIO - libxml2 - libxslt Note that successful exploitation of the most serious issues can result in arbitrary code execution.
    last seen2020-06-01
    modified2020-06-02
    plugin id92497
    published2016-07-21
    reporterThis script is Copyright (C) 2016-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/92497
    titleMac OS X 10.9.5 and 10.10.5 Multiple Vulnerabilities (Security Update 2016-004)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(92497);
      script_version("1.9");
      script_cvs_date("Date: 2018/07/14  1:59:36");
    
      script_cve_id(
        "CVE-2013-7456",
        "CVE-2016-1684",
        "CVE-2016-1836",
        "CVE-2016-4447",
        "CVE-2016-4448",
        "CVE-2016-4449",
        "CVE-2016-4483",
        "CVE-2016-4607",
        "CVE-2016-4608",
        "CVE-2016-4609",
        "CVE-2016-4610",
        "CVE-2016-4612",
        "CVE-2016-4614",
        "CVE-2016-4615",
        "CVE-2016-4616",
        "CVE-2016-4619",
        "CVE-2016-4629",
        "CVE-2016-4630",
        "CVE-2016-4637",
        "CVE-2016-4650",
        "CVE-2016-5093",
        "CVE-2016-5094",
        "CVE-2016-5096"
      );
      script_bugtraq_id(
        90856,
        90857,
        90859,
        90861,
        90864,
        90865,
        90876,
        90946,
        91824,
        91826,
        91834,
        92034
      );
      script_xref(name:"APPLE-SA", value:"APPLE-SA-2016-05-16-4");
    
      script_name(english:"Mac OS X 10.9.5 and 10.10.5 Multiple Vulnerabilities (Security Update 2016-004)");
      script_summary(english:"Checks for the presence of Security Update 2016-004.");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote host is missing a Mac OS X update that fixes multiple
    vulnerabilities.");
      script_set_attribute(attribute:"description", value:
    "The remote host is running a version of Mac OS X that is 10.9.5 or
    10.10.5 and is missing Security Update 2016-004. It is, therefore,
    affected by multiple vulnerabilities in the following components :
    
      - apache_mod_php (affects 10.10.5 only)
      - CoreGraphics
      - ImageIO
      - libxml2
      - libxslt
    
    Note that successful exploitation of the most serious issues can
    result in arbitrary code execution.");
      script_set_attribute(attribute:"see_also", value:"https://support.apple.com/en-us/HT206903");
      # http://lists.apple.com/archives/security-announce/2016/Jul/msg00000.html
      script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?5da74f53");
     script_set_attribute(attribute:"solution", value:
    "Install Security Update 2016-004 or later.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
      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:"vuln_publication_date", value:"2016/07/18");
      script_set_attribute(attribute:"patch_publication_date", value:"2016/07/18");
      script_set_attribute(attribute:"plugin_publication_date", value:"2016/07/21");
    
      script_set_attribute(attribute:"plugin_type", value:"local");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:apple:mac_os_x");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"MacOS X Local Security Checks");
    
      script_copyright(english:"This script is Copyright (C) 2016-2018 Tenable Network Security, Inc.");
    
      script_dependencies("ssh_get_info.nasl");
      script_require_keys("Host/local_checks_enabled", "Host/MacOSX/Version", "Host/MacOSX/packages/boms");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("misc_func.inc");
    
    patch = "2016-004";
    
    # Compare 2 patch numbers to determine if patch requirements are satisfied.
    # Return true if this patch or a later patch is applied
    # Return false otherwise
    function check_patch(year, number)
    {
      local_var p_split = split(patch, sep:"-");
      local_var p_year  = int( p_split[0]);
      local_var p_num   = int( p_split[1]);
    
      if (year >  p_year) return TRUE;
      else if (year <  p_year) return FALSE;
      else if (number >=  p_num) return TRUE;
      else return FALSE;
    }
    
    if (!get_kb_item("Host/local_checks_enabled"))
      audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
    
    os = get_kb_item("Host/MacOSX/Version");
    if (!os)
      audit(AUDIT_OS_NOT, "Mac OS X");
    
    if (!ereg(pattern:"Mac OS X 10\.(10|9)\.5([^0-9]|$)", string:os))
      audit(AUDIT_OS_NOT, "Mac OS X 10.9.5 or 10.10.5");
    
    packages = get_kb_item_or_exit("Host/MacOSX/packages/boms", exit_code:1);
    sec_boms_report = egrep(pattern:"^com\.apple\.pkg\.update\.security\..*bom$", string:packages);
    sec_boms = split(sec_boms_report, sep:'\n');
    
    foreach package (sec_boms)
    {
      # Grab patch year and number
      match = eregmatch(pattern:"[^0-9](20[0-9][0-9])[-.]([0-9]{3})[^0-9]", string:package);
      if (empty_or_null(match[1]) || empty_or_null(match[2]))
        continue;
    
      patch_found = check_patch(year:int(match[1]), number:int(match[2]));
      if (patch_found) exit(0, "The host has Security Update " + patch + " or later installed and is therefore not affected.");
    }
    
    report =  '\n  Missing security update : ' + patch;
    report += '\n  Installed security BOMs : ';
    if (sec_boms_report) report += str_replace(find:'\n', replace:'\n                            ', string:sec_boms_report);
    else report += 'n/a';
    report += '\n';
    
    security_report_v4(port:0, severity:SECURITY_HOLE, extra:report);
    

Seebug

bulletinFamilyexploit
description### SUMMARY An exploitable heap based buffer overflow exists in the handling of EXR images on OS X. A crafted EXR document can lead to a heap based buffer overflow resulting in remote code execution. Vulnerability can be triggered via a saved EXR file delivered by other means when opened in any application using the Apple Image I/O API. ### TESTED VERSIONS OSX El Capitan - 10.11.4 ### PRODUCT URLs https://developer.apple.com/osx/download ### CVSSv3 SCORE 7.1 - CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N ### DETAILS This vulnerability is present in the Apple Image I/O API which is used for all image handling on OS X including rendering images in Preview. There exists a vulnerability in the parsing and handling of EXR images. A specially crafted EXR image file can lead to an out of bounds write and ultimately to remote code execution. OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications and is used in all motion pictures currently in production. EXR uses 16-bit floating-point color component values. Since the IEEE-754 floating-point specification does not define a 16-bit format, EXR created the "half" format. Half values have 1 sign bit, 5 exponent bits, and 10 mantissa bits. This information is then read in as rows of x and y coordinates to draw the image. The vulnerability arises when the values read in are not properly sanitized. EXR includes support for multiple different compression formats. B44 compression is used in this case and ultimately leads to the vulnerability. Below is the crash that happens when running the trigger: ``` (lldb) disass -s $pc libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell: -> 0x7fff8bd3f0e0 <+448>: vmovups ymm0, ymmword ptr [rsi - 0x20] 0x7fff8bd3f0e5 <+453>: mov r11, rdi 0x7fff8bd3f0e8 <+456>: sub rdi, 0x1 0x7fff8bd3f0ec <+460>: and rdi, -0x20 0x7fff8bd3f0f0 <+464>: mov rcx, r11 0x7fff8bd3f0f3 <+467>: sub rcx, rdi 0x7fff8bd3f0f6 <+470>: sub rsi, rcx 0x7fff8bd3f0f9 <+473>: sub rdx, rcx (lldb) register read General Purpose Registers: rax = 0x000000a111951000 rbx = 0x000000a111951000 rcx = 0x00007fb3c9fd26e0 rdx = 0xffffffff00000028 rdi = 0x000000a011951028 rsi = 0x000000001194f028 rbp = 0x0000700000116cb0 rsp = 0x0000700000116cb0 r8 = 0x0000000000000000 r9 = 0x0000000000000004 r10 = 0x00007fb3c9fd276c r11 = 0x000000a000002000 r12 = 0x0000000000000024 r13 = 0x0000000000000000 r14 = 0xffffffff00000028 r15 = 0xffffffff80000014 rip = 0x00007fff8bd3f0e0 libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell + 448 rflags = 0x0000000000010282 cs = 0x000000000000002b fs = 0x0000000000000000 gs = 0x0000000000000000 (lldb) bt * thread #10: tid = 0x2443c3c3, 0x00007fff8bd3f0e0 libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell + 448, stop reason = EXC_BAD_ACCESS (code=1, address=0x1194f008) * frame #0: 0x00007fff8bd3f0e0 libsystem_platform.dylib`_platform_memmove$VARIANT$Haswell + 448 frame #1: 0x00000001115cf1c2 libOpenEXR.dylib`Imf_2_2::B44Compressor::uncompress(char const*, int, Imath_2_2::Box<Imath_2_2::Vec2<int> >, char const*&) + 2430 frame #2: 0x00000001115cf2c8 libOpenEXR.dylib`Imf_2_2::B44Compressor::uncompressTile(char const*, int, Imath_2_2::Box<Imath_2_2::Vec2<int> >, char const*&) + 26 frame #3: 0x00000001115c2ee1 libOpenEXR.dylib`Imf_2_2::(anonymous namespace)::TileBufferTask::execute() + 209 frame #4: 0x00000001116308ce libOpenEXR.dylib`IlmThread_2_2::(anonymous namespace)::WorkerThread::run() + 162 frame #5: 0x00007fff9117699d libsystem_pthread.dylib`_pthread_body + 131 frame #6: 0x00007fff9117691a libsystem_pthread.dylib`_pthread_start + 168 frame #7: 0x00007fff91174351 libsystem_pthread.dylib`thread_start + 13 ``` And running the trigger again except with guard malloc enabled this time shows us some interesting output: ``` GuardMalloc[Preview-98952]: Attempting excessively large memory allocation: 687194773760 bytes GuardMalloc[Preview-98952]: If you really wanted to allocate so much memory, launch your executable with the environment variable MALLOC_PERMIT_INSANE_REQUESTS set to any value to circumvent this check. GuardMalloc[Preview-98952]: Explicitly trapping into debugger!!! ``` The large malloc is caused by a user controlled value for the size of the compressed B44 data. This pointer ultimately gets stored in an int despite the fact that it is the size of long. This ultimately causes truncation of the malloced value leading to an out of bounds access. This is a direct memcpy of user controlled data into an out of bounds buffer and could be leveraged to gain full remote code execution. ### CRASH INFORMATION ``` Crashed thread log = 0 libsystem_platform.dylib 0x00007fff8bd3f0e0 _platform_memmove$VARIANT$Haswell + 448 1 libOpenEXR.dylib 0x0000000110f7b1c2 Imf_2_2::B44Compressor::uncompress(char const*, int, Imath_2_2::Box<Imath_2_2::Vec2<int> >, char const*&) + 2430 2 libOpenEXR.dylib 0x0000000110f7b2c8 Imf_2_2::B44Compressor::uncompressTile(char const*, int, Imath_2_2::Box<Imath_2_2::Vec2<int> >, char const*&) + 26 3 libOpenEXR.dylib 0x0000000110f6eee1 Imf_2_2::(anonymous namespace)::TileBufferTask::execute() + 209 4 libOpenEXR.dylib 0x0000000110fdc8ce IlmThread_2_2::(anonymous namespace)::WorkerThread::run() + 162 5 libsystem_pthread.dylib 0x00007fff9117699d _pthread_body + 131 6 libsystem_pthread.dylib 0x00007fff9117691a _pthread_start + 168 7 libsystem_pthread.dylib 0x00007fff91174351 thread_start + 13 --- exception=EXC_BAD_ACCESS:signal=11:is_exploitable=yes:instruction_disassembly=.byte 0xc5 #bad opcode:instruction_address=0x00007fff8bd3f0e0:access_type=unknown:access_address=0x00000000118e8008: Crash accessing invalid address. Consider running it again with libgmalloc(3) to see if the log changes. ``` ### TIMELINE * 2016-05-16 - Vendor Disclosure * 2016-07-18 - Public Release
idSSV:96728
last seen2017-11-19
modified2017-10-17
published2017-10-17
reporterRoot
titleApple Image I/O EXR Compression Remote Code Execution Vulnerability(CVE-2016-4630)

Talos

idTALOS-2016-0181
last seen2019-05-29
published2016-07-18
reporterTalos Intelligence
sourcehttp://www.talosintelligence.com/vulnerability_reports/TALOS-2016-0181
titleApple Image I/O EXR Compression Remote Code Execution Vulnerability