Difference between revisions of "Scp"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 11: Line 11:
  
 
According to [[OpenSSH]] developers in April 2019 the scp protocol is outdated, inflexible and not readily fixed; they recommend the use of more modern protocols like <code>[[Secure file transfer program|sftp]]</code> and <code>[[rsync]]</code> for file transfer.<ref>{{cite web|url=https://www.openssh.com/txt/release-8.0|title=OpenSSH 8.0|work=OpenSSH Release Notes|date=17 April 2019}}</ref>
 
According to [[OpenSSH]] developers in April 2019 the scp protocol is outdated, inflexible and not readily fixed; they recommend the use of more modern protocols like <code>[[Secure file transfer program|sftp]]</code> and <code>[[rsync]]</code> for file transfer.<ref>{{cite web|url=https://www.openssh.com/txt/release-8.0|title=OpenSSH 8.0|work=OpenSSH Release Notes|date=17 April 2019}}</ref>
 +
 +
* scp(1): when receiving files, scp(1) could be become desynchronised
 +
  if a utimes(2) system call failed. This could allow file contents
 +
  to be interpreted as file metadata and thereby permit an adversary
 +
  to craft a file system that, when copied with scp(1) in a
 +
  configuration that caused utimes(2) to fail (e.g. under a SELinux
 +
  policy or syscall sandbox), transferred different file names and
 +
  contents to the actual file system layout.
 +
 +
  Exploitation of this is not likely as utimes(2) does not fail under
 +
  normal circumstances. Successful exploitation is not silent - the
 +
  output of scp(1) would show transfer errors followed by the actual
 +
  file(s) that were received.
 +
 +
  Finally, filenames returned from the peer are (since openssh-8.0)
 +
  matched against the user's requested destination, thereby
 +
  disallowing a successful exploit from writing files outside the
 +
  user's selected target glob (or directory, in the case of a
 +
  recursive transfer). This ensures that this attack can achieve no
 +
  more than a hostile peer is already able to achieve within the scp
 +
  protocol.
  
  

Revision as of 16:49, 27 May 2020

wikipedia:Secure copy (scp) is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. scp implements a progress bar to estimate transfers.

http://man7.org/linux/man-pages/man1/scp.1.html


scp USERNAME@SERVER:/tmp/FILE ./
USERNAME@SERVER's password:
Could not chdir to home directory /home/USERNAME: No such file or directory
protocol error: mtime.sec not present


According to OpenSSH developers in April 2019 the scp protocol is outdated, inflexible and not readily fixed; they recommend the use of more modern protocols like sftp and rsync for file transfer.[1]

* scp(1): when receiving files, scp(1) could be become desynchronised
  if a utimes(2) system call failed. This could allow file contents
  to be interpreted as file metadata and thereby permit an adversary
  to craft a file system that, when copied with scp(1) in a
  configuration that caused utimes(2) to fail (e.g. under a SELinux
  policy or syscall sandbox), transferred different file names and
  contents to the actual file system layout.
  Exploitation of this is not likely as utimes(2) does not fail under
  normal circumstances. Successful exploitation is not silent - the
  output of scp(1) would show transfer errors followed by the actual
  file(s) that were received.
  Finally, filenames returned from the peer are (since openssh-8.0)
  matched against the user's requested destination, thereby
  disallowing a successful exploit from writing files outside the
  user's selected target glob (or directory, in the case of a
  recursive transfer). This ensures that this attack can achieve no
  more than a hostile peer is already able to achieve within the scp
  protocol.


Activities

  1. Understand the differences between cp, scp and rsync: https://stackoverflow.com/questions/20244585/how-does-scp-differ-from-rsync
  2. Review security advisories related to scp: CVE-2019-6111[2] related to scp tool and protocol allowing to overwrite arbitrary files in the scp client target directory
  1. pv </dev/zero | ssh REMOTE_SERVER 'cat >/dev/null'


Related commands

See also

  • "OpenSSH 8.0". OpenSSH Release Notes. 17 April 2019.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
  • https://nvd.nist.gov/vuln/detail/CVE-2019-6111
  • Advertising: