Summary
Juju versions 3.0.0 through 3.6.18 contain an authorization flaw in the secret-set tool that allows a grantee to modify secret content beyond the intended scope.
Under certain error conditions, the secret is still updated even though an error is logged, enabling unauthorized reading or updating of other secrets shared within the Juju model.
Affected context
This vulnerability arises in Juju environments using the secrets feature where secrets are shared between an owner and one or more grantees.
Specifically, it affects workflows that rely on the secret-set tool to enforce ownership-based updates and assume that failed operations leave secret values unchanged.
Deployments where multiple applications, units, or users share secrets and depend on strict ownership or fine-grained access boundaries are more exposed, especially in multi-tenant or shared-controller setups.
Exploit preconditions
- Attack surface: Juju secrets management interface via the
secret-settool. - Required access: Valid grantee-level access to at least one secret (e.g., an application or unit that has been granted access).
- Trigger point: Invocation of
secret-setunder conditions that cause an error to be logged during an update attempt. - Why exploitation is possible: The authorization check and error-handling logic are flawed, allowing the secret value to be updated despite the operation being reported as failed, and potentially broadening effective access to secrets not intended to be modifiable by the grantee.
Why this happens
The issue is rooted in broken access control combined with incorrect error-handling semantics around secret updates.
Instead of enforcing strict checks that only the secret owner (or a properly authorized entity) can change the secret value, the implementation of secret-set allows a grantee to update the content when certain error paths are taken.
This maps to CWE-863: Incorrect Authorization and CWE-284: Improper Access Control, where the system grants more privileges than intended, and to CWE-778: Insufficient Logging because error logs misleadingly suggest that the operation failed while state has actually changed.
Abstractly, the pattern is: authorization decisions and state updates are not tightly coupled, so a side-effect (secret update) occurs even when the system signals failure, breaking the expected security contract.
Potential impact
- A grantee may modify the contents of a secret they were only intended to read.
- Secrets owned by one application or user can be updated in ways not anticipated by the owner.
- Unauthorized reading of secret data can occur when updates affect shared or mis-scoped secrets.
- Integrity of configuration, credentials, and other sensitive data stored as secrets can be compromised.
- Lateral movement within a Juju model may be facilitated via tampered secrets (e.g., modified API keys or tokens).
General mitigation guidance
Effective mitigation focuses on tightening authorization boundaries and ensuring state changes are atomic with respect to access checks:
- Ensure that only the designated owner or explicitly authorized principals can update secret values, and enforce this at the server-side API boundary, not only in client tools.
- Couple authorization decisions and side-effects so that a failure to authorize or validate an operation guarantees no change in the underlying secret state.
- Treat error conditions during secret updates as security-sensitive, and design the code so that any error causes a full rollback of changes to secret content and metadata.
- Reduce the exposure of secrets by granting read or write access only where strictly necessary, and prefer separate secrets for different consumers rather than broad sharing.
- Apply least-privilege design to Juju applications and units, limiting their secret grants to the minimal scope and lifetime required.
- Formalize security invariants for secrets management (e.g., "grantees cannot change owner secrets") and encode them in tests and review checklists.
How teams detect issues like this
Detection typically involves both code-level and operational perspectives:
- Static analysis / code review: Look for authorization logic in the secrets-handling code where:
- Privilege checks are performed after state changes, or not performed for certain caller roles.
- Error-handling paths log failures without explicitly rolling back updates.
- Client-side tools are trusted to enforce access control rather than central controller logic.
- Policy and test enforcement: Add regression tests that:
- Verify that grantees cannot change secrets when they only have read access.
- Confirm that any error reported by
secret-setor equivalent APIs leaves the secret content unchanged. - Runtime and log analysis: Monitor logs for:
- Repeated
secret-seterrors followed by unexpected changes to secret content or metadata. - Anomalous patterns where non-owner entities frequently attempt secret updates.
- Automated review tools and CI checks can be configured to flag suspicious authorization patterns and missing rollback logic for privileged operations such as secret updates.

