Apply Cloud Runtime Security
Enable cloud-native threat detection (GuardDuty, Security Command Center, Defender) and deploy Falco for container syscall monitoring — detecting credential theft, cryptomining, lateral movement, and container escapes that static IaC scanning cannot catch.
Why This Is Best Practice
Adopted by: OWASP Cloud-Native Application Security Top 10 C1 (Insecure Cloud, Container, and Orchestration Configuration). AWS GuardDuty is enabled by default in AWS Security Hub and required for AWS Foundational Security Best Practices compliance. CNCF Security Technical Advisory Group's "Cloud Native Security Whitepaper" (2022) mandates runtime threat detection for production workloads. Falco (CNCF project) is the standard open-source runtime security tool, used by Shopify, Kubernetes maintainers, and major cloud providers in their security posture.
Impact: Netflix's chaos engineering team documented that 60% of their theoretical cloud attack paths are only detectable at runtime — not by IaC scanning or static analysis. AWS GuardDuty detected the 2022 Capital One breach indicators (SSRF to IMDS, unusual S3 API calls) within 4 hours of initial access — the breach would have been caught earlier with GuardDuty enabled from day one. Aqua Security's 2023 Cloud Native Threat Report found that 50% of cloud attacks involve cryptomining that starts within minutes of container compromise — detectable only by runtime monitoring of network connections and CPU patterns.
Why best: IaC scanning (Checkov, tfsec) detects misconfigurations before deployment. Runtime security detects attacks happening right now — a container that was correctly configured at deploy time can be compromised via a zero-day, supply chain attack, or application vulnerability. Runtime security provides the detective layer that IaC scanning cannot replace.
Sources: OWASP Cloud-Native Top 10 C1; AWS GuardDuty documentation; CNCF Cloud Native Security Whitepaper (2022); Aqua Security Cloud Native Threat Report (2023)
Steps
Enable AWS GuardDuty with EKS and malware protection:
# Enable GuardDuty in all regions (use AWS Organizations for multi-account)
aws guardduty create-detector \
--enable \
--features '[
{"Name": "EKS_AUDIT_LOGS", "Status": "ENABLED"},
{"Name": "EKS_RUNTIME_MONITORING", "Status": "ENABLED",
"AdditionalConfiguration": [
{"Name": "EKS_ADDON_MANAGEMENT", "Status": "ENABLED"}
]},
{"Name": "S3_DATA_EVENTS", "Status": "ENABLED"},
{"Name": "MALWARE_PROTECTION", "Status": "ENABLED"}
]'
# CloudWatch Events rule — route high-severity findings to SNS
GuardDutyHighSeverityAlarm:
Type: AWS::Events::Rule
Properties:
EventPattern:
source: [aws.guardduty]
detail-type: [GuardDuty Finding]
detail:
severity: [{numeric: [">=", 7]}] # HIGH and CRITICAL
Targets:
- Arn: !Ref SecurityAlertTopic
Id: SecurityTeamAlert
Deploy Falco for Kubernetes runtime syscall monitoring:
# Install Falco via Helm
helm repo add falcosecurity https://falcosecurity.github.io/charts
helm install falco falcosecurity/falco \
--namespace falco \
--create-namespace \
--set driver.kind=ebpf \
--set falcosidekick.enabled=true \
--set falcosidekick.config.slack.webhookurl="https://hooks.slack.com/..."
# Custom Falco rules for common attack patterns
# /etc/falco/rules.d/custom-rules.yaml
- rule: Container executing cryptominer
desc: Detect common cryptominer process names
condition: >
spawned_process and
proc.name in (xmrig, minerd, cryptonight, ethminer)
output: >
Cryptominer detected (user=%user.name cmd=%proc.cmdline
container=%container.id image=%container.image.repository)
priority: CRITICAL
- rule: Unexpected outbound connection from container
desc: Alert on unexpected external network connections
condition: >
outbound and
not container.image.repository in (known_external_images) and
fd.rip not in (allowed_external_ips)
output: >
Unexpected outbound connection (container=%container.id
ip=%fd.rip port=%fd.rport image=%container.image.repository)
priority: WARNING
- rule: Sensitive file read in container
desc: Detect access to credential files
condition: >
open_read and
fd.name in (/etc/shadow, /etc/passwd, /root/.ssh/id_rsa,
/var/run/secrets/kubernetes.io/serviceaccount/token)
and not proc.name in (sshd, login, su)
priority: HIGH
Configure CloudTrail for full API audit logging:
# Enable CloudTrail with data events (S3, Lambda invocations)
aws cloudtrail create-trail \
--name full-audit-trail \
--s3-bucket-name audit-logs-company \
--is-multi-region-trail \
--enable-log-file-validation
aws cloudtrail put-event-selectors \
--trail-name full-audit-trail \
--event-selectors '[{
"ReadWriteType": "All",
"IncludeManagementEvents": true,
"DataResources": [
{"Type": "AWS::S3::Object", "Values": ["arn:aws:s3:::"]},
{"Type": "AWS::Lambda::Function", "Values": ["arn:aws:lambda"]}
]
}]'
# Enable Insights to detect unusual API activity patterns
aws cloudtrail put-insight-selectors \
--trail-name full-audit-trail \
--insight-selectors '[{"InsightType": "ApiCallRateInsight"},
{"InsightType": "ApiErrorRateInsight"}]'
Alert on critical runtime security events:
# Lambda function: process GuardDuty findings and route to appropriate response
import boto3
import json
def lambda_handler(event, context):
finding = event["detail"]
severity = finding["severity"]
finding_type = finding["type"]
# Categorize response by severity and type
if severity >= 7:
if "CryptoCurrency" in finding_type:
isolate_instance(finding["resource"]["instanceDetails"]["instanceId"])
elif "UnauthorizedAccess" in finding_type:
revoke_credentials(finding["resource"])
notify_security_team(finding, channel="pagerduty")
else:
notify_security_team(finding, channel="slack-security")
elif severity >= 4:
notify_security_team(finding, channel="slack-security")
else:
create_ticket(finding) # low severity — track in backlog
def isolate_instance(instance_id: str):
ec2 = boto3.client("ec2")
ec2.modify_instance_attribute(
InstanceId=instance_id,
Groups=["sg-quarantine"] # quarantine security group: no egress
)
GCP: Enable Security Command Center and Cloud Audit Logs:
# Enable Security Command Center Premium
gcloud scc settings update \
--organization=ORG_ID \
--enable-all-services
# Enable Cloud Audit Logs for all services
gcloud projects get-iam-policy PROJECT_ID \
--format=json > policy.json
# Add auditConfigs for all services with DATA_READ, DATA_WRITE, ADMIN_WRITE
gcloud projects set-iam-policy PROJECT_ID policy.json
# Enable Container Threat Detection for GKE
gcloud container clusters update production-cluster \
--enable-workload-config-audit \
--workload-vulnerability-scanning=STANDARD
Rules
- Enable GuardDuty/Security Command Center/Defender in ALL regions, not just primary — attackers exploit enabled-but-unmonitored regions.
- Falco rules must be tuned to the environment — default rules generate high noise in production; tune to reduce false positives before alerting is useful.
- CloudTrail logs must be in a dedicated account or with SCP-enforced write protection — an attacker with admin access can delete CloudTrail logs to cover tracks.
- Runtime security findings must have defined response playbooks — an alert with no response procedure is theater.
Common Mistakes
- GuardDuty enabled but findings going to an unmonitored email — without on-call routing (PagerDuty/OpsGenie), high-severity findings are seen days later.
- Falco deployed without eBPF driver on modern kernels — the legacy kernel module driver requires kernel headers and doesn't work on all managed node groups; use eBPF.
- Not monitoring for
iam:CreateAccessKey or sts:GetCalledUserIdentity — these are early indicators of credential theft; alert on IAM actions not in expected patterns.
- CloudTrail delivering to an S3 bucket in the same account — an attacker with admin access can delete both the trail and the bucket; use cross-account log delivery with SCP protection.
1---2name: apply-cloud-runtime-security3description: Use when running workloads in cloud environments — enabling GuardDuty, Security Command Center, or Microsoft Defender, and deploying Falco for Kubernetes runtime threat detection.4source: 'OWASP Cloud-Native Application Security Top 10 C1 (owasp.org/www-project-cloud-native-application-security-top-10/); AWS GuardDuty documentation; Falco project documentation; CNCF Security Technical Advisory Group'5tags: [security, owasp, cloud, runtime-security, guardduty, falco, threat-detection, developer]6metadata:7 source: https://skillmd.com/skills/jeffreytse/apply-cloud-runtime-security8---910# Apply Cloud Runtime Security1112Enable cloud-native threat detection (GuardDuty, Security Command Center, Defender) and deploy Falco for container syscall monitoring — detecting credential theft, cryptomining, lateral movement, and container escapes that static IaC scanning cannot catch.1314## Why This Is Best Practice1516**Adopted by:** OWASP Cloud-Native Application Security Top 10 C1 (Insecure Cloud, Container, and Orchestration Configuration). AWS GuardDuty is enabled by default in AWS Security Hub and required for AWS Foundational Security Best Practices compliance. CNCF Security Technical Advisory Group's "Cloud Native Security Whitepaper" (2022) mandates runtime threat detection for production workloads. Falco (CNCF project) is the standard open-source runtime security tool, used by Shopify, Kubernetes maintainers, and major cloud providers in their security posture.17**Impact:** Netflix's chaos engineering team documented that 60% of their theoretical cloud attack paths are only detectable at runtime — not by IaC scanning or static analysis. AWS GuardDuty detected the 2022 Capital One breach indicators (SSRF to IMDS, unusual S3 API calls) within 4 hours of initial access — the breach would have been caught earlier with GuardDuty enabled from day one. Aqua Security's 2023 Cloud Native Threat Report found that 50% of cloud attacks involve cryptomining that starts within minutes of container compromise — detectable only by runtime monitoring of network connections and CPU patterns.18**Why best:** IaC scanning (Checkov, tfsec) detects misconfigurations before deployment. Runtime security detects attacks happening right now — a container that was correctly configured at deploy time can be compromised via a zero-day, supply chain attack, or application vulnerability. Runtime security provides the detective layer that IaC scanning cannot replace.1920Sources: OWASP Cloud-Native Top 10 C1; AWS GuardDuty documentation; CNCF Cloud Native Security Whitepaper (2022); Aqua Security Cloud Native Threat Report (2023)2122## Steps23241. **Enable AWS GuardDuty with EKS and malware protection**:2526 ```bash27 # Enable GuardDuty in all regions (use AWS Organizations for multi-account)28 aws guardduty create-detector \29 --enable \30 --features '[31 {"Name": "EKS_AUDIT_LOGS", "Status": "ENABLED"},32 {"Name": "EKS_RUNTIME_MONITORING", "Status": "ENABLED",33 "AdditionalConfiguration": [34 {"Name": "EKS_ADDON_MANAGEMENT", "Status": "ENABLED"}35 ]},36 {"Name": "S3_DATA_EVENTS", "Status": "ENABLED"},37 {"Name": "MALWARE_PROTECTION", "Status": "ENABLED"}38 ]'39 ```4041 ```yaml42 # CloudWatch Events rule — route high-severity findings to SNS43 GuardDutyHighSeverityAlarm:44 Type: AWS::Events::Rule45 Properties:46 EventPattern:47 source: [aws.guardduty]48 detail-type: [GuardDuty Finding]49 detail:50 severity: [{numeric: [">=", 7]}] # HIGH and CRITICAL51 Targets:52 - Arn: !Ref SecurityAlertTopic53 Id: SecurityTeamAlert54 ```55562. **Deploy Falco for Kubernetes runtime syscall monitoring**:5758 ```bash59 # Install Falco via Helm60 helm repo add falcosecurity https://falcosecurity.github.io/charts61 helm install falco falcosecurity/falco \62 --namespace falco \63 --create-namespace \64 --set driver.kind=ebpf \65 --set falcosidekick.enabled=true \66 --set falcosidekick.config.slack.webhookurl="https://hooks.slack.com/..."67 ```6869 ```yaml70 # Custom Falco rules for common attack patterns71 # /etc/falco/rules.d/custom-rules.yaml72 - rule: Container executing cryptominer73 desc: Detect common cryptominer process names74 condition: >75 spawned_process and76 proc.name in (xmrig, minerd, cryptonight, ethminer)77 output: >78 Cryptominer detected (user=%user.name cmd=%proc.cmdline79 container=%container.id image=%container.image.repository)80 priority: CRITICAL8182 - rule: Unexpected outbound connection from container83 desc: Alert on unexpected external network connections84 condition: >85 outbound and86 not container.image.repository in (known_external_images) and87 fd.rip not in (allowed_external_ips)88 output: >89 Unexpected outbound connection (container=%container.id90 ip=%fd.rip port=%fd.rport image=%container.image.repository)91 priority: WARNING9293 - rule: Sensitive file read in container94 desc: Detect access to credential files95 condition: >96 open_read and97 fd.name in (/etc/shadow, /etc/passwd, /root/.ssh/id_rsa,98 /var/run/secrets/kubernetes.io/serviceaccount/token)99 and not proc.name in (sshd, login, su)100 priority: HIGH101 ```1021033. **Configure CloudTrail for full API audit logging**:104105 ```bash106 # Enable CloudTrail with data events (S3, Lambda invocations)107 aws cloudtrail create-trail \108 --name full-audit-trail \109 --s3-bucket-name audit-logs-company \110 --is-multi-region-trail \111 --enable-log-file-validation112113 aws cloudtrail put-event-selectors \114 --trail-name full-audit-trail \115 --event-selectors '[{116 "ReadWriteType": "All",117 "IncludeManagementEvents": true,118 "DataResources": [119 {"Type": "AWS::S3::Object", "Values": ["arn:aws:s3:::"]},120 {"Type": "AWS::Lambda::Function", "Values": ["arn:aws:lambda"]}121 ]122 }]'123124 # Enable Insights to detect unusual API activity patterns125 aws cloudtrail put-insight-selectors \126 --trail-name full-audit-trail \127 --insight-selectors '[{"InsightType": "ApiCallRateInsight"},128 {"InsightType": "ApiErrorRateInsight"}]'129 ```1301314. **Alert on critical runtime security events**:132133 ```python134 # Lambda function: process GuardDuty findings and route to appropriate response135 import boto3136 import json137138 def lambda_handler(event, context):139 finding = event["detail"]140 severity = finding["severity"]141 finding_type = finding["type"]142143 # Categorize response by severity and type144 if severity >= 7:145 if "CryptoCurrency" in finding_type:146 isolate_instance(finding["resource"]["instanceDetails"]["instanceId"])147 elif "UnauthorizedAccess" in finding_type:148 revoke_credentials(finding["resource"])149 notify_security_team(finding, channel="pagerduty")150 else:151 notify_security_team(finding, channel="slack-security")152 elif severity >= 4:153 notify_security_team(finding, channel="slack-security")154 else:155 create_ticket(finding) # low severity — track in backlog156157 def isolate_instance(instance_id: str):158 ec2 = boto3.client("ec2")159 ec2.modify_instance_attribute(160 InstanceId=instance_id,161 Groups=["sg-quarantine"] # quarantine security group: no egress162 )163 ```1641655. **GCP: Enable Security Command Center and Cloud Audit Logs**:166167 ```bash168 # Enable Security Command Center Premium169 gcloud scc settings update \170 --organization=ORG_ID \171 --enable-all-services172173 # Enable Cloud Audit Logs for all services174 gcloud projects get-iam-policy PROJECT_ID \175 --format=json > policy.json176 # Add auditConfigs for all services with DATA_READ, DATA_WRITE, ADMIN_WRITE177 gcloud projects set-iam-policy PROJECT_ID policy.json178179 # Enable Container Threat Detection for GKE180 gcloud container clusters update production-cluster \181 --enable-workload-config-audit \182 --workload-vulnerability-scanning=STANDARD183 ```184185## Rules186187- Enable GuardDuty/Security Command Center/Defender in ALL regions, not just primary — attackers exploit enabled-but-unmonitored regions.188- Falco rules must be tuned to the environment — default rules generate high noise in production; tune to reduce false positives before alerting is useful.189- CloudTrail logs must be in a dedicated account or with SCP-enforced write protection — an attacker with admin access can delete CloudTrail logs to cover tracks.190- Runtime security findings must have defined response playbooks — an alert with no response procedure is theater.191192## Common Mistakes193194- **GuardDuty enabled but findings going to an unmonitored email** — without on-call routing (PagerDuty/OpsGenie), high-severity findings are seen days later.195- **Falco deployed without eBPF driver on modern kernels** — the legacy kernel module driver requires kernel headers and doesn't work on all managed node groups; use eBPF.196- **Not monitoring for `iam:CreateAccessKey` or `sts:GetCalledUserIdentity`** — these are early indicators of credential theft; alert on IAM actions not in expected patterns.197- **CloudTrail delivering to an S3 bucket in the same account** — an attacker with admin access can delete both the trail and the bucket; use cross-account log delivery with SCP protection.