CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-5774

CVE-2026-5774: Race Condition and Denial of Service in Canonical Juju API Server

Alon Barad
Alon Barad
Software Engineer

Apr 11, 2026·7 min read·39 visits

Executive Summary (TL;DR)

A race condition in Juju's API server allows authenticated users to crash the server or replay authentication tokens due to thread-unsafe map operations.

Canonical Juju is affected by a medium-severity race condition vulnerability (CWE-362) within its API server. The vulnerability allows an authenticated attacker to trigger concurrent memory access violations in the Go runtime, resulting in an unrecoverable fatal panic and Denial of Service (DoS), or to bypass single-use token constraints via an authentication replay attack.

Vulnerability Overview

Canonical Juju is affected by a medium-severity race condition vulnerability tracked as CVE-2026-5774. The flaw resides within the API server component, specifically in the management of macaroon discharge tokens during the local login process. An authenticated attacker can exploit this vulnerability to induce a Denial of Service (DoS) state or bypass single-use token restrictions.

The root of the issue is categorized as CWE-362, concurrent execution using a shared resource with improper synchronization. The API server stores discharge tokens in a standard data structure that lacks inherent concurrency protections. When the server processes simultaneous HTTP requests, these requests execute in isolated goroutines but interact with the same underlying token storage mechanism.

This architectural choice creates an exposed attack surface on the /local-login/discharge and /local-login/form endpoints. A threat actor with valid credentials can dispatch carefully timed network requests to these endpoints, intentionally triggering the concurrency limits of the runtime environment. The resulting state corruption forces the API server process to terminate, disrupting management access to the Juju environment.

Root Cause Analysis

The vulnerability originates from the unsafe concurrent access patterns applied to a native Go map[string]string structure. In the Juju API server codebase, the localLoginHandlers struct utilizes a userTokens map to track active macaroon discharge tokens. The Go runtime mandates that map implementations are not thread-safe and strictly prohibits simultaneous memory access involving at least one write operation.

When the runtime detects a concurrent write, or a concurrent read and write against the same map instance, it triggers a fatal, non-recoverable panic. The Juju API server triggers this condition because the formHandler function continuously writes new authentication tokens to the userTokens map upon successful login events. Concurrently, the checkThirdPartyCaveat function reads tokens from the map for verification and subsequently issues a delete operation to ensure the token cannot be reused.

Because the Go HTTP server implementation handles each incoming request in a separate goroutine, high-frequency requests directly translate to concurrent execution threads. The absence of a mutual exclusion lock (mutex) around the userTokens map guarantees that these independent goroutines will eventually intersect during memory access.

Furthermore, the logic implemented in the checkThirdPartyCaveat function exhibits a Time-of-Check to Time-of-Use (TOCTOU) condition. The function first queries the map to verify token existence and then executes the deletion operation in a separate, non-atomic step. This execution gap allows two parallel verification threads to read the same token successfully before either thread removes the token from memory.

Code Analysis

The codebase lacked synchronization primitives in the authentication handlers prior to the patch. The userTokens map was declared directly within the localLoginHandlers struct without an associated mutex. Token validation and deletion were performed sequentially in the caveat checker, exposing the TOCTOU window.

// Vulnerable implementation
type localLoginHandlers struct {
	authCtxt   *authContext
	finder     state.EntityFinder
	userTokens map[string]string
}
 
// Non-atomic read and delete operation inside caveat checker
username, ok := h.userTokens[tokenString]
delete(h.userTokens, tokenString)

The remediation introduced in commit 2bc884d34dce1a72f93e67202c1fd1385ad474b0 resolves the issue by adding a sync.Mutex field named tokenMutex to the struct. The developers refactored the map operations into dedicated, thread-safe methods. The getUserFromToken method now locks the mutex before accessing the map, reads the token, deletes it, and unlocks the mutex via a defer statement.

// Patched implementation
type localLoginHandlers struct {
	authCtxt *authContext
	finder   state.EntityFinder
	tokenMutex sync.Mutex
	userTokens map[string]string
}
 
