返回文章列表
安全 | 产品更新 | DevSecOps | 2024-09-19

极狐GitLab 重要安全版本:17.3.3, 17.2.7, 17.1.8, 17.0.8, 16.11.10

极狐GitLab

本文分享极狐GitLab 重要安全版本 17.3.3, 17.2.7, 17.1.8, 17.0.8, 16.11.10 的详情内容。

 

 

今天我们正式发布了极狐GitLab 17.3.3, 17.2.7, 17.1.8, 17.0.8, 16.11.10 版本。该版本包含了重要的缺陷和安全修复,我们强烈建议所有的私有化部署用户应立即升级到上述推荐的某一个版本。对于极狐GitLab SaaS(JihuLab.com)来讲,专业的技术团队已经进行了升级。

 

建议操作

 

我们强烈建议所有运行以下描述问题所影响的版本应尽快升级到最新版本。

 

如果没有指明极狐GitLab 特定的部署类型(ominbus、源代码、helm chart 等),那也就意味着所有的类型都受影响。

 

安全修复

 

安全修复表

 

标题

严重性

SAML 认证绕过

严重

SAML 认证绕过

 

SAML 认证绕过(SAML authentication bypass)漏洞是由 Ruby SAML 库引起的,对应的漏洞 ID为 CVE-2024-45409。将依赖 omniauth-saml升级到 2.2.1ruby-saml升级到 1.17.0就能够

减轻 CVE-2024-45409 漏洞带来的安全危害。

 

私有化部署版本:已知的缓解措施

 

以下针对私有化部署的减缓措施能够成功避免实例受到 CVE-2024-45409 漏洞带来的攻击:

 

为极狐GitLab 私有化部署实例上的所有用户开启双因素认证(注意:开启身份识别供应商提供的多因素认证并不能减缓该漏洞带来的安全危害)以及

不允许在极狐GitLab 中使用 SAML 双因素认证绕过选项

 

私有化部署实例:识别和检测该漏洞的利用尝试

 

尝试或成功利用 Ruby-SAML (CVE-2024-45409) 的证据将出现在 GitLab 的 application_json 和 auth_json 日志文件中。

 

未成功的利用尝试——捕获

 

未成功的利用尝试可能会从 RubySaml库产生一个 ValidationError信息。这可能是由于构造一个有效利用程序的复杂性所导致的各种原因。

 

下面展示了两个示例,但是错误可能以其他描述的形式出现,要在 application_json 日志文件中搜索常见的字符串 RubySaml::ValidationError

 

1. 由于不正确的回调 URL 而导致票据(ticket)无效;

  1. 日志事件示例:
  2. {"severity":"ERROR","time":"2024-xx-xx","correlation_id":"xx","message":"(saml) Authentication failure! invalid_ticket: OneLogin::RubySaml::ValidationError, The response was received at https://domain.com/users/auth/saml/incorrect_callback instead of https://domain.com/users/auth/saml/callback"}
    由于证书签名问题而导致的票据(ticket)无效;

2. 由于证书签名问题而导致的票据(ticket)无效;

  1. 日志事件示例
  2. "message":"(saml) Authentication failure! invalid_ticket: OneLogin::RubySaml::ValidationError, Fingerprint mismatch"

 

成功的利用尝试——捕获

 

成功地利用尝试将会触发与 SAML 相关的日志事件。然而,要将正常合法的 SAML 认证事件和漏洞利用尝试成功的事件区别开来是非常有难度的。

 

成功的利用尝试将记录攻击者在尝试利用时设置的任何 extern_id 值因此,识别一个在你的组织中不常见的唯一 extern_uid 可能是潜在利用的指示信号。

 

  1. 在 application_json 日志文件中的示例利用认证事件,其中 extern_id 在利用 PoC 代码中被设置:
  2. 日志事件
  3. {"severity":"INFO","time":"2024-xx-xx","correlation_id":"xx","meta.caller_id":"OmniauthCallbacksController#saml","meta.remote_ip":"0.0.0.0","meta.feature_category":"system_access","meta.client_id":"ip/0.0.0.0","message":"(SAML) saving user exploit-test-user@domain.com from login with admin =\\u003e false, extern_uid =\\u003e exploit-test-user"}

 

在构造利用程序时,攻击者需要制作许多 SAML 断言以完美复制合法登录。这些断言包括你在身份提供者(IdP)处指定的密钥和值字段,且这些字段可能对未经授权的人员未知——尤其是当你自定义了这些属性时。

 

你可以查看 auth_json 日志文件,以查找属性部分中信息不正确或缺失的 SAML 响应。

 

  1. 在 auth_json 日志文件中的 SAML authentication 事件示例
  2. "severity":"INFO","time":"2024-xx-xx","correlation_id":"xx","meta.caller_id":"OmniauthCallbacksController#saml","meta.remote_ip":"0.0.0.0","meta.feature_category":"system_access","meta.client_id":"ip/0.0.0.0","payload_type":"saml_response": {"issuer": ["xxx"],"name_id": "xxx","name_id_format": "xxx","name_id_spnamequalifier": null,"name_id_namequalifier": null,"destination": "xxx","audiences": ["xxx"],"attributes": {"first_name": ["xxx"],"last_name": ["yyy"], "email": ["zzz"]}}

 

对于私有化部署的客户,可以将极狐GitLab 的 application_json 日志转发到 SIEM,可以创建检测规则以识别 Ruby-SAML (CVE-2024-45409) 利用尝试。我们的团队提供了两条用 Sigma 格式编写的威胁检测规则,以检测潜在的利用行为。

 

