F5 Networks BIG-IP : TMM buffer-overflow vulnerability (K56715231)

2021-03-10T00:00:00
ID F5_BIGIP_SOL56715231.NASL
Type nessus
Reporter This script is Copyright (C) 2021 and is owned by Tenable, Inc. or an Affiliate thereof.
Modified 2021-07-08T00:00:00

Description

Undisclosed requests to a virtual server may be incorrectly handled by Traffic Management Microkernel (TMM) URI normalization, which may trigger a buffer overflow, resulting in a DoS attack. In certain situations, it theoretically may allow bypass of URL based access control or remote code execution (RCE). (CVE-2021-22991)

Note : This vulnerability is mostly exposed on the data plane via virtual server with the vulnerable configuration; however, it can also be exposed on the control plane via URL Categorization lookup command invoked by an authenticated user with TMOS Shell ( tmsh ) access. Exploitation can lead to complete system compromise.

Impact

This vulnerability affects systems with one or more of the following configurations.

Affected configurations

BIG-IP APM

This vulnerability affects avirtual server associated with a BIG-IPAPMprofile.All BIG-IP APM use cases are vulnerable.

BIG-IP ASM

This vulnerability affects only BIG-IP ASMRisk Engine use cases. BIG-IP ASM Risk Engine is currently available only to Early Access customersand requires a special license.

BIG-IP PEM

This vulnerability affects BIG-IP PEM systems that use the following :

URL filtering with Websense database license activated

One or more virtual servers that perform URL categorization and use one of the following: An iRule

A local traffic policy

A BIG-IP PEM policy

Secure Web Gateway

This vulnerability affects allF5 Secure Web Gatewayuse cases. URL categorization is fundamental to the operation of theSecure Web Gateway. TheSecure Web Gatewayrequires a separate subscription.

SSL Orchestrator

This vulnerability affects all systems that usethe SSL OrchestratorCategorization macro.

BIG-IP (all modules)

This vulnerability affects all BIG-IP system modules that use one or more of the following configurations :

URL filtering with Websense database license activated

A virtual server associated with an HTTP profile and a local traffic policy witha rule condition that has the following options enabled: HTTP URI or HTTP Referer and Use normalized URI Note : The Use normalized URI option is disabled by default.

For more information about HTTP profiles and local traffic policy rules, refer toK40243113: Overview of the HTTP profileandK04597703: Overview of the Local Traffic Policies feature (12.1.0 and later)respectively.

For example, in the following configuration,the local traffic policy is vulnerable :

ltm policy /Common/K56715231 { requires { http http-connect } rules { VULN_RULE01 { conditions { 0 { http-uri proxy-connect normalized values { VULN_URI_STRING } } } } VULN_RULE02 { conditions { 0 { http-referer proxy-connect normalized values { VULN_REF_STRING } } } ordinal 1 } } strategy /Common/first-match }

A virtual server associated with an HTTP profile and an iRule that uses any of the following commands with the -normalized switch: HTTP::uri

HTTP::query

HTTP::path

For example, the following iRule is vulnerable :

when HTTP_REQUEST { if { ([HTTP::uri -normalized] starts_with '/vulnerable')} { log local0.error 'K56715231 URI example' } elseif { ([HTTP::query -normalized] starts_with '/vulnerable')} { log local0.error 'K56715231 Query example' } elseif { ([HTTP::path

-normalized] starts_with '/vulnerable')} { log local0.error 'K56715231 Path example' } }

Identify whether your system has URL filtering with Websense database license activated

You can identify whether yourBIG-IP system has URL filtering with Websense database license activated by checking the /var/log/tmm log file during restart. When you have this feature, you see a log entry similar to the following :

tmm:<13> Apr 8 02:34:05 bigip.local notice URLCAT_LIB: urlcat_websense_license_callback/984: WEBSENSE DB is licensed

This log entry only displays when you set the BIG-IP system database variable tmm.lib.urlcat.log.level to Debug .

Note : If you believe your system is compromised, refer toK11438344: Considerations and guidance when you suspect a security compromise on a BIG-IP system.

                                        
                                            #%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from F5 Networks BIG-IP Solution K56715231.
