CVE-2024-41129: ops leaking secrets if `subprocess.CalledProcessError` happens with a `secret-*` CLI command
The issue here is that we pass the secret content as one of the args via CLI. This issue may affect any of our charms that are using: Juju (>=3.0), Juju secrets and not correctly capturing and processing subprocess.CalledProcessError
.
There are two points that may log this command, in different files:
First, if there is an error during a secret handling, there will be a subprocess.CalledProcessError
, which will contain the CLI comand + all its args. This is going to be logged in any logging level. This exception, if not caught by the charm, will bubble up to the /var/log/juju/
logs and syslog journal. Now, on Ubuntu 22.04, these logs are protected with:
$ juju ssh -m controller 0 -- ls -la /var/log/juju/
total 224
drwxr-xr-x 2 syslog adm 4096 Jul 14 10:59 .
drwxrwxr-x 9 root syslog 4096 Jul 14 10:58 ..
-rw-r----- 1 syslog adm 20124 Jul 14 11:10 audit.log
-rw-r----- 1 syslog adm 110432 Jul 14 11:10 logsink.log
-rw-r----- 1 syslog adm 80783 Jul 14 11:06 machine-0.log
-rw-r----- 1 syslog adm 766 Jul 14 11:10 machine-lock.log
-rw-r--r-- 1 root root 0 Jul 14 10:59 slow-query.log
-rw-r----- 1 syslog adm 3732 Jul 14 11:10 unit-controller-0.log
Second, certain audit setups may log terminal commands, which would result in this command being logged with its secrets. It is unknown if this is done on ubuntu security benchmarks, such as CIS hardening.
Keep in mind these logs may be copied or even backed up. Which exposes it to more services in the user’s environment (e.g. CI runs in GH - although these are dummy password generated per test only).
References
Detect and mitigate CVE-2024-41129 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →