安全研究

安全漏洞
GitLab任意代码执行漏洞(CVE-2013-4581)

发布日期:2014-05-12
更新日期:2014-05-13

受影响系统:
GitLab GitLab 6.x
描述:
CVE(CAN) ID: CVE-2013-4581

GitLab,是一个利用Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。

GitLab 5.4.2, Community Edition 6.2.4, Enterprise Edition 6.2.1, gitlab-shell 1.7.8之前版本存在安全漏洞,远程攻击者通过SSH进行精心构造的更改,即可利用此漏洞执行任意代码。

<*来源:joernchen
  *>

建议:
临时解决方法:

如果您不能立刻安装补丁或者升级,NSFOCUS建议您在/home/git/gitlab-shell内运用下面补丁以降低威胁:


--- a/lib/gitlabconfig.rb
+++ b/lib/gitlabconfig.rb
@@ -48,12 +48,12 @@ class GitlabConfig
     if redis.empty?
       # Default to old method of connecting to redis
       # for users that haven't updated their configuration
-      "env -i redis-cli"
+      %W(env -i redis-cli)
     else
       if redis.has_key?("socket")
-        "#{redis['bin']} -s #{redis['socket']}"
+        %W(#{redis['bin']} -s #{redis['socket']})
       else
-        "#{redis['bin']} -h #{redis['host']} -p #{redis['port']}"
+        %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
       end
     end
   end


--- a/lib/gitlabupdate.rb
+++ b/lib/gitlabupdate.rb
@@ -1,5 +1,6 @@
requirerelative 'gitlabinit'
requirerelative 'gitlabnet'
+require 'json'



class GitlabUpdate
   attr_reader :config
@@ -53,7 +54,8 @@ class GitlabUpdate
   end



def updateredis
-    command = "#{config.rediscommand} rpush '#{config.redisnamespace}:queue:postreceive' '{\"class\":\"PostReceive\",\"args\":[\"#
-    system(command)
+    queue = "#{config.redisnamespace}:queue:postreceive"
+    msg = JSON.dump({'class' => 'PostReceive', 'args' => [@repopath, @oldrev, @newrev, @refname, @keyid]})
+    system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null')
   end
end

厂商补丁:

GitLab
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

https://www.gitlab.com/
https://gitlab.com/gitlab-org/gitlab-ce
https://github.com/gitlabhq/gitlabhq

浏览次数:2241
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障