Sep 23, 2026·5 min read·19 visits
LightRAG before v1.5.5 is vulnerable to SSRF because its image-download validator fails to inspect IPv4 addresses wrapped in IPv6 transition formats, permitting access to local networks and cloud metadata services.
A security vulnerability in HKUDS/LightRAG prior to v1.5.5 allows authenticated attackers to bypass the native markdown image downloader guard. The system fails to normalize IPv6 transition wrappers (such as NAT64, IPv4-compatible, and 6to4 blocks) encapsulating internal IPv4 addresses. Python's ipaddress library evaluates these wrappers as globally routable, but hosting environments running NAT64/DNS64 routing decapsulate and route the requests to internal resources.
The HKUDS/LightRAG framework is designed to provide fast and simple retrieval-augmented generation (RAG) processes. To support markdown ingestion, the framework parses uploaded files and retrieves external assets, such as images, to integrate them into the knowledge base. This operation exposes a significant attack surface if input URLs are not strictly validated before network resolution.
To defend against Server-Side Request Forgery (SSRF), the framework employs an IP-level validation mechanism. It resolves the hostnames specified in the image tags and validates the resulting IP addresses. This validation relies on checking whether the destination address is globally routable.
A critical security flaw exists in the validation logic within lightrag/parser/markdown/parser.py. The validation routine fails to detect and normalize IPv6 transition wrappers that encapsulate internal or private IPv4 addresses. This allows authenticated users with document upload privileges to circumvent the safety boundary.
The root cause of the vulnerability lies in the reliance on the standard library's ipaddress package for identifying globally routable IP addresses. When validating a resolved IP, the parser inspects the ip.is_global attribute. The parser permits the request if this attribute evaluates to True or if the address matches an explicitly allowed network subnet.
IPv6 transition technologies, designed to facilitate communication between IPv4 and IPv6 networks, encapsulate 32-bit IPv4 addresses within a 128-bit IPv6 container. Common transition formats include NAT64 well-known prefixes (RFC 6052), IPv4-compatible addresses (RFC 4291), 6to4 tunneling (RFC 3056), and local-use NAT64 prefixes (RFC 8215). These formats represent internal IPv4 destinations, such as 127.0.0.1 or 169.254.169.254, using valid global IPv6 prefixes.
Python's interpreter processes these encapsulated literals as globally routable because the outer prefix block is classified as global. For instance, the library evaluates 64:ff9b::7f00:1 (which embeds the localhost address 127.0.0.1) as globally routable. When the application issues the outbound HTTP request, the hosting environment's dual-stack socket layer decapsulates the prefix and routes the packet to the internal IPv4 target.
In vulnerable versions of LightRAG, the parser checks destination validity by directly querying the is_global property of the resolved IP object. The relevant code path is located in the _validated_addresses() function within lightrag/parser/markdown/parser.py.
# Vulnerable validation logic
if not (ip.is_global or any(ip in net for net in allow)):
return []The patch introduces a normalization wrapper to extract the underlying IPv4 address from known IPv6 transition formats. It also establishes a strict default-deny policy for specific blocks.
# Remediation implementation
_FORCE_NON_GLOBAL_V6 = (ip_network("64:ff9b:1::/48"), ip_network("2002::/16"))
def _unwrap_embedded_ipv4(ip):
if ip.version != 6:
return ip
if ip.ipv4_mapped is not None:
return ip.ipv4_mapped
b = ip.packed
if b[:12] == b"\\x00" * 12 and b[12:] not in (
b"\\x00\\x00\\x00\\x00",
b"\\x00\\x00\\x00\\x01",
):
return ip_address(b[12:])
if b[:12] == b"\\x00\\x64\\xff\\x9b" + b"\\x00" * 8:
return ip_address(b[12:])
return ipThis extraction process ensures that the RAG pipeline applies security checks to the actual destination address. By unwrapping these formats, the validation engine correctly recognizes local loops and private subnets hidden inside IPv6 structures.
An attack requires document upload privileges within the LightRAG instance. The attacker crafts a malicious markdown document containing image tags referencing wrapped IPv6 transition addresses. When the server processes this document, the image download module is triggered.
The target infrastructure must run a dual-stack configuration or be deployed within an IPv6-only cloud subnet that utilizes NAT64 or DNS64 resolution services. Standard deployments in environments like AWS or Google Cloud commonly incorporate these configurations. The attacker converts the target local or private IPv4 address to its hexadecimal equivalent to structure the payload.
# Document ingestion test
Upon ingestion, the resolved host is verified as safe by the RAG application. The outbound request is dispatched, and the platform network layer strips the prefix. The underlying host routes the request directly to the instance metadata service, returning sensitive IAM credentials or local services.
The security impact of CVE-2026-85740 is rated as High, with a CVSS base score of 7.1. This rating reflects the capacity of an attacker to breach logical trust boundaries. The attack allows access to internal systems that are otherwise shielded from public network interaction.
Successful exploitation enables arbitrary request routing to localhost loopbacks, internal development subnets, and cloud management interfaces. Attackers can leverage this access to perform service enumeration, exploit internal endpoints lacking authentication, or harvest cloud metadata credentials. Exposure of credentials from instance metadata services often leads to further cloud infrastructure compromise.
The vulnerability does not directly permit remote code execution on the host without downstream exploitation of target services. Integrity impact is constrained to the state of internal APIs that accept modification commands. The scope is changed because the execution environment can query external trust boundaries.
The primary remediation for CVE-2026-85740 is upgrading HKUDS/LightRAG to version 1.5.5 or higher. The fixed version incorporates target normalization of IPv6 transition wrappers before evaluating routability. It also enforces block-level denials for deprecated or ambiguous blocks.
If immediate package upgrades are unfeasible, organizations should implement host-level mitigations. For instance, disabling instance metadata service access or requiring IMDSv2 with a hop limit of one prevents credentials harvesting. Restricting outbound HTTP communication from the container to verified remote domains also reduces the risk.
Additionally, organizations can deploy an explicit outbound proxy. Forcing all outbound RAG connections through a secure forward proxy that strictly filters destinations ensures that any bypassed requests are blocked at the network perimeter.
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
LightRAG HKUDS | < 1.5.5 | 1.5.5 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-918 |
| Attack Vector | Network (AV:N) |
| Attack Complexity | High (AC:H) |
| Privileges Required | Low (PR:L) |
| Scope | Changed (S:C) |
| Impact | Confidentiality: High, Integrity: Low, Availability: None |
| Exploit Status | PoC / Non-weaponized |
| CISA KEV Status | Not Listed |
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.
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.
CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.
Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.
CVE-2026-128068 (GHSA-cpgf-5mjf-73p7) is a Regular Expression Denial of Service (ReDoS) vulnerability in the rails-html-sanitizer Ruby gem affecting versions 1.0.3 through 1.7.1. The flaw resides in the Rails::HTML::PermitScrubber#scrub_attribute method, which uses the multiline regular expression /^\s*[^#\s].*/m to enforce local-only URI fragment references on SVG elements. On Ruby runtimes prior to version 3.2 (CRuby <= 3.1 and JRuby), evaluating an attribute value composed of repeated newline and whitespace characters without a hash character triggers quadratic backtracking O(n^2). Applications are only vulnerable if their sanitization allowlist is explicitly configured to permit SVG reference elements such as <use> alongside href or xlink:href attributes.
CVE-2026-126360 (GHSA-mf5v-w3w3-f6cg) is an algorithmic complexity vulnerability (Regular Expression Denial of Service) in the trace context propagation logic of the opentelemetry-api package within the OpenTelemetry Python ecosystem. In versions prior to 1.45.2, the TraceContextTextMapPropagator.extract() method utilizes a regular expression susceptible to quadratic-time backtracking when parsing malformed W3C traceparent headers containing long sequences of whitespace followed by an embedded newline character. In Python applications—particularly those using single-threaded asynchronous event loops—an unauthenticated remote attacker transmitting payloads over newline-preserving carriers can monopolize CPU execution and induce application-level Denial of Service.