// Thread-safe, atomic read and delete operation
func (h *localLoginHandlers) getUserFromToken(token string) (string, bool) {
	h.tokenMutex.Lock()
	defer h.tokenMutex.Unlock()
 
	username, ok := h.userTokens[token]
	delete(h.userTokens, token)
	return username, ok
}

The following diagram illustrates the thread safety implementation introduced by the patch, ensuring that concurrent goroutines are sequentially gated.

Exploitation and Attack Methodology

An authenticated threat actor can exploit this vulnerability through the network by executing a race condition attack. The primary attack vector targets the availability of the API server. By generating a high volume of simultaneous HTTP requests to the /local-login/form and /local-login/discharge endpoints, the attacker forces the server to process multiple map operations simultaneously.

This deliberate flooding guarantees that at least two goroutines will attempt to modify or read the userTokens map at the exact same instruction cycle. The Go runtime detects this specific violation and intentionally crashes the application process with a fatal error: concurrent map writes message. The API server remains offline until restarted by the orchestration layer.

Alternatively, an attacker can exploit the TOCTOU behavior to replay authentication tokens. The attacker obtains a single valid macaroon discharge token via standard authentication procedures. The attacker then scripts two distinct HTTP clients to transmit the same token to the caveat checker endpoint at precisely the same time.

If the execution timing aligns properly within the vulnerable window, both goroutines evaluate the token presence check as true. The system authenticates both sessions before either goroutine advances to the deletion instruction. This technique bypasses the intended security design that explicitly mandates discharge tokens must be consumed exactly once.

Impact Assessment

The vulnerability presents two distinct impacts: total loss of availability for the API service and subversion of authentication mechanisms. The availability impact is classified as high because the resulting Go runtime panic is fatal. The process termination cannot be intercepted or handled by application-level error recovery routines, requiring a full process restart to restore service.

During the period the API server is offline, administrators lose management access to the Juju environment. Automated orchestration tasks, deployment processes, and health monitoring mechanisms dependent on the API fail to execute. This disruption scales in severity based on the operational reliance on the Juju controller.

The confidentiality and integrity impact resulting from the token replay vector is constrained by the attacker's existing privilege level. The attacker must already possess valid credentials to generate the initial discharge token. Replaying the token allows the generation of parallel authenticated sessions, but does not inherently escalate privileges beyond the permissions associated with the original compromised account.

The Common Vulnerability Scoring System (CVSS) v4.0 evaluation yields a score of 6.1 (Medium). The vector string CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N accurately reflects the network attack surface, the high complexity of timing the race condition, and the high impact on target availability.

Mitigation and Remediation Guidance

Canonical resolved this vulnerability in three specific patch branches across the Juju ecosystem. Administrators operating Juju 4.0.x installations must upgrade to version 4.0.6 to secure the API server. Deployments running the Juju 3.6.x branch require an upgrade to version 3.6.21. Legacy installations on the Juju 2.9.x branch must update to version 2.9.57.

Organizations that cannot immediately apply the vendor patches should implement network-level rate limiting against the Juju controller interfaces. Throttling incoming connections to the /local-login/discharge and /local-login/form endpoints reduces the probability of concurrent execution overlap. While rate limiting does not eliminate the root cause, it significantly increases the attack complexity required to trigger the concurrency panic.

Security operations centers should deploy detection mechanisms targeting API server logs and network traffic patterns. Teams must monitor the application runtime logs for fatal error: concurrent map writes events, which serve as a definitive indicator of compromise or active exploitation attempts. High-frequency request clusters originating from a single authenticated source address should trigger automated defensive blocks.

Official Patches

CanonicalGitHub Security Advisory for Canonical Juju

Fix Analysis (2)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Affected Systems

Canonical Juju API Server

Affected Versions Detail

Product
Affected Versions
Fixed Version
Juju
Canonical
2.0.0 to < 2.9.572.9.57
Juju
Canonical
3.0.0 to < 3.6.213.6.21
Juju
Canonical
4.0.0 to < 4.0.64.0.6
AttributeDetail
CWE IDCWE-362
Attack VectorNetwork
CVSS v4.0 Score6.1 (Medium)
ImpactDenial of Service (DoS) and Authentication Replay
Exploit StatusProof of Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization

