Vulnerabilities > CVE-2015-7392 - Improper Restriction of Operations within the Bounds of a Memory Buffer vulnerability in Freeswitch 1.2/1.6.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
freeswitch
CWE-119
nessus

Summary

Heap-based buffer overflow in the parse_string function in libs/esl/src/esl_json.c in FreeSWITCH before 1.4.23 and 1.6.x before 1.6.2 allows remote attackers to execute arbitrary code via a trailing \u in a json string to cJSON_Parse.

Vulnerable Configurations

Part Description Count
Application
Freeswitch
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 familyMisc.
NASL idFREESWITCH_FS8160.NASL
descriptionThe remote FreeSWITCH server is prior to version 1.4.26 or 1.6.x prior to 1.6.5. It is, therefore, affected by a remote code execution vulnerability due to improper validation of user-supplied input to the parse_string() function in esl_json.c, switch_json.c, and ks_json.c. A remote attacker can exploit this, via a crafted JSON message, to cause a heap-based buffer overflow condition, resulting in a denial of service or the execution of arbitrary code.
last seen2020-06-01
modified2020-06-02
plugin id88696
published2016-02-11
reporterThis script is Copyright (C) 2016-2018 Tenable Network Security, Inc.
sourcehttps://www.tenable.com/plugins/nessus/88696
titleFreeSWITCH < 1.4.26 / 1.6.x < 1.6.5 JSON Parser RCE
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(88696);
  script_version("1.4");
  script_cvs_date("Date: 2018/07/11 17:09:26");

  script_cve_id("CVE-2015-7392", "CVE-2015-8311");
  script_bugtraq_id(76976);
  script_xref(name:"TRA", value:"TRA-2015-05");

  script_name(english:"FreeSWITCH < 1.4.26 / 1.6.x < 1.6.5 JSON Parser RCE");
  script_summary(english:"Checks the version of FreeSWITCH.");

  script_set_attribute(attribute:"synopsis", value:
"The remote FreeSWITCH server is affected by a remote code execution
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote FreeSWITCH server is prior to version 1.4.26 or 1.6.x prior
to 1.6.5. It is, therefore, affected by a remote code execution
vulnerability due to improper validation of user-supplied input to the
parse_string() function in esl_json.c, switch_json.c, and ks_json.c. A
remote attacker can exploit this, via a crafted JSON message, to cause
a heap-based buffer overflow condition, resulting in a denial of
service or the execution of arbitrary code.");
  script_set_attribute(attribute:"see_also", value:"https://freeswitch.org/jira/browse/FS-8160");
  script_set_attribute(attribute:"see_also", value:"https://www.tenable.com/security/research/tra-2015-05");
  script_set_attribute(attribute:"solution", value:
"Upgrade to FreeSWITCH version 1.4.26 / 1.6.5 or later.");
  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_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:"2015/09/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2015/11/24");
  script_set_attribute(attribute:"plugin_publication_date", value:"2016/02/11");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:freeswitch:freeswitch");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Misc.");
  script_copyright(english:"This script is Copyright (C) 2016-2018 Tenable Network Security, Inc.");

  script_dependencies("freeswitch_detection.nbin");
  script_require_keys("Settings/ParanoidReport", "sip/freeswitch/present");
  script_require_ports("Services/udp/sip", "Services/sip");

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");

appname = "FreeSWITCH";
get_kb_item_or_exit("sip/freeswitch/present");

if (report_paranoia < 2) audit(AUDIT_PARANOID);

errors = make_list();
udp_ports = get_kb_list("Services/udp/sip");
tcp_ports = get_kb_list("Services/sip");
if (isnull(tcp_ports) && isnull(udp_ports)) audit(AUDIT_NOT_INST, appname);

function is_vulnerable(version, commit, proto, port)
{
  local_var report = '';

  if (version == 'unknown')
  {
    errors = make_list(errors, "Unable to determine the FreeSWITCH version on " + proto + "/" + port + ".");
    return FALSE;
  }

  # the fix was pushed out in 1.6.5
  if (ver_compare(ver:version, fix:"1.6.5", strict:FALSE) < 0)
  {
    # freeswitch now maintains a 1.6 branch and a 1.4 branch. Determine
    # if we are looking at a 1.4 line
    if (ver_compare(ver:version, fix:"1.5", strict:FALSE) < 0)
    {
      if (ver_compare(ver:version, fix:"1.4.26", strict:FALSE) < 0)
      {
        report = 
          '\n  Installed version : ' + version + 
          '\n  Fixed version     : 1.4.26\n';
      }
    }
    else
    {
      report = 
        '\n  Installed version : ' + version +
        '\n  Fixed version     : 1.6.5\n';
    }
  }

  if (report != '')
  {
    if (report_verbosity > 0) security_hole(extra:report, port:port, proto:proto);
    else security_hole(port:port, proto:proto);
    return TRUE;
  }
  return FALSE;
}

is_vuln = FALSE;
if (!isnull(tcp_ports))
{
  foreach port (make_list(tcp_ports))
  {
    version = get_kb_item("sip/freeswitch/tcp/" + port + "/version");
    if (!version) continue;
    if (!isnull(version) && is_vulnerable(version:version, proto:"tcp", port:port)) is_vuln = TRUE;
  }
}
if (!isnull(udp_ports))
{
  foreach port (make_list(udp_ports))
  {
    version = get_kb_item("sip/freeswitch/udp/" + port + "/version");
    if (!version) continue;
    if (!isnull(version) && is_vulnerable(version:version, proto:"udp", port:port)) is_vuln = TRUE;
  }
}

if (max_index(errors))
{
  errmsg = 'Errors were encountered verifying installs : \n  ' + join(errors, sep:'\n  ');
  exit(1, errmsg);
} else if(!is_vuln) audit(AUDIT_INST_VER_NOT_VULN, appname);