
摘要
Microsoft Teams 作為一個被廣泛採用的協作平台,為各種網路威脅提供了顯著的攻擊面。本報告對 Threat actor 利用 Microsoft Teams 的方法進行了技術分析,涵蓋了從偵察到影響的整個攻擊鏈。它深入探討了特定的工具、技術和技術概念,提供了有關平台功能如何被重新用於 malicious activities 的見解。本分析旨在增進對這些威脅技術基礎的理解,並為強大的防禦策略提供參考。

1. 簡介
Microsoft Teams 普遍地整合到現代企業環境中,已將其轉變為關鍵的通訊和協作中心。其廣泛的功能集,包含訊息傳遞、通話、會議和檔案共享,在提高生產力的同時,也使其成為網路犯罪份子和複雜 Threat actor 的高價值目標 [1]。本報告著重於這些攻擊者如何在整個網路攻擊生命週期中,利用或濫用 Teams 固有功能的技術層面,詳細檢視了在最近的攻擊中觀察到的戰術、技術和程序 (Tactics, Techniques, and Procedures, TTPs)。
2. 攻擊鏈分析
Threat actor 有系統地在攻擊鏈的各個階段利用 Microsoft Teams。了解這些階段對於制定有效的對策至關重要。以下圖表說明了一個通用的攻擊鏈,強調了 Teams 特有的濫用如何融入每個階段。
Figure 1: Microsoft Teams Attack Chain Overview
2.1. 偵察
在偵察階段,Threat actor 旨在收集有關目標組織及其 Teams 環境的資訊。這通常涉及列舉 Microsoft Entra ID 身份,這是每個 Teams 使用者帳號和 Team 物件的基礎 [1]。攻擊者可以透過 API 將 Teams 作為一種物件類型進行查詢,以繪製關係圖、識別權限,並推斷指示外部通訊政策的 federation tenant 設定 [1]。
開源工具在此階段發揮了重要作用。 ROADtools 、 TeamFiltration 、 TeamsEnum 和 MSFT-Recon-RS 等框架經常被重新用於列舉使用者、群組、tenants、Teams、channels 和已啟用的網域。這些工具通常利用 Microsoft Graph API 或 DNS 紀錄來收集情報,包括在未嚴格執行隱私設定時的使用者在線狀態資訊 [1]。這些工具中有許多是模組化的 Python packages,允許客制化擴展以及與其他偵察框架的互操作性。
以下提供了一個簡化的 Python 範例,演示攻擊者如何嘗試使用 Microsoft Graph API 列舉 Teams 使用者。這需要具有適當權限的 access token。
- import requests
- import json
- # This is a simplified example and requires proper authentication (e.g., OAuth 2.0 with Azure AD)
- # In a real scenario, you would obtain an access token first.
- # For demonstration purposes, we'll assume an access token is available.
- # --- Configuration ---
- TENANT_ID = "YOUR_TENANT_ID" # Replace with your Azure AD Tenant ID
- ACCESS_TOKEN = "YOUR_ACCESS_TOKEN" # Replace with a valid access token with appropriate permissions (e.g., User.Read.All, Group.Read.All)
- # --- Microsoft Graph API Endpoints ---
- GRAPH_API_BASE_URL = "https://graph.microsoft.com/v1.0"
- # --- Headers for API requests ---
- HEADERS = {
- "Authorization": f"Bearer {ACCESS_TOKEN}",
- "Content-Type": "application/json"
- }
- def enumerate_teams_users():
- """Enumerates users in the Microsoft Teams environment."""
- print("\n--- Enumerating Teams Users ---")
- users_endpoint = f"{GRAPH_API_BASE_URL}/users"
- try:
- response = requests.get(users_endpoint, headers=HEADERS)
- response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
- users_data = response.json()
- for user in users_data.get(\'value\', []):
- print(f" User ID: {user.get(\'id\')}, Display Name: {user.get(\'displayName\')}, User Principal Name: {user.get(\'userPrincipalName\')}")
- except requests.exceptions.RequestException as e:
- print(f"Error enumerating users: {e}")
- if response and response.status_code == 401:
- print("Authentication failed. Check your ACCESS_TOKEN and permissions.")
- elif response and response.status_code == 403:
- print("Authorization failed. The provided token might not have sufficient permissions (e.g., User.Read.All).")
- def enumerate_teams_channels():
- """Enumerates channels within a specific Microsoft Team."""
- print("\n--- Enumerating Teams Channels (requires a Team ID) ---")
- # You would typically find team IDs through other enumeration or discovery methods
- # For this example, replace with a known Team ID from your environment
- TEAM_ID = "YOUR_TEAM_ID" # Replace with a valid Team ID
- if TEAM_ID == "YOUR_TEAM_ID":
- print("Please replace \'YOUR_TEAM_ID\' with an actual Team ID to enumerate channels.")
- return
- channels_endpoint = f"{GRAPH_API_BASE_URL}/teams/{TEAM_ID}/channels"
- try:
- response = requests.get(channels_endpoint, headers=HEADERS)
- response.raise_for_status()
- channels_data = response.json()
- for channel in channels_data.get(\'value\', []):
- print(f" Channel ID: {channel.get(\'id\')}, Display Name: {channel.get(\'displayName\')}, Description: {channel.get(\'description\')}")
- except requests.exceptions.RequestException as e:
- print(f"Error enumerating channels: {e}")
- if response and response.status_code == 401:
- print("Authentication failed. Check your ACCESS_TOKEN and permissions.")
- elif response and response.status_code == 403:
- print("Authorization failed. The provided token might not have sufficient permissions (e.g., Channel.ReadBasic.All).")
- if __name__ == "__main__":
- print("This script demonstrates Microsoft Graph API usage for Teams reconnaissance.")
- print("**IMPORTANT**: Replace TENANT_ID, ACCESS_TOKEN, and TEAM_ID with actual values for testing.")
- print("Ensure the ACCESS_TOKEN has necessary permissions (e.g., User.Read.All, Group.Read.All, Channel.ReadBasic.All).")
- print("\n--- Disclaimer ---")
- print("This code is for educational and research purposes only. Unauthorized access or enumeration of systems is illegal and unethical.")
- # Example usage (uncomment to run after configuring TENANT_ID, ACCESS_TOKEN, and TEAM_ID)
- # enumerate_teams_users()
- # enumerate_teams_channels()
- print("\nScript finished. No actual API calls were made without proper configuration and uncommenting.")
2.2. 資源開發
在此階段,Threat actor 會為其攻擊準備資源。這通常涉及為社交工程建立令人信服的 persona,利用自訂 domains 和 branding 等資源來冒充內部服務台或 IT 支援等合法實體 [1]。目標是使其冒充行為具有可信度,然後可將其用作透過 Teams 中的聊天訊息和電話滲透目標的藉口。複雜的 actors 甚至可能會取得多個 tenants 以進行 staging development 或運行單獨的 operations,利用日常 Teams 功能(例如安排私人會議)來實現其 malicious objectives [1]。
2.3. 初始存取
透過 Teams 獲得對目標環境的初始存取通常嚴重依賴社交工程。例如,技術支援詐騙仍然是傳遞 malicious Remote Monitoring and Management (RMM) 工具和資訊竊取 malware 的熱門藉口 [1]。Threat actor 可能會發起 email bombing campaigns 以製造緊迫感,接著在 Teams 上發起語音和視訊通話,冒充服務台人員以獲得遠端存取權 [1]。使用 deepfakes 可以進一步提高此類社交工程戰術的有效性,因為它增加了預期的權威性 [1]。
諸如 TeamsPhisher 之類的 Red teaming tools 被用於透過 Teams 散播 malware(例如 DarkGate)和其他 malicious payloads。這可能涉及在 Teams 通話期間冒充客戶,說服目標安裝遠端存取軟體(如 AnyDesk),然後用於部署進一步的 malware [1]。此外,廣泛可用的 admin tools(包括 AADInternals )可用於將 malicious links 和 payloads 直接傳送到 Teams。Adversary-in-the-middle (AiTM) actors 可能在 malvertising campaigns 中利用 Teams branding,將使用者誤導至 hosting credential-stealing malware 的假下載網站 [1]。
2.4. 持續性
Threat actor 採用各種技術來維持對 Teams 生態系統中受損系統的存取。一種值得注意的方法是 device code phishing,攻擊者透過利用 device code authentication flows 來截取 authentication tokens。這通常涉及偽裝成 Teams 會議邀請並發起聊天以建立關係,誘騙目標使用攻擊者產生的 device codes 來竊取 authenticated sessions [1]。
Teams phishing lures 本身可以作為一種持續性機制。例如, TeamsPhisher 等工具可用於發送 phishing lures,以傳遞自訂 malware(例如 JSSloader),該 malware 作為 ransomware operators 在網路中維持立足點的 access vector [1]。Threat actor 還可能嘗試建立 guest users 或將其自己的 credentials 新增到 Teams 帳號以確保持續存取 [1]。
2.5. 執行
除了損害 privileged admin accounts 之外,Threat actor 經常以日常 Teams 使用者為目標,誘騙他們點擊 malicious links 或開啟受感染的檔案。這種 code execution 方法類似於基於電子郵件的攻擊,但它利用了 Teams 聊天和共享檔案的受信任環境 [1]。成功執行可能導致各種 malware 的部署,包括 ransomware、information stealers 和 remote access tools。
2.6. 權限提升
一旦獲得初始存取,Threat actor 通常會尋求提升權限。如果攻擊者成功入侵 Teams admin role,他們可以濫用與該 role 相關聯的權限以推進其目標 [1]。這可能涉及更改 permission groups、授予自己更高的存取級別,或操縱 Teams 設定以促進其他攻擊階段。
2.7. 認證存取
Teams 環境中的認證存取通常涉及 authentication tokens 的竊取和濫用。有了有效的 refresh token,攻擊者就可以透過 Teams API 冒充使用者 [1]。諸如 AADInternals 之類的工具可能會被惡意地重新用於透過 custom phishing flows 攔截 access tokens。例如,在認證被竊取之後,透過 password spraying, TeamFiltration 等工具可用於請求用於 Teams 和其他 Microsoft 365 服務的 OAuth tokens [1]。
Threat actor 還積極嘗試透過各種方式繞過 multifactor authentication (MFA),包括反覆生成 authentication prompts 直到使用者錯誤地接受,或透過新增 alternate phone numbers 或攔截 SMS-based codes 來損害 MFA [1]。有時透過 Teams 進行的 aggressive social engineering 用於獲得 privileged accounts 的 MFA 控制權,通常是使用諸如 AADInternals 之類的工具以 forging tokens 為目標的 federated identity providers [1]。
2.8. 探索
為了完善他們的 targeting 並了解被滲透的環境,Threat actor 會從 API responses 中分析 Teams 設定資料。如果獲得未經授權的存取,他們會列舉 Teams applications,並使用旨在將潛在攻擊路徑情境化的 toolkits 搜尋有價值的檔案和目錄[1]。例如, AzureHound 已被用於列舉 Microsoft Entra ID 設定,收集有關使用者、roles、groups、applications 和 devices 的詳細資訊。 AADInternals 也可用於發現 Teams group structures 和 permissions [1]。在某些情況下,Threat actor 甚至透過網頁用戶端直接存取 Teams conversations 和 messages [1]。
2.9. 橫向移動
獲得 Teams admin access 的 Threat actor 可以利用 external communication settings 以及組織之間建立的信任關係,在一個或甚至跨多個 tenants 內橫向移動 [1]。這可能涉及冒充 IT 人員,說服其他組織的使用者接受聊天請求並授予遠端存取權,從而促進進一步的滲透[1]。
2.10. 收集
收集階段著重於從 Teams 收集敏感資訊。Threat actor 會從 Teams 中挖掘被認為有用的資料,可能從一個被滲透的帳號轉向可透過 OneDrive 或 SharePoint 存取的資料 [1]。諸如 AADInternals 之類的工具可以收集敏感的聊天資料和使用者 profiles。在滲透之後, GraphRunner 可以利用 Microsoft Graph API 搜尋所有聊天和 channels 並匯出 Teams conversations [1]。諸如 TeamFiltration 之類的工具還包括用於提取 recent contacts 和下載聊天和檔案的 modules [1]。
2.11. 命令與控制 (C2)
Teams 可用作 command and control (C2) communications 的隱蔽 channel。Threat actor 嘗試透過 Teams 聊天或 channels 中的 file attachments 傳遞 malware [1]。諸如 Brute Ratel C4 (BRc4) 之類的複雜工具的 Cracked versions 包含 features,透過利用 Teams 的 communication protocols 來傳送和接收 commands 和 data 來建立 C2 channels [1]。
在滲透之後,諸如 ConvoC2 之類的 red teaming tools 可以使用 Adaptive Card 框架透過 Microsoft Teams messages 傳送 commands。此技術涉及將資料 embedding 在 hidden span tags 中,然後使用 webhooks 將其 exfiltrating,有效地將 Teams 變成了 interactive C2 mechanism [1]。Legitimate remote access tools 也可以被利用來透過 Teams 建立 interactive C2 [1]。
2.12. 資料外洩
透過 Teams 進行的資料外洩涉及 Threat actor 使用 messages 或 shared links 將敏感資料導向到其控制下的雲端儲存 [1]。諸如 TeamFiltration 之類的工具包含 exfiltration modules,如果擁有有效的 access token,可以提取 recent contacts 並從 OneDrive 或 SharePoint 下載聊天和檔案 [1]。這突顯了監控 Teams 環境內部和外部資料移動的重要性。
2.13. 影響
這些攻擊的最終影響通常涉及透過 extortion、社交工程或技術手段進行金融竊盜。Threat actor 可能使用 Teams 發送辱罵,嘲笑和威脅訊息,作為 ransomware payment pressure tactics 的一部分。在透過社交工程獲得 MFA 的控制權之後,他們可以登入 Teams 以識別支持其 financially motivated operations 的敏感資訊 [1]。
3. 緩解與保護指南
為了對抗針對 Microsoft Teams 的複雜威脅,多層次的防禦策略至關重要。關鍵的緩解和保護指南包括:
- 強化身份保護: 在 Microsoft Entra ID Protection 中實施 sign-in 和使用者 risk policies。根據 sign-in risk 執行 access controls,並確保使用者已註冊 Microsoft Entra multifactor authentication。使用 Microsoft Entra Privileged Identity Management (PIM) 對 privileged roles 設定 just-in-time access,以減少 standing privileges [1]。
- 強化端點安全: 利用 configuration analyzers 來強化 security posture,識別並修復比標準 profiles 不安全程度低的 policies。保持 Teams clients、browsers、operating systems 和 dependencies 的持續更新 [1]。
- 啟用網路保護和網頁保護: 實施強大的網路安全措施,以檢測和預防與基於 Teams 的攻擊相關的 malicious traffic。
- 使用者教育與意識: 定期培訓使用者識別社交工程戰術、phishing attempts 以及在 Teams 內點擊可疑連結或開啟 unsolicited files 相關的 risks。
- 監控與稽核: 持續監控 Teams activity logs、Microsoft Entra ID sign-in logs 和 Microsoft Graph API usage 的異常行為。針對可疑活動(例如不尋常的存取行為模式、新使用者客戶的建立或大檔案傳輸)實施 alerts。
- Application 治理: 針對第三方和 custom Teams applications 實施 policies,確保只允許經過驗證和必要的 applications。定期審查 application permissions。
4. 結論
針對 Microsoft Teams 的威脅分析揭示了一個複雜的環境,其中攻擊者巧妙地利用了平台的功能和整合。從利用 Microsoft Graph API 的複雜偵察到透過 device code phishing 實現的 persistent access 以及透過 Adaptive Cards 實現的 covert C2 channels,Threat actor 的技術獨創性顯而易見。有效的防禦需要一個全面的方法,結合強大的身份和端點安全、持續監控和主動的使用者教育。透過了解這些攻擊的技術方法,組織可以更好地強化其 Teams 環境,以應對不斷變化的網路威脅。