CVE-2021-43837
📋 TL;DR
CVE-2021-43837 is a remote code execution vulnerability in vault-cli where secrets starting with '!template!' are interpreted as Jinja2 templates. Attackers who can manipulate vault secrets can execute arbitrary code on systems running vulnerable vault-cli versions. Organizations using vault-cli with untrusted vault content are affected.
💻 Affected Systems
- vault-cli
📦 What is this software?
Vault Cli by Vault Cli Project
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise via arbitrary code execution leading to data theft, lateral movement, and persistent backdoors.
Likely Case
Privilege escalation and data exfiltration from systems where vault-cli processes secrets from partially trusted sources.
If Mitigated
No impact if vault content is fully trusted or rendering is disabled.
🎯 Exploit Status
Exploitation requires ability to write or modify vault secrets. Jinja2 SSTI techniques are well-documented.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.0.0
Vendor Advisory: https://github.com/peopledoc/vault-cli/security/advisories/GHSA-q34h-97wf-8r8j
Restart Required: No
Instructions:
1. Upgrade vault-cli to version 3.0.0 or later using pip: 'pip install --upgrade vault-cli>=3.0.0' 2. Verify installation with 'vault-cli --version'
🔧 Temporary Workarounds
Disable template rendering via environment variable
allSet VAULT_CLI_RENDER=false to disable Jinja2 template processing
export VAULT_CLI_RENDER=false
Disable template rendering via command flag
allUse --no-render flag with vault-cli commands
vault-cli --no-render get-all
Disable template rendering in configuration
allAdd 'render: false' to vault-cli configuration YAML file
echo 'render: false' >> ~/.config/vault-cli/config.yaml
🧯 If You Can't Patch
- Implement strict access controls to vault secrets to prevent unauthorized modifications
- Audit all vault secrets for '!template!' prefixes and remove or sanitize them
🔍 How to Verify
Check if Vulnerable:
Check vault-cli version with 'vault-cli --version' - versions below 3.0.0 are vulnerable
Check Version:
vault-cli --version
Verify Fix Applied:
Confirm version is 3.0.0+ and test that '!template!' secrets are no longer processed as templates
📡 Detection & Monitoring
Log Indicators:
- Unusual process execution from vault-cli context
- Error logs related to Jinja2 template rendering
Network Indicators:
- Unexpected outbound connections from systems running vault-cli
SIEM Query:
process_name:"vault-cli" AND (command_line:"!template!" OR command_line:"--no-render")
🔗 References
- https://github.com/peopledoc/vault-cli/commit/3ba3955887fd6b7d4d646c8b260f21cebf5db852
- https://github.com/peopledoc/vault-cli/security/advisories/GHSA-q34h-97wf-8r8j
- https://podalirius.net/en/publications/grehack-2021-optimizing-ssti-payloads-for-jinja2/
- https://github.com/peopledoc/vault-cli/commit/3ba3955887fd6b7d4d646c8b260f21cebf5db852
- https://github.com/peopledoc/vault-cli/security/advisories/GHSA-q34h-97wf-8r8j
- https://podalirius.net/en/publications/grehack-2021-optimizing-ssti-payloads-for-jinja2/