Your own cloud account: assess with a read-only identity

Unit 4 of 5 in Active Directory, cloud and cluster assessment.

You will be able to read a provider's testing policy, create a separate read-only assessor identity, inventory and sweep an account you own, see your own test in the audit log and fix findings as code.

Lesson

Permission now has two layers: the account owner and the provider

AWS's penetration testing policy says customers are welcome to carry out security assessments of their own AWS infrastructure without prior approval for a list of permitted services, and that customers are not permitted to assess AWS infrastructure or the AWS services themselves; a problem found in an AWS service goes to AWS Security. The policy also prohibits activities such as denial of service and simulated denial of service, port, protocol and request flooding, and DNS zone walking through Route 53, and says that security testing that includes command and control requires prior approval.

It also says any tool that has a denial-of-service capability must be able to disable it. The lesson for your plan is that the provider's policy sits on top of your own scope. Read the current policy on the day you test, because it changes, and write the account, regions and services in your scope file. This is education, not legal advice.

Assess through a separate, read-only role

The AWS managed policy SecurityAudit is described as granting access to read security configuration metadata, useful for software that audits the configuration of an account. A role is a good home for it because a role has no long-term key: the trust policy, a required resource-based policy attached to the role, names the principals that you trust to assume it. The lab writes a trust policy that requires multi-factor authentication, attaches SecurityAudit and sets a session name.

Separating the assessor identity from the administrator identity limits what a mistake or a leaked credential can do, and it makes your test easy to find afterwards, because the session name shows in the audit log. It also makes the identity itself a subject of the assessment: who can assume it, and what it can and cannot do.

Map the account before you grade it

CloudFox's README says the tool helps you gain situational awareness in unfamiliar cloud environments, and then says something worth remembering: it does not create alerts or findings and does not check compliance against a baseline or benchmark. It gives you the information needed to validate whether an attack path is possible. Benchmark tools answer which checks fail. A map answers what exists, who can reach it, and who is trusted.

So you read its tables as a map and write the findings yourself, with a fix beside each: wildcard permissions, risky role trusts, workloads running with administrator roles. The sweep lab adds a script that checks every region for kinds of resource shared with the world, and proves the script against a resource you opened on purpose in your own account, then closed.

What the account owner sees

AWS describes CloudTrail event history as a viewable, searchable, downloadable and immutable record of the past 90 days of management events in a region, available by default and queryable with the lookup-events command. It lists limits: event history shows management events only, not data events, and covers only 90 days, so an ongoing record needs a trail or an event data store.

Reading your own assessment there teaches the defender's side: the role-assumption call, the burst of read calls under your session name, and the denied calls that map what the role tried and could not do. A pattern like that is something a defender could write a detection for, and the lab asks you to write the idea down.

Fix as code, then prove it

Fixing a finding in the console leaves no record and invites drift. The capstone lab fixes it in Terraform: read the plan before applying, scan before and after, and keep both sets of evidence. Terraform's plan command has a detailed exit code option that returns 0 for a successful run with no changes, 1 for an error and 2 for a successful run with changes present, which turns a re-run into a drift check: if someone changes the resource by hand, the next plan exits 2.

Key points

Sources

Lecture

Cloud shared responsibility: Which part of the security job is the provider's and which is yours, the line every cloud assessment is drawn on.

Practice in the labs

Do the whole cloud series on your own account: role, inventory, sweep, the log view and a fix as code. Free-tier accounts work; every lab says what to tear down.

Also try, in the simulators

Knowledge check

  1. According to AWS's policy, what are customers not permitted to assess? Answer: AWS infrastructure or the AWS services themselves. The policy welcomes assessments of customers' own infrastructure for listed services, and says problems found in AWS services should be reported to AWS Security.
  2. Why assess through a role instead of a long-term access key? Answer: A role has no long-term key to leak, its trust policy can require MFA, and its session can be named and found in the log. The trust policy defines who may assume the role; a named session makes your test visible to the account owner afterwards.
  3. What does the CloudFox README say it does not do? Answer: Create alerts or findings, or check compliance against a baseline or benchmark. It is a map for manual testing: you write the findings yourself.
  4. You need a record of account activity older than 90 days, including data events. What do you need? Answer: A trail or an event data store, because event history covers only 90 days of management events. AWS lists both limits and says an ongoing record needs a trail or an event data store.

Back to the syllabus or see all classes.

Related