{"id":"CVE-2021-43837","aliases":["CVE-2021-43837","GHSA-q34h-97wf-8r8j","PYSEC-2021-853"],"related":[],"kind":"vulnerability","state":"published","title":"Template injection in vault-cli","summary":"vault-cli is a configurable command-line interface tool (and python library) to interact with Hashicorp Vault. In versions before 3.0.0 vault-cli features the ability for rendering templated values. 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 is 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. In 3.0.0, the code related to interpreting vault templated secrets has been removed entirely. Users are advised to upgrade as soon as possible. For users unable to upgrade a workaround does exist. 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"vault-cli is a configurable command-line interface tool (and python library) to interact with Hashicorp Vault. In versions before 3.0.0 vault-cli features the ability for rendering templated values. 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 is 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. In 3.0.0, the code related to interpreting vault templated secrets has been removed entirely. Users are advised to upgrade as soon as possible. For users unable to upgrade a workaround does exist. 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.","source":"cvelist"},{"lang":"en","text":"### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nvault-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.\nJinja2 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.\nIf 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.\n\nThis 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.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nIn 3.0.0, the code related to interpreting vault templated secrets has been removed entirely.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nUsing 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.\nUsing 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.\n\n### References\n_Are there any links users can visit to find out more?_\n\nHere'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/\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the vault-cli repo](https://github.com/peopledoc/vault-cli/issues/new)","format":"markdown","source":"ghsa"},{"lang":"es","text":"vault-cli es una herramienta configurable de interfaz de línea de comandos (y biblioteca de python) para interactuar con Hashicorp Vault. En versiones anteriores a 3.0.0 vault-cli cuenta con la capacidad de renderizar valores templados. Cuando un secreto comienza con el prefijo \"!template!\", vault-cli interpreta el resto del contenido del secreto como una plantilla Jinja2. Jinja2 es un potente motor de plantillas y no está diseñado para renderizar de forma segura plantillas arbitrarias. Un atacante que controle una plantilla jinja2 renderizada en una máquina puede lanzar código arbitrario, lo que supone un riesgo de Ejecución de Código Remota (RCE). Si el contenido de la bóveda puede ser completamente confiable, entonces esto no es un problema. De lo contrario, si su modelo de amenaza incluye casos en los que un atacante puede manipular un valor secreto leído desde la bóveda usando vault-cli, entonces esta vulnerabilidad puede afectarle. En la versión 3.0.0, el código relacionado con la interpretación de los secretos de las plantillas de las bóvedas se ha eliminado por completo. Se recomienda a usuarios que actualicen lo antes posible. Para los usuarios que no puedan actualizar, se presenta una solución. Usando la variable de entorno \"VAULT_CLI_RENDER=false\" o el flag \"--no-render\" (colocada entre \"vault-cli\" y el subcomando, por ejemplo \"vault-cli --no-render get-all\") o añadiendo \"render: false\" al archivo yaml de configuración de vault-cli es deshabilitada la renderización y se elimina la vulnerabilidad. Usando la librería python, puedes usar \"vault_cli.get_client(render=False)\" cuando creas tu cliente para conseguir un cliente que no renderice los secretos de las plantillas y así operar de forma segura","source":"nvd"}],"published":"2021-12-16T18:55:14.000Z","modified":"2026-07-08T06:28:15.882Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","score":8.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:A/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H","score":9.1,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:S/C:C/I:C/A:C","score":9,"rating":"HIGH"}],"cwes":["CWE-74","CWE-94"],"affected":[{"ranges":[{"version":">= 0.7.0,< 3.0.0","status":"affected"}],"vendor":"peopledoc","product":"vault-cli","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0.7.0","status":"affected","fixed":"3.0.0"}],"ecosystem":"PyPI","package":"vault-cli","purl":"pkg:pypi/vault-cli","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"0.7.0","fixed":"3.0.0"}],"vendor":"vault-cli_project","product":"vault-cli","cpe":"cpe:2.3:a:vault-cli_project:vault-cli:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"3ba3955887fd6b7d4d646c8b260f21cebf5db852"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.0.0"}],"ecosystem":"PyPI","package":"vault-cli","purl":"pkg:pypi/vault-cli","repo":"https://github.com/peopledoc/vault-cli","source":"pysec"}],"references":[{"url":"https://github.com/peopledoc/vault-cli/security/advisories/GHSA-q34h-97wf-8r8j","tags":["advisory","exploit","mitigation","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/peopledoc/vault-cli/commit/3ba3955887fd6b7d4d646c8b260f21cebf5db852","tags":["fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://podalirius.net/en/publications/grehack-2021-optimizing-ssti-payloads-for-jinja2/","tags":["exploit","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-43837","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/peopledoc/vault-cli/pull/198","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/peopledoc/vault-cli","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/peopledoc/vault-cli/releases/tag/3.0.0","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/vault-cli/PYSEC-2021-853.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://podalirius.net/en/publications/grehack-2021-optimizing-ssti-payloads-for-jinja2","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-43837","url":"https://www.cve.org/CVERecord?id=CVE-2021-43837","licence":"CVE Terms of Use","modified":"2024-08-04T04:10:16.268Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q34h-97wf-8r8j","url":"https://github.com/advisories/GHSA-q34h-97wf-8r8j","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:15.882Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-43837","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-43837","licence":"Public domain","modified":"2026-06-17T04:11:32.527Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-853","url":"https://osv.dev/vulnerability/PYSEC-2021-853","licence":"CC-BY-4.0","modified":"2023-11-08T04:07:14.038Z"}],"updatedAt":"2026-11-25T22:24:36.313Z","epss":{"score":0.05167,"percentile":0.93227,"date":"2026-11-30T12:00:22.000Z"}}