A documented AWS attack path shows how an attacker can escalate privileges by combining SSRF, exposed EC2 instance credentials, and a misconfigured CodeBuild project that reads its buildspec from an attacker-writable S3 bucket. In the reported scenario, the attacker first used Server-Side Request Forgery against an EC2 instance’s IMDSv1 metadata service to obtain temporary AWS credentials, then enumerated access and found permissions including codebuild:StartBuild and s3:PutObject.
Without needing iam:PassRole or permission to modify CodeBuild projects directly, the attacker altered the S3-hosted build specification and triggered a new build, causing arbitrary commands to run on the CodeBuild worker. That execution exposed the worker’s AWS credentials, which inherited the project’s assigned role and in the described case led to a more privileged role with iam:* permissions. The technique highlights how cloud misconfigurations can turn limited access into broad account compromise, and underscores mitigations including least privilege, tighter S3 and CodeBuild controls, and use of IMDSv2 to reduce SSRF impact on EC2 instances.

Map this exposure pattern across your cloud, code, and identities.
4 events from the most recent confirmed update back to the earliest known activity.
From the resulting shell on the CodeBuild worker, the attackers retrieved the worker's AWS credentials, which inherited the project's assigned role. In the reported case, this led to a more privileged role with iam:* permissions.
The attackers abused an attacker-writable S3 bucket used by a CodeBuild project for its buildspec, injecting commands into the buildspec file and then starting a build. This caused arbitrary code to execute in the context of the CodeBuild worker.
After enumerating permissions, the attackers found access to S3 and CodeBuild but could not create or update CodeBuild projects and did not have iam:PassRole. These constraints led them to look for an alternate privilege-escalation path.
In the described assessment, initial AWS credentials were obtained from an EC2 instance by exploiting SSRF against the IMDSv1 metadata service. This gave the attackers a foothold to enumerate the environment's AWS permissions.
Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.
See where this exposure pattern shows up across your cloud, code, supply chain, and non-human identities.
3 references tracked. Mallory keeps watching after this page renders.
owasp.org
Open sourceaws.amazon.com
Open sourceshielder.com
Open sourceMap indicators from this story to your assets and identify affected systems in minutes.
Every observed campaign, victim, and pivot linked to actors named in this story.
Malware, exploits, and IOCs connected to the activity described here.
YARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Get matching new stories delivered to your team as they break — not the next morning.
Ask questions about this story and take action on the answers.