fix(playbooks): Block metadata IP egress from the host itself - #7461
Open
regdocs wants to merge 1 commit into
Open
fix(playbooks): Block metadata IP egress from the host itself#7461regdocs wants to merge 1 commit into
regdocs wants to merge 1 commit into
Conversation
The iptables role only blocked 169.254.169.254 on the FORWARD chain from docker0 — i.e. from benches. The host's own processes reach it via the OUTPUT chain, which was unguarded, and that is the path the webhook SSRF used. Add an OUTPUT REJECT so a request from the control-plane host itself can't reach the metadata service either. REJECT rather than DROP so a stray request fails immediately instead of hanging on the timeout. Complements the application-layer fix in #7459. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
iptablesrole already blocks the cloud metadata IP (169.254.169.254), but only on theFORWARDchain scoped toin_interface: docker0— i.e. it stops benches/containers from reaching metadata. The host's own processes (the gunicorn web + background workers) reach the metadata service via theOUTPUTchain, which was unguarded.That
OUTPUTpath is exactly what the webhook SSRF used to reach169.254.169.254from the control-plane host. This adds anOUTPUT-chainREJECTso a request originating on the host itself can't reach the metadata service either.REJECT(notDROP) so a stray request fails immediately instead of hanging on the timeout. The existingSave iptables rulestask persists it to/etc/iptables/rules.v4.Relationship to the SSRF fix
This is the network-layer complement to the application-layer fix in #7459 (which resolves the webhook host, rejects non-global IPs, pins to the resolved IP, and disables redirects). The code fix is what closes the vulnerability; this ensures the next SSRF-shaped bug hits a wall at the network too.
Rollout note
This role runs on every server that runs
iptables.yml, and the rule also blocks the host's own runtime metadata use. That's safe where metadata is only read by cloud-init at boot (DigitalOcean / Hetzner / Frappe Compute) and where cloud API access uses static credentials rather than an instance role (press storesaws_secret_access_keyin the DB). Confirm no server type fetches IMDS at runtime before applying fleet-wide, and lift the rule during any maintenance that reconfigures networking (e.g. a floating/reserved-IP reassignment).🤖 Generated with Claude Code