freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

安全研究 | 如何查看GitLab中的共享敏感数据
2021-03-12 21:54:45

关于GitLab Watchman

GitLab Watchman这款应用程序可以帮助广大研究人员使用GitLab API来审查GitLab内部暴露的敏感数据和凭据。

功能介绍

GitLab Watchman可以搜索GitLab中的内部共享项目,并查看下列内容:

  • 代码;
  • 提交内容;
  • WiKi页面;
  • 问题;
  • 合并请求;
  • 项目里程碑;

GitLab Watchman支持搜索下列内容:

  • GCP密钥和服务帐户文件;
  • AWS密钥;
  • Azure密钥和服务帐户文件;
  • Google API密钥;
  • Slack API令牌&webhooks;
  • 私钥(SSH、PGP、任何其他杂项私钥);
  • 公开的令牌(Bearer令牌、访问令牌和client_secret等);
  • S3配置文件;
  • Heroku、PayPal等服务的令牌;
  • 明文密码;
  • ...

基于事件的搜索

我们还可以运行GitLab Watchman并搜索下列时间间隔返回的数据结果:

  • 24小时;
  • 7天;
  • 30天;
  • 所有时间;

这也就意味着,在一次深度扫描之后,我们可以安排GitLab Watchman定期运行,并且只返回所选时间段的结果。

规则

GitLab Watchman使用自定义YAML规则来检测GitLab中的匹配数据项。

规则格式如下所示:

---

filename:

enabled: #[true|false]

meta:

  name:

  author:

  date:

  description: #what the search should find#

  severity: #rating out of 100#

scope: #what to search, any combination of the below#

- blobs

- commits

- milestones

- wiki_blobs

- issues

- merge_requests

test_cases:

  match_cases:

  - #test case that should match the regex#

  fail_cases:

  - #test case that should not match the regex#

strings:

- #search query to use in GitLab#

pattern: #Regex pattern to filter out false positives#

项目中引入了Python测试来确保规则格式的正确性,项目目录中的tests目录下还包含正则匹配模式。关于检测规则的更多内容,请查看项目下的docs/rules.md文件。

.conf文件

配置选项可以在watchman.conf文件中进行配置,该文件必须存储在项目的根目录下。该文件必须遵循YAML格式:

gitlab_watchman:

  token: abc123

  url: https://gitlab.example.com

  logging:

    file_logging:

      path:

    json_tcp:

      host:

      port:

GitLab Watchman将会在运行时查询该配置文件,并使用其中的配置信息。除此之外,本项目还提供了一份配置文件样本,路径为docs/example.conf。

工具要求

GitLab版本

GitLab Watchman使用了v4 API,支持GitLab企业版:

  • GitLab.com
  • 13.0及其以上版本
  • 12.0-12.10版本

工具安装

广大研究人员可以使用下列命令安装GitLab Watchman:

pip install gitlab-watchman

工具使用

GitLab Watchman将以全局命令的形式进行安装,可以通过下列方式使用:

usage: gitlab-watchman [-h] --timeframe {d,w,m,a} --output

                   {file,stdout,stream} [--version] [--all] [--blobs]

                   [--commits] [--wiki-blobs] [--issues] [--merge-requests]

                   [--milestones] [--comments]

 

Monitoring GitLab for sensitive data shared publicly

 

optional arguments:

  -h, --help            show this help message and exit

  --version             show program's version number and exit

  --all                 Find everything

  --blobs               Search code blobs

  --commits             Search commits

  --wiki-blobs          Search wiki blobs

  --issues              Search issues

  --merge-requests      Search merge requests

  --milestones          Search milestones

  --comments            Search comments

 

required arguments:

  --timeframe {d,w,m,a}

                        How far back to search: d = 24 hours w = 7 days, m =

                        30 days, a = all time

  --output {file,stdout,stream}

                        Where to send results

我们可以使用GitLab Watchman来查询所有支持的数据项,并将结果输出至默认Stdout:

gitlab-watchman --timeframe a --all

或者,我们也可以将参数一起提交给搜索命令:

gitlab-watchman --timeframe m --commits --milestones --output stream

项目地址

GitLab Watchman:【GitHub传送门

# 敏感数据 # Gitlab # 敏感信息泄露 # GitLab安全
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录