作者:xxhzz@星闌科技PortalLab
原文鏈接:https://mp.weixin.qq.com/s/VaHYzhkn2gZhHcCPTdO-Tg

漏洞描述

6月29日,Atlassian官方發布安全公告,在Atlassian Jira 多款產品中存在服務端請求偽造漏洞(SSRF),經過身份驗證的遠程攻擊者可通過向Jira Core REST API發送特制請求,從而偽造服務端發起請求,從而導致敏感信息泄露,同時為下一步攻擊利用提供條件。需注意的是,若服務端開啟注冊功能,則未授權用戶可通過注冊獲取權限進而利用。

利用范圍

Jira Core Server, Jira Software Server, and Jira Software Data Center:

  • Versions after 8.0 and before 8.13.22
  • 8.14.x
  • 8.15.x
  • 8.16.x
  • 8.17.x
  • 8.18.x
  • 8.19.x
  • 8.20.x before 8.20.10
  • 8.21.x
  • 8.22.x before 8.22.4

Jira Service Management Server and Data Center:

  • Versions after 4.0 and before 4.13.22
  • 4.14.x
  • 4.15.x
  • 4.16.x
  • 4.17.x
  • 4.18.x
  • 4.19.x
  • 4.20.x before 4.20.10
  • 4.21.x
  • 4.22.x before 4.22.4

漏洞分析

環境搭建

使用docker搭建,在docker倉庫(https://hub.docker.com/r/weareogury/atlassian-jira-software/tags)中可找到漏洞版本的Jira Software Server鏡像。

按步驟進行配置即可。

環境搭建成功

代碼分析

分析Jira Mobile 插件,在com.atlassian.jira.plugin.mobile.rest.v1_0.BatchResource中存在barch API接口,閱讀代碼,該API應該是用于接收多個請求并在服務端執行。

分析下方的executeBatch函數。

在如圖所示代碼,實際負責發送HTTP請求。其中batchService接口的實現類BatchServiceImpl位于com.atlassian.jira.plugin.mobile.service.impl.BatchServiceImpl.class

分析batch函數。

根據如上代碼,定位execute函數。

其中relativeLocation來自于requestBean.getLocation中的location。

后續傳入toJiraLocation函數

繼續跟進,位于com.atlassian.jira.plugin.mobile.util.LinkBuilder.class

URL通過簡單的拼接構造,而其中的path來自于location,完全可控。

繼續回到execute函數。

location會從json對象中獲取,在獲取到URL對象后,再調用httpClientProvider發送Http請求。

因為URL的后半部分是可控的,如果我們簡單指定location為@xx.com,那么最終的URL為https://jira-host.com@xx.com,httpClientProvider實際上會對xx.com發送http請求,所以導致了SSRF漏洞產生。

漏洞復現

使用burpsuite自帶的dnslog功能進行探測,成功發送請求。

修復建議

1. 將受影響的產品升級到最新安全版本:

Jira Core Server、Jira Software Server 和 Jira Software Data Center 可升級至:

  • 8.13.22
  • 8.20.10
  • 8.22.4
  • 9.0.0

Jira Service Management Server 和 Data Center 可升級至:

  • 4.13.22
  • 4.20.10
  • 4.22.4
  • 5.0.0

2. 緩解措施

(1) 關閉用戶注冊功能。

(2) 禁用Mobile Plugin,具體步驟如下:

a、在應用程序的頂部導航欄中,選擇設置 -> 管理加載項或管理應用程序。

b、找到Mobile Plugin for Jira Data Center and Server應用程序,然后選擇禁用即可。

(3) 升級Mobile Plugin至最新版本。

參考材料

https://confluence.atlassian.com/jira/jira-server-security-advisory-29nd-june-2022-1142430667.html


Paper 本文由 Seebug Paper 發布,如需轉載請注明來源。本文地址:http://www.bjnorthway.com/1998/