Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow - Nessus

Critical   Plugin ID: 12294

This page contains detailed information about the Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 12294
Name: Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow
Filename: squid_ntlm.nasl
Vulnerability Published: 2004-06-09
This Plugin Published: 2004-06-30
Last Modification Time: 2022-04-11
Plugin Version: 1.29
Plugin Type: remote
Plugin Family: Firewalls
Dependencies: find_service1.nasl, proxy_use.nasl

Vulnerability Information


Severity: Critical
Vulnerability Published: 2004-06-09
Patch Published: 2004-06-07
CVE [?]: CVE-2004-0541
CPE [?]: cpe:/a:squid-cache:squid

Synopsis

The remote service is affected by a remote code execution vulnerability.

Description

The remote server is affected by a remote code execution vulnerability in the Squid Internet Object Cache server due to a failure to test the length of the user-supplied LanMan hash value in the ntlm_check_auth() function in libntlmssp.c. An unauthenticated, remote attacker can exploit this, via a specially crafted request, to cause a stack-based buffer overflow, resulting in the execution of arbitrary code.

Note that Squid 2.5*-STABLE and 3.*-PRE are reportedly vulnerable.

Solution

Apply the relevant patch or upgrade to the latest version.

Public Exploits


Target Network Port(s): 3128, 8080
Target Asset(s): Services/http_proxy
Exploit Available: True (Metasploit Framework, Exploit-DB)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow vulnerability:

  1. Metasploit: exploit/linux/proxy/squid_ntlm_authenticate
    [Squid NTLM Authenticate Overflow]
  2. Exploit-DB: exploits/multiple/remote/9951.rb
    [EDB-9951: Squid 2.5.x/3.x - NTLM Buffer Overflow (Metasploit)]
  3. Exploit-DB: exploits/linux/remote/16847.rb
    [EDB-16847: Squid - NTLM (Authenticated) Overflow (Metasploit)]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2004-0541
CVSS V2 Vector: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.3 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:9.8 (Critical)
Impact Subscore:5.9
Exploitability Subscore:3.9
CVSS Temporal Score:9.1 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.1 (Critical)

Go back to menu.

Plugin Source


This is the squid_ntlm.nasl nessus plugin source code. This script is Copyright (C) 2004-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

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

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

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

  script_cve_id("CVE-2004-0541");
  script_bugtraq_id(10500);

  script_name(english:"Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow");

  script_set_attribute(attribute:"synopsis", value:
"The remote service is affected by a remote code execution
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote server is affected by a remote code execution vulnerability
in the Squid Internet Object Cache server due to a failure to test the
length of the user-supplied LanMan hash value in the ntlm_check_auth()
function in libntlmssp.c. An unauthenticated, remote attacker can
exploit this, via a specially crafted request, to cause a stack-based
buffer overflow, resulting in the execution of arbitrary code.

Note that Squid 2.5*-STABLE and 3.*-PRE are reportedly vulnerable.");
  # https://labs.idefense.com/verisign/intelligence/2009/vulnerabilities/display.php?id=107
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?7990c203");
  script_set_attribute(attribute:"solution", value:
"Apply the relevant patch or upgrade to the latest version.");
  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:F/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:F/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2004-0541");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Squid NTLM Authenticate Overflow');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2004/06/09");
  script_set_attribute(attribute:"patch_publication_date", value:"2004/06/07");
  script_set_attribute(attribute:"plugin_publication_date", value:"2004/06/30");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:squid-cache:squid");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_MIXED_ATTACK);
  script_family(english:"Firewalls");

  script_copyright(english:"This script is Copyright (C) 2004-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("find_service1.nasl", "proxy_use.nasl");
  script_require_ports("Services/http_proxy", 8080, 3128);

  exit(0);
}


# start script

# Keep the old API for that test
include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http_func.inc");

port = get_service(svc:"http_proxy", default:3128, exit_on_fail:TRUE);

soc = open_sock_tcp(port);
if (!soc) audit(AUDIT_SOCK_FAIL, port);

# up to 25 chars won't overwrite any mem in SQUID NTLM helper auth
malhost = string("http://www.", rand() % 65536, "nessus.test/");
malreq = string("GET ", malhost, " HTTP/1.1\r\nHost: ", malhost, "\r\n");
malreq += string("Authorization: NTLM ", crap(20), "=\r\n\r\n");

send(socket:soc, data:malreq);
r = http_recv(socket:soc);
close(soc);

