fix: wallet-based rate limiting to prevent IP-spoofing bypass (SECURITY)#1698
Open
jujujuda wants to merge 1 commit intoScottcjn:mainfrom
Open
fix: wallet-based rate limiting to prevent IP-spoofing bypass (SECURITY)#1698jujujuda wants to merge 1 commit intoScottcjn:mainfrom
jujujuda wants to merge 1 commit intoScottcjn:mainfrom
Conversation
Fixes rate limit bypass via X-Forwarded-For header spoofing. Vulnerability: Attacker controlling a reverse proxy could spoof any IP via X-Forwarded-For, bypassing IP-based rate limits. Fix: Add wallet-based rate limiting as primary defense. Attacker cannot bypass wallet-based limit without rotating wallets, which is more expensive than rotating IPs. Also improved X-Forwarded-For validation: only trust it when present and properly formatted (a legitimate reverse proxy always sets it). Addresses: rustchain-bounties#2246
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
Owner
|
Good security fix — we want to merge this. But it has merge conflicts with main. Could you rebase on main and force-push? We'll merge once conflicts are resolved. Thanks @jujujuda! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security Fix: Faucet Rate Limit Bypass via X-Forwarded-For Spoofing
Vulnerability Summary
Reported in rustchain-bounties#2246.
The faucet (
faucet.py) used IP-based rate limiting only. An attacker who controls or exploits a misconfigured reverse proxy could set arbitraryX-Forwarded-Forvalues, bypassing the IP-based rate limit.Fix Applied
Primary Defense: Wallet-based rate limiting
X-Forwarded-For Validation
Changes
get_client_ip(): Improved XFF validationcan_drip_by_wallet(): New — wallet-based rate limitcan_drip_by_ip(): Existing IP-based check (secondary)drip()endpoint: Now checks both wallet AND IP limitsBounty payment wallet
RTC2fe3c33c77666ff76a1cd0999fd4466ee81250ff