The vulnerability is a race condition in Juju's secret management subsystem, allowing an authenticated unit agent to claim ownership of a newly created secret. The root cause of this vulnerability lies in the state.State.findSecretEntity function, which failed to correctly resolve the owning entity for secrets associated with units in a remote application. This flaw would cause the system to believe a secret was unowned, opening a window for an attacker to claim it.
The primary evidence for this is the patch applied to findSecretEntity in state/secrets.go. The change introduces logic to look up the remote application if a unit is not found locally. This ensures that the ownership of a secret is correctly determined even for remote units, closing the race condition window.
A secondary, related change was made in the state.State.GrantSecretAccess function. This function was patched to explicitly forbid granting secret access to units in a remote application. This change serves as a defense-in-depth measure, further securing the secret management system by preventing a potential vector for unauthorized access.