注意:这些检测规则可能需要根据客户的环境进行调整和修改,以提供有效的结果。由于不同客户环境的配置各异,客户应验证这些检测规则识别的事件的合法性和准确性。

 

一段时间内具有多个唯一 extern_uid 的用户

 

此检测旨在识别具有多个 extern_uid 值与认证事件相关联的已认证 SAML 用户,这可能是攻击者设置了 extern_uid 字段的恶意认证的潜在迹象。

 

title: Multiple extern_ids
description: Detects when their are multiple extern_id's associated with a user. 
author: Gitlab Security Engineering
date: 09/15/2024
schedule: "*/10 * * * *"
pseudocode: |
  select log source application.log
  where 7d < event_time < now()
  where severity="INFO" and meta_caller_id="Groups::OmniauthCallbacksController#group_saml"
  regex(message, "saving user (?<user_email>\S+) .*extern_uid \S+ (?<extern_id>[\S]+)")
  count extern_id by user_email as total_extern_ids
  where total_extern_ids > 1
verify: Review Gitlab application logs for the source IP of the SAML authentications. If there is a singular IP for all extern_ids this could point to a false positive. Cross reference the SAML authentication source IP/s with the known user's IP from sso authentication logs. 
tuning: N/A

 

在一段时间内,同一用户的 GitLab SAML 认证与其他身份提供者(IdP)事件的 IP 地址不同

 

此检测旨在关联用户的认证事件,比较 GitLab SAML 认证事件与其他身份提供者(IdP)的认证事件,以识别用户 IP 地址的任何变化,这可能是攻击者认证会话的迹象。

 

title: Gitlab SAML IP differs from SSO IP
description: Detects when the source IP for the SAML authentication to Gitlab from application.log differs from the users known IP from SSO MFA logs. 
author: Gitlab Security Engineering
date: 09/15/2024
schedule: "*/10 * * * *"
pseudocode: |
  select log source application.log 
  where severity="INFO" and meta_caller_id="Groups::OmniauthCallbacksController#group_saml"
  regex(message, "saving user (?<user_email>\S+) ")
  #Create sub-query to bring in table from SSO authentication data
  select meta_remote_ip, user_email
  where user_email in
    (
    select log source authentication
    where 1d < event_time < now()
    where event_type="user.authentication.auth_via_mfa"
    group by user_email, sso_source_ip
    )
  where sso_source_ip!=meta_remote_ip
verify: False positives can arise when the user is traveling. Review SSO authentication logs to see if the geo-location is similar to the SAML authentication to Gitlab. If any discrepancies are found, reach out to the user for verification. If the user is not traveling, temporarily lock the user's Gitlab account and review their activity through Gitlab's application logs. 
tuning: If the query is producing high false positives, consider using

 

修复的缺陷

 

17.3.3

 

升级了 OpenSSL 3 的升级告警说明

升级了极狐GitLab 备份命令的 gem bundler

升级了 ruby-saml 和 omniauth-saml

 

17.2.7

 

升级了 OpenSSL 3 的升级告警说明

升级了 ruby-saml 和 omniauth-saml

 

17.1.8

 

升级了 OpenSSL 3 的升级告警说明

升级了 ruby-saml 和 omniauth-saml

 

17.0.8

 

升级了 ruby-saml 和 omniauth-saml

 

16.11.10

 

升级了 ruby-saml 和 omniauth-saml

 

 

升级指南

 

对于GitLab/极狐GitLab 私有化部署版的用户,通过将原有的GitLab CE/EE/JH升级至极狐GitLab

17.3.3-jh、17.2.7-jh、17.1.8-jh、17.0.8-jh、16.11.10-jh 版本即可修复该漏洞。

 

使用 Omnibus 安装部署的实例,升级详情可以查看极狐GitLab 安装包安装升级文档

 

使用 Docker 安装部署的实例,可使用如下三个容器镜像将产品升级到上述三个版本:
 

  • registry.gitlab.cn/omnibus/gitlab-jh:17.3.3-jh.0
  • registry.gitlab.cn/omnibus/gitlab-jh:17.2.7-jh.0
  • registry.gitlab.cn/omnibus/gitlab-jh:17.1.8-jh.0
  • registry.gitlab.cn/omnibus/gitlab-jh:17.0.8-jh.0
  • registry.gitlab.cn/omnibus/gitlab-jh:16.11.10-jh.0

 

升级详情可以查看极狐GitLab Docker 安装升级文档。 

 

使用云原生安装的实例,可将使用的 Helm Chart 升级到 8.3.3(对应 17.3.3-jh)、8.2.7(对应 17.2.7-jh)、8.1.8(对应 17.1.8-jh)、8.0.8(对应 17.0.8)以及 7.11.10(对应 16.11.10)来修复该漏洞。升级详情可以查看 Helm Chart 安装升级文档

 

JH 版本

17.3.3

17.2.7

17.1.8

17.0.8

16.11.10

Chart 版本

8.3.3

8.2.7

8.1.8

8.0.8

7.11.10

 

对于SaaS用户(jihulab.com),无需进行任何操作,我们已经升级SaaS以修复该漏洞。

极狐GitLab 一体化DevOps平台 专为中国用户研发,免费试用60天专业版高级功能
售前咨询
联系电话
在线支持
预约演示