WorkAWS Threat Detection as Code

Own projectCloud security2026

Six AWS threat detections written in Terraform, mapped to MITRE ATT&CK and scanned by Checkov in CI.

Six detections defined in Terraform and scanned in CI.

Role
Author
Scope
Own project
Stack
Terraform · CloudTrail · GuardDuty · EventBridge · Lambda · Checkov
Year
2026
Figure2026
CLOUDTRAILGUARDDUTYEVENTBRIDGE RULESLAMBDAALERTSroot-account-activityT1078.004console-login-no-mfaT1078cloudtrail-tamperingT1562.008iam-persistenceT1136.003 · T1098security-group-exposureT1562.007guardduty-findingsMANAGEDCLOUDTRAIL · GUARDDUTYEVENTBRIDGE RULESLAMBDAALERTS
CloudTrail and GuardDuty feed the EventBridge rules. Each of the six detections maps to its MITRE ATT&CK technique at the right.

Summary

CloudTrail and GuardDuty feed EventBridge rules that act as the detection logic. Each rule maps to a MITRE ATT&CK technique and sends matches to a Lambda function that raises an alert. Everything is defined in Terraform, and every change runs through terraform validate and a Checkov scan before it ships.

Detections

root-account-activity, T1078.004. Any use of the root account, which should never happen day to day.

console-login-no-mfa, T1078. A console sign-in without MFA, which is what a phished password looks like.

cloudtrail-tampering, T1562.008. Stopping, deleting or changing the trail. Attackers blind the logs first.

iam-persistence, T1136.003 and T1098. New IAM users, access keys, login profiles or attached policies: the classic backdoor.

security-group-exposure, T1562.007. Ingress opened to 0.0.0.0/0, whether by accident or on purpose.

guardduty-findings. GuardDuty's managed findings at or above the configured severity.

Coverage

This is a starter set, not full coverage. The gaps called out in the repository include exfiltration, STS lateral movement, data destruction and region hopping.