Fundamentals

T1525

Cloud Security Fundamentals

Cloud security concepts every analyst needs — shared responsibility model, IAM policies vs roles vs users, CloudTrail, CloudWatch, Azure Monitor, VPC flow logs, and S3 logging. Foundation for investigating cloud incidents.

View on Graph

The Shared Responsibility Model — What the Provider Secures vs. What You Secure

The shared responsibility model is the single most important cloud security concept. Misunderstanding it is the root cause of most cloud data breaches.

Who Secures What

LayerAWSAzureGCPYour Responsibility
Physical security✅ Provider✅ Provider✅ ProviderNone
Hypervisor✅ Provider✅ Provider✅ ProviderNone
Network infrastructure✅ Provider✅ Provider✅ ProviderProvider-managed
Compute (EC2/VM/GCE)Provider (host)Provider (host)Provider (host)You configure: OS patching, firewall rules, access keys, IAM roles attached
Storage (S3/Blob/GCS)Provider (infrastructure)Provider (infrastructure)Provider (infrastructure)You configure: bucket policies, encryption, public access blocks, logging
Database (RDS/Azure SQL/Cloud SQL)Provider (infrastructure, basic patching)Provider (infrastructure, basic patching)Provider (infrastructure, basic patching)You configure: access controls, encryption at rest, backup retention
Identity (IAM/AAD/Cloud IAM)Provider (auth infrastructure)Provider (auth infrastructure)Provider (auth infrastructure)You configure: policies, roles, MFA, service account limits
Application codeYouYouYouApplication security, dependency management, secrets handling

Key insight for analysts: When investigating cloud incidents, look for IAM misconfigurations first. The Cloud Security Alliance reports that IAM misconfigurations are the leading cause of cloud data breaches — not provider vulnerabilities.

Common Shared Responsibility Mistakes

MistakeExampleDetection
Assuming IAM is the provider’s problemLeaving S3 bucket public because “AWS manages infrastructure”CloudTrail + bucket policy audit
Not patching cloud VMsAssuming EC2/VM patching is automatic (unless you configure it)AWS Systems Manager Patch Manager compliance report
Leaving default VPC settingsDefault security group allows all outbound trafficVPC Flow Logs showing unexpected outbound connections
Using root accountDaily operations from AWS root / Azure Global Admin / GCP org adminCloudTrail RootActivity events

IAM — Users vs. Roles vs. Policies (and Why the Difference Matters)

IAM is the control plane for who can do what in a cloud environment. Misconfigurations here account for the majority of cloud security incidents.

IAM Components

ComponentAWSAzureGCP
UserIAM UserAzure AD UserGoogle Account / Cloud Identity
GroupIAM GroupAzure AD GroupGoogle Group
RoleIAM Role (assumable)Azure RBAC Role / Managed IdentityIAM Role / Service Account
PolicyIAM Policy (JSON document)RBAC Role DefinitionIAM Policy (bindings)
Service principalIAM Role sessionService Principal (App Registration)Service Account

Users

A user is a long-term identity tied to a person. Users have static credentials (password, access keys).

Detection priority: Access keys used outside of automation. Every human user should use single sign-on (SSO) — not static access keys.

Roles

A role is an identity that can be assumed temporarily. Roles have no static credentials — they issue temporary credentials via AWS STS, Azure Managed Identity, or GCP Service Accounts.

Why roles matter for security:

  • No static access keys — temporary credentials expire (default 1 hour for AWS STS)
  • Least privilege is easier — assign roles to services, not users
  • Cross-account access — trust relationships between accounts (AWS, Azure, GCP)

Policies

A policy is a document that defines what an identity can do. Understanding how policies work is essential for investigation.

