← Lab /Security & privacy

CGNAT detection classifier identifies shared IPs with 98% accuracy, reducing collateral damage

Their supervised learning classifier can reliably distinguish CGNAT IPs from VPN/proxy and single-tenant IPs with 98% accuracy, enabling more equitable security actions.

Security & privacy Cloudflare Research 29 Oct 2025 Tooling Deployed evidence

Published as “One IP address, many users: detecting CGNAT to reduce collateral effects”

Why it matters

Identifying CGNAT IPs lets operators tune security controls to avoid penalizing thousands of innocent users sharing the same address.

Summary

The team built a labeled dataset of over 200K CGNAT IPs using traceroute, WHOIS/PTR scraping, and public VPN/proxy lists, then trained an XGBoost multi-class model on features extracted from Cloudflare HTTP logs. The classifier achieved 0.98 accuracy, 0.97 weighted F1, and 0.04 log loss on a held-out test set. They observed that CGNAT IPs are rate-limited three times more often than non-CGNAT IPs, highlighting collateral damage. The detection service is running in production, providing a global view of CGNAT deployment and informing mitigation policies.

What they found 2

  1. The classifier achieves high predictive performance.

    “The classifier achieves 0.98 accuracy, 0.97 weighted F1, and 0.04 log loss.”

  2. CGNAT IPs are rate-limited more frequently than non-CGNAT IPs.

    “Interestingly, despite bot scores that indicate traffic is more likely to be from human users, CGNAT IPs are subject to rate limiting three times more often than non-CGNAT IPs.”

Caveats 3

  • The errors observed are mainly misclassifications of VPN/proxy IPs as CGNATs, mostly for VPN/proxy IPs that are within a /24 prefix that is also shared by broadband users outside of the proxy service.
  • Although traceroute accuracy depends on router configurations, detecting private and shared IP ranges is a reliable way to identify large-scale IP sharing.
  • Given that both PTR and WHOIS records may be manually maintained and therefore may be stale, we try to sanitize the extracted data by validating the fact that the corresponding ISPs indeed use CGNAT based on customer and market reports.

What’s new here 4

  • First large-scale CGNAT detection using Cloudflare traffic logs and RIPE Atlas traceroutes.
  • Combined public data sources to create a 200K+ labeled CGNAT training set.
  • Trained an XGBoost classifier that reaches 0.98 accuracy and 0.97 weighted F1.
  • Showed CGNAT IPs are rate-limited three times more often than non-CGNAT IPs, exposing socioeconomic bias.