-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(misconf): improve CIDR related checks #8184
Comments
@itaysk @tamirkiviti13 @simar7 The description of some checks (e.g. https://github.com/aquasecurity/trivy-checks/blob/main/checks/cloud/google/compute/no_public_egress.rego) includes the wording In addition, there is an inconsistency between the description and the logic of the checks. The description talks about subnets that allow all traffic, i.e. cover the entire range of IP addresses, but in practice the check is triggered if the subnet:
Was there a reason why the checks did not originally check subnets containing only the entire IP range? Perhaps the check was intended to be broader to identify other potentially risky configurations, but this should be reflected in the description. If the purpose of the inspection is to identify subnets that allow all incoming traffic, the logic should be refined to match the description. Otherwise, the description should be adapted to clearly explain the current inspection logic. |
Using /0 is often a common security misconfiguration that is widely seen in practice, usually done to debug network flows but often left unsecured and shipped in production. This check simply aims to find /0 or ::/0 (incase of ipv6). I think we need to improve the logic to check that. That's my understanding of this check. |
@nikpivkin very good catch and discussion. I wanted to track the origin of this, the commit history is hard to follow with many renames and merges but looks like it is inspired by these original checks: https://github.com/aquasecurity/tfsec/blob/84e24dad91645b2d6250fecea501c60be6e3962a/internal/app/tfsec/checks/aws_open_security_group_rules.go https://github.com/aquasecurity/tfsec/blob/84e24dad91645b2d6250fecea501c60be6e3962a/internal/app/tfsec/checks/aws_public_ip.go Along the way maybe they were conflated somehow. Anyway, I think there's no question about checking for unrestrictive CIDR ( |
@itaysk Okay, got it.
I think we should focus on the first category. |
Discussed in #8181
Originally posted by tamirkiviti13 December 26, 2024
IDs
AVD-AWS-0104
Description
Trivy wrongly detects an issue of allowing access to /o CIDR range, even though a restrictive CIDR range is set by default in the variable.
Reproduction Steps
...
Version
Checklist
-f json
that shows data sources and confirmed that the security advisory in data sources was correctThe text was updated successfully, but these errors were encountered: