Skip to content

Security: Duplicate-packet suppression only compares to the most recent packet, allowing trivial bypass #1724

Closed

Description

@bluetoothbot

Problem

_process_datagram_at_time short-circuits processing only when the incoming data equals self.data — a single-slot remembered "last packet." An attacker alternating between two byte-distinct payloads (A, B, A, B, …) bypasses the guard entirely on every packet, even when the actual semantic content is the same query. Combined with finding #1, this means an attacker who alternates just two TC-flagged payloads is also defeating duplicate suppression at the receive layer, and every packet flows through DNSIncoming(...) parse + the deferred-queue path.

Why This Matters

This converts what should be a per-source rate-limiter into a one-bit XOR puzzle. The CPU cost of parsing each packet (DNSIncoming._initial_parse, name decompression, NSEC bitmap decode, etc.) plus the O(N) deferred-queue dedup scan from finding #1 turns into a sustainable CPU/memory drain by one malicious LAN host.

Suggested Fix

Replace the single-slot self.data check with a small bounded recency window (e.g. a collections.deque of N most-recent packet digests, or a small LRU keyed on (addr, hash(data))), so alternating-payload attacks no longer slip through. Keep the window small (≤16) so legitimate burst traffic still passes.

Details

Severity 🟡 Medium
Category dos
Location src/zeroconf/_listener.py:113-129
Effort ⚡ Quick fix

🤖 Created by Kōan from audit session

Activity

  1. bdraco commented on May 18, 2026

    @bdraco
    Member
  2. bdraco commented on May 20, 2026

    @bdraco
    Member

    Need to make sure the fix is per interface because we don't want loose QU questions or unicast questions per interface if they come in on a different interface

  3. bdraco commented on May 20, 2026

    @bdraco
    Member
  4. added 4 commits that reference this issue on May 20, 2026
    642efe7
    99cdade
    303a453
    56bb3a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions