Sep 23, 2026·5 min read·16 visits
Unauthenticated remote timing side-channels in HKUDS LightRAG authentication logic permit username enumeration and plaintext password recovery.
HKUDS LightRAG prior to version 1.5.5 is vulnerable to multiple timing side-channels (CWE-208) in its API authentication layer. The password verification logic in `lightrag/api/passwords.py` compares plaintext administrative credentials using Python's short-circuiting equality operator (`==`). Additionally, `lightrag/api/auth.py` terminates authentication early on non-existent usernames, creating an observable latency difference compared to computationally expensive bcrypt comparisons on valid accounts. Together, these allow remote unauthenticated attackers with low-latency network access to enumerate valid usernames and extract plaintext passwords character by character.
HKUDS LightRAG is an open-source framework designed for fast, retrieval-augmented generation (RAG) using large language models. To restrict access to administrative functions, the application exposes API endpoints protected by basic token authentication. The credentials are defined using the AUTH_ACCOUNTS configuration parameter.
Prior to version 1.5.5, the authentication mechanism exposed two major security weaknesses. The primary weakness (CWE-208) resides in the password verification routines, which compare plaintext administrative password strings without a constant-time algorithm. A secondary weakness allows an external attacker to reliably determine valid usernames by analyzing the processing time of authentication requests, bypass the primary layer, and recover plaintext credentials.
The vulnerability stems from two independent implementation details within the authentication layer. First, lightrag/api/passwords.py relies on Python's default equality operator (==) to match supplied passwords against stored plaintext values.
Python's string and byte equality checks optimize comparison performance using two techniques:
False immediately.False.Because of this short-circuiting behavior, the execution latency is directly proportional to the number of matching characters in the user's input. A guess that matches the first three characters of a password will take slightly longer to fail than a guess that mismatch on the first character.
Second, the authentication handler in lightrag/api/auth.py evaluates whether the user exists prior to executing password checking. When bcrypt hashing is enabled, verifying a valid user triggers bcrypt.checkpw, which executes in roughly 100 milliseconds. If the username does not exist, the routine returns False immediately in microseconds. This large difference in latency allows external observers to enumerate valid usernames.
In the vulnerable version of the codebase, password verification was implemented as a direct equality operation:
# Vulnerable implementation in lightrag/api/passwords.py
def verify_password(plain_password: str, stored_password: str) -> bool:
# ...
return stored_password == plain_passwordThis behavior is fixed in the patch by utilizing Python's hmac.compare_digest function. The corrected implementation enforces constant-time byte comparisons by processing the full length of the byte strings:
# Patched implementation in lightrag/api/passwords.py
import hmac
def verify_password(plain_password: str, stored_password: str) -> bool:
# ...
return hmac.compare_digest(
stored_password.encode("utf-8"), plain_password.encode("utf-8")
)Additionally, the username enumeration side-channel was resolved in lightrag/api/auth.py by integrating a dummy verification mechanism. If a username does not exist in the store, the application executes a verification pass against a static, synthetic bcrypt hash (_DUMMY_VERIFY_SPEC). This forces the server to spend identical computational time on invalid accounts:
# Patched implementation in lightrag/api/auth.py
_DUMMY_VERIFY_SPEC = (
BCRYPT_PASSWORD_PREFIX
+ "$2b$12$ilI0sY2jGfy4h0AVtn6WuutU6BFwzZq5MVvrQYY9fbyQ59NI2NBKa"
)
def verify_password(self, username: str, plain_password: str) -> bool:
stored_password = self.accounts.get(username)
if stored_password is None:
# Execute dummy verification to equalize execution time
verify_password(plain_password, _DUMMY_VERIFY_SPEC)
return False
return verify_password(plain_password, stored_password)To exploit these vulnerabilities, an attacker needs a network path with minimal jitter, such as co-location inside the same cloud region or container infrastructure. The attack is carried out in two distinct phases:
An attacker sends repetitive requests containing different candidate usernames to the /login endpoint. By sorting the returned network latencies, usernames that delay response times by roughly 100 milliseconds are marked as valid administrative accounts on systems configured with bcrypt.
Once a username is validated, the attacker attacks the plaintext comparison routine:
admin123 and the attacker sends aaaa, it fails immediately at index 0. Sending axxx fails at index 1, which requires slightly more time. Analyzing the latency distributions over a high number of requests isolates the correct character prefix, eventually reconstructing the credential.A successful attack compromises the confidentiality of administrative credentials for the LightRAG framework. This vulnerability possesses a CVSS 3.1 rating of 5.9 (Medium) with the vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
The attack complexity is designated as High (AC:H) because measuring sub-millisecond differences over a network requires precise statistical analysis, filtering algorithms, and low network latency. However, in containerized or shared network architectures, these requirements are met. Compromise of administrative passwords grants attackers write and read capabilities over the retrieval-augmented generation engine, including the ability to manipulate indexed documentation, execute prompt injections, and poison generative AI outputs.
The primary resolution is to upgrade HKUDS LightRAG to version 1.5.5 or higher, which integrates the constant-time comparisons and the dummy bcrypt executions.
Additionally, administrators must configure their deployment's passwords securely. When storing accounts in the AUTH_ACCOUNTS configurations, passwords must be formatted using cryptographic bcrypt hashes prefixed with the {bcrypt} tag. Plaintext values are discouraged, as any deployment storing unhashed passwords remains vulnerable to local configuration leakage and other password-recovery mechanisms.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
LightRAG HKUDS | < 1.5.5 | 1.5.5 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-208: Observable Timing Discrepancy |
| Attack Vector | Network (Low-latency / High-precision) |
| CVSS v3.1 | 5.9 (Medium) |
| Exploit Status | Proof-of-Concept |
| KEV Status | Not Listed |
| Impact | Administrative Credential Recovery & Username Enumeration |
The product performs an operation that takes a variable amount of time, and the security of the operation is dependent on that operation being completed in a constant amount of time.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.
CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.
CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.
The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.