AWS Red Teaming: TTPs
When threat actors compromise an AWS user, they often follow a systematic process of enumeration and lateral movement to expand their access and gather sensitive information.
Hereโs a breakdown of how attackers perform these activities using various AWS CLI commands.
The first step an attacker takes is to identify the compromised IAM user and account details:
๐๐ฌ๐จ ๐จ๐ฉ๐จ ๐๐๐ฉ-๐๐๐ก๐ก๐๐ง-๐๐๐๐ฃ๐ฉ๐๐ฉ๐ฎ
Next, attackers gather more details about the IAM user (creation date, tags, and other metadata):
๐๐ฌ๐จ ๐๐๐ข ๐๐๐ฉ-๐ช๐จ๐๐ง --๐ช๐จ๐๐ง-๐ฃ๐๐ข๐ <๐ช๐จ๐๐ง๐ฃ๐๐ข๐>
To understand the userโs permissions, attackers check for group memberships and attached policies:
๐๐ฌ๐จ ๐๐๐ข ๐ก๐๐จ๐ฉ-๐๐ง๐ค๐ช๐ฅ๐จ-๐๐ค๐ง-๐ช๐จ๐๐ง --๐ช๐จ๐๐ง-๐ฃ๐๐ข๐ <๐ช๐จ๐๐ง๐ฃ๐๐ข๐>
๐๐ฌ๐จ ๐๐๐ข ๐ก๐๐จ๐ฉ-๐๐ฉ๐ฉ๐๐๐๐๐-๐ช๐จ๐๐ง-๐ฅ๐ค๐ก๐๐๐๐๐จ --๐ช๐จ๐๐ง-๐ฃ๐๐ข๐ <๐ช๐จ๐๐ง๐ฃ๐๐ข๐>
๐๐ฌ๐จ ๐๐๐ข ๐ก๐๐จ๐ฉ-๐ช๐จ๐๐ง-๐ฅ๐ค๐ก๐๐๐๐๐จ --๐ช๐จ๐๐ง-๐ฃ๐๐ข๐ <๐ช๐จ๐๐ง๐ฃ๐๐ข๐>
Attackers need to understand the permissions granted by these policies:
๐๐ฌ๐จ ๐๐๐ข ๐ก๐๐จ๐ฉ-๐ฅ๐ค๐ก๐๐๐ฎ-๐ซ๐๐ง๐จ๐๐ค๐ฃ๐จ --๐ฅ๐ค๐ก๐๐๐ฎ-๐๐ง๐ฃ <๐ฅ๐ค๐ก๐๐๐ฎ-๐๐ง๐ฃ>
๐๐ฌ๐จ ๐๐๐ข ๐๐๐ฉ-๐ฅ๐ค๐ก๐๐๐ฎ-๐ซ๐๐ง๐จ๐๐ค๐ฃ --๐ฅ๐ค๐ก๐๐๐ฎ-๐๐ง๐ฃ <๐ฅ๐ค๐ก๐๐๐ฎ-๐๐ง๐ฃ> --๐ซ๐๐ง๐จ๐๐ค๐ฃ-๐๐ <๐ซ๐๐ง๐จ๐๐ค๐ฃ-๐๐>
After understanding the permissions, attackers can move laterally by assuming roles or accessing other resources:
๐๐ฌ๐จ ๐๐๐ข ๐๐๐ฉ-๐ง๐ค๐ก๐ --๐ง๐ค๐ก๐-๐ฃ๐๐ข๐ <๐ง๐ค๐ก๐-๐ฃ๐๐ข๐>
๐๐ฌ๐จ ๐จ๐ฉ๐จ ๐๐จ๐จ๐ช๐ข๐-๐ง๐ค๐ก๐ --๐ง๐ค๐ก๐-๐๐ง๐ฃ <๐ง๐ค๐ก๐-๐๐ง๐ฃ> --๐ง๐ค๐ก๐-๐จ๐๐จ๐จ๐๐ค๐ฃ-๐ฃ๐๐ข๐ <๐จ๐๐จ๐จ๐๐ค๐ฃ-๐ฃ๐๐ข๐>
With new permissions granted, attackers can access sensitive data like S3 bucket contents, EC2 instances or secrets stored in Secrets Manager:
๐๐ฌ๐จ ๐๐2 ๐๐๐จ๐๐ง๐๐๐-๐๐ฃ๐จ๐ฉ๐๐ฃ๐๐๐จ
๐๐ฌ๐จ ๐จ๐๐๐ง๐๐ฉ๐จ๐ข๐๐ฃ๐๐๐๐ง ๐ก๐๐จ๐ฉ-๐จ๐๐๐ง๐๐ฉ๐จ
๐๐ฌ๐จ ๐จ๐๐๐ง๐๐ฉ๐จ๐ข๐๐ฃ๐๐๐๐ง ๐๐๐ฉ-๐จ๐๐๐ง๐๐ฉ-๐ซ๐๐ก๐ช๐ --๐จ๐๐๐ง๐๐ฉ-๐๐ <๐จ๐๐๐ง๐๐ฉ-๐๐>
๐๐ฌ๐จ ๐จ3 ๐ก๐จ ๐จ3://<๐๐ช๐๐ ๐๐ฉ-๐ฃ๐๐ข๐>
๐๐ฌ๐จ ๐จ3 ๐๐ฅ ๐จ3://<๐๐ช๐๐ ๐๐ฉ-๐ฃ๐๐ข๐>/๐ฅ๐๐จ๐จ๐ฌ๐ค๐ง๐๐จ.๐ฉ๐ญ๐ฉ .