server: add RCON lockout after repeated failed attempts #831
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.
This change adds a simple per-IP RCON authentication lockout on top of the existing rate-limiting logic.
The goal is to make brute-forcing the RCON password significantly harder without changing behavior for other connectionless traffic (getstatus, getinfo, etc).
Current engine behavior uses a leaky bucket via SVC_RateLimitAddress (per-address) and SVC_RateLimit (global) to:
This prevents a single IP from spamming RCON indefinitely, but it does not strictly limit how many password guesses an attacker can make over time, as long as they stay under the burst/period thresholds.
A lockout after a small number of failures is a standard way to make brute-force/dictionary attacks impractical, even when the attacker stays within the pure packet rate limits.
Locally verified with:
From a single IP:
3 incorrect RCON attempts equal in lock message for that IP and 60 seconds of RCON being ignored.
During lock:
Additional incorrect RCON attempts produce “rcon locked …” debug messages and do not reach the password handling. Correct RCON attempts are also ignored until the lock expires.
After ~60 seconds:
Correct RCON requests are accepted again; command output appears as usual.
With multiple IPs on loopback:
Adding a second local IP (e.g. 10.0.0.2) and connecting from it: