Summary
Antrea's network policy priority assignment system contains a uint16 arithmetic overflow bug that can cause incorrect OpenFlow priority calculations when many policies with varied priorities are installed.
Under heavy or complex policy configurations, this flaw may result in traffic being enforced contrary to intended network policies, potentially allowing or blocking traffic inappropriately.
Affected context
This vulnerability affects Kubernetes clusters using Antrea as the CNI where:
- Antrea network policies are heavily used, with many policies defined.
- Policies rely on nuanced priority ordering to enforce zero-trust or microsegmentation.
- OpenFlow rules are generated and installed based on computed priorities derived from 16-bit integer arithmetic.
The issue is most relevant in deployments with complex policy hierarchies or dynamically generated network policies, where accumulated priority calculations increase the chance of overflow.
Exploit preconditions
- Attack surface: Kubernetes network policy layer managed by Antrea, impacting how OpenFlow rules are ordered and enforced.
- Required access: Ability to create, modify, or trigger reconciliation of many Antrea network policies (for example via Kubernetes API access to NetworkPolicy/AntreaPolicy CRDs).
- Trigger point: Installation or recalculation of network policies when large numbers of policies with diverse priority values cause uint16 overflow during priority computation.
- Why exploitation is possible: The priority assignment logic uses 16-bit unsigned integer arithmetic without robust overflow handling, allowing computed OpenFlow priorities to wrap around and misrepresent the intended order of policy evaluation.
Why this happens
The underlying bug is an arithmetic overflow in the priority assignment algorithm for Antrea network policies.
Priority values are stored or manipulated using a uint16 type, which can represent only a limited range of values.
When a sufficiently large number of policies or specific priority combinations are processed, arithmetic operations on these values exceed the type's maximum and wrap around.
This maps to CWE-770: Allocation of Resources Without Limits or Throttling in the sense that the system does not adequately bound or safely handle the scaling of policies and their derived priority space, leading to resource representation exhaustion.
Functionally, the overflow breaks the assumption that computed OpenFlow priorities preserve the logical ordering of policies, causing the wrong rules to be evaluated first.
The resulting mismatch between intended and actual enforcement is conceptually related to access control failures (akin to CWE-287) because traffic may be authorized or denied contrary to policy.
Potential impact
- Network policies may be evaluated in an incorrect order, leading to unintended traffic flows.
- Unauthorized traffic could be allowed through segments that were expected to be isolated.
- Legitimate traffic could be blocked, causing availability issues and service disruptions.
- Microsegmentation or zero-trust designs can be weakened, increasing the blast radius of a compromised workload.
- Security monitoring and compliance assumptions based on network policy intent may no longer hold true.
General mitigation guidance
Mitigation patterns focus on enforcing safe limits, robust arithmetic, and defense-in-depth around network policy enforcement:
- Use wider or safer numeric types for priority calculations and enforce explicit bounds to prevent arithmetic overflow when deriving rule priorities.
- Introduce validation layers that reject or normalize policy sets whose combined priority calculations would exceed safe ranges.
- Apply logical tiers or buckets for policy priorities to reduce the granularity needed and the likelihood of overflow in underlying representations.
- Implement consistency checks between desired policy ordering and the actual OpenFlow table state, failing safe if a discrepancy is detected.
- Design policies to avoid unnecessary priority complexity where possible, keeping the priority scheme simple and predictable.
- Complement network policies with additional controls (workload identity, host-based firewalls, service mesh policy) so that misordered network rules alone cannot fully undermine segmentation.
How teams detect issues like this
Effective detection combines configuration analysis, runtime observation, and policy governance:
- Static configuration review: Analyze Antrea policy definitions for excessive numbers of rules or overly dense priority ranges that increase overflow risk.
- Code-level analysis: Use static analysis and code review to flag arithmetic on bounded integer types involved in priority or index calculations, verifying overflow handling and bounds checking.
- Runtime consistency checks: Periodically compare intended policy order (from CRDs) with actual OpenFlow rule priorities and matching behavior, alerting on mismatches or anomalous rule ordering.
- Policy governance controls: Implement admission controllers or policy-as-code (e.g., OPA/Gatekeeper) to enforce limits on the number of policies, priority ranges, and complexity of network policy sets.
- Monitoring and logging: Enable detailed Antrea and OpenFlow logging, and watch for unexpected allow/deny decisions or frequent policy reconciliation events that can indicate miscalculated priorities.
- Automated security scanning tools that understand Kubernetes networking constructs can be extended with rules to identify risky policy patterns and excessive use of fine-grained priorities.

