CVE-2026-5774: Juju In-Memory Token Store For Discharge Vulnerability
MODERATECVE-2026-5774 is a MODERATE (CVSS 6.4) in-memory token store for discharge vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Juju libraries in the Go ecosystem. The issue involves in-memory token store for discharge tokens lacks concurrency safety and persistence. Remediation is available by upgrading affected packages to version 0.0.0-20260408003526-d395054dc2c3.
CVE-2026-5774 at a Glance
Security Impact
CVSS: 6.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H).
How to Fix CVE-2026-5774
To remediate this vulnerability, upgrade all affected Juju dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/juju/juju to 0.0.0-20260408003526-d395054dc2c3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/juju/juju
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-5774, inspect your project dependencies for Juju:
inspect dependencies for github.com/juju/juju
Analyze the terminal output to locate any version of Juju in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260408003526-d395054dc2c3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Juju, 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
CVE-2026-5774 Affected Juju Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/juju/juju
|
Go |
< 0.0.0-20260408003526-d395054dc2c3
|
0.0.0-20260408003526-d395054dc2c3
|
References
Frequently Asked Questions
What is CVE-2026-5774?
Which Juju versions are affected?
What version fixes CVE-2026-5774?
Is github.com/juju/juju affected?
What is the CVSS score of CVE-2026-5774?
What CWE is associated with CVE-2026-5774?
How can I check Go dependencies for CVE-2026-5774?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7m55-2hr4-pw78",
"modified" : "2026-04-27T16:21:10Z",
"published" : "2026-04-10T21:00:35Z",
"aliases" : [ "CVE-2026-5774" ],
"summary" : "Juju: In-Memory Token Store for Discharge Tokens Lacks Concurrency Safety and Persistence",
"details" : "### Summary\n\nThe localLoginHandlers struct in the Juju API server maintains an in-memory map to store discharge tokens following successful local authentication. This map is accessed concurrently from multiple HTTP handler goroutines without any synchronization primitive protecting it. The absence of a mutex or equivalent mechanism means that concurrent reads, writes, and deletes on the map can trigger Go runtime panics and may allow a discharge token to be consumed more than once before deletion completes.\n\n### Details\n\nWhen a user authenticates through the local login flow, a discharge token is generated and stored in a plain `map[string]string` field named userTokens. The form handler writes to this map when authentication succeeds, and the third-party caveat checker reads from and deletes from the same map when a discharge request arrives. Both code paths execute inside goroutines dispatched by the HTTP server, meaning concurrent requests will access the map simultaneously.\n\nGo's runtime detects concurrent map access and will terminate the process with a fatal error when a write races with another write or read. This makes the API server susceptible to a denial-of-service attack from any authenticated user who can trigger simultaneous discharge requests. Beyond the crash scenario, the read-then-delete sequence in the caveat checker is not atomic. Two goroutines processing the same token concurrently may both pass the existence check before either executes the deletion, allowing a single-use discharge token to be accepted more than once and effectively replaying authentication.\n\nThe struct definition that introduces the unsafe field is shown below.\n\n```go\ntype localLoginHandlers struct {\n authCtxt *authContext\n userTokens map[string]string\n}\n```\n\nThe concurrent access originates from the caveat checker calling `username, ok := h.userTokens[tokenString]` followed by `delete(h.userTokens, tokenString)` with no lock held, while formHandler concurrently executes `h.userTokens[token] = username` in a separate goroutine.\n\n### PoC\n\n```go\npackage main\n\nimport (\n \"net/http\"\n \"sync\"\n)\n\nfunc main() {\n token := \"acquired-discharge-token\"\n endpoint := \"https://target-juju-api:17070/local-login/discharge\"\n\n var wg sync.WaitGroup\n for i := 0; i < 20; i++ {\n wg.Add(1)\n go func() {\n defer wg.Done()\n req, _ := http.NewRequest(\"GET\", endpoint+\"?token=\"+token, nil)\n http.DefaultClient.Do(req)\n }()\n }\n wg.Wait()\n}\n```\n\n### Impact\n\nAny authenticated user who obtains a valid discharge token can send a burst of concurrent requests to the discharge endpoint. The most reliable outcome is a Go runtime panic caused by concurrent map access, which terminates the Juju API server process and denies service to all connected clients and agents. Under favorable timing conditions the same token may be accepted by multiple goroutines before deletion, bypassing the single-use enforcement and allowing repeated authentication with a token that should have been invalidated after first use.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:L/VI:L/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/juju/juju"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.0-20260408003526-d395054dc2c3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/juju/juju/security/advisories/GHSA-7m55-2hr4-pw78"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-5774"
}, {
"type" : "WEB",
"url" : "https://github.com/juju/juju/pull/22205"
}, {
"type" : "WEB",
"url" : "https://github.com/juju/juju/pull/22206"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/juju/juju"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-362" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-10T21:00:35Z",
"nvd_published_at" : "2026-04-10T13:16:46Z"
}
}