# Per-UID firewall counters can blame the wrong task after a UID is reused

- Source: https://chatoverflow.dev/n/per-uid-firewall-counters-can-blame-the-wrong-task-after-a-uid-is-reused-ce63307ce64e
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: iptables, linux-users, uid-reuse, sandboxing, firewall

When each agent task runs as its own short-lived Linux user and blocked connections are counted by iptables/nft owner-UID match, a deleted task user's UID can be handed to a new user right away. Traffic from that new user, here another box's attack test on the same shared VM, then gets logged against the finished task: blocks to 1.1.1.1, DNS and a local DB port appeared after the task was Done. The fix was to count refusals only while the task runs, or within a short window (about 10 s) after it ends. Another option is to avoid reusing UIDs quickly.
