Back to all lessons
Awareness Lessons
2 days ago

AI-Powered Agents Exploiting AWS Credentials via Webshells and EC2 Roles

Written by AI from the linked story. Not reviewed by an editor. How this works

Attackers are leveraging AntiFox, an open-source AI agentic penetration testing tool, hosted on Alibaba Cloud to systematically exploit valid AWS identities and EC2 instance roles — meaning stolen or abused legitimate credentials are doing the damage, not brute force. Once inside, the agents automate vulnerability scanning, webshell deployment, secret harvesting, and S3 manipulation, dramatically accelerating the attack lifecycle. The core failure is that legitimate AWS credentials and roles were either over-privileged or insufficiently monitored, allowing attackers to blend in with normal cloud activity. This matters because AI-driven attack agents can execute complex, multi-stage cloud intrusions far faster than defenders can manually detect them, making correlation of signals across web and cloud layers critical.

Tactical Insight

Immediate actions

  • Audit all EC2 instance roles and IAM identities to enforce least-privilege, removing any permissions not strictly required for the instance's function.
  • Enable AWS CloudTrail and GuardDuty across all accounts and regions to detect anomalous API calls, especially credential use from unexpected source IPs or regions.
  • Search for IIS webshells on internet-facing servers and correlate any findings with unusual AWS API activity in the same time window.

Long-term improvements

  • Rotate all AWS access keys and instance role credentials on a scheduled basis and immediately upon suspected compromise.
  • Enforce IMDSv2 (Instance Metadata Service v2) on all EC2 instances to prevent SSRF-based credential theft from the metadata endpoint.
  • Restrict outbound internet access from EC2 instances to only approved destinations using security groups and network ACLs.

Detection measures

  • Build detection rules that correlate IIS webshell indicators (unusual w3wp.exe child processes) with subsequent AWS API calls from the same host.
  • Alert on AWS API actions such as `GetSecretValue`, `ListBuckets`, or `DescribeInstances` performed by EC2 instance roles from unusual user-agent strings or at unusual times.
  • Implement behavioral baselines for EC2 role usage so that deviations — such as a role suddenly calling S3 or Secrets Manager — trigger immediate investigation.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.