D1Defect 15 of 17, in the order they close

One allow rule opens everything

allow-all ingress from 0.0.0.0/0, all protocols, no target, priority 1000.

Severity
critical
Closes in
phase 6, Govern and tighten
Closed by
Rule scoping and priority
  • Your VPC
  • Run by Google
  • Firewall and access rules
  • Allowed traffic
  • Where it breaks
A packetfrom 203.0.113.9to legacy-api :5432from the internetingress rules, by priority900 · allow-ssh-from-iap35.235.240.0/20 · tcp:22no match1000 · allow-all0.0.0.0/0 · all protocols · no targetD11000 · allow-health-check35.191.0.0/16 · tcp:80never checked65535 · implied denyevery ingress the rules above missnever checkedlegacy-api :5432answers the internet

Only what D1 touches. Red is the defect and what it lets through; switch to fixed to see the same parts with only D1 closed. Struck IDs are closed.

As foundallow INGRESS · 0.0.0.0/0 · all protocols · no target · priority 1000

Wide by design - scroll it sideways.

Notes

open one at a time

1.

What it can cause

Every port on every VM with an external address answers the internet - database ports, admin consoles, debug ports nobody remembers opening.
  • Every port on every VM with an external address answers the internet - database ports, admin consoles, debug ports nobody remembers opening.
  • Every narrow rule written since is decoration. Tightening one changes nothing, so reviews pass while nothing is protected.
  • Anyone who lands on one VM can reach every other VM on any port.
2.

Why it is wrong

Priority and the implied deny - a rule at 1000 is consulted long before the implied deny at 65535, so one broad allow makes every narrow rule decoration.

It sits above the implied deny at 65535, so it is consulted first and always matches. Every other ingress rule in the project is decoration.

The idea

Priority and the implied deny - a rule at 1000 is consulted long before the implied deny at 65535, so one broad allow makes every narrow rule decoration.

Learn it

3.

How you would find it

gcloud compute firewall-rules list --format="table(name,priority,direction,sourceRanges.list(),targetTags.list(),allowed[].map().firewall_rule().list())" --filter="direction=INGRESS AND sourceRanges:0.0.0.0/0"
detect
gcloud compute firewall-rules list --format="table(  name,priority,direction,sourceRanges.list(),targetTags.list(),  allowed[].map().firewall_rule().list())" \  --filter="direction=INGRESS AND sourceRanges:0.0.0.0/0"
4.

The change that closes it

Rule deleted. Each service keeps its own narrow rule, and the implied deny is reached again.
As found
allow INGRESS · 0.0.0.0/0 · all protocols · no target · priority 1000
Fixed
Rule deleted. Each service keeps its own narrow rule, and the implied deny is reached again.
fix
gcloud compute firewall-rules delete allow-all # verify nothing depended on it, per VM, before deleting:gcloud compute instances network-interfaces get-effective-firewalls legacy-api-abc1 \  --network-interface=nic0 --zone=asia-southeast1-b
5.

When to fix it

Phase 6, Govern and tighten - after D2, D6, D9

Phase 6, Govern and tighten, together with D10 and D11. Deleting the allow-all rule goes last, because it is the moment you find out what was quietly relying on it.

Cannot start until

  • D2SSH open to the internet · phase 2
  • D6Cloud Run ingress is left at all · phase 3
  • D9Egress is completely unrestricted · phase 5

Unblocks

Nothing waits on it.