#
# The text description of this plugin is (C) F5 Networks.
#

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

if (description)
{
  script_id(147623);
  script_version("1.7");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/07/08");

  script_cve_id("CVE-2021-22991");

  script_name(english:"F5 Networks BIG-IP : TMM buffer-overflow vulnerability (K56715231)");
  script_summary(english:"Checks the BIG-IP version.");

  script_set_attribute(
    attribute:"synopsis",
    value:"The remote device is missing a vendor-supplied security patch."
  );
  script_set_attribute(
    attribute:"description",
    value:
"Undisclosed requests to a virtual server may be incorrectly handled by
Traffic Management Microkernel (TMM) URI normalization, which may
trigger a buffer overflow, resulting in a DoS attack. In certain
situations, it theoretically may allow bypass of URL based access
control or remote code execution (RCE). (CVE-2021-22991)

Note : This vulnerability is mostly exposed on the data plane via
virtual server with the vulnerable configuration; however, it can also
be exposed on the control plane via URL Categorization lookup command
invoked by an authenticated user with TMOS Shell ( tmsh ) access.
Exploitation can lead to complete system compromise.

Impact

This vulnerability affects systems with one or more of the following
configurations.

Affected configurations

BIG-IP APM

This vulnerability affects avirtual server associated with a
BIG-IPAPMprofile.All BIG-IP APM use cases are vulnerable.

BIG-IP ASM

This vulnerability affects only BIG-IP ASMRisk Engine use cases.
BIG-IP ASM Risk Engine is currently available only to Early Access
customersand requires a special license.

BIG-IP PEM

This vulnerability affects BIG-IP PEM systems that use the following :

URL filtering with Websense database license activated

One or more virtual servers that perform URL categorization and use
one of the following: An iRule

A local traffic policy

A BIG-IP PEM policy

Secure Web Gateway

This vulnerability affects allF5 Secure Web Gatewayuse cases. URL
categorization is fundamental to the operation of theSecure Web
Gateway. TheSecure Web Gatewayrequires a separate subscription.

SSL Orchestrator

This vulnerability affects all systems that usethe SSL
OrchestratorCategorization macro.

BIG-IP (all modules)

This vulnerability affects all BIG-IP system modules that use one or
more of the following configurations :

URL filtering with Websense database license activated

A virtual server associated with an HTTP profile and a local traffic
policy witha rule condition that has the following options enabled:
HTTP URI or HTTP Referer and Use normalized URI Note : The Use
normalized URI option is disabled by default.

For more information about HTTP profiles and local traffic policy
rules, refer toK40243113: Overview of the HTTP profileandK04597703:
Overview of the Local Traffic Policies feature (12.1.0 and
later)respectively.

For example, in the following configuration,the local traffic policy
is vulnerable :

ltm policy /Common/K56715231 { requires { http http-connect } rules {
VULN_RULE01 { conditions { 0 { http-uri proxy-connect normalized
values { VULN_URI_STRING } } } } VULN_RULE02 { conditions { 0 {
http-referer proxy-connect normalized values { VULN_REF_STRING } } }
ordinal 1 } } strategy /Common/first-match }

A virtual server associated with an HTTP profile and an iRule that
uses any of the following commands with the -normalized switch:
HTTP::uri

HTTP::query

HTTP::path

For example, the following iRule is vulnerable :

when HTTP_REQUEST { if { ([HTTP::uri -normalized] starts_with
'/vulnerable')} { log local0.error 'K56715231 URI example' } elseif {
([HTTP::query -normalized] starts_with '/vulnerable')} { log
local0.error 'K56715231 Query example' } elseif { ([HTTP::path

-normalized] starts_with '/vulnerable')} { log local0.error 'K56715231
Path example' } }

Identify whether your system has URL filtering with Websense database
license activated

You can identify whether yourBIG-IP system has URL filtering with
Websense database license activated by checking the /var/log/tmm log
file during restart. When you have this feature, you see a log entry
similar to the following :

tmm:&lt;13&gt; Apr 8 02:34:05 bigip.local notice URLCAT_LIB:
urlcat_websense_license_callback/984: WEBSENSE DB is licensed

This log entry only displays when you set the BIG-IP system database
variable tmm.lib.urlcat.log.level to Debug .

Note : If you believe your system is compromised, refer toK11438344:
Considerations and guidance when you suspect a security compromise on
a BIG-IP system."
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://support.f5.com/csp/article/K04597703"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://support.f5.com/csp/article/K11438344"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://support.f5.com/csp/article/K40243113"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://support.f5.com/csp/article/K56715231"
  );
  script_set_attribute(
    attribute:"solution",
    value:
"Upgrade to one of the non-vulnerable versions listed in the F5
Solution K56715231."
  );
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:POC/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:P/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2021-22991");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_access_policy_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_advanced_firewall_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_application_acceleration_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_application_security_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_application_visibility_and_reporting");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_global_traffic_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_link_controller");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_local_traffic_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:f5:big-ip_policy_enforcement_manager");
  script_set_attribute(attribute:"cpe", value:"cpe:/h:f5:big-ip");

  script_set_attribute(attribute:"vuln_publication_date", value:"2021/03/31");
  script_set_attribute(attribute:"patch_publication_date", value:"2021/03/10");
  script_set_attribute(attribute:"plugin_publication_date", value:"2021/03/10");
  script_set_attribute(attribute:"generated_plugin", value:"current");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2021 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"F5 Networks Local Security Checks");

  script_dependencies("f5_bigip_detect.nbin");
  script_require_keys("Host/local_checks_enabled", "Host/BIG-IP/hotfix", "Host/BIG-IP/modules", "Host/BIG-IP/version", "Settings/ParanoidReport");

  exit(0);
}


