Lucene search
K

MikroTik RouterOS HTTP Server Arbitrary Write RCE (ChimayRed)

🗓️ 01 May 2017 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 1164 Views

MikroTik RouterOS HTTP Server Arbitrary Write RCE (ChimayRed) vulnerability allows remote attackers to execute arbitrary code or cause a denial of service via specially crafted POST request

Refs
Code
#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(99763);
  script_version("1.6");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_name(english:"MikroTik RouterOS HTTP Server Arbitrary Write RCE (ChimayRed)");

  script_set_attribute(attribute:"synopsis", value:
"The remote host is affected by a remote code execution vulnerability.");
  script_set_attribute(attribute:"description", value:
"The MikroTik RouterOS software running on the remote host is affected
by a flaw in its HTTP web server process due to improper validation of
user-supplied input. An unauthenticated, remote attacker can exploit
this, via a specially crafted POST request, to write data to an
arbitrary location within the web server process, resulting in a
denial of service condition or the execution of arbitrary code.

Note that this vulnerability is reportedly part of the ChimayRed
exploit from the Vault 7 leaks.");
  script_set_attribute(attribute:"see_also", value:"https://mikrotik.com/download/changelogs/#tab-tree_3");
  script_set_attribute(attribute:"solution", value:
"Upgrade to MikroTik RouterOS version 6.38.5 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  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:N/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"in_the_news", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2017/03/09");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/03/09");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/05/01");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:mikrotik:routeros");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"Misc.");

  script_copyright(english:"This script is Copyright (C) 2017-2022 Tenable Network Security, Inc.");

  script_dependencies("mikrotik_detect.nasl");
  script_require_keys("MikroTik/RouterOS/Version");
  script_require_ports("Services/www", 80);

  exit(0);
}

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

appname = "MikroTik RouterOS";

# version should always be available if the web interface is up
version = get_kb_item_or_exit("MikroTik/RouterOS/Version");
port = get_http_port(default:80, embedded:TRUE, dont_exit:FALSE);
get_kb_item_or_exit("Services/www/" + port + "/embedded");

# connect to the server
soc = open_sock_tcp(port);
if (!soc) audit(AUDIT_SOCK_FAIL, port, appname);

# If unpatched the server will accept any content length. It
# will then write the provided data at (stack_ptr - length).
# A patched server restricts the acceptable size in the
# content length field. The content length we send here is
# large enough to generate an immediate response from a
# patched server but small enough not to crash an unpatched server.
request = 'POST /scep/nessus?operation=PKIOperation HTTP/1.1\r\n' +
  'Host: ' + get_host_ip() + ':' + port + '\r\n' +
  'Content-Type: application/x-pki-message\r\n' +
  'Content-Length: 16384\r\n' +
  '\r\n' +
  'AAAA';
send(socket:soc, data:request);

# An unpatched server won't respond at all. A patched server
# will respond with a 200 OK.
resp = recv(socket:soc, length:1024);
close(soc);

if (!isnull(resp))
{
  audit(AUDIT_INST_VER_NOT_VULN, appname, version);
}

report =
  '\nNessus has determined the server doesn\'t sufficiently\n' +
  'validate the SCEP server content length field.\n';
security_report_v4(port:port, severity:SECURITY_HOLE, extra:report);

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

11 Apr 2022 00:00Current
6.1Medium risk
Vulners AI Score6.1
1164