lilingjie2015 发表于 2018-9-16 09:51:10

Git任意代码执行漏洞检测与修复(CVE-2018-11235)

检测漏洞方法
  检测漏洞有两种方法:

1.通过查看git客户端版本
  

git --version  

  如果版本低于2.13.7肯定存在漏洞
  如果版本高于2.13.7请比对下面的版本
  版本2.13.x,小于2.13.7则存在漏洞
  版本2.14.x ,小于 2.14.4则存在漏洞
  版本2.15.x,小于 2.15.2则存在漏洞
  版本2.16.x,小于 2.16.4则存在漏洞
  版本2.17.x,小于 2.17.1则存在漏洞

2.通过git命令检测
  

cd /tmp  

  
git init test && cd test && git update-index --add --cacheinfo 120000,e69de29bb2d1d6434b8b29ae775ad8c2e48c5391,.gitmodules
  


[*]如果只出现下面的提示,证明存在漏洞
  “Initialized empty Git repository in /tmp/test/.git/”


[*]如果出现下面的提示,证明漏洞已被修复
  “Initialized empty Git repository in /tmp/test/.git/
  error: Invalid path '.gitmodules'
  fatal: git update-index: --cacheinfo cannot add .gitmodules”

修复漏洞方法

1.Mac OS


[*]通过brew更新git  不知道brew是什么的请自行搜索

  

brew install git  

  如果看到下面的提示,表示你需要强制更新
  "Error: The brew link step did not complete successfully
  The formula built, but is not symlinked into /usr/local"


[*]强制更新命令:
  

brew link --overwrite git  

  更新完毕后,再用上面的方法检测漏洞
  如果出现下面的提示,证明漏洞已被修复!!!
  “Initialized empty Git repository in /tmp/test/.git/
  error: Invalid path '.gitmodules'
  fatal: git update-index: --cacheinfo cannot add .gitmodules”

2.CentOS
  找了半天,貌似只能通过源码安装,如果有人知道如何yum安装请私信
  

cd /tmp  
wget https://www.kernel.org/pub/software/scm/git/git-2.17.1.tar.gz
  
tar zxf git-2.17.1.tar.gz
  
cd git-2.17.1
  
sudo ./configure
  
sudo make
  
sudo make install
  

3.Ubuntu
  

sudo add-apt-repository ppa:git-core/ppa  
sudo apt update
  
sudo apt install git
  

4.Windows
  https://gitforwindows.org/ 可以下载

参考文档
  https://www.edwardthomson.com/blog/upgrading_git_for_cve2018_11235.html
  http://blog.nsfocus.net/cve-2018-11235/
  http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-11235


页: [1]
查看完整版本: Git任意代码执行漏洞检测与修复(CVE-2018-11235)