fix(agent): correlation-chain block path bypassed cloud_safelist (banned Canonical)#1125
Merged
Merged
Conversation
…ned Canonical) Found live on the Hetzner box (2026-06-27): the `Data Exfiltration (eBPF Sequence)` correlation chain issued `ufw deny from 185.125.190.49` — Canonical's livepatch/archive range — breaking apt/livepatch on the host. Root cause: `handle_completed_chain` gated on `cloud_safelist::identify_provider` (the FIRST-OCTET heuristic), which only matches a hardcoded set of first octets and silently misses safelisted CIDR ranges whose first octet it doesn't enumerate. 185.125.190.49 is in the safelisted `185.125.188.0/22` (Canonical), but first octet 185 is not in the heuristic -> None -> not skipped -> blocked. This is the exact bug class the 2026-05-08 fix closed for the repeat-offender + decision paths (switched them to `safelist_label`, the CIDR walk), but the correlation-chain path was missed. Fix: a shared `safelisted_provider` helper (CIDR walk via `safelist_label`) now gates BOTH the correlation-chain path and the repeat-offender path, so they cannot drift apart again. Anti-evasion preserved: a real attacker outside every safelist range still returns None and stays blockable by both paths. Test `safelisted_provider_uses_cidr_walk_not_first_octet_heuristic` pins the regression witness (identify_provider misses 185.x) + the fix (safelist_label catches Canonical / ip-api.com / Fastly) + the anti-evasion (real attacker IPs are not safelisted). cargo fmt + clippy --workspace clean. 0 em-dashes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov flagged the two safelisted_provider() call sites (chain + repeat-offender) as uncovered: the prior test exercised the helper in isolation but neither async response path. Add an async test that drives check_repeat_offenders and handle_completed_chain with a CIDR-only safelisted IP (Canonical 185.125.190.49) and asserts each path purges it from reputation state instead of escalating a block. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
esteves-uk
approved these changes
Jun 27, 2026
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.
Found live on Hetzner (2026-06-27)
The
Data Exfiltration (eBPF Sequence)correlation chain issuedufw deny from 185.125.190.49— Canonical's livepatch/archive range — breaking apt/livepatch on the host.Root cause
handle_completed_chaingated oncloud_safelist::identify_provider(the first-octet heuristic), which only matches a hardcoded set of first octets and silently misses safelisted CIDR ranges whose first octet it doesn't enumerate.185.125.190.49is in the safelisted185.125.188.0/22, but first octet185isn't in the heuristic →None→ not skipped → blocked.This is the exact bug class the 2026-05-08 fix closed for the repeat-offender + decision paths (switched them to
safelist_label, the CIDR walk) — but the correlation-chain path was missed. The repeat-offender path's own comment even lists "Canonical archive blocked 14x" as a victim.Fix
A shared
safelisted_providerhelper (CIDR walk viasafelist_label) now gates both the correlation-chain path and the repeat-offender path, so they can't drift apart again.Anti-evasion preserved: a real attacker outside every safelist range still returns
Noneand stays blockable by both paths.Test
safelisted_provider_uses_cidr_walk_not_first_octet_heuristicpins: the regression witness (identify_providermisses 185.x), the fix (safelist_labelcatches Canonical / ip-api.com / Fastly), and the anti-evasion (real-attacker IPs are not safelisted).cargo fmt+cargo clippy --workspace -- -D warningsclean. 0 em-dashes.Discovered while updating Hetzner (the only k7.0 host) to 0.15.29 (where the eBPF execve-ppid fix also verifier-loads cleanly on kernel 7.0). Immediate mitigation already applied on the box (unblocked 185.125.190.49).
🤖 Generated with Claude Code