CVE-2026-39413: lightrag-hku JWT Algorithm Confusion Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-8ffj-4hx4-9pgf
CVSS 4.2
CWE-347
Published
Advisory Summary

CVE-2026-39413 is a MODERATE (CVSS 4.2) jwt algorithm confusion vulnerability vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting lightrag-hku libraries in the PyPI ecosystem. The issue involves jwt algorithm confusion vulnerability. Remediation is available by upgrading affected packages to version 1.4.14.

CVE-2026-39413 at a Glance

CVE Identifier CVE-2026-39413
GHSA Identifier GHSA-8ffj-4hx4-9pgf
Severity MODERATE
CVSS v3.1 Base Score 4.2
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product lightrag-hku
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 4.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-39413

To remediate this vulnerability, upgrade all affected lightrag-hku dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lightrag-hku fixed: 1.4.14
pip install lightrag-hku>=1.4.14
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show lightrag-hku

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-39413, inspect your installed packages using pip:

pip show lightrag-hku

Analyze the terminal output to locate any version of lightrag-hku in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.14), your application is affected.

Note: The pip show lightrag-hku command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In lightrag-hku, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The LightRAG API is vulnerable to a JWT algorithm confusion attack where an attacker can forge tokens by specifying 'alg': 'none' in the JWT header. Since the `jwt.decode()` call does not explicitly deny the 'none' algorithm, a crafted token without a signature will be accepted as valid, leading to unauthorized access. ## Details In `lightrag/api/auth.py` at line 128, the `validate_token` method calls: ```python payload = jwt.decode(token, self.secret, algorithms=[self.algorithm]) ``` This allows any algorithm listed in the token's header to be processed, including 'none'. The code does not explicitly specify that 'none' is not allowed, making it possible for an attacker to bypass authentication. ## PoC An attacker can generate a JWT with the following structure: ```json { "header": { "alg": "none", "typ": "JWT" }, "payload": { "sub": "admin", "exp": 1700000000, "role": "admin" } } ``` Then send a request like: ```bash curl -H "Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcwMDAwMDAwMCwicm9sZSI6ImFkbWluIn0." http://localhost:8000/api/protected-endpoint ``` ## Impact An attacker can impersonate any user, including administrators, by forging a JWT with 'alg': 'none', gaining full access to protected resources without needing valid credentials. ## Recommended Fix Explicitly specify allowed algorithms and exclude 'none'. Modify the `validate_token` method to: ```python allowed_algorithms = [self.algorithm] if self.algorithm != 'none' else ['HS256', 'HS384', 'HS512'] payload = jwt.decode(token, self.secret, algorithms=allowed_algorithms) ``` Or better yet, hardcode the expected algorithm(s): ```python payload = jwt.decode(token, self.secret, algorithms=['HS256']) ```

CVE-2026-39413 Affected lightrag-hku Versions

1 component(s)
Fixed Versions:
1.4.14
Product / Package Ecosystem Affected Versions Fixed Version
lightrag-hku
PyPI
< 1.4.14
1.4.14

References

Frequently Asked Questions

What is CVE-2026-39413?
CVE-2026-39413 is a security vulnerability in lightrag-hku involving JWT Algorithm Confusion Vulnerability under CWE-347: Improper Verification of Cryptographic Signature.
Which lightrag-hku versions are affected?
Affected versions include releases prior to 1.4.14 across affected packages: lightrag-hku.
What version fixes CVE-2026-39413?
Upgrading to 1.4.14 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lightrag-hku affected?
Yes, lightrag-hku is affected in releases prior to 1.4.14. Upgrade your dependency to 1.4.14 or later.
What is the CVSS score of CVE-2026-39413?
CVE-2026-39413 has a CVSS v3.1 base score of 4.2 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-39413?
CVE-2026-39413 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check PyPI dependencies for CVE-2026-39413?
Run the dependency tree command: 'pip show lightrag-hku'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8ffj-4hx4-9pgf",
  "modified" : "2026-04-27T16:13:13Z",
  "published" : "2026-04-08T00:17:50Z",
  "aliases" : [ "CVE-2026-39413" ],
  "summary" : "lightrag-hku: JWT Algorithm Confusion Vulnerability ",
  "details" : "## Summary\nThe LightRAG API is vulnerable to a JWT algorithm confusion attack where an attacker can forge tokens by specifying 'alg': 'none' in the JWT header. Since the `jwt.decode()` call does not explicitly deny the 'none' algorithm, a crafted token without a signature will be accepted as valid, leading to unauthorized access.\n\n## Details\nIn `lightrag/api/auth.py` at line 128, the `validate_token` method calls:\n\n```python\npayload = jwt.decode(token, self.secret, algorithms=[self.algorithm])\n```\n\nThis allows any algorithm listed in the token's header to be processed, including 'none'. The code does not explicitly specify that 'none' is not allowed, making it possible for an attacker to bypass authentication.\n\n## PoC\nAn attacker can generate a JWT with the following structure:\n\n```json\n{\n  \"header\": {\n    \"alg\": \"none\",\n    \"typ\": \"JWT\"\n  },\n  \"payload\": {\n    \"sub\": \"admin\",\n    \"exp\": 1700000000,\n    \"role\": \"admin\"\n  }\n}\n```\n\nThen send a request like:\n\n```bash\ncurl -H \"Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTcwMDAwMDAwMCwicm9sZSI6ImFkbWluIn0.\" http://localhost:8000/api/protected-endpoint\n```\n\n## Impact\nAn attacker can impersonate any user, including administrators, by forging a JWT with 'alg': 'none', gaining full access to protected resources without needing valid credentials.\n\n## Recommended Fix\nExplicitly specify allowed algorithms and exclude 'none'. Modify the `validate_token` method to:\n\n```python\nallowed_algorithms = [self.algorithm] if self.algorithm != 'none' else ['HS256', 'HS384', 'HS512']\npayload = jwt.decode(token, self.secret, algorithms=allowed_algorithms)\n```\n\nOr better yet, hardcode the expected algorithm(s):\n\n```python\npayload = jwt.decode(token, self.secret, algorithms=['HS256'])\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "lightrag-hku"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.4.13"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/HKUDS/LightRAG/security/advisories/GHSA-8ffj-4hx4-9pgf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39413"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/HKUDS/LightRAG/commit/728f2e54509d93e0a44f929c7f83f2c88d6d291b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/HKUDS/LightRAG"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-08T00:17:50Z",
    "nvd_published_at" : "2026-04-08T20:16:25Z"
  }
}