SEC-008 P1: Clipboard 複製敏感資料無自清機制

Resolved 💬 2 comments Opened Mar 22, 2026 by stephen-taipei Closed Mar 25, 2026

問題描述

應用直接複製 TOTP secret、備用碼、API tokens、referral codes 等敏感資料到 Clipboard。Clipboard 對其他應用透明,惡意應用可監聽並竊取。

檔案位置

  • ios-swift/Connectors/Views/Security/TOTPSetupView.swift:348
  • ios-swift/Connectors/Views/Security/BackupCodesView.swift:393
  • ios-swift/Connectors/Views/Security/TOTPSetupView.swift:639
  • ios-swift/Connectors/Managers/ShareManager.swift:192
  • 其他 12+ 個位置 (referral codes, messages, templates)

詳細說明

UIPasteboard.general.string = setupResponse.secret  // TOTP Secret
UIPasteboard.general.string = codesText            // Backup Codes
UIPasteboard.general.string = referralCode         // Referral Code

風險評估

  • 惡意應用可監聽 clipboard 變更並竊取敏感資料
  • 使用者可能在其他應用意外粘貼敏感資料
  • Clipboard 內容在設備備份中不加密

解決方案

  1. 自清機制:在 3 秒後自動清空 clipboard(敏感資料)
  2. 限制可見性:使用 UIPasteboard 的 setObjects(_:options:) 並設定 UIPasteboardOptionLocalOnly = true
  3. 替代方案
  • 對於 referral codes,優先使用 Share Sheet 分享
  • 對於 TOTP secret,提供掃描 QR code 而非複製
  1. 用戶警示:在複製敏感資料時顯示警告訊息

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