Git用戶憑證泄露漏洞(CVE-2020-5260)
更新時間 2023-10-31 16:49:02
最近更新時間: 2023-10-31 16:49:02
分享文章
本章介紹Git用戶憑證泄露漏洞問題。
2020年4月15日,Git發布安全通告公布了一個導致Git用戶憑證泄露的漏洞(CVE-2020-5260)。Git使用憑證助手(credential helper)來幫助用戶存儲和檢索憑證。
當URL中包含經過編碼的換行符(%0a)時,可能將非預期的值注入到credential helper的協議流中。受影響Git版本對惡意URL執行git clone命令時,會觸發此漏洞,攻擊者可利用惡意URL欺騙Git客戶端發送主機憑據。
漏洞編號
CVE-2020-5260
漏洞名稱
Git用戶憑證泄露漏洞
影響范圍
影響版本
- Git 2.17.x <= 2.17.3
- Git 2.18.x <= 2.18.2
- Git 2.19.x <= 2.19.3
- Git 2.20.x <= 2.20.2
- Git 2.21.x <= 2.21.1
- Git 2.22.x <= 2.22.2
- Git 2.23.x <= 2.23.1
- Git 2.24.x <= 2.24.1
- Git 2.25.x <= 2.25.2
- Git 2.26.x <= 2.26.0
安全版本
- Git 2.17.4
- Git 2.18.3
- Git 2.19.4
- Git 2.20.3
- Git 2.21.2
- Git 2.22.3
- Git 2.23.2
- Git 2.24.2
- Git 2.25.3
- Git 2.26.1
官網解決方案
目前官方已在最新版本中修復了該漏洞,請受影響的用戶及時升級到安全版本。
官方下載鏈接:
檢測與修復建議
天翼云企業主機安全服務對該漏洞的便捷檢測與修復。
其他防護建議
若您暫時無法進行升級操作,也可以采用以下方式進行防護:
方式一:使用以下命令禁用credential helper
git config --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper
方式二:提高警惕避免惡意URL
- 使用git clone時,檢查URL的主機名和用戶名中是否存在編碼的換行符(%0a)或者憑據協議注入的證據(例如:host=github.com)。
- 避免將子模塊與不受信任的倉庫一起使用(不使用clone --recurse-submodules;只有在檢查gitmodules中找到url之后,才使用git submodule update)。
- 請勿對不受信任的URL執行git clone。
