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

转载于:https://blog.51cto.com/355665/2123320

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值