Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CheckIMDSAccessRequiresToken = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0028", Provider: provider.AWSProvider, Service: "ec2", ShortCode: "enforce-http-token-imds", Summary: "aws_instance should activate session tokens for Instance Metadata Service.", Impact: "Instance metadata service can be interacted with freely", Resolution: "Enable HTTP token requirement for IMDS", Explanation: ` IMDS v2 (Instance Metadata Service) introduced session authentication tokens which improve security when talking to IMDS. By default <code>aws_instance</code> resource sets IMDS session auth tokens to be optional. To fully protect IMDS you need to enable session tokens by using <code>metadata_options</code> block and its <code>http_tokens</code> variable set to <code>required</code>. `, Links: []string{ "https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformEnforceHttpTokenImdsGoodExamples, BadExamples: terraformEnforceHttpTokenImdsBadExamples, Links: terraformEnforceHttpTokenImdsLinks, RemediationMarkdown: terraformEnforceHttpTokenImdsRemediationMarkdown, }, Severity: severity.High, }, func(s *state.State) (results rules.Results) { for _, instance := range s.AWS.EC2.Instances { if !instance.RequiresIMDSToken() && !instance.HasHTTPEndpointDisabled() { results.Add( "Instance does not require IMDS access to require a token", instance.MetadataOptions.HttpTokens, ) } else { results.AddPassed(&instance) } } return results }, )
View Source
var CheckNoSecretsInUserData = rules.Register( rules.Rule{ AVDID: "AVD-AWS-0029", Provider: provider.AWSProvider, Service: "ec2", ShortCode: "no-secrets-in-user-data", Summary: "User data for EC2 instances must not contain sensitive AWS keys", Impact: "User data is visible through the AWS Management console", Resolution: "Remove sensitive data from the EC2 instance user-data", Explanation: `EC2 instance data is used to pass start up information into the EC2 instance. This userdata must not contain access key credentials. Instead use an IAM Instance Profile assigned to the instance to grant access to other AWS Services.`, Links: []string{ "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-add-user-data.html", }, Terraform: &rules.EngineMetadata{ GoodExamples: terraformNoSecretsInUserDataGoodExamples, BadExamples: terraformNoSecretsInUserDataBadExamples, Links: terraformNoSecretsInUserDataLinks, RemediationMarkdown: terraformNoSecretsInUserDataRemediationMarkdown, }, CloudFormation: &rules.EngineMetadata{ GoodExamples: cloudFormationNoSecretsInUserDataGoodExamples, BadExamples: cloudFormationNoSecretsInUserDataBadExamples, Links: cloudFormationNoSecretsInUserDataLinks, RemediationMarkdown: cloudFormationNoSecretsInUserDataRemediationMarkdown, }, Severity: severity.Critical, }, func(s *state.State) (results rules.Results) { for _, instance := range s.AWS.EC2.Instances { if instance.IsUnmanaged() { continue } if result := scanner.Scan(instance.UserData.Value()); result.TransgressionFound { results.Add( fmt.Sprintf("Sensitive data found in instance user data: %s", result.Description), instance.UserData, ) } else { results.AddPassed(&instance) } } return }, )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.