
在云平台环境下,安全组负责管理入站和出站网络流量。
将端口22(SSH)对公网(0.0.0.0/0)开放,极易引发未经授权的远程访问风险,成为攻击者入侵云主机的常见入口。
云安全最佳实践明确建议限制SSH端口的暴露范围,但在实际运维中,因配置不当或自动化脚本操作,仍可能存在误将端口22暴露在公网的场景。及时发现并修正此类配置,有效防止潜在威胁并加强云资源的安全防护。
请编写检测规则,识别通过 CloudTrail事件AuthorizeSecurityGroupIngress操作,将安全组端口 22 对未知外部IP或0.0.0.0/0开放的行为。
在编写检测语句时,请确保将
eventID字段包含在输出结果中,以便后续进行验证
数据源CloudTrail,数据样例:
{ "awsRegion": "ap-southeast-2", "eventCategory": "Management", "eventID": "fdf4b0b4-fb14-4237-af87-e97ba6360e1e", "eventName": "AuthorizeSecurityGroupIngress", "eventSource": "ec2.amazonaws.com", "eventTime": "2025-06-11T08:30:06Z", "eventType": "AwsApiCall", "eventVersion": "1.10", "managementEvent": true, "readOnly": false, "recipientAccountId": "438465128930", "requestID": "79c4dd5e-5e7c-4b36-bb98-1a95382c3c46", "requestParameters": { "cidrIp": "0.0.0.0/0", "fromPort": 22, "groupId": "sg-06519ff9524185867", "ipPermissions": {}, "ipProtocol": "tcp", "toPort": 22 }, "responseElements": { "_return": true, "requestId": "79c4dd5e-5e7c-4b36-bb98-1a95382c3c46", "securityGroupRuleSet": { "items": [ { "cidrIpv4": "0.0.0.0/0", "fromPort": 22, "groupId": "sg-06519ff9524185867", "groupOwnerId": "438465128930", "ipProtocol": "tcp", "isEgress": false, "securityGroupRuleArn": "arn:aws:ec2:ap-southeast-2:438465128930:security-group-rule/sgr-0932ae67cf102fcf1", "securityGroupRuleId": "sgr-0932ae67cf102fcf1", "toPort": 22 } ] } }, "sourceIPAddress": "154.84.135.91", "tlsDetails": { "cipherSuite": "TLS_AES_128_GCM_SHA256", "clientProvidedHostHeader": "ec2.ap-southeast-2.amazonaws.com", "tlsVersion": "TLSv1.3" }, "userAgent": "stratus-red-team_a830c203-b560-4c74-a5e5-f6cf5ffc1d26", "userIdentity": { "accessKeyId": "AKIAWMFUO5HRKBD6JQ6D", "accountId": "438465128930", "arn": "arn:aws:iam::438465128930:user/soclabs-test", "principalId": "AIDAWMFUO5HRCBESZ467O", "type": "IAMUser", "userName": "soclabs-test" }}
没有找到匹配的字段