Concurrent Execution using Shared Resource with Improper Synchronization

Vulnerability Timeline

Initial fix commit for race condition authored.
2026-03-20
Final merge of the mutex gate fix completed.
2026-04-02
Security advisory published (GHSA-7m55-2hr4-pw78).
2026-04-08
CVE-2026-5774 officially published.
2026-04-10

References & Sources

  • [1]GitHub Security Advisory: GHSA-7m55-2hr4-pw78
  • [2]Juju PR #22205
  • [3]Juju PR #22206
  • [4]NVD Vulnerability Detail: CVE-2026-5774
  • [5]CVE Record: CVE-2026-5774

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•30 minutes ago•CVE-2026-61427
7.3

CVE-2026-61427: Authentication Bypass and Unvalidated Tool Execution in PraisonAI MCP HTTP-Stream Server

CVE-2026-61427 is a critical authentication bypass and improper input validation vulnerability within the Model Context Protocol (MCP) HTTP-stream server of PraisonAI. In versions prior to 4.6.78, the server lacks authentication by default and forwards client messages directly to Python tool handlers without input validation. When bound to non-localhost interfaces, this permits unauthenticated remote attackers to perform unauthorized administrative operations and execute tools.

Alon Barad
Alon Barad
2 views•4 min read
•about 1 hour ago•CVE-2026-107387
6.2

CVE-2026-107387: Uncontrolled Memory Allocation (OOM) in music-metadata APEv2 Parser

CVE-2026-107387 is a high-impact uncontrolled memory allocation vulnerability in music-metadata, a widely used Node.js metadata parser. The flaw occurs in the APEv2 tag parser, where the library reads an attacker-controlled 32-bit integer indicating the tag size and immediately requests a corresponding heap buffer reservation. Because this allocation occurs before validating if the input stream actually contains those bytes, an attacker can supply a minuscule audio file to trigger large, disproportionate allocations, resulting in heap exhaustion and an uncatchable process-wide Out of Memory (OOM) crash.

Amit Schendel
Amit Schendel
3 views•5 min read
•about 2 hours ago•CVE-2026-107391
6.2

CVE-2026-107391: Synchronous Infinite Loop and Memory Exhaustion in music-metadata MP4 Parser

An input validation vulnerability exists in music-metadata versions prior to 11.16.0, where parsing a crafted MP4 file containing a sample-description (stsd) box with a zero-value size entry causes a synchronous infinite loop and memory exhaustion, resulting in complete Denial of Service.

Alon Barad
Alon Barad
7 views•7 min read
•about 3 hours ago•CVE-2026-107377
7.5

CVE-2026-107377: Arbitrary File Write and Overwrite via Protobuf Weak Import Path Traversal in datamodel-code-generator

A path traversal vulnerability in datamodel-code-generator allows remote attackers to write or overwrite arbitrary files on the local host filesystem via a manipulated Protobuf schema containing malicious weak import paths.

Amit Schendel
Amit Schendel
9 views•5 min read
•about 4 hours ago•CVE-2026-61431
6.8

CVE-2026-61431: Arbitrary Local File Read and Path Traversal in PraisonAI ContextGatherer

PraisonAI is vulnerable to an arbitrary local file read vulnerability prior to version 4.6.78. The flaw is in the ContextGatherer component, where validation checks are executed only after files are parsed and appended to the context bundle, bypassing security constraints.

Amit Schendel
Amit Schendel
8 views•6 min read
•about 6 hours ago•CVE-2026-107212
7.5

CVE-2026-107212: CPU Exhaustion Denial of Service via Look-Ahead Row Parsing in Excelize

An algorithmic complexity vulnerability (CWE-770) in the Excelize library allows remote attackers to cause resource exhaustion (100% CPU usage) via a crafted Microsoft Excel spreadsheet. This occurs because the look-ahead row index parsing in Rows.Columns() fails to enforce upper boundary limits, enabling an out-of-bounds row index to trigger an infinite seek loop inside the Rows iterator.

Alon Barad
Alon Barad
14 views•6 min read