-
-
Notifications
You must be signed in to change notification settings - Fork 211
Security: Fix X-Forwarded-For IP spoofing in fleet detection (RIP-201) #525
Copy link
Copy link
Closed
Labels
RIParea: apiAPI or backend service surfaceAPI or backend service surfacehelp wantedExtra attention is neededExtra attention is neededneeds strong contributorRequires repo familiarity or higher-risk changesRequires repo familiarity or higher-risk changessecuritySecurity-related changeSecurity-related changeseverity: criticalMust be handled immediatelyMust be handled immediatelytype: securitySecurity-sensitive issueSecurity-sensitive issue
Metadata
Metadata
Assignees
Labels
RIParea: apiAPI or backend service surfaceAPI or backend service surfacehelp wantedExtra attention is neededExtra attention is neededneeds strong contributorRequires repo familiarity or higher-risk changesRequires repo familiarity or higher-risk changessecuritySecurity-related changeSecurity-related changeseverity: criticalMust be handled immediatelyMust be handled immediatelytype: securitySecurity-sensitive issueSecurity-sensitive issue
Summary
Fixed a critical IP spoofing vulnerability where 10 locations in the server code trusted the client-supplied
X-Forwarded-Forheader instead of nginx'sX-Real-IPheader. This allowed fleet operators to evade fleet detection by making all fleet miners appear from different IPs.Vulnerability
Affected:
rustchain_v2_integrated_v2.2.1_rip200.py(10 locations)The vulnerable pattern:
X-Forwarded-Forleftmost value is client-supplied — an attacker sets it to any IP.X-Real-IPis set by nginx from the actual TCP connection.Fix Applied
1. Centralized
get_client_ip()function2. Replaced all 10 X-Forwarded-For references
All
request.headers.get("X-Forwarded-For", ...)calls replaced withget_client_ip().3. Fleet timing window widened (30s → 300s)
In
fleet_immune_system.py:FLEET_TIMING_WINDOW_Schanged from 30 to 300 seconds. The original 30-second window was too narrow — fleet operators could trivially space attestations 31 seconds apart to evade timing correlation.Deployment Status
Credit
Vulnerability identified via RIP-201 bypass PoC analysis (PR #514 by @liu971227-sys, 200 RTC bounty paid).