The Wake-Up Call: Rogue OAuth App Breach in Action

In a recent incident response investigation, Mitiga uncovered a chilling attack that started with a single compromised email inbox and spiraled into a full-blown takeover of an organization's cloud infrastructure.

The culprits? A rogue OAuth application and a series of clever moves by attackers who turned a phishing email into a master key for the victim’s AWS environment. 

This blog post breaks down how the attack unfolded and provides practical recommendations to protect your organization from similar threats.

Incident Overview: How the Rogue OAuth App Attack Began

The incident began with a targeted phishing campaign that tricked a user into granting permissions to a rogue OAuth application registered in Microsoft Azure. This initial compromise provided the attackers with persistent access to the victim’s email account, allowing them to search for and extract sensitive information, including AWS access keys for a sandbox environment.

Armed with the access keys, the attackers conducted reconnaissance and discovered a trust relationship between the sandbox and production environments. This allowed them to escalate privileges and gain complete control over the organization's AWS infrastructure.

Phishing email led to rogue OAuth app access and eventual exfiltration of sensitive data from production, with network traffic originating from Rostelecom IP addresses.

Step-by-Step Attack Progression

  1. Initial Compromise: The victim clicked a phishing link from an email delivered by the attackers, granting permissions to the rogue OAuth. The app used the Microsoft Graph API for persistent mailbox access, allowing the attackers to read emails and perform searches without further user interaction.
  2. Mailbox Exploitation: The attackers used POST requests via the Graph API to search the mailbox for sensitive information. While the specific keywords searched were not visible in the logs due to the POST method, the logs recorded the emails accessed by the attackers.
  3. Credential Discovery: The attackers discovered AWS access keys for a sandbox environment within the compromised mailbox.
  4. AWS Reconnaissance: Using the stolen AWS keys, the attackers employed Scout Suite, an open-source cloud security auditing tool, to enumerate permissions within the AWS sandbox environment.
  5. Privilege Escalation: The attackers discovered a trust relationship between the sandbox and production environments, exploiting this misconfiguration to escalate privileges and gain unauthorized access to the production AWS infrastructure.
  6. Data Exfiltration: The attackers exfiltrated sensitive data from the production environment, with network traffic originating from Rostelecom IP addresses.

Forensic Evidence from the Breach

Investigation relied heavily on available forensic data to piece together the attacker’s actions. To provide insight into the investigation process, let’s look at some sanitized excerpts of key log records that highlight critical stages of the attack.

  1. Permission Granting to Malicious OAuth Application

This entry shows the victim granting permissions to the rogue OAuth app, establishing the initial compromise.

{
"EventTime":"X",
"Scope":["Mail.Read","User.Read","offline_access",
"openid","profile"],
"event_name":"Add delegated permission grant.",
"TargetServicePrincipalName":"[Rogue OAuth App Name]",
"UserKey":"[Victim User Key]"
}

  1. Graph API Query Execution

This log entry captures the attacker's use of the Graph API to search the mailbox, with the POST method hiding specific query details.

{
"EventTime":"X",
"requestMethod": "POST",
"requestUri":"https://graph.microsoft.com/beta/search/query",
"appId":"[Rogue OAuth App ID]",
"ipAddress":"185.100.X.X. (Rostelecom)",
"userAgent":"python-requests/2.31.0",
"apiVersion":"beta"
}

  1. Graph API Email Access

Right after the repetitive queries, the attacker commenced the extraction of email content, highlighting their intent to target sensitive information.

{
"EventTime":"X",
"requestMethod": "GET",
"requestUri":"https://graph.microsoft.com/v1.0/me/messages/
[Message ID]",
"appId":"[Rogue OAuth App ID]",
"ipAddress":"185.100.X.X. (Rostelecom)",
"userAgent":"python-requests/2.31.0",
"apiVersion":"beta"
}

  1. Scout Suite Usage in AWS

AWS CloudTrail shows the attackers using stolen credentials to run Scout Suite, enumerating permissions in the sandbox environment.

