Re:Critical security updates for Git, Subversion and Mercurial
by ekimekim on Friday August 11, 2017 @04:40PM
(#14994002)
> it can't depend on every ssh implementation understanding this
Indeed, from a comment[1] above:
> We discussed that, but it wasn't clear that doing so was portable. It works for OpenSSH. It doesn't for PuTTY. We don't know what other implementations people might have as `ssh` on their systems.
Re:Critical security updates for Git, Subversion and Mercurial
by numbsafari on Friday August 11, 2017 @09:25AM
(#14989391)
How is this any different than a SQL-injection attack?
Seems to me like git shouldn't be using the shell in order to invoke ssh at all.
Re:Critical security updates for Git, Subversion and Mercurial
by jjnoakes on Friday August 11, 2017 @09:31AM
(#14989444)
I haven't checked git, but even if git uses exec*() directly and skips the shell (which I suspect it does), the problem still exists.
The issue isn't one of shell quoting, but one of ssh treating the argument list ["ssh", "-oProxyCommand=something", "remote-cmd"] not as ["ssh", hostname, command] but as ["ssh", option, hostname].
Re:Critical security updates for Git, Subversion and Mercurial
by deckar01 on Friday August 11, 2017 @09:37AM
(#14989495)
There are C libraries for SSH, like libssh, that would avoid these type of vulnerabilities.
Re:Critical security updates for Git, Subversion and Mercurial
by peff on Friday August 11, 2017 @09:50AM
(#14989606)
One downside of libraries like libssh is that they don't behave the same way as your regular ssh command. So thing you've configured like host aliases, proxy commands, etc, don't just work out of the box (and in some cases may not even be supported at all).
Re:Critical security updates for Git, Subversion and Mercurial
by deckar01 on Friday August 11, 2017 @11:12AM
(#14990451)
True. It sounds like there is room for an ORM-like sanitizer for SSH that is responsible for translating a C API to sanitized commands. I have no clue what to search to find if that already exists.
Re:Critical security updates for Git, Subversion and Mercurial
by virtualized on Friday August 11, 2017 @11:42AM
(#14990778)
It almost seems like ad-hoc text formats like command line argument syntaxes are difficult to use correctly.
Re:Critical security updates for Git, Subversion and Mercurial
by snakeanus on Friday August 11, 2017 @01:01PM
(#14991925)
libgit2 depends on libssh2 actually.
Re:Critical security updates for Git, Subversion and Mercurial
by peff on Friday August 11, 2017 @09:48AM
(#14989592)
Exactly. It's an option injection attack. There's no shell involved.
Re:Critical security updates for Git, Subversion and Mercurial
by numbsafari on Friday August 11, 2017 @09:40AM
(#14989515)
Got it.
Seems to me the the use of "=" notation for CLI args would be rife with situations like this.
Yikes...
[also, still going through the code, but it looks like they are setting up for a call to exec*()]
Re:Critical security updates for Git, Subversion and Mercurial
by wahern on Friday August 11, 2017 @03:13PM
(#14993209)
Yes, which is why "--" is the standard way to avoid this stuff, and why people should generally avoid writing their own options processor and instead use getopt() or getopt_long(), which provide consistent, standard semantics.
Re:Critical security updates for Git, Subversion and Mercurial
by rschoon on Friday August 11, 2017 @12:33PM
(#14991549)
In this case, it's not the shell that's the problem, it's ssh's command line argument parsing that you need to be careful with.
Re:Critical security updates for Git, Subversion and Mercurial
by nobodyorother on Friday August 11, 2017 @01:24PM
(#14992190)
Not just SSH's library parsing, but every SSH implementation's argument parsing.
It's a shame, because the Git dispatching code ought to be able to invoke the ssh command via
to prevent interpreting options in <hostname>, thus defusing the in-band signalling causing this. But I suppose it can't depend on every ssh implementation understanding this "--" POSIX utility syntax guideline.