Cloudanix VulnDB

CVE-2017-8386

High · 8.8

CVSS

8.8

EPSS

12.4%

Published

Jun 1, 2017

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A flaw in older versions of the git tool lets someone who already has limited access trick the system into running extra commands, which could let them take over the server.

Exploit Available
Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Privilege Gain
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

git-shell accepts repository names beginning with a dash and passes them directly to git commands, enabling injection of arbitrary command-line options that can lead to privilege escalation for authenticated users.

Why it matters to the business

Attackers who already have limited git access can obtain full system control, exposing source code, intellectual property, and any data reachable from the git server account.

How an attack unfolds

An authenticated user supplies a repository name that begins with a dash followed by a git option or shell command; git-shell invokes the underlying git binary with the malicious argument, causing unintended command execution and privilege gain.

How to fix it

Upgrade git to a fixed release (2.4.12, 2.5.6, 2.6.7, 2.7.5, 2.8.5, 2.9.4, 2.10.3, 2.11.2, 2.12.3 or later). For wordpress/wordpress (GIT) apply commit dd2d8110a94de43a72926e269056f45f2904b45c. Restrict git-shell access to only trusted users until patches are deployed.

How to confirm the fix worked

Confirm the installed git version is at or above one of the listed fixed releases; attempt to create a test repository whose name begins with a dash and verify that git-shell rejects it with an error rather than executing injected options.

Typical attack path

  1. Obtain valid credentials for a git-shell account
  2. Create or reference a repository whose name starts with a dash and contains a command injection payload
  3. Invoke git-shell (via SSH or other allowed transport) with the malicious repository name
  4. Execute arbitrary commands or escalate to higher privileges on the host

How to detect it

Review git server logs (sshd, git-shell invocation logs) and repository creation records for names that begin with a hyphen; correlate with successful command execution or unexpected file modifications performed under the git user account.

  • repository name starting with '-'
  • git-shell invocation containing '-exec' or other injected options
  • unexpected process spawns from git-shell or git-upload-pack under the git user

What your security team should do

  • Immediately patch all git installations to the versions listed in remediation guidance
  • Audit which accounts are permitted to use git-shell and reduce the set to the minimum required
  • Monitor for new repository creation events that contain leading dash characters in their names

The record

git-shell in git before 2.4.12, 2.5.x before 2.5.6, 2.6.x before 2.6.7, 2.7.x before 2.7.5, 2.8.x before 2.8.5, 2.9.x before 2.9.4, 2.10.x before 2.10.3, 2.11.x before 2.11.2, and 2.12.x before 2.12.3 might allow remote authenticated users to gain privileges via a repository name that starts with a - (dash) character.

Affected packages

Ecosystem Package Introduced Fixed
Alpine:v3.3 git 0 2.6.7-r0
Debian:11 git 0 1:2.11.0-3
Debian:12 git 0 1:2.11.0-3
Debian:13 git 0 1:2.11.0-3
Debian:7 git 0 1:1.7.10.4-1+wheezy4
Debian:8 git 0 1:2.1.4-2.1+deb8u3
Mageia:5 git 0 2.7.4-1.1.mga5
Red Hat:enterprise_linux:7::client emacs-git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client emacs-git-el 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-all 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-bzr 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-cvs 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-daemon 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-debuginfo 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-email 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-gui 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-hg 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-p4 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client git-svn 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client gitk 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client gitweb 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client perl-Git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::client perl-Git-SVN 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode emacs-git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode emacs-git-el 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-all 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-bzr 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-cvs 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-daemon 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-debuginfo 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-email 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-gui 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-hg 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-p4 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode git-svn 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode gitk 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode gitweb 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode perl-Git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::computenode perl-Git-SVN 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server emacs-git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server emacs-git-el 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-all 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-bzr 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-cvs 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-daemon 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-debuginfo 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-email 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-gui 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-hg 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-p4 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server git-svn 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server gitk 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server gitweb 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server perl-Git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::server perl-Git-SVN 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation emacs-git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation emacs-git-el 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-all 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-bzr 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-cvs 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-daemon 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-debuginfo 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-email 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-gui 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-hg 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-p4 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation git-svn 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation gitk 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation gitweb 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation perl-Git 0 0:1.8.3.1-11.el7
Red Hat:enterprise_linux:7::workstation perl-Git-SVN 0 0:1.8.3.1-11.el7
Red Hat:rhel_software_collections:2::el6 rh-git29-emacs-git 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-emacs-git-el 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-all 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-core 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-core-doc 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-cvs 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-daemon 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-debuginfo 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-email 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-gui 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-p4 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-git-svn 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-gitk 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-gitweb 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-perl-Git 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el6 rh-git29-perl-Git-SVN 0 0:2.9.3-3.el6
Red Hat:rhel_software_collections:2::el7 rh-git29-git 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-all 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-core 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-core-doc 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-cvs 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-daemon 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-debuginfo 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-email 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-gui 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-p4 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-git-svn 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-gitk 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-gitweb 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-perl-Git 0 0:2.9.3-3.el7
Red Hat:rhel_software_collections:2::el7 rh-git29-perl-Git-SVN 0 0:2.9.3-3.el7
SUSE:Linux Enterprise Server 12 SP1 git 0 2.12.3-26.1
SUSE:Linux Enterprise Server 12 SP2 git 0 2.12.3-26.1
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 git 0 2.12.3-26.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 git 0 2.12.3-26.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 git 0 2.12.3-26.1
SUSE:Linux Enterprise Software Development Kit 11 SP4 git 0 1.7.12.4-0.17.1
SUSE:Linux Enterprise Software Development Kit 12 SP1 git 0 2.12.3-26.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 git 0 2.12.3-26.1
SUSE:Studio Onsite 1.3 git 0 1.7.12.4-0.17.1
Ubuntu:14.04:LTS git 0 1:1.9.1-1ubuntu0.5
Ubuntu:16.04:LTS git 0 1:2.7.4-0ubuntu1.1
openSUSE:Tumbleweed git 0 2.33.0-1.3

Related vulnerabilities