Skip to content

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 50+ tests passed.

fix(geoip): treat CGNAT and IPv6 ULA proxy hosts as non-routable

CloakHQ4c5d582fb26b
diff --git a/cloakbrowser/geoip.py b/cloakbrowser/geoip.py
index 1a890c9..688dad0 100644
--- a/cloakbrowser/geoip.py
+++ b/cloakbrowser/geoip.py
@@ -197,7 +197,8 @@ def _resolve_proxy_ip(proxy_url: str) -> str | None:
def _is_private_ip(ip: str) -> bool:
"""Check if an IP address is private/internal (not routable on the internet)."""
try:
- return ipaddress.ip_address(ip).is_private
+ # not is_global: is_private misses CGNAT 100.64/10 (Tailscale)
+ return not ipaddress.ip_address(ip).is_global
except ValueError:
return False
diff --git a/dotnet/src/CloakBrowser/GeoIp.cs b/dotnet/src/CloakBrowser/GeoIp.cs
index 1bb681d..01a4012 100644
--- a/dotnet/src/CloakBrowser/GeoIp.cs
+++ b/dotnet/src/CloakBrowser/GeoIp.cs
@@ -198,9 +198,12 @@ public static class GeoIp
|| (b[0] == 172 && b[1] >= 16 && b[1] <= 31)
|| (b[0] == 192 && b[1] == 168)
|| b[0] == 127
- || (b[0] == 169 && b[1] == 254);
+ || (b[0] == 169 && b[1] == 254)
+ || (b[0] == 100 && b[1] >= 64 && b[1] <= 127); // CGNAT (Tailscale)
}
- return IPAddress.IsLoopback(addr) || addr.IsIPv6LinkLocal || addr.IsIPv6SiteLocal;
+ // IsIPv6SiteLocal is fec0::/10 only; ULA fc00::/7 checked by byte
+ return IPAddress.IsLoopback(addr) || addr.IsIPv6LinkLocal || addr.IsIPv6SiteLocal
+ || (addr.GetAddressBytes()[0] & 0xFE) == 0xFC;
}
private static double GetGeoIpTimeoutSeconds()
diff --git a/dotnet/tests/CloakBrowser.Tests/MiscTests.cs b/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
index 787ae9b..344d6e0 100644
--- a/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
+++ b/dotnet/tests/CloakBrowser.Tests/MiscTests.cs
@@ -12,6 +12,8 @@ public class GeoIpTests
[InlineData("192.168.1.1", true)]
[InlineData("172.16.0.1", true)]
[InlineData("127.0.0.1", true)]
+ [InlineData("100.100.1.1", true)]
+ [InlineData("fd00::1", true)]
[InlineData("8.8.8.8", false)]
[InlineData("1.1.1.1", false)]
public void IsPrivateIp_Classifies(string ip, bool isPrivate)
diff --git a/js/src/geoip.ts b/js/src/geoip.ts
index b00ad01..af7e21d 100644
--- a/js/src/geoip.ts
+++ b/js/src/geoip.ts
@@ -198,6 +198,7 @@ PRIVATE_NETWORKS.addSubnet("172.16.0.0", 12, "ipv4");
PRIVATE_NETWORKS.addSubnet("192.168.0.0", 16, "ipv4");
PRIVATE_NETWORKS.addSubnet("127.0.0.0", 8, "ipv4");
PRIVATE_NETWORKS.addSubnet("169.254.0.0", 16, "ipv4");
+PRIVATE_NETWORKS.addSubnet("100.64.0.0", 10, "ipv4"); // CGNAT (Tailscale)
PRIVATE_NETWORKS.addAddress("::1", "ipv6");
PRIVATE_NETWORKS.addSubnet("fc00::", 7, "ipv6");
PRIVATE_NETWORKS.addSubnet("fe80::", 10, "ipv6");
diff --git a/js/tests/geoip.test.ts b/js/tests/geoip.test.ts
index 1ca78ad..75d9ce8 100644
--- a/js/tests/geoip.test.ts
+++ b/js/tests/geoip.test.ts
@@ -61,7 +61,7 @@ describe("resolveProxyIp", () => {
describe("isPrivateIp", () => {
it("classifies loopback, private and link-local ranges", () => {
- for (const ip of ["127.0.0.1", "10.0.0.1", "172.16.5.4", "192.168.1.1", "169.254.1.1", "::1", "fd00::1", "fe80::1"]) {
+ for (const ip of ["127.0.0.1", "10.0.0.1", "172.16.5.4", "192.168.1.1", "100.100.1.1", "169.254.1.1", "::1", "fd00::1", "fe80::1"]) {
expect(isPrivateIp(ip), ip).toBe(true);
}
for (const ip of ["8.8.8.8", "172.32.0.1", "2001:4860:4860::8888", "not-an-ip"]) {
diff --git a/tests/test_geoip.py b/tests/test_geoip.py
index 2d38fed..d26acf3 100644
--- a/tests/test_geoip.py
+++ b/tests/test_geoip.py
@@ -374,6 +374,12 @@ def test_private_ip_rfc1918():
assert _is_private_ip("172.16.0.1") is True
+def test_private_ip_cgnat_and_ula():
+ # Tailscale/CGNAT and IPv6 ULA are not routable exits either
+ assert _is_private_ip("100.100.1.1") is True
+ assert _is_private_ip("fd00::1") is True
+
+
def test_private_ip_public():
assert _is_private_ip("8.8.8.8") is False
assert _is_private_ip("8.8.8.8") is False