Anonymous API Rate Limit Bypass via X-Forwarded-For
Weblate's anonymous API rate limiting uses Django REST Framework's default client identification, which trusts the X-Forwarded-For header, so an unauthenticated client can rotate that header to get a fresh rate-limit bucket for each request. This lets an attacker send more requests than the configured per-client limit, making automated enumeration and scraping easier.
- Fixed in 4 days
- Disclosed after 51 days
Summary
Weblate's anonymous API rate limiting can be bypassed by supplying different X-Forwarded-For values.
The affected RateOverrideThrottle class inherits Django REST Framework's SimpleRateThrottle but does not override get_ident(). As a result, the throttle identity can be influenced by the X-Forwarded-For header.
An unauthenticated client can change this header between requests and obtain different rate-limit buckets instead of remaining associated with the same client identity.
I reproduced the issue locally against Weblate commit b2f5d586ff. The PoC passed 17/17 checks in three independent runs.
Affected Code
Repository:
WeblateOrg/weblate
File:
weblate/api/throttling.py
Affected class:
RateOverrideThrottle
The class inherits from DRF's SimpleRateThrottle without defining its own get_ident() implementation.
Because of this, the throttle uses DRF's default client identification behavior instead of explicitly using Weblate's normalized REMOTE_ADDR.
Steps to Reproduce
The issue can be reproduced without authentication.
- Start a local Weblate instance using the affected commit.
- Send an anonymous request to an API endpoint protected by the anonymous throttle.
- Repeat requests until the anonymous rate limit is reached.
- Send the same request again while changing the
X-Forwarded-Forheader.
For example:
GET /api/search/?q=test HTTP/1.1
Host: localhost
X-Forwarded-For: 6.6.6.6
Then send the same request with:
GET /api/search/?q=test HTTP/1.1
Host: localhost
X-Forwarded-For: 7.7.7.7
And again with:
GET /api/search/?q=test HTTP/1.1
Host: localhost
X-Forwarded-For: 8.8.8.8
The request itself remains the same. Only the X-Forwarded-For value is changed.
Observed Result
Different X-Forwarded-For values produce different anonymous throttle identities and cache keys.
For example, the PoC observed:
throttle_anon_6.6.6.6
throttle_anon_7.7.7.7
These are separate cache keys.
This confirms that changing the X-Forwarded-For value causes the request to be associated with a different anonymous rate-limit bucket.
The PoC verifies the cache keys directly and does not rely only on HTTP response timing or status codes.
Why This Bypasses the Rate Limit
The anonymous rate limit is intended to restrict repeated requests from the same client.
However, the client can supply different X-Forwarded-For values. Each different value can result in a different throttle identity.
For example:
X-Forwarded-For: 6.6.6.6
Cache key: throttle_anon_6.6.6.6
X-Forwarded-For: 7.7.7.7
Cache key: throttle_anon_7.7.7.7
X-Forwarded-For: 8.8.8.8
Cache key: throttle_anon_8.8.8.8
An attacker can therefore rotate the header and avoid accumulating all requests against one anonymous throttle bucket.
Affected Anonymous API Surface
The local source and configuration analysis identified anonymous API endpoints using the affected throttling path, including:
/api/search//api/projects//api/components//api/translations//api/changes//api/languages//api/units//api/suggestions/
The access-control behavior differs between endpoints, but requests subject to the affected anonymous throttle can obtain a different throttle identity by changing X-Forwarded-For.
Root Cause
Weblate has its own proxy middleware that handles proxy-related information and normalizes REMOTE_ADDR.
However, RateOverrideThrottle relies on DRF's inherited SimpleRateThrottle.get_ident() and does not explicitly use the normalized REMOTE_ADDR.
This creates a mismatch between Weblate's proxy handling and the identity used by the API throttle.
The throttle should use a server-side client address rather than allowing an untrusted request header to determine the anonymous rate-limit identity.
Suggested Fix
A minimal fix is to explicitly define the throttle identity in RateOverrideThrottle:
class RateOverrideThrottle(SimpleRateThrottle):
def get_ident(self, request):
return request.META.get("REMOTE_ADDR", "")
With this change, changing X-Forwarded-For no longer changes the anonymous throttle identity because the throttle uses REMOTE_ADDR.
Verification
I created a local PoC containing 17 checks covering:
- anonymous API throttling;
- different
X-Forwarded-Forvalues; - generated throttle identities and cache keys;
- multiple XFF formats;
- anonymous API behavior;
- session-based rate limiting;
- authenticated-user throttling;
- before and after behavior with the proposed fix.
The PoC was executed independently three times:
Run 1: 17 passed, 0 failed
Run 2: 17 passed, 0 failed
Run 3: 17 passed, 0 failed
The cache-key tests confirmed that different XFF values resulted in different anonymous throttle keys.
After applying the proposed get_ident() override, changing X-Forwarded-For no longer changed the throttle identity.
The existing session-based and authenticated-user throttle tests also continued to pass.
Expected Behavior
Changing an X-Forwarded-For value supplied by an untrusted client should not allow the client to obtain a new anonymous throttle identity.
Repeated anonymous requests from the same client should remain subject to the same rate-limit bucket.
Actual Behavior
Changing X-Forwarded-For changes the anonymous throttle identity and cache key.
Example:
X-Forwarded-For: 6.6.6.6
Cache key: throttle_anon_6.6.6.6
X-Forwarded-For: 7.7.7.7
Cache key: throttle_anon_7.7.7.7
As a result, an unauthenticated client can rotate XFF values to bypass the intended anonymous API rate limit.
Environment
Repository: WeblateOrg/weblate
Tested commit: b2f5d586ff
Testing environment: Local instance
Authentication required: No
PoC: xff-bypass/poc_xff_bypass.py
PoC result: 17/17 checks passed in three independent runs.
Impact
An unauthenticated attacker can rotate X-Forwarded-For values to obtain separate anonymous rate-limit buckets.
This weakens the protection provided by Weblate's anonymous API rate limiting and allows more requests than the configured per-client limit.
For publicly accessible API endpoints, this can make automated enumeration and scraping easier because requests can be distributed across separate throttle buckets.
No authenticated account is required to reproduce the issue.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the RateOverrideThrottle class inherits Django REST Framework's SimpleRateThrottle without overriding get_ident(), so the throttle identity comes from the client-controlled X-Forwarded-For header instead of Weblate's normalised REMOTE_ADDR.
Impact
An unauthenticated attacker can rotate X-Forwarded-For values to obtain separate anonymous rate-limit buckets, weakening the anonymous API rate limit and making automated enumeration and scraping easier on publicly accessible endpoints.
What the attacker needed
No authentication required; ability to set X-Forwarded-For header
The fix
The throttle should be fixed by explicitly defining get_ident() in RateOverrideThrottle to return the server-side REMOTE_ADDR instead of relying on the inherited header-based identification.
How it was found
- Start a local Weblate instance using the affected commit.
- Send an anonymous request to an API endpoint protected by the anonymous throttle.
- Repeat requests until the anonymous rate limit is reached.
- Send the same request again while changing the X-Forwarded-For header.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A rate limit is a cap on how many requests one client can make in a period, used to stop abuse like scraping. Weblate's API tried to identify each anonymous client by an address, but it read that address from a header the client itself can set, so changing the header made the server think each request came from a different person. The fix is to use the address the server actually sees the connection coming from, not a value the client supplies.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.