include("f5_func.inc");

if ( ! get_kb_item("Host/local_checks_enabled") ) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
version = get_kb_item("Host/BIG-IP/version");
if ( ! version ) audit(AUDIT_OS_NOT, "F5 Networks BIG-IP");
if ( isnull(get_kb_item("Host/BIG-IP/hotfix")) ) audit(AUDIT_KB_MISSING, "Host/BIG-IP/hotfix");
if ( ! get_kb_item("Host/BIG-IP/modules") ) audit(AUDIT_KB_MISSING, "Host/BIG-IP/modules");

sol = "K56715231";
vmatrix = make_array();

if (report_paranoia &lt; 2) audit(AUDIT_PARANOID);

# AFM
vmatrix["AFM"] = make_array();
vmatrix["AFM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["AFM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# AM
vmatrix["AM"] = make_array();
vmatrix["AM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["AM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# APM
vmatrix["APM"] = make_array();
vmatrix["APM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["APM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# ASM
vmatrix["ASM"] = make_array();
vmatrix["ASM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["ASM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# AVR
vmatrix["AVR"] = make_array();
vmatrix["AVR"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["AVR"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# GTM
vmatrix["GTM"] = make_array();
vmatrix["GTM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["GTM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# LC
vmatrix["LC"] = make_array();
vmatrix["LC"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["LC"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# LTM
vmatrix["LTM"] = make_array();
vmatrix["LTM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["LTM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");

# PEM
vmatrix["PEM"] = make_array();
vmatrix["PEM"]["affected"  ] = make_list("16.0.0-16.0.1","15.1.0-15.1.2","14.1.0-14.1.3","13.1.0-13.1.3","12.1.0-12.1.5");
vmatrix["PEM"]["unaffected"] = make_list("16.1.0","16.0.1.1","15.1.2.1","14.1.4","13.1.3.6","12.1.5.3");


if (bigip_is_affected(vmatrix:vmatrix, sol:sol))
{
  if (report_verbosity &gt; 0) security_warning(port:0, extra:bigip_report_get());
  else security_warning(0);
  exit(0);
}
else
{
  tested = bigip_get_tested_modules();
  audit_extra = "For BIG-IP module(s) " + tested + ",";
  if (tested) audit(AUDIT_INST_VER_NOT_VULN, audit_extra, version);
  else audit(AUDIT_HOST_NOT, "running any of the affected modules");
}