Vulnerabilities > CVE-2019-7251 - Integer Overflow or Wraparound vulnerability in Digium Asterisk

047910
CVSS 4.0 - MEDIUM
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
SINGLE
Confidentiality impact
NONE
Integrity impact
NONE
Availability impact
PARTIAL
network
low complexity
digium
CWE-190
nessus

Summary

An Integer Signedness issue (for a return code) in the res_pjsip_sdp_rtp module in Digium Asterisk versions 15.7.1 and earlier and 16.1.1 and earlier allows remote authenticated users to crash Asterisk via a specially crafted SDP protocol violation.

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Forced Integer Overflow
    This attack forces an integer variable to go out of range. The integer variable is often used as an offset such as size of memory allocation or similarly. The attacker would typically control the value of such variable and try to get it out of range. For instance the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value which can lead to unexpected behavior. At worst the attacker can execute arbitrary code.

Nessus

  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_BE0E38173BFE11E99CD6001999F8D30B.NASL
    descriptionThe Asterisk project reports : When Asterisk makes an outgoing call, a very specific SDP protocol violation by the remote party can cause Asterisk to crash.
    last seen2020-06-01
    modified2020-06-02
    plugin id122572
    published2019-03-04
    reporterThis script is Copyright (C) 2019-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/122572
    titleFreeBSD : asterisk -- Remote crash vulnerability with SDP protocol violation (be0e3817-3bfe-11e9-9cd6-001999f8d30b)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    # The descriptive text and package checks in this plugin were  
    # extracted from the FreeBSD VuXML database :
    #
    # Copyright 2003-2020 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(122572);
      script_version("1.3");
      script_cvs_date("Date: 2020/02/07");
    
      script_cve_id("CVE-2019-7251");
    
      script_name(english:"FreeBSD : asterisk -- Remote crash vulnerability with SDP protocol violation (be0e3817-3bfe-11e9-9cd6-001999f8d30b)");
      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:
    "The Asterisk project reports :
    
    When Asterisk makes an outgoing call, a very specific SDP protocol
    violation by the remote party can cause Asterisk to crash."
      );
      script_set_attribute(
        attribute:"see_also",
        value:"https://downloads.asterisk.org/pub/security/AST-2019-001.html"
      );
      # https://vuxml.freebsd.org/freebsd/be0e3817-3bfe-11e9-9cd6-001999f8d30b.html
      script_set_attribute(
        attribute:"see_also",
        value:"http://www.nessus.org/u?9565e484"
      );
      script_set_attribute(attribute:"solution", value:"Update the affected packages.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:N/I:N/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:L/UI:N/S:U/C:N/I:N/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:freebsd:freebsd:asterisk15");
      script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:asterisk16");
      script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2019/01/24");
      script_set_attribute(attribute:"patch_publication_date", value:"2019/03/01");
      script_set_attribute(attribute:"plugin_publication_date", value:"2019/03/04");
      script_set_attribute(attribute:"generated_plugin", value:"current");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_copyright(english:"This script is Copyright (C) 2019-2020 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:"asterisk15<15.7.2")) flag++;
    if (pkg_test(save_report:TRUE, pkg:"asterisk16<16.2.1")) flag++;
    
    if (flag)
    {
      if (report_verbosity > 0) security_warning(port:0, extra:pkg_report_get());
      else security_warning(0);
      exit(0);
    }
    else audit(AUDIT_HOST_NOT, "affected");
    
  • NASL familyMisc.
    NASL idASTERISK_AST_2019_001.NASL
    descriptionAccording to its SIP banner, the version of Asterisk running on the remote host is 15.x prior to 15.7.2, 16.x prior to 16.2.1. It is therefore, affected by an error related to handling SDP traffic and RTP negotiation described in AST-2019-001. This error allows denial of service attacks. Note that Nessus has not tested for these issues but has instead relied only on the application
    last seen2020-06-01
    modified2020-06-02
    plugin id122670
    published2019-03-08
    reporterThis script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/122670
    titleAsterisk 15.x < 15.7.2 / 16.x < 16.2.1 DoS (AST-2019-001)
    code
    #
    # (C) Tenable Network Security, Inc.
    #
    
    include("compat.inc");
    
    if (description)
    {
      script_id(122670);
      script_version("1.2");
      script_cvs_date("Date: 2019/10/31 15:18:51");
    
      script_cve_id("CVE-2019-7251");
      script_bugtraq_id(107212);
    
      script_name(english:"Asterisk 15.x < 15.7.2 / 16.x < 16.2.1 DoS (AST-2019-001)");
      script_summary(english:"Checks the version in the SIP banner.");
    
      script_set_attribute(attribute:"synopsis", value:
    "A telephony application running on the remote host is affected by a
    denial of service vulnerability.");
      script_set_attribute(attribute:"description", value:
    "According to its SIP banner, the version of Asterisk running on the
    remote host is 15.x prior to 15.7.2, 16.x prior to 16.2.1. It is
    therefore, affected by an error related to handling SDP traffic and
    RTP negotiation described in AST-2019-001. This error allows denial
    of service attacks.
    
    Note that Nessus has not tested for these issues but has instead
    relied only on the application's self-reported version number.");
      script_set_attribute(attribute:"see_also", value:"http://downloads.asterisk.org/pub/security/AST-2019-001.html");
      script_set_attribute(attribute:"solution", value:
    "Upgrade to Asterisk version 15.7.2 / 16.2.1 or later.");
      script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:N/I:N/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:L/UI:N/S:U/C:N/I:N/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-2019-7251");
    
      script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
    
      script_set_attribute(attribute:"vuln_publication_date", value:"2019/01/24");
      script_set_attribute(attribute:"patch_publication_date", value:"2019/01/24");
      script_set_attribute(attribute:"plugin_publication_date", value:"2019/03/08");
    
      script_set_attribute(attribute:"potential_vulnerability", value:"true");
      script_set_attribute(attribute:"plugin_type", value:"remote");
      script_set_attribute(attribute:"cpe", value:"cpe:/a:digium:asterisk");
      script_end_attributes();
    
      script_category(ACT_GATHER_INFO);
      script_family(english:"Misc.");
    
      script_copyright(english:"This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
    
      script_dependencies("asterisk_detection.nasl");
      script_require_keys("asterisk/sip_detected", "Settings/ParanoidReport");
    
      exit(0);
    }
    
    include("audit.inc");
    include("global_settings.inc");
    include("misc_func.inc");
    include("lists.inc");
    
    get_kb_item_or_exit("asterisk/sip_detected");
    
    asterisk_kbs = get_kb_list_or_exit("sip/asterisk/*/version");
    
    if (report_paranoia < 2) audit(AUDIT_PARANOID);
    
    is_vuln = FALSE;
    not_vuln_installs = make_list();
    errors = make_list();
    
    foreach kb_name (keys(asterisk_kbs))
    {
      vulnerable = 0;
    
      matches = pregmatch(pattern:"/(udp|tcp)/([0-9]+)/version", string:kb_name);
      if (isnull(matches))
      {
        collib::push("Unexpected error parsing port number from '"+kb_name+"'.", errors);
        continue;
      }
    
      proto = matches[1];
      port  = matches[2];
      version = asterisk_kbs[kb_name];
    
      if (version == 'unknown')
      {
        collib::push("Unable to obtain version of installation on " + proto + "/" + port + ".", errors);
        continue;
      }
    
      banner = get_kb_item("sip/asterisk/" + proto + "/" + port + "/source");
      if (!banner)
      {
        # We have version but banner is missing;
        # log error and use in version-check though.
        collib::push("KB item 'sip/asterisk/" + proto + "/" + port + "/source' is missing.", errors);
        banner = 'unknown';
      }
    
      if (version =~ "^15([^0-9])" && "cert" >!< tolower(version))
      {
        fixed = "15.7.2";
        vulnerable = ver_compare(ver:version, fix:fixed, app:"asterisk");
      }
      else if (version =~ "^16([^0-9])" && "cert" >!< tolower(version))
      {
        fixed = "16.2.1";
        vulnerable = ver_compare(ver:version, fix:fixed, app:"asterisk");
      }
    
      if (vulnerable < 0)
      {
        is_vuln = TRUE;
        report =
            '\n  Version source    : ' + banner +
            '\n  Installed version : ' + version +
            '\n  Fixed version     : ' + fixed +
            '\n';
          security_report_v4(severity:SECURITY_WARNING, port:port, proto:proto, extra:report);
      }
      else collib::push(version + " on port " + proto + "/" + port, not_vuln_installs);
    }
    
    if (max_index(errors))
    {
      if (max_index(errors) == 1) errmsg = errors[0];
      else errmsg = 'Errors were encountered verifying installations : \n  ' + join(errors, sep:'\n  ');
    
      exit(1, errmsg);
    }
    else
    {
      installs = max_index(not_vuln_installs);
      if (installs == 0)
      {
        if (is_vuln) exit(0);
        else audit(AUDIT_NOT_INST, "Asterisk");
      }
      else audit(AUDIT_INST_VER_NOT_VULN, "Asterisk", not_vuln_installs);
    }