🇰🇷 한글 설명
vault-cli 3.0.0 미만 버전에서 비밀번호 값이 '!template!' 접두사로 시작할 경우 이를 Jinja2 템플릿으로 해석하여 처리하는 취약점이 발견되었습니다. 공격자가 Vault 내의 비밀번호 값을 조작할 수 있다면 임의의 코드를 실행할 수 있는 원격 코드 실행(RCE) 위험이 존재합니다.
💡 쉬운 설명
해커가 저장된 비밀번호 내용을 특수한 명령어로 바꿔치기하면, 이를 읽어오는 컴퓨터에서 해커의 명령이 실행될 수 있는 보안 약점입니다. 비밀번호를 단순히 글자로 읽지 않고 프로그램 코드로 오해해서 발생하는 문제입니다.
🇺🇸 원문 (English)
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.
📍 영향받는 시스템
vault-cli versions before 3.0.0
⚔️ 공격 벡터
Vault 내의 비밀번호 값을 '!template!' 접두사가 포함된 악성 Jinja2 템플릿 코드로 조작하여 vault-cli로 읽을 때 실행
🛡️ 대응 방법
vault-cli를 3.0.0 이상 버전으로 업그레이드하거나, 환경 변수 VAULT_CLI_RENDER=false 또는 --no-render 플래그를 사용하여 템플릿 렌더링 기능을 비활성화합니다.
🔧 검증 코드
명령어 실행 결과로 3.0.0 미만의 버전 번호가 출력되면 취약한 버전이 설치된 상태입니다.
vault-cli --version 2>/dev/null | grep -E '^[0-2]\.'