HSEC-2023-0009

git-annex command injection via malicious SSH hostname

git-annex was vulnerable to the same class of security hole as git's CVE-2017-1000117. In several cases, git-annex parses a repository URL, and uses it to generate a ssh command, with the hostname to ssh to coming from the URL. If the hostname it parses is something like -eProxyCommand=evil, this could result in arbitrary local code execution.

Some details of URL parsing may prevent the exploit working in some cases.

Exploiting this would involve the attacker tricking the victim into adding a remote something like ssh://-eProxyCommand=evil/blah.

One possible avenue for an attacker that avoids exposing the URL to the user is to use initremote with an SSH remote, so embedding the URL in the git-annex branch. Then the victim would enable it with enableremote.

This was fixed in version 6.20170818. Now there's a SshHost type that is not allowed to start with a dash, and every invocation of git-annex uses a function that takes a SshHost.

Info

Published
July 25, 2023
Modified
July 25, 2023
CAPECs
< none >
CWEs
20
78
Keywords
ssh, command-injection, historical
Aliases
CVE-2017-12976
Related
CVE-2017-9800, CVE-2017-12836, CVE-2017-1000116, CVE-2017-1000117
References
[ADVISORY] https://git-annex.branchable.com/security/CVE-2017-12976/
[FIX] http://source.git-annex.branchable.com/?p=source.git;a=commitdiff;h=df11e54788b254efebb4898b474de11ae8d3b471

Affected

git-annex
CVSS
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Versions
>=0 && <6.20170818
Declarations
< none >