COMP-221 · Lesson 9 of 12 · 19 min
Cloud asset discovery
▶ Video coming soon A video version of this lesson is on the way.
Prairiefold's network diagram stopped at the firewall. Its real footprint did not. Mail, identity, file sharing, the careers site, marketing storage and part of the staging portal's pipeline all lived with cloud providers. On Tuesday, October 20, Priyanka opened a fresh page in the target profile titled "Everything that is not in a server room", and asked Tobias to help fill it.
This lesson covers discovering an organization's cloud and software-as-a-service assets from outside, and enumerating them from inside with limited, approved access. It draws on objective 2.1 (information gathering, including DNS and code repositories), objective 2.2 (secrets enumeration of cloud access keys, API keys and session tokens; permission enumeration; host and service discovery) and objective 2.4 (Shodan, Censys, DNS tools). Cloud attacks themselves are covered in COMP-223.
Shared responsibility and scope
Cloud services divide security responsibility between provider and customer. The provider secures its infrastructure; the customer secures what it configures: identities, data, storage permissions, network rules and applications. A penetration test examines the customer's side. The provider's infrastructure is never in scope merely because the client uses it, and tests must follow the provider's published rules for customer testing. Major providers allow customers to test their own resources without advance approval for most services, but prohibit activities such as denial-of-service testing and anything that touches other customers.
Prairiefold's authorization covered its Microsoft 365 tenant configuration and its Azure subscription. The rules of engagement granted Priyanka a cloud account with a read-only role on the subscription and a read-only directory role, so she could review configuration without changing anything. Password guessing against cloud accounts was prohibited, and any user enumeration against Microsoft sign-in services was limited to the small set of test addresses Prairiefold supplied.
What DNS says about the cloud
DNS records from lesson 3 are the starting point. MX records pointing to a cloud mail service, autodiscover records, SPF includes and domain verification tokens in TXT records show which providers the organization uses. CNAME records reveal hosted applications, content delivery networks and storage endpoints, because cloud services typically give each customer resource a name under the provider's domain and customers alias their own names to it.
# Which names alias to provider-hosted resources?
dig careers.prairiefold.example CNAME +short
dig news.prairiefold.example CNAME +short
dig autodiscover.prairiefold.example CNAME +shortpf-careers.app-host.example. pf-news.cdn-edge.example. autodiscover.mail-provider.example.
Tobias resolved each target in turn. The news site's CDN name and the autodiscover alias resolved normally. The careers alias did not: the provider-hosted name returned NXDOMAIN. The careers application had been deleted from the provider, but the CNAME pointing to it remained. That is the dangling CNAME pattern from lesson 3. If the provider let any customer create an application with the same name, an outsider could take over careers.prairiefold.example and serve anything on it, including a convincing fake job application form. Priyanka recorded it as a high-priority hypothesis for COMP-222 work, to be confirmed only by the safe method agreed with the client, and Felix had the record removed the following week.
Providers also publish the IP address ranges their services use. Comparing addresses found during discovery against those lists shows which belong to a provider rather than to the client, which helps avoid scanning shared infrastructure by mistake.
Identity: the tenant from outside
Cloud identity services expose some information publicly by design, because sign-in pages must know where to send a user. Querying the identity provider's published discovery documents for a domain can reveal whether the organization has a tenant, its tenant identifier, which other domains are registered to it, and whether sign-in is managed in the cloud or federated to an on-premises identity provider. These are ordinary, unauthenticated requests to the provider, not to the client, and they are generally treated as passive.
For Prairiefold, these lookups confirmed a Microsoft Entra ID tenant, cloud-managed sign-in with password hash synchronization from the on-premises directory, and three additional verified domains, one of them belonging to a credit union that had merged with Prairiefold years earlier. The merged domain was still verified in the tenant and still had an MX record pointing to the cloud mail service, which meant mail addressed to it was accepted. Nobody at Prairiefold had thought about that domain in years.
User enumeration against cloud identity services is a different matter. Sign-in flows sometimes respond differently for existing and non-existing usernames, and attackers exploit this to confirm valid accounts before password spraying. Testing this sends requests about the client's users to the provider, can count toward lockout protections and may alert the client's security team. It is active, and Ironwhistle's rules limited it to Prairiefold's supplied test addresses, which was enough to show whether the behavior existed. Defenses include the provider's smart lockout, conditional access, and, above all, phishing-resistant multifactor authentication so that a confirmed username is worth little.
Storage
Cloud object storage holds files in containers (called buckets by some providers). Each container has a name that forms part of a public address, and each can be set to allow anonymous reading or even anonymous listing of its contents. Misconfigured public storage has caused many data exposures. Discovery works because names are predictable: organizations name storage after themselves, their products and their environments.
| Provider term | Public address pattern (described) | Anonymous access setting |
|---|---|---|
| Azure storage account and blob container | Account name plus the blob service domain, then the container path | Container public access level: none, blob or container |
| Amazon S3 bucket | Bucket name in the S3 service domain | Bucket policies, access control lists and Block Public Access |
| Google Cloud Storage bucket | Bucket name under the storage domain | Uniform bucket-level access and IAM bindings such as allUsers |
Tools such as cloud_enum and, for Azure specifically, MicroBurst generate candidate names from keywords and test whether storage endpoints with those names exist and allow anonymous access. Internet scan data and search engines sometimes index public storage too. With read-only access to the subscription, the authenticated view is faster and more reliable: list every storage account and check each container's access level directly.
# Authenticated, read-only review with the Azure CLI (role assigned for the engagement)
az account show --query "{subscription:name, tenant:tenantId}"
az storage account list --query "[].{name:name, publicAccess:allowBlobPublicAccess, tls:minimumTlsVersion}" -o table
az storage container list --account-name <storage-account> --auth-mode login \
--query "[].{container:name, access:properties.publicAccess}" -o tableName PublicAccess Tls ---------------- -------------- ------- pfcustaging01 False TLS1_2 pfcumarketing True TLS1_2 pfcureports False TLS1_0 Container Access ----------- --------- brochures container events container web-assets blob
The marketing account allowed public access, which made sense for brochures and website images. But two containers were set to container access, which lets anyone list every file, and the events container held, alongside photographs, a spreadsheet of registrations for a member financial literacy evening. It contained names, email addresses and branch preferences of about 300 members. That was personal information, and the rules of engagement required testers to stop accessing any member data they encountered. Priyanka confirmed the file name and size from the listing, did not download it, captured the evidence of anonymous listing, and called Dario, who called Gwendolyn. The container was made private within the hour. Ruth Mbatha, Prairiefold's legal counsel, then took over the question of whether the exposure needed to be reported under privacy law, which was the client's decision, informed by the evidence Ironwhistle provided.
The reports account also allowed connections using TLS 1.0, an outdated protocol version, which went into the findings as a configuration weakness with a simple fix.
Secrets: keys and tokens
Objective 2.2's secrets enumeration names cloud access keys, passwords, API keys and session tokens. In cloud environments these turn up in code repositories, continuous integration pipeline settings and logs, infrastructure-as-code templates, container images, application configuration and environment variables, and browser storage in web applications. Many have recognizable formats: cloud access key identifiers and some API tokens begin with fixed prefixes, which is why automated secret scanners can find them reliably.
| Where secrets hide | Example | Detection and defense |
|---|---|---|
| Public and internal code repositories | Access keys in a configuration file or commit history | Secret scanning with push protection; rotate on exposure |
| Pipeline settings and build logs | A deployment token printed in a failed build | Masked variables; short-lived credentials via federation |
| Infrastructure-as-code templates | A database password in a template parameter default | Reference a secrets vault instead of literal values |
| Container images | Credentials baked into an image layer | Scan images; inject secrets at run time |
| Web front ends | A third-party API key in JavaScript | Keep privileged keys server-side; restrict public keys by origin |
| Session tokens | Tokens in logs, URLs or shared screenshots | Short lifetimes, token binding, careful logging |
With read access to the staging portal's pipeline configuration, granted under the web test, Priyanka found that a deployment pipeline used a long-lived service principal secret stored as a pipeline variable. It was correctly masked in logs, which she recorded as a positive. She also found that the same secret had been set to expire in two years and had broad contributor rights on the whole subscription. The recommendation was to replace it with workload identity federation, which issues short-lived tokens, and to narrow its role to the resource group it deployed to.
Permission enumeration in the cloud
In the cloud, identity is the perimeter. Permission enumeration asks which identities, human and machine, can do what to which resources. With read-only access, testers list role assignments at each level (management group, subscription, resource group, resource), directory roles, application permissions and consent grants, and look for the same patterns as on premises: too many owners, standing privileged access, stale accounts, and machine identities with more rights than they need.
# Who holds which roles on the subscription?
az role assignment list --all --query "[].{who:principalName, type:principalType, role:roleDefinitionName, scope:scope}" -o tablePrairiefold's subscription had seven Owner role assignments, three of them for individual user accounts that also held day-to-day email and browsing access, and no use of just-in-time elevation. Open-source assessment tools such as ScoutSuite and Prowler run hundreds of read-only checks like these across a cloud account and produce a report of misconfigurations, which the team used as a checklist rather than a verdict, confirming each item by hand.
Cloud hosts and services from outside
Virtual machines, managed databases and other services with public addresses appear in internet scan data and in live scans like any other host, provided the addresses belong to the client's resources. Shodan and Censys searches by organization name or certificate often find cloud-hosted services that do not appear in the client's own address block. Prairiefold's search found one: a virtual machine used for a proof of concept, with SSH open to the internet, inside the in-scope subscription. It was added to the scan list after Felix confirmed it, and to the findings as an untracked asset.
Defending the cloud footprint
Cloud defense starts with knowing what exists. Organizations should maintain an inventory across every subscription and tenant, remove DNS records when resources are deleted, block public access to storage by default and allow it only for containers meant to be public, run secret scanning on every repository and pipeline, prefer short-lived federated credentials over long-lived secrets, keep privileged roles few and time-limited, and run configuration assessment tools continuously rather than once a year. Each of these maps to a Prairiefold finding from this lesson.
Worked problem
Is this cloud resource in scope?
Priyanka finds four things: a storage account in Prairiefold's subscription; a CNAME from Prairiefold's domain to a software-as-a-service provider for the help desk portal; a public storage container named after Prairiefold in an unknown account; and Microsoft's sign-in service. Which can she enumerate further under the authorization?
Show solution
- The storage account is in Prairiefold's subscription, covered by the authorization: in scope for read-only review.
- The help desk portal is run by a provider. Prairiefold's configuration of it may be reviewable through Prairiefold's own admin account, but the provider's platform is out of scope without the provider's permission.
- A container named after Prairiefold in an unknown account might belong to a supplier, a former employee or an impersonator. Record it, do not access its contents beyond what is needed to describe it, and ask Prairiefold whether it is theirs.
- Microsoft's sign-in service is provider infrastructure. Only the agreed, limited user enumeration with test addresses is allowed.
Answer: Only the storage account in the subscription is clearly in scope; the others are recorded and raised with the client, or handled within the specific limits agreed.
Common mistakes
MistakeAssuming anything with the client's name on a cloud platform is the client's.
InsteadConfirm ownership through the client's subscriptions and tenant before enumerating further.
MistakeDownloading files from public storage to prove exposure.
InsteadProve listing or access with metadata, stop at personal data, and report.
MistakeTesting provider infrastructure because the client uses it.
InsteadTest only the client's resources, following the provider's rules for customer testing.
MistakeRunning user enumeration against a cloud sign-in service at volume.
InsteadTreat it as active, keep to agreed test accounts, and respect lockout protections.
MistakeTreating assessment tool output as a list of confirmed findings.
InsteadUse it as a checklist and confirm each item.
Summary and key terms
- Under shared responsibility, testers examine the customer's configuration, never the provider's infrastructure.
- DNS records reveal cloud mail, identity, hosting and storage; dangling CNAMEs are takeover candidates.
- Public identity discovery documents reveal tenants and sign-in types; user enumeration against sign-in services is active.
- Storage containers may allow anonymous reading or listing; prove exposure with metadata and stop at personal data.
- Secrets hide in repositories, pipelines, templates, images and front ends; short-lived federated credentials reduce the risk.
- Permission enumeration in the cloud examines role assignments, directory roles and machine identities.
- ScoutSuite and Prowler automate read-only configuration reviews, confirmed by hand.
- Shared responsibility model
- The division of security duties between a cloud provider and its customer.
- Tenant
- An organization's dedicated instance of a cloud identity service.
- Federated sign-in
- Authentication handled by the organization's own identity provider rather than the cloud service.
- Blob container
- A container for files in Azure storage, whose public access level may allow anonymous reads or listing.
- Subdomain takeover
- Gaining control of a subdomain whose DNS record points to an unclaimed third-party resource.
- Service principal
- An identity used by an application or automation in Microsoft Entra ID.
- Workload identity federation
- Exchanging a trusted external token for short-lived cloud credentials instead of storing a secret.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which DNS records most often reveal a cloud email provider?
Show answer
MX records, supported by SPF includes, autodiscover records and verification tokens in TXT records.
Why is cloud user enumeration treated as active?
Show answer
It sends requests about the client's users to sign-in services, can affect lockout protections and may be detected.
What is the safest way to show that a storage container allows anonymous listing?
Show answer
Capture the anonymous listing response with file names and sizes, without downloading sensitive contents.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.