git-annex/Remote
Joey Hess df11e54788
avoid the dashed ssh hostname class of security holes
Security fix: Disallow hostname starting with a dash, which would get
passed to ssh and be treated an option. This could be used by an attacker
who provides a crafted ssh url (for eg a git remote) to execute arbitrary
code via ssh -oProxyCommand.

No CVE has yet been assigned for this hole.
The same class of security hole recently affected git itself,
CVE-2017-1000117.

Method: Identified all places where ssh is run, by git grep '"ssh"'
Converted them all to use a SshHost, if they did not already, for
specifying the hostname.

SshHost was made a data type with a smart constructor, which rejects
hostnames starting with '-'.

Note that git-annex already contains extensive use of Utility.SafeCommand,
which fixes a similar class of problem where a filename starting with a
dash gets passed to a program which treats it as an option.

This commit was sponsored by Jochen Bartl on Patreon.
2017-08-17 22:11:31 -04:00
..
Directory remove 163 lines of code without changing anything except imports 2016-01-20 16:36:33 -04:00
External external: nice error message for keys with spaces in their name 2017-08-17 16:18:34 -04:00
Helper avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
Rsync adeiu, MissingH 2017-05-16 01:03:52 -04:00
WebDAV adeiu, MissingH 2017-05-16 01:03:52 -04:00
BitTorrent.hs Some optimisations to string splitting code. 2017-01-31 19:06:22 -04:00
Bup.hs Support GIT_SSH and GIT_SSH_COMMAND 2017-03-17 16:20:37 -04:00
Ddar.hs avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
Directory.hs add SetupStage parameter to RemoteType.setup 2017-02-07 14:55:58 -04:00
External.hs external: nice error message for keys with spaces in their name 2017-08-17 16:18:34 -04:00
GCrypt.hs avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
Git.hs add annex-ignore-command and annex-sync-command configs 2017-08-17 13:54:14 -04:00
Glacier.hs add SetupStage parameter to RemoteType.setup 2017-02-07 14:55:58 -04:00
Hook.hs add SetupStage parameter to RemoteType.setup 2017-02-07 14:55:58 -04:00
List.hs stub Remote.P2P 2016-12-06 12:27:58 -04:00
P2P.hs de-Maybe remoteGitConfig 2017-05-11 16:05:01 -04:00
Rsync.hs avoid the dashed ssh hostname class of security holes 2017-08-17 22:11:31 -04:00
S3.hs fix build with old http-client versions 2017-08-17 11:00:48 -04:00
Tahoe.hs add SetupStage parameter to RemoteType.setup 2017-02-07 14:55:58 -04:00
Web.hs Avoid backtraces on expected failures when built with ghc 8; only use backtraces for unexpected errors. 2016-11-15 21:29:54 -04:00
WebDAV.hs add SetupStage parameter to RemoteType.setup 2017-02-07 14:55:58 -04:00