vault-cli
Affected
- introduced
0.7.0, fixed3.0.0(ecosystem)
Fixed versions
3.0.0
Fix
- Fixed version
3.0.0pip install --upgrade vault-cli==3.0.0
Advisory
Also known as: CVE-2021-43837, PYSEC-2021-853
vault-cli contains possible RCE when reading user-defined data
Impact
_What kind of vulnerability is it? Who is impacted?_
vault-cli features the ability for rendering templated values (as explained in the documentation). When a secret starts with the prefix !template!, vault-cli interprets the rest of the contents of the secret as a Jinja2 template.
Jinja2 is a powerful templating engine and it's not designed to safely render arbitrary templates. An attacker controlling a jinja2 template rendered on a machine can trigger arbitrary code, making this a Remote Code Execution (RCE) risk.
If the content of the vault can be completely trusted, then this is not a problem. Otherwise, if your threat model includes cases where an attacker can manipulate a secret value read from the vault using vault-cli, then this vulnerability may impact you.
This does not impact vault itself, except for the fact that the attacker, having an RCE on the machine that executes vault-cli, may abuse the token that vault-cli uses, to read, write or delete other data from the vault.
Patches
_Has the problem been patched? What versions should users upgrade to?_
In 3.0.0, the code related to interpreting vault templated secrets has been removed entirely.
Workarounds
_Is there a way for users to fix or remediate the vulnerability without upgrading?_
Using the environment variable VAULT_CLI_RENDER=false or the flag --no-render (placed between vault-cli and the subcommand, e.g. vault-cli --no-render get-all) or adding render: false to the vault-cli configuration yaml file disables rendering and removes the vulnerability.
Using the python library, you can use: vault_cli.get_client(render=False) when creating your client to get a client that will not render templated secrets and thus operates securely.
References
_Are there any links users can visit to find out more?_
Here's an article explaining how jinja2 templates might be exploited to have side effects: https://podalirius.net/en/publications/grehack-2021-optimizing-ssti-payloads-for-jinja2/
For more information
If you have any questions or comments about this advisory:
Medium Basis: The source's own band: MODERATE
0.7.0, fixed 3.0.0 (ecosystem)3.0.0
3.0.0pip install --upgrade vault-cli==3.0.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0