Scoping a cloud penetration test
Brief
A cloud test reviews what identities can do in accounts the client owns, under a letter that names those accounts, the identity we use and every change we may make. The first ten minutes prove the credentials in hand point at exactly those accounts, and show how a change is tested for permission without being made.
On this page
- Situation
- A signed scope letter or rules of engagement, and the credentials the client issued for the test: a read-only review role in AWS, a review principal or test user in Entra ID and Azure, a reviewer account in Google Cloud. Nothing has run yet. Every command on this page is a read or a dry run, and its only purpose is to prove that the credentials reach the accounts, subscriptions and projects the letter names, and nothing else, before any other page's checks start.
- Goal
- A scope check record: for each account, tenant, subscription and project, the identifier the CLI reports beside the one in the letter, the regions enabled against the regions in scope, and the changes the letter permits.
- Outputs
- Representative examples on placeholder hosts, trimmed to the lines that matter. Not captured from a public fixture yet.
Check first
- The letter names identifiers, not descriptions: AWS account ids, the Entra tenant id, Azure subscription ids, Google Cloud project ids, the regions, the review identity, the window in UTC, our source addresses, the client's contacts by role and a stop condition.
- Every change we may make is named in the letter, with the resource it touches: a tag, a test policy version, a function created and deleted. Anything not named is a read.
- Who owns each account. A parent company, a reseller or a vendor may run the organization, the tenant or the billing account, and the letter has to come from whoever can authorize testing of it.
- The provider's own testing policy, read the week the letter is signed, since they change. AWS lists the services that need no pre-approval, Microsoft publishes rules of engagement for its cloud, Google Cloud asks for no notice to test your own projects, and Oracle sets out its own process in its security testing policy.
- The operator log is running before the first command, as on the evidence package page.
Steps
What does the scope letter need to name?
Scope record, kept with the operator log
AWS account 111122223333 (alias corp-prod), regions us-east-1 and eu-west-1
identity: role atarus-review, session name atarus-review, ReadOnlyAccess
Azure tenant <tenant-id> (corp.example.com), subscription 00000000-1111-2222-3333-444444444444
identity: review service principal, Reader on that subscription only
Google Cloud project example-project-123456, reviewer tester@example.com, roles/viewer
Window 2026-11-02T14:00Z to 2026-11-06T22:00Z, from 203.0.113.24 only
Changes one tag atarus-scope=check on i-0abc1234def567890, removed the same hour
Out of scope production data reads, denial of service, other subscriptions in the tenant
Stop any identifier that does not match this record; any sign of another intruder
Contacts platform on-call (phone in the letter), security lead for findings rated Critical
A cloud test is a configuration and identity review with a few proofs, not an attack on the provider and not a test of the applications the account hosts. The record above is what the rest of the track checks against: every later page says its commands touch only what the letter names, and this is where those names come from. Read-only is the default posture because a review role sees almost everything a reader needs, and every write is a change to someone's production system that has to be named, small, reversible and recorded with its clean-up.
Negative result. A letter that says "the AWS environment" or "our Azure tenant" without identifiers. Nothing runs until the ids are in writing, because the CLI will happily reach accounts nobody meant to include.
Fix. The client keeps an inventory of accounts, subscriptions and projects with an owning team for each, so a scope letter can be written from it in an hour and a finding lands with the right team.
AWS
Is this the account the letter names?
aws sts get-caller-identity --query '[Account,Arn]' --output text
aws iam list-account-aliases --query 'AccountAliases' --output text
aws organizations describe-organization --query 'Organization.[Id,MasterAccountId,FeatureSet]' --output text
Expected output
$ aws sts get-caller-identity --query '[Account,Arn]' --output text
111122223333 arn:aws:sts::111122223333:assumed-role/atarus-review/atarus-review # <- account and session from the letter
$ aws iam list-account-aliases --query 'AccountAliases' --output text
corp-prod
$ aws organizations describe-organization --query 'Organization.[Id,MasterAccountId,FeatureSet]' --output text
o-a1b2c3d4e5 777766665555 ALL # <- the management account: whoever holds it owns the guardrails
get-caller-identity needs no permission and cannot be denied, so it is always the first call and its output is the first operator log line. The account id is the evidence; the alias is a label anyone with IAM rights can change. MasterAccountId names the organization's management account: if it is not an account the client named or owns, the service control policies and the organization trail belong to someone else, and the letter needs that party's agreement before the guardrail pages run.
Negative result. An account id that differs from the letter: stop, run nothing else, and tell the contact. AWSOrganizationsNotInUseException is not a stop; it means a standalone account with no SCPs and no organization trail, which goes in the coverage notes.
Fix. Issue review roles under a name that says what they are for, with a role session name the client can search CloudTrail for, and remove them when the test ends.
Which regions are enabled, and which are in scope?
aws account list-regions --region-opt-status-contains ENABLED ENABLED_BY_DEFAULT \
--query 'Regions[].RegionName' --output text
aws ec2 describe-instances --region ap-southeast-2 \
--query 'Reservations[].Instances[].InstanceId' --output text
Expected output
$ aws account list-regions --region-opt-status-contains ENABLED ENABLED_BY_DEFAULT --query ... --output text
ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-south-1 ap-southeast-1 ap-southeast-2 ca-central-1 eu-central-1 eu-north-1 eu-west-1 eu-west-2 eu-west-3 me-central-1 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 # <- the seventeen default regions plus one opt-in
$ aws ec2 describe-instances --region ap-southeast-2 --query ... --output text
An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to perform this operation. # <- refused before the service, by the region guardrail
Every enabled region is somewhere a resource can exist, so the list is the denominator for the coverage line in the report around the findings: two regions reviewed out of eighteen enabled is a statement the client needs to read. The seventeen regions AWS enables by default cannot be disabled, so the list never shrinks below them; an opt-in region in it, such as me-central-1, was turned on by someone. We run the second command only where the letter lists the region guardrail as something to check. An SCP that denies everything outside the approved regions refuses the call before EC2 sees it, which is what an out-of-scope region should look like from the CLI; a list of instances means the guardrail is missing or the region is allowed.
Negative result. No opt-in region the client does not use is enabled, and every region outside the letter is refused by a guardrail the SCP review can read.
Fix. Leave opt-in regions disabled unless a workload needs them, and deny the rest with an SCP on aws:RequestedRegion that exempts the global services.
How do I test whether a change is allowed without making it?
aws ec2 create-tags --dry-run --resources i-0abc1234def567890 --tags Key=atarus-scope,Value=check
sim() {
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::111122223333:role/atarus-review \
--action-names "$1" --resource-arns "$2" \
--query 'EvaluationResults[].[EvalActionName,EvalDecision]' --output text
}
sim ec2:CreateTags arn:aws:ec2:us-east-1:111122223333:instance/i-0abc1234def567890
sim s3:PutObject arn:aws:s3:::exports-prod-example/atarus-scope-check.txt
sim iam:CreateUser arn:aws:iam::111122223333:user/atarus-scope-check
aws ec2 describe-tags --filters Name=resource-id,Values=i-0abc1234def567890 Name=key,Values=atarus-scope \
--query 'Tags[].[Key,Value]' --output text
Expected output
$ aws ec2 create-tags --dry-run ... (with the test key the letter names for the tag proof)
An error occurred (DryRunOperation) when calling the CreateTags operation: Request would have succeeded, but DryRun flag is set. # <- allowed, and nothing was written
$ aws ec2 create-tags --dry-run ... (with the review role)
An error occurred (UnauthorizedOperation) when calling the CreateTags operation: You are not authorized to perform this operation. Encoded authorization failure message: <encoded>
$ sim ec2:CreateTags ...; sim s3:PutObject ...; sim iam:CreateUser ...
ec2:CreateTags implicitDeny
s3:PutObject implicitDeny
iam:CreateUser implicitDeny # <- each write tested on the resource it would touch: the review role cannot write, as the letter promised
$ aws ec2 describe-tags --filters ... --output text
# <- empty: the dry run left no tag
EC2 checks permission on a --dry-run call and stops there, so DryRunOperation proves the identity holds the permission and UnauthorizedOperation proves it does not; both exit 254 and neither changes anything. Most other services have no dry run, which is what the simulator is for. Each simulation names the resource the write would touch, one action to a call, because a simulation that names no resource tests only grants on *; the IAM policy evaluation page explains that rule and what else the simulator misses. Dropping --dry-run needs written consent for that change on that resource. The empty describe-tags is the clean-up check, and it goes in the log beside the dry run.
Negative result. The review role is denied every write, each simulated with its resource named, and the one change the letter names is allowed for the identity meant to make it.
Fix. Review roles carry ReadOnlyAccess or SecurityAudit and nothing else, so a mistake on our side fails at the API rather than in production.
Azure
Is the CLI pointed at the tenant and subscription in the letter?
az account show --query '{tenant:tenantId,subscription:id,user:user.name}' -o json
az account list --query '[].[name,id,tenantId]' -o tsv
Expected output
$ az account show --query '{tenant:tenantId,subscription:id,user:user.name}' -o json
{
"subscription": "00000000-1111-2222-3333-444444444444",
"tenant": "<tenant-id>", # <- must match the letter, not only the domain
"user": "<app-id>"
}
$ az account list --query '[].[name,id,tenantId]' -o tsv
corp-prod 00000000-1111-2222-3333-444444444444 <tenant-id>
corp-sandbox 55555555-6666-7777-8888-999999999999 <tenant-id> # <- visible, and not in the letter
The CLI keeps a default subscription and runs every later command against it, so the first read is which one that is. az account list shows every subscription the identity can see. A subscription that is visible but not in the letter stays out of scope: we never pass its id to --subscription, and we tell the client, because a review principal that sees more than it was meant to is a finding about how the role was assigned.
Negative result. One subscription, the one in the letter, under the tenant id in the letter.
Fix. Assign the review principal Reader on the subscriptions in scope only, never on a management group that holds others.
GCP
Is gcloud pointed at the project in the letter?
gcloud config list --format='value(core.account,core.project)'
gcloud projects describe example-project-123456 --format='value(projectNumber,parent.type,parent.id)'
Expected output
$ gcloud config list --format='value(core.account,core.project)'
tester@example.com example-project-123456
$ gcloud projects describe example-project-123456 --format=...
123456789012 organization <org-id> # <- the organization above the project, whose policies apply to it
gcloud config list reads local configuration and makes no call, so it is the check to run before anything leaves the machine. The project's parent says whether an organization sits above it; organization policies and folder-level grants then apply to the project, and reading them needs organization-level access the letter has to name, as the org policy review does.
Negative result. The account and project match the letter, and the parent is an organization the client owns.
Fix. Grant reviewers roles/viewer and roles/iam.securityReviewer on the projects in scope rather than at the organization.
The defender sees
GetCallerIdentity, ListAccountAliases, DescribeOrganization and ListRegions land in CloudTrail under the review session. The refused DescribeInstances in the excluded region carries errorCode Client.UnauthorizedOperation, and the dry run is a CreateTags event with errorCode Client.DryRunOperation, so a dry run is visible even though nothing changed. On Azure, signing in leaves an Entra sign-in record for the review principal; az account show and az account list read local and Resource Manager data and leave no Activity Log record, because that log holds writes only (see the Activity Log review). On Google Cloud, gcloud config list makes no call, and projects describe is an admin read that appears only where the client has turned on Data Access audit logs for Resource Manager. The client should be able to find the first of these within minutes of the window opening; if nobody can, that goes in the report as the first observation about logging.
Done when
Every identifier the CLI reports matches the letter, the enabled regions are listed against the regions in scope, the dry run is recorded with the empty tag read that follows it, and the operator log has its first line.
Not covered
Contract terms, denial of service, social engineering and physical work, which need their own agreements, each provider's testing policy beyond pointing at it, and the Oracle Cloud tenancy check, which opens the OCI page; the outputs shown are representative examples on placeholder accounts, not captured runs.