Skip to main content
Back
IntrusionAWS
11 min read

SugarCRM zero-day to AWS account takeover through keys on EC2 hosts

Victim
Unnamed organizations running SugarCRM on Amazon EC2
When
Not stated; within the year before August 2023Disclosed Aug 10, 2023
Entry
CVE-2023-22952 in SugarCRM gave code execution on EC2 instances that kept long-term IAM user access keys in plain text.

Unit 42 responded to multiple cases in the year before August 2023 in which the SugarCRM EmailTemplates flaw CVE-2023-22952 gave code execution on Amazon EC2 instances that kept long-term IAM user access keys in plain text. With those keys the actors inventoried the account and its AWS organization, restored the CRM databases from new snapshots as public databases, cloned the servers with SSH open and launched an instance in a Region the organization did not use. Their root sign-in to the management account failed, in some cases because of MFA; whether data was read from the public copies is not established.

What happened

External Parties
SugarCRM
Unit 42
Internet
AWS APIlong-term IAM user keys
SugarCRM
SugarCRM Workload
+ organizational units
+ account IDs
+ management account email
Organization Management
+ SSH open to any address
+ imported key pair
+ Marketplace AMI instance
Region Not in Use
SugarCRM Servers
CRM RDS Databases
Public Database Copies
Cloned EC2 Instances

Replaying the SugarCRM intrusions reported August 2023

  1. 1

    Zero-day to keys

    Not dated; the fix shipped on January 11, 2023

    A crafted request to the SugarCRM EmailTemplates module (CVE-2023-22952) runs code on the EC2 servers, and the actors read long-term IAM user keys in plain text from the AWS CLI credentials file.

  2. 2

    Discovery with the keys

    Not dated

    The keys call STS GetCallerIdentity, Pacu and Scout Suite scan EC2, IAM, RDS, S3, SNS, SES and Lambda, and Organizations and Cost Explorer calls return the management account ID and email and the account's costs.

  3. 3

    Database copies made public

    Not dated

    New RDS snapshots of the CRM databases are restored as public databases, with port 3306 added to security groups that allowed SSH and the master passwords changed; whether data was read is not established.

  4. 4

    Instances and Regions

    Not dated

    AMIs of the SugarCRM servers launch as new instances with SSH open to any address, and an instance from a public AWS Marketplace AMI is launched in a Region the organization did not use.

  5. 5

    Root sign-in attempt

    Not dated

    A root sign-in to the management account, with the email that DescribeOrganization returned, fails; in some cases MFA stopped it.

Impact

In multiple cases, IAM user keys taken from SugarCRM hosts inventoried the account and the organization, made public copies of the CRM databases and launched instances in normal and unused Regions; root sign-in failed, and whether data was read from the public copies is not established.

Outcome

Where cloud-provider controls fit

No AWS control refuses the SugarCRM exploit itself: the vendor's fix owns it, and a security group allow list only bounds who can send it, where your CRM need not be public. What turned a web flaw into an AWS intrusion was the long-term IAM user keys on the hosts. A service control policy that refuses every call by an IAM user without MFA leaves such keys answering only GetCallerIdentity in a member account; it does not bind the management account, and the sources do not say which account this was. A permissions boundary that caps the CRM's user at what your application needs would have refused the Organizations, Cost Explorer, snapshot, security group and EC2 calls in any account, though the sources do not say which policies the user held. A service control policy on approved Regions refuses calls in other Regions in member accounts only. An Allowed AMIs setting limited to your own accounts would have refused the launch from the AWS Marketplace image. VPC Block Public Access would have kept the public database copies and the cloned servers off the internet; it and declarative policies date from November and December 2024, after the incident. An AWS Sign-In policy on the management account bounds where a root sign-in can start, and MFA already stopped some attempts.

Could this have been prevented?

In hindsight, not as a whole. 5 controls would have refused a step outright, and 15 controls would have limited one. 2 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

5
Prevented
15
Contained
2
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

External Parties
SugarCRM
Unit 42
Internet
AWS APIlong-term IAM user keys
SugarCRM
SugarCRM Workload
+ organizational units
+ account IDs
+ management account email
Organization Management
+ SSH open to any address
+ imported key pair
+ Marketplace AMI instance
Region Not in Use
SugarCRM Servers
CRM RDS Databases
Public Database Copies
Cloned EC2 Instances

Replaying the SugarCRM intrusions reported August 2023

1 · Zero-day to keys

2 Contained2 Not covered6 on other clouds

2 · Discovery with the keys

1 Prevented5 Contained6 on other clouds

3 · Database copies made public

2 Prevented4 Contained9 on other clouds

4 · Instances and Regions

2 Prevented3 Contained6 on other clouds

5 · Root sign-in attempt

1 Contained3 on other clouds

Key facts

  • SugarCRM disclosed the EmailTemplates code injection flaw to its audience on January 10, 2023 and released the fixed versions 12.0.2 and 11.0.5 on January 11, 2023, with no workaround; the CVE record was published the same day
  • CISA added CVE-2023-22952 to the Known Exploited Vulnerabilities catalog on February 2, 2023
  • In the cases Unit 42 worked, the actors read long-term access keys of IAM users from the AWS CLI credentials file on the EC2 hosts, where they sat in plain text; the users held wider permissions than the application needed
  • The actors called STS GetCallerIdentity, scanned EC2, IAM, RDS, S3, SNS, SES and Lambda with Pacu and Scout Suite, and called Organizations and Cost Explorer; DescribeOrganization returned the management account ID and email
  • The actors restored new RDS snapshots as public databases, added port 3306 to their security groups and changed their master user passwords; whether data left could be measured only where VPC flow logs were on
  • The actors created no IAM users and did not stop CloudTrail or disable GuardDuty; their root sign-in attempts failed, in some cases because of MFA

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    When a Zero Day and Access Keys Collide in the Cloud: Responding to the SugarCRM Zero-Day VulnerabilityUnit 42 (Palo Alto Networks) · Aug 16, 2023 · ResearchEntry vector, credential access, discovery, RDS actions, EC2 actions, Regions, root sign-in attempts, defense evasion, remediation advice
  2. 2.
    Palo Alto: SugarCRM zero-day reveals growing cloud threatsTechTarget · Aug 10, 2023 · NewsBlack Hat talk, root MFA, attacker profile, SugarCloud statement
  3. 3.
    sugarcrm-sa-2023-001SugarCRM · Jan 11, 2023 · AdvisoryVulnerability description, affected and fixed releases, disclosure dates, SugarCloud hotfix
  4. 4.
    Known Exploited Vulnerabilities Catalog, entry CVE-2023-22952CISA · Feb 2, 2023 · AdvisoryExploitation in the wild, date added, required action
  5. 5.
    CVE-2023-22952NIST National Vulnerability Database · Jan 11, 2023 · AdvisoryCVE description, publication date

The estate in the replay is illustrative and drawn at the level of attack stages; the victim's real environment is not public. Verdicts describe what a control does when it is in place before the incident. They are not an assessment of the victim's security program.

More cloud attack breakdowns

All breakdowns