Vulnerability record · PyPI
PYSEC-2026-4064
Description
LightRAG's native markdown parser downloads external images referenced by an uploaded markdown or textpack document. The only SSRF guard, _validated_addresses() in lightrag/parser/markdown/parser.py, resolves the image host and rejects it when the resolved IP is not is_global. That check is evaluated on the raw resolved address and never decodes IPv6 transition wrappers that embed an internal IPv4. Python's ipaddress classifies a NAT64 (64:ff9b::/96 and the RFC 8215 64:ff9b:1::/48 prefix), IPv4-compatible (::a.b.c.d), or 6to4 (2002::/16) literal that wraps an internal IPv4 as globally routable, so the guard passes it. On a host with NAT64/DNS64 routing the request is then delivered to the embedded internal target (loopback, RFC1918, or a cloud metadata endpoint), and the fetched body is ingested. The plain and IPv4-mapped (::ffff:) forms of the same internal address are correctly blocked, so this is an encoding that defeats the existing filter.
lightrag-hku (LightRAG), the native markdown image-download path.lightrag/parser/markdown/parser.py, guard _validated_addresses() (the if not (ip.is_global or ...) check), reached from _download() -> _build_guarded_opener().open(req).download_enabled = _env_bool("NATIVE_MD_IMAGE_DOWNLOAD_ENABLED", True).<= 1.5.4 (latest release at time of report, commit 9a45b64).Depends(combined_auth)); the host has NAT64/DNS64 routing for the encoded address to reach the internal endpoint.Evaluated on the exact resolved addresses (CPython ipaddress):
| Form | address | is_global | guard verdict |
|---|---|---|---|
| plain internal 127.0.0.1 | 127.0.0.1 | False | BLOCK (correct) |
| IPv4-mapped | ::ffff:7f00:1 | False | BLOCK (correct) |
| NAT64 64:ff9b::/96 |…
Manual fix · PyPI
pip install --upgrade "lightrag-hku>=1.5.5"Sources