{
"eventTime":"X",
"src_ip":"185.100.X.X. (Rostelecom)",
"src_useragent":"Scout-Suite/5.13.0 md/Botocore#1.34.74 ua/
2.0 os/linux#4.4.0-26100-Microsoft md/arch#x86_64 lang/
python#3.10.12 md/pyimpl#CPython cfg/
retry-mode#legacy Scout Suite/5.13.0 
(https://github.com/nccgroup/ScoutSuite)",
"accessKeyId":"[Stolen AccessKeyId]"
}

  1. Exploitation of Trust Relationship

This entry shows the attacker leveraging the trust relationship to assume a role in the Production account.

{
"eventTime":"X",
"src_ip":"185.100.X.X. (Rostelecom)",
"eventName":"AssumeRole",
"EventSource":"sts.awsamazon.com",
"RequestParameters":{
"roleArn":"arn:aws:iam:
[Sanitized Production Account ID]:role/[Role Name]",
"roleSessionName":"[Session Name]"
}

Strategic Recommendations to Reduce Risk of Rogue OAuth App Attacks

  1. OAuth App Governance
    • Implement a strict approval process for third-party OAuth applications.
    • Regularly audit and revoke unnecessary app permissions in Microsoft Azure.
  2. Phishing Defense
    • Enhance user training to recognize phishing emails and suspicious links.
    • Deploy advanced email filtering to detect and block malicious OAuth app links.
  3. Credential Management
    • Prohibit storing sensitive credentials, such as AWS access keys, in email or unsecured locations.
    • Use a secure vault solution for managing and rotating access keys.
  4. Monitoring and Detection
    • Enable detailed logging for Microsoft Graph API and AWS activities to capture suspicious behavior.
    • Implement real-time alerts for unauthorized OAuth app activity and anomalous cloud access.

Conclusion: Why Rogue OAuth App Threats Require Attention

This incident shows how a single email can lead to a cloud infrastructure compromise if combined with weak app governance and misconfigured trust relationships, underscoring the risk posed by rogue OAuth applications and the importance of securing cloud environments against lateral movement. 

By addressing the identified misconfiguration, such as permissive OAuth apps, exposed credentials, and misconfigured trust relationships, organizations can significantly reduce the risk of similar attacks. Robust monitoring and attribution is essential to detecting and responding to threats effectively.

LAST UPDATED:

August 26, 2025

Don't miss these stories:

Defending SaaS & Cloud Workflows: Supply Chain Security Insights with Idan Cohen

From GitHub Actions to SaaS platforms, supply chain threats are growing. Hear Mitiga’s Idan Cohen and Field CISO Brian Contos explore real-world compromises, detection tips, and strategies to strengthen your cloud security.

Inside Mitiga’s Forensic Data Lake: Built for Real-World Cloud Investigations

Most security tools weren’t designed for the scale or complexity of cloud investigations. Mitiga’s Forensic Data Lake was.

Measurements That Matter: What 80% MITRE Cloud ATT&CK Coverage Looks Like

Security vendors often promote “100% MITRE ATT&CK coverage.” The reality is most of those claims reflect endpoint-centric testing, not the attack surfaces organizations rely on most today: Cloud, SaaS, AI, and Identity.

How Threat Actors Used Salesforce Data Loader for Covert API Exfiltration

In recent weeks, a sophisticated threat group has targeted companies using Salesforce’s SaaS platform with a campaign focused on abusing legitimate tools for illicit data theft. Mitiga’s Threat Hunting & Incident Response team, part of Mitiga Labs, investigated one such case and discovered that a compromised Salesforce account was used in conjunction with a “Salesforce Data Loader” application, a legitimate bulk data tool, to facilitate large-scale data exfiltration of sensitive customer data.

Why Visibility Drives Everything in Modern Cybersecurity with Sevco’s Greg Fitzgerald

In this episode of Mitiga Mic, Brian Contos sits down with Greg Fitzgerald, co-founder of Sevco Security, for a candid conversation on the real state of asset visibility, prioritization, and the evolving challenges facing security teams. With nearly three decades in the industry, Fitzgerald brings perspective on how cybersecurity has shifted from endpoint tools to orchestration-wide awareness. And why that shift is critical for cloud, SaaS, AI, and identity defense. Watch the episode or read the full transcript below.

God-Mode in the Shadows: When Security Tools and Excessive Permissions Become Cloud Security Risks

By the time the alarms go off, it’s often too late. A trusted third-party security tool, one that promised to protect your cloud and SaaS environments, has been operating with unchecked ‘god-mode’ privileges. These tools, usually classified as SaaS Security Posture Management (SSPM) or Data Security Posture Management (DSPM), have been granted near-unrestricted access to your data, configurations, and secrets.