vault-cli contains possible RCE when reading user-defined data
Date: 2021-12
Affected: pip/vault-cli
Attack vector: rce
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2021-43837
CWE: CWE-74
CWE-94
CVSS: 8.4 (CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H)

### Impact _What kind of vulnerability is it? Who is impacted?_ vault-cli features the ability for rendering templated values (as explained in the [documentation](https://github.com/peopledoc/vault-cli/blob/2.2.1/docs/howto/templated_secrets.rst)). 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


Mitigations:

Architectural layers (MAESTRO):