Mastering Cloud Reconnaissance: A Methodology for AWS & Azure Penetration Testing

Imagine you have just landed initial access during an internal penetration test. You pull the AWS credentials out of a developer's .aws/credentials file, export them to your environment, and run aws sts get-caller-identity. The credentials work. You are authenticated.
Now what?
A cloud environment with thousands of EC2 instances, hundreds of IAM roles, and dozens of undocumented API gateways stares back at you. Attempting to manually enumerate this infrastructure using the AWS CLI or the Azure portal is an exercise in futility. You will miss critical attack paths, and you will undoubtedly burn the limited time you have allocated for the engagement.
This is where a structured, automated cloud reconnaissance methodology becomes mandatory. Today, we are breaking down the exact workflow to rapidly map out AWS and Azure environments, identify exploitable misconfigurations, and establish situational awareness using CloudFox, an open-source tool developed by Bishop Fox.
A mandatory reminder: The reconnaissance techniques and tools detailed in this methodology must only be executed against cloud infrastructure where you have explicit, written authorization to perform penetration testing. Cloud providers will detect and shut down unauthorized scanning activity.
The Goal & Scope Rules
The primary goal of cloud reconnaissance is to answer three questions as fast as possible:
- Who am I? (What privileges do the current credentials hold?)
- Where is the data? (S3 buckets, Azure Blobs, RDS databases, Secrets Manager.)
- How do I escalate? (Over-permissive IAM roles, trust policy flaws, shadow admins.)
Before launching a single automated tool, you must strictly define your scope. If you are authorized to test the Dev AWS account, you must ensure your tools do not accidentally enumerate resources in the Prod account via cross-account IAM roles. Similarly, in Azure, ensure your reconnaissance is scoped to the specific Subscription or Resource Group dictated by your Rules of Engagement.
Stage 1: Initial Profiling and Situational Awareness
The first stage relies on establishing a baseline. We want to identify the footprint of the cloud environment without generating massive amounts of noise in CloudTrail or Azure Activity Logs.
For this, we turn to CloudFox. Designed to be the "PowerView for cloud infrastructure," CloudFox codifies common manual enumeration techniques into a fast, modular application.
First, install the latest binary from the CloudFox Releases page and configure your local cloud provider profiles.
To get a high-level summary of an AWS account's attack surface, run the inventory module:
# Enumerate all AWS services currently in use across all regions cloudfox aws --profile dev-account inventory
This command parses the environment and outputs clean, grepable tables summarizing EC2 instances, Lambda functions, IAM roles, and endpoints. By reviewing the inventory output, you can immediately decide where to focus your manual efforts.
Stage 2: Deep Enumeration and Privilege Analysis
Once you know what services exist, you must map the identity fabric. In cloud environments, identity is the new perimeter. If you can compromise a highly privileged IAM role or an Azure Service Principal, the entire network topology becomes irrelevant.
CloudFox automating the extraction and correlation of IAM permissions and active directory endpoints during a cloud assessment.
AWS IAM Enumeration
Run the CloudFox permissions command to analyze the exact actions your compromised user can perform. This is vastly superior to manually parsing JSON policies:
# Evaluate the effective permissions of the current AWS profile cloudfox aws --profile dev-account permissions
This output will highlight critical "shadow admin" privileges, such as the ability to iam:PassRole or iam:CreatePolicyVersion. If you see these permissions, you immediately have an escalation path to administrative control.
Azure Enumeration
If your target is hosted on Azure, you must pivot to enumerating Entra ID (formerly Azure Active Directory) and Role-Based Access Control (RBAC) assignments. CloudFox supports Azure natively. You can dump the entire RBAC hierarchy to identify users with Owner or Contributor rights over the target Subscription:
# Dump Azure RBAC assignments for a specific tenant cloudfox azure --tenant YOUR_TENANT_ID rbac
Stage 3: Hunting for Data and Secrets
With a firm grasp of the environment's topology and identity structure, the final reconnaissance stage involves hunting for the actual objective: sensitive data.
Developers frequently hardcode database credentials, API keys, and internal IP addresses in User Data scripts, Lambda environment variables, or publicly accessible storage buckets.
You can use CloudFox to dump the User Data (bootstrap scripts) of every EC2 instance in the account automatically:
# Dump EC2 User Data to search for hardcoded secrets cloudfox aws --profile dev-account instances -v
After generating the output files, you can use standard Linux utilities to parse the results for sensitive strings:
# Parse the localized CloudFox output for secrets grep -rni "password\|secret\|key" ~/.cloudfox/aws/dev-account/ec2/
Common Mistakes
- Ignoring Regions: A classic mistake is enumerating only the
us-east-1region. Attackers frequently hide persistence mechanisms (like rogue IAM users or cross-account roles) in unused, unmonitored regions (e.g.,ap-northeast-2). Always scan globally. - Over-Scanning: Running tools like Pacu or CloudFox without rate limits against a highly monitored production environment will trigger immediate GuardDuty alerts. Know when to use surgical, manual queries instead of loud, automated enumeration.
- Misinterpreting Trust Policies: Finding an IAM role is useless if you do not analyze its Trust Policy (who is allowed to assume it). Failing to enumerate cross-account trust relationships is a missed opportunity for lateral movement.
How Defenders Catch This
Defenders rely heavily on API telemetry to detect reconnaissance. In AWS, every API call made by CloudFox is logged in AWS CloudTrail.
A SOC analyst monitoring CloudTrail will look for specific behavioral patterns:
- Volume: A single IAM user executing hundreds of
Describe*,List*, andGet*API calls across multiple services in a matter of seconds. - Anomalous User Agents: If an attacker fails to spoof their HTTP User-Agent, API calls originating from known tools (or custom Python scripts using Boto3) will stand out against normal developer traffic.
- Access Denied Spikes: Automated tools often attempt to query services the compromised user does not have access to, generating a massive spike in
AccessDeniederrors.
Defenders can implement basic detection rules (like this example Sigma logic) to flag aggressive enumeration:
# Simplified Sigma rule for detecting excessive AWS API enumeration title: Excessive AWS Enumeration Activity logsource: product: aws service: cloudtrail detection: selection: eventName: - 'Describe*' - 'List*' - 'Get*' condition: selection | count(eventName) > 100 by userIdentity.arn
Verdict
Mastering cloud reconnaissance requires abandoning manual portal clicking in favor of structured automation. Tools like CloudFox allow you to ingest the chaos of an enterprise AWS or Azure environment and distill it into actionable attack paths in minutes. By strictly defining your scope, identifying your identity boundaries, and systematically hunting for secrets, you transform a daunting cloud assessment into a predictable, repeatable methodology.
For a deeper dive into practicing these exact techniques safely, I highly recommend deploying CloudFoxable, Bishop Fox's intentionally vulnerable AWS sandbox designed specifically for learning cloud penetration testing.
Related Blogs
- Web Cache Deception Returns: Analyzing CVE-2026-44582
- Web Fuzzing Content Discovery Tool Roundup
- Tool Spotlight: Why Ligolo-ng is Replacing Chisel for Pentesting
References / Further Reading
- CloudFox Official Repository (GitHub). https://github.com/BishopFox/cloudfox
- CloudFox Releases. https://github.com/BishopFox/cloudfox/releases
- CloudFoxable Sandbox Environment. https://github.com/BishopFox/cloudfoxable
- AWS Security Incident Response Guide (AWS). https://docs.aws.amazon.com/whitepapers/latest/aws-security-incident-response-guide/aws-security-incident-response-guide.html