if (!r) audit(AUDIT_RESP_NOT, port);

if (safe_checks())
{
  if (!egrep(string:r, pattern:"^Server: [Ss]quid")) audit(AUDIT_NOT_DETECT, "Squid", port);

  if (egrep(string:r, pattern:"^Server: [Ss]quid/(2\.5\.STABLE[0-5]([^0-9]|$)|3\.0\.PRE|2\.[0-4]\.)") )
  {
    mymsg =  string("According to its version number, the remote SQUID Proxy\n");
    mymsg += string("may be affected by a remote buffer overflow in its NTLM\n");
    mymsg += string("authentication component, if enabled. Run Nessus without safe\n");
    mymsg += string("checks to actually test the overflow.\n");
    security_hole(port:port, extra:mymsg);
    exit(0);
  }
  else audit(AUDIT_LISTEN_NOT_VULN, "Squid", port);
}
else
{
  if (report_paranoia < 2)
  {
    if (!egrep(string:r, pattern:"^Server: [Ss]quid")) audit(AUDIT_NOT_DETECT, "Squid", port);
  }

  soc = open_sock_tcp(port);
  if (!soc) audit(AUDIT_SOCK_FAIL, port);

  malhost = string("http://www.", rand() % 65536, "nessus.test/");
  malreq = string("GET ", malhost, " HTTP/1.1\r\nHost: ", malhost, "\r\n");
  malreq += string("Authorization: NTLM TlRMTVNTUAABAAAAl4II4AAA", crap(data:"A", length:1024), "=\r\n\r\n");

  send(socket:soc, data:malreq);
  r = http_recv(socket:soc);
  close(soc);

  if (! r)
  {
    security_hole(port);
    exit(0);
  }
  else audit(AUDIT_LISTEN_NOT_VULN, "Squid", port);
}

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/squid_ntlm.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\squid_ntlm.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/squid_ntlm.nasl

Go back to menu.

How to Run


Here is how to run the Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Firewalls plugin family.
  6. On the right side table select Squid ntlm_check_auth Function NTLM Authentication Helper Password Handling Remote Overflow plugin ID 12294.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl squid_ntlm.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a squid_ntlm.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - squid_ntlm.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state squid_ntlm.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 36518 - FreeBSD : Buffer overflow in Squid NTLM authentication helper (6f955451-ba54-11d8-b88c-000d610a3b12)
  • 14524 - GLSA-200406-13 : Squid: NTLM authentication helper buffer overflow
  • 14158 - Mandrake Linux Security Advisory : squid (MDKSA-2004:059)
  • 12504 - RHEL 3 : squid (RHSA-2004:242)
  • 13832 - SuSE-SA:2004:016: squid
  • 119726 - Squid 3.1.12.1 <= 3.1.x <= 3.1.23 / 3.2.0.4 <= 3.2.x / 3.3.x / 3.4.x / 3.5.x <= 3.5.28 / 4.x < 4.4 Cross-Site Scripting Vulnerability (SQUID-2018:4)
  • 69042 - Squid 3.2.x < 3.2.13 / 3.3.x < 3.3.8 Port Handling DoS
  • 89080 - Squid 3.x < 3.5.15 / 4.x < 4.0.7 Multiple DoS
  • 148111 - Squid 2.x < 4.14 / 5.x < 5.0.5 (SQUID-2020:11)
  • 35620 - Squid < 2.7.STABLE6 / 3.0.STABLE13 / 3.1.0.5 HTTP Version Number Request Remote DoS
  • 104998 - Check Point Gaia Operating Remote Heap Buffer Overflow (sk104443)(GHOST)
  • 125886 - Fortinet FortiOS <= 5.4, 5.6.x < 5.6.8, 6.0.x < 6.0.5 SSL VPN Buffer Overflow (FG-IR-18-387)
  • 125887 - Fortinet FortiOS < 5.6.11, 6.0.x < 6.0.5 SSL VPN Heap Buffer Overflow (FG-IR-18-388)
  • 11575 - Kerio Personal Firewall Administrator Authentication Handshake Packet Remote Buffer Overflow
  • 33104 - SecurityGateway < 1.0.2 Administration Interface username Field Remote Overflow
  • 141474 - SonicWall SonicOS Buffer Overflow Vulnerability

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file squid_ntlm.nasl version 1.29. For more plugins, visit the Nessus Plugin Library.

Go back to menu.