AWS IAM Policy structure:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::important-bucket/*",
      "Condition": {
        "IpAddress": {"aws:SourceIp": "10.0.0.0/8"}
      }
    }
  ]
}

Azure RBAC Role structure:

{
  "Name": "Custom Storage Blob Data Reader",
  "IsCustom": true,
  "Actions": ["Microsoft.Storage/storageAccounts/blobServices/containers/read"],
  "NotActions": [],
  "AssignableScopes": ["/subscriptions/{sub-id}"]
}

GCP IAM Policy structure:

{
  "bindings": [
    {
      "role": "roles/storage.objectViewer",
      "members": ["user:alice@example.com", "serviceAccount:sa@project.iam.gserviceaccount.com"]
    }
  ]
}

The Common Misconfiguration Pattern

Overly permissive policy: "Action": "*" and "Resource": "*" on a user or role = unfettered access to everything.

SPL query (via CloudTrail) — detect overly permissive policies being attached:

index=cloudtrail eventName="AttachUserPolicy" OR eventName="AttachRolePolicy" OR eventName="PutUserPolicy" OR eventName="PutRolePolicy"
| search requestParameters.policyArn="*:*:*:*:*"
| eval alert = "HIGH — Policy " . requestParameters.policyName . " attached to " . requestParameters.userName . " — verify least privilege"
| table _time, userIdentity.arn, requestParameters.policyArn, sourceIPAddress, alert
| sort - _time

CloudTrail, CloudWatch, and Azure Monitor — The Log Sources

AWS CloudTrail

CloudTrail records every API call made to AWS services — who, what, when, and from where.

Event types:

TypeWhat It CapturesRetention
Management EventsControl-plane operations (CreateUser, RunInstances, ModifySecurityGroup)90 days (default), longer with trail in S3
Data EventsData-plane operations (GetObject, PutObject, Invoke)Must be enabled per resource type
Insights EventsAnomalous API activity (unusual call volume, unusual API patterns)Must be enabled separately

Key CloudTrail fields for investigation:

FieldMeaningDetection Use
userIdentity.arnAWS ARN of the callerWho did it — user, role, federated identity, root, assumed role
eventNameAPI action (e.g., RunInstances, CreateAccessKey)What did they do
sourceIPAddressSource IP of the API callWhere did they log in from
userAgentClient used (console, CLI, SDK, Lambda)How did they access — automated vs. manual
requestParametersParameters of the API callWhat specific resource was targeted
recipientAccountIdTarget accountCross-account access indicator
errorCodeError returned (e.g., AccessDenied, UnauthorizedOperation)Failed attempts — attacker probing

Common CloudTrail detection queries:

# Failed API calls — attacker probing permissions
index=cloudtrail errorCode="AccessDenied" OR errorCode="UnauthorizedOperation"
| stats count by userIdentity.arn, sourceIPAddress, eventName, errorCode
| sort - count

# Root account activity — should be rare
index=cloudtrail userIdentity.type="Root"
| stats count by sourceIPAddress, eventName, userAgent
| sort - _time

# Console logins from unusual geolocations
index=cloudtrail eventName="ConsoleLogin"
| iplocation sourceIPAddress
| where Country != "US" AND Country != "CA" (adjust for your org)
| stats count by userIdentity.arn, sourceIPAddress, Country

Azure Activity Log (Azure Monitor)

Azure’s equivalent of CloudTrail — records control-plane operations on Azure resources.

Key event types:

TypeWhat It Captures
AdministrativeResource creation, modification, deletion (Create VM, Modify NSG)
Service HealthAzure service incidents and maintenance
Resource HealthResource status changes (unhealthy, degraded)
AlertAzure Monitor alert firings
AutoscaleAutoscale operation events
RecommendationAzure Advisor recommendations

Key fields:

FieldMeaning
callerWho made the call (UPN, SPN, or Object ID)
operationNamee.g., Microsoft.Compute/virtualMachines/write
statusSucceeded, Failed, Accepted, Started
httpRequest.clientIpAddressSource IP
propertiesEvent-specific details (resource changes, property values)

Sample KQL query — detect NSG rule modifications:

AzureActivity
| where OperationNameValue == "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/WRITE"
| project TimeGenerated, Caller, CallerIpAddress, Resource, OperationName, Status
| order by TimeGenerated desc

GCP Cloud Audit Logs

GCP’s Cloud Audit Logs capture administrative and data-access events.

Log types:

TypeWhat It Captures
Admin ActivityMetadata changes (CreateServiceAccount, SetIamPolicy) — always enabled
Data AccessRead/write of user data (GetObject, ReadLogs) — must be enabled
System EventsNon-human GCP actions (automatic maintenance)
Policy DeniedAccess denied by IAM — attacker probing

Key fields:

FieldMeaning
protoPayload.authenticationInfo.principalEmailWho did it
protoPayload.methodNamee.g., google.iam.admin.v1.CreateKey
protoPayload.requestMetadata.callerIpSource IP
protoPayload.status.code0 = success, 7 = PERMISSION_DENIED

VPC Flow Logs — The Cloud Network Log

VPC Flow Logs capture network traffic metadata in cloud environments. They are the cloud equivalent of firewall logs.

What They Capture

FieldDescription
srcaddr / dstaddrSource and destination IPs
srcport / dstportSource and destination ports
protocolTCP (6), UDP (17), ICMP (1)
packets / bytesTraffic volume
start / endWindow start and end timestamps
actionACCEPT or REJECT (AWS default deny / explicit allow)
log-statusOK, NODATA, SKIPDATA

Analyst Use Cases

  • Beaconing detection: Consistent outbound connections to a single IP at regular intervals
  • Data exfiltration: High outbound bytes to a destination that is not a known cloud service
  • Lateral movement: Unexpected internal connections between subnets or accounts
  • Scanning / recon: REJECT records from a single source targeting many ports or IPs

VPC Flow Logs are sampled by default (1 in 10,000 packets on AWS). For full visibility, enable 1:1 packet sampling or use a network tap solution.

Cross-Cloud Flow Log Setup

CloudService NameEnable Via
AWSVPC Flow LogsVPC Console or CLI: aws ec2 create-flow-logs
AzureNSG Flow LogsNetwork Watcher > NSG Flow Logs
GCPVPC Flow LogsEnabled per subnet: gcloud compute networks subnets update

S3 Logging — Server Access Logs vs. CloudTrail

S3 is the most common source of cloud data breaches. Two log sources exist:

S3 Server Access Logs

Granular logs for every request to S3, logged by the S3 data plane.

Enabled: Per-bucket destination in the same account (or another account).

Captures:

  • Bucket Owner, Bucket, Time, Remote IP, Requester ARN
  • Request ID, Operation (REST.GET.OBJECT, REST.PUT.OBJECT)
  • Key (object key), Request-URI, HTTP Status, Error Code
  • Bytes Sent, Object Size, Total Time, Turn-Around Time
  • Referrer, User-Agent, Version ID

S3 CloudTrail Data Events

Less granular than server access logs but integrated into CloudTrail and easier to search across accounts.

Enabled: Per-bucket in CloudTrail trail.

Captures:

  • Standard CloudTrail fields + S3-specific: bucketName, objectKey, eventName
  • s3: prefix events: GetObject, PutObject, DeleteObject, ListBucket

When to Use Which

ScenarioUse
Investigating known bucket breachBoth — Server Access Logs for full request audit, CloudTrail for user identity
Threat hunting for data accessCloudTrail Data Events — searchable in SIEM, cross-account
Compliance (who accessed which objects)Server Access Logs — includes object key, requester IP, HTTP status
Anomaly detection (unusual object access)CloudTrail + GuardDuty / Macie (not free)

SPL query — detect public S3 object access (Server Access Logs):

index=s3_access
| search requester="Anonymous" (public access)
| stats count by bucket, key, remote_ip, operation
| where count > 1
| eval alert = "MEDIUM — Public S3 access to " . bucket . "/" . key . " — check if public access is intentional"
| table _time, bucket, key, remote_ip, operation, count, alert

The Cloud Incident Investigation Workflow

Phase 1: Identify the Entry Point

QuestionLog Source
Was it leaked keys?CloudTrail — unusual source IP or user agent for a known user
Was it a misconfigured bucket?S3 Access Logs — public access (anonymous requester)
Was it a compromised IAM role?CloudTrail — API calls from an assumed role with unusual patterns
Was it a vulnerable app?VPC Flow Logs + ALB/Azure Front Door/GCP HTTP LB logs — exploitation pattern

Phase 2: Determine the Blast Radius

ActionLog Source
What data was accessed?S3 Access Logs — object keys accessed by attacker identity
What resources were created?CloudTrail — RunInstances, CreateInstance, CreateFunction
Were permissions escalated?CloudTrail — AttachRolePolicy, CreatePolicy, PassRole
Were credentials stolen?CloudTrail — CreateAccessKey, CreateServiceAccountKey
What network connections?VPC Flow Logs — outbound connections from compromised resources

Phase 3: Containment

ActionHow
Revoke stolen keysaws iam delete-access-key --access-key-id AKIA...
Disable compromised useraws iam update-user --user-name compromised --no-login-profile
Detach permissive policiesaws iam detach-role-policy --role-name compromised --policy-arn...
Block network accessUpdate security groups / NSG rules / firewall rules
Rotate all credentialsForce new passwords, access keys, and service account keys

Sources