# HCSEC-2026-12 - Consul-template vulnerable to sandbox path bypass in file helper through symlink attack

**URL:** <https://discuss.hashicorp.com/t/hcsec-2026-12-consul-template-vulnerable-to-sandbox-path-bypass-in-file-helper-through-symlink-attack/77414>\
**Category:** Security\
**Tags:** security-consul\
**Created:** [May 12, 2026, 1:54pm UTC](https://discuss.hashicorp.com/t/hcsec-2026-12-consul-template-vulnerable-to-sandbox-path-bypass-in-file-helper-through-symlink-attack/77414 "2026-05-12T13:54:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![james.warren](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/james.warren/32/44042_2.png) [@james.warren](https://discuss.hashicorp.com/u/james.warren)\
**Post date:** [May 12, 2026, 1:54pm UTC](https://discuss.hashicorp.com/t/hcsec-2026-12-consul-template-vulnerable-to-sandbox-path-bypass-in-file-helper-through-symlink-attack/77414/1 "2026-05-12T13:54:02Z")

</div>

**Bulletin ID:** HCSEC-2026-12  
**Affected Products / Versions:** Consul-template up to 0.41.4; fixed in 0.42.0.  
**Publication Date:** May 12, 2026

**Summary**  
The consul-template library before version 0.42.0 is vulnerable to a sandbox path bypass in the file template helper that may allow reading an out-of-sandbox file. This vulnerability (CVE-2026-5061) is fixed in consul-template 0.42.0.

**Background**  
The file template function reads a local file from disk and renders its contents into the template output. It also watches the file for changes. When a file is modified, consul-template automatically re-renders the template. The sandbox\_path restricts which local files the file function is allowed to read and ensures the path passed falls within the given directory tree.

**Details**  
During template evaluation the file template helper enforces the sandbox\_path, but the later dependency fetch reads the original input path without rechecking the sandbox\_path. This creates a time-of-check time-of-use gap. An attacker can retarget a symlink after the initial validation but before the dependency fetch, the fetch can read an out-of-sandbox file. If the attacker restores the safe target before the next render, the second validation still passes and the template consumes the already-cached out-of-sandbox content.

**Remediation**  
Customers should evaluate the risk associated with this issue and consider upgrading to consul-template 0.42.0.

**Acknowledgement**  
This issue was reported to HashiCorp by Mohamed Abdelaal (0xmrma).

_We deeply appreciate any effort to coordinate disclosure of security vulnerabilities. For information about security at HashiCorp and the reporting of security vulnerabilities, please see [https://hashicorp.com/security](https://hashicorp.com/security)._
