PISA Pakistan — Community CERT

← ⚙️ SOC Analyst Foundations

35. SaaS Security Monitoring: Detecting OAuth Token Theft and Malicious App Installations

⏱ 9 min

SaaS Attack Surface for Pakistani Organizations

Many Pakistani enterprises run Microsoft 365, Google Workspace, and Salesforce for daily operations. Attackers increasingly abuse OAuth 2.0 consent‑grant flows to install malicious third‑party apps that can read emails, exfiltrate files, or harvest tokens. The SOC must monitor consent‑grant events and abnormal app activity.

OAuth & Third‑Party App Integration Telemetry

  • Microsoft Cloud App Security (MCAS): alerts for “App permission granted” and “OAuth risky app detection”.
  • Google Workspace Admin console: audit logs for “Third‑party app access”.
  • Salesforce: “Connected App” permission change events.
  • Azure AD sign‑in logs: flag apps requesting high‑privilege scopes (Mail.Read, Files.Read).

Detecting Malicious OAuth Tokens and App Permissions

  1. Enable “Alert on new OAuth apps” in MCAS; set a rule to trigger when an app requests Files.Read.All or Mail.Read.
  2. Cross‑reference with threat intel: if a newly installed app’s publisher appears in MISP events (e.g., “DarkMatter” campaign), auto‑escalate.
  3. Monitor token usage: a token used from an unusual ASN (e.g., a foreign ISP) should raise an alert.
  4. Correlate with DLP logs: if a user’s OneDrive file is accessed by an OAuth app outside business hours, treat it as potential data exfiltration.

Monitoring for Data Exfiltration via Shared Drives

  • Use Elastic SIEM to ingest OneDrive/SharePoint audit logs; create a rule that alerts on bulk downloads (>50 files) by a single app within 5 minutes.
  • For JazzCash or e‑easypaisa integration, ensure that any OAuth app accessing their APIs is approved by the compliance team per SBP consumer‑finance guidelines.

Do / Don't

  • Do maintain an approved app whitelist in Azure AD.
  • Don't ignore OAuth consent emails—train users to report suspicious consent requests.
  • Do integrate SaaS alerts into theHive and share IOCs with NCCIA 1799 for national correlation.
  • Don't rely on default SaaS security settings—customize data‑retention and alert thresholds.

Takeaway: Audit the OAuth applications connected to your Microsoft 365 or Google Workspace tenant today and revoke any that are unapproved or overly permissive.

← PrevNext →