
在AWS环境中,EC2实例会自动分配临时IAM凭据,以便安全地访问云服务。
如果攻击者获取了某个AWS账户中EC2实例的临时凭据,可能会在其自身控制的AWS账户下的EC2实例中使用这些凭据,从而在未经授权的环境中访问原账户的云资源。这种凭据泄露行为,使攻击者能够在其控制的外部环境中远程滥用原账户的权限,带来数据泄露和资源被非法操作等严重安全风险。
因此,及时检测EC2凭据在外部AWS账户环境中的异常调用,对于保障云环境的凭据安全至关重要。
识别所有由 EC2 实例凭据发起,且凭据所属账户与实际调用环境账户不一致的API操作事件。
在编写检测语句时,请确保将
eventID字段包含在输出结果中,以便后续进行验证
数据源CloudTrail,数据样例:
{ "id": 1, "awsRegion": "ap-southeast-2", "eventCategory": "Management", "eventID": "d588ddca-7441-4866-9197-3c25a05c4b5d", "eventName": "DescribeInstances", "eventSource": "ec2.amazonaws.com", "eventTime": "2025-05-23T09:01:24Z", "eventType": "AwsApiCall", "eventVersion": "1.10", "identityAccountId": "103164125733", "issuerAccountId": "438465128930", "managementEvent": true, "readOnly": true, "recipientAccountId": "438465128930", "requestID": "5902cc55-9e7f-4373-bed9-069305dcbf54", "requestParameters": { "filterSet": {}, "instancesSet": {} }, "responseElements": null, "sourceIPAddress": "101.44.82.95", "tlsDetails": { "cipherSuite": "TLS_AES_128_GCM_SHA256", "clientProvidedHostHeader": "ec2.ap-southeast-2.amazonaws.com", "tlsVersion": "TLSv1.3" }, "userAgent": "stratus-red-team_7092f0da-0a76-4b8e-b136-eb5ea1d7d5ec", "userIdentity": { "accessKeyId": "ASIAWMFUO5HRNCJ7VF5V", "accountId": "103164125733", "arn": "arn:aws:sts::103164125733:assumed-role/stratus-red-team-ec2-steal-credentials-role/i-02299a25947b0226d", "principalId": "AROAWMFUO5HRMMR7MYWAN:i-02299a25947b0226d", "sessionContext": { "attributes": { "creationDate": "2025-05-23T08:59:50Z", "mfaAuthenticated": "false" }, "ec2RoleDelivery": "1.0", "sessionIssuer": { "accountId": "438465128930", "arn": "arn:aws:iam::438465128930:role/stratus-red-team-ec2-steal-credentials-role", "principalId": "AROAWMFUO5HRMMR7MYWAN", "type": "Role", "userName": "stratus-red-team-ec2-steal-credentials-role" } }, "type": "AssumedRole" }, "userIdentity.type": "AssumedRole"}
没有找到匹配的字段