geoip-cn.srs incorrectly classifies Google anycast IPs (142.251.x.x) as China, causing false rejects

Open Beginner friendly
#5,520 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Domain
networking

Research direction

Inspect /rule-set/geoip-cn.srs and compare the listed ranges with the issue's dig and whois evidence for 142.251.32.163. Reproduce the routing case with www.gstatic.com/generate_204, then verify that Google anycast addresses are no longer matched by geoip-cn and the request is not rejected.

Written by the indexing model from the issue text.

Description

Problem

The geoip-cn rule set contains Google anycast IP ranges (e.g. 142.251.32.163), which are not Chinese IPs. This causes any domain resolving to these Google IPs to be falsely matched by geoip-cn and rejected.

Affected file

geoip-cn.srs (path: /rule-set/geoip-cn.srs)

Reproduction

Using sing-box with this rule in routing:

{
  "action": "reject",
  "rule_set": ["geoip-cn", "geosite-cn"]
}

Request https://www.gstatic.com/generate_204 → connection rejected.

sing-box debug log:

dns: lookup succeed for www.gstatic.com: 142.251.32.163 2607:f8b0:4007:805::2003
router: match[4] rule_set=[geoip-cn geosite-cn] => reject
router: connection closed: rejected

Evidence that 142.251.32.163 is a Google (not CN) IP

$ dig www.gstatic.com @1.1.1.1 +short
142.251.32.163

$ curl -4 -I https://www.gstatic.com/generate_204   # direct, works
HTTP/2 204

$ whois 142.251.32.163
NetOrg: GOGL  →  OrgName: Google LLC

The IP belongs to Google LLC (AS15169), not any Chinese network.

Impact

Any Google domain that resolves to a 142.251.x.x anycast IP (www.gstatic.com, ssl.gstatic.com, etc.) gets rejected when users enable the geoip-cn block rule. Meanwhile other Google domains (e.g. www.google.com) work because they resolve to different IPs not (yet) in the set — making the bug look random/intermittent.

Expected behavior

Google's IP ranges (142.250.0.0/15, 172.217.0.0/16, 142.251.32.163, etc.) should not be part of geoip-cn.

Suggested fix

Exclude Google's global anycast ranges from the CN geoip build, or cross-check against AS15169 before adding IPs to geoip-cn.

Environment

  • Rule source: https://raw.githubusercontent.com/Chocolate4U/Iran-sing-box-rules/rule-set/geoip-cn.srs
  • sing-box version: hiddify-sing-box 1.13.1 (hiddify-core v4.0.4)
  • Hiddify Manager: 12.3.3
Dominant language
Python
Stars
9.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hiddify/Hiddify-Manager

All issues in hiddify/Hiddify-Manager

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.