# CVE-2026-5061: HashiCorp consul-template sandbox path bypass in file helper

Source: https://junglewise.ai/threats/cve-2026-5061-hashicorp-consul-template-sandbox-path-bypass-in-file-helper  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-12. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

CVE-2026-5061 · Severity: medium · CVSS 4.7 · Published 2026-05-12

HashiCorp consul-template is a tool used to manage configuration files by automatically updating them when data changes in HashiCorp Consul or Vault. A security flaw in the tool's file-handling component could allow a local user to bypass security restrictions and read sensitive files on the host system that they should not have access to. This could lead to the exposure of private configuration data or system secrets, potentially compromising the security of the underlying infrastructure.

Technologies: [HashiCorp Consul-Template](https://junglewise.ai/threats/technologies/consul-template). Vendors: [HashiCorp](https://junglewise.ai/threats/vendors/hashicorp).

## Quick answers

**Is CVE-2026-5061 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-5061 being exploited in the wild.

**How severe is CVE-2026-5061?** Medium severity, with a CVSS score of 4.7, published 12 May 2026.

**Which products and versions are affected?** HashiCorp Consul-Template < 0.42.0.

**Is there a fix for CVE-2026-5061?** A patch was published on 2026-05-12: Fixed in version 0.42.0 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-5061 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-5061?** Check whether you run HashiCorp Consul-Template at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A Time-of-Check Time-of-Use (TOCTOU) vulnerability exists in the 'file' template helper of consul-template. While the helper enforces a 'sandbox_path' during initial template evaluation, a subsequent dependency fetch reads the original input path without re-validating it against the sandbox restrictions. An attacker with local access can exploit this by replacing a legitimate file with a symlink after the initial check but before the fetch occurs (CWE-59). This allows the attacker to read files outside the sandbox. If the symlink is restored to a safe target before the next render cycle, the bypass may remain undetected while the template continues to use the cached out-of-sandbox content. The issue is fixed in version 0.42.0.

## Affected products

- HashiCorp consul-template < 0.42.0

## Timeline

- 2026-05-12: disclosed
- 2026-05-12: advisory
- 2026-05-12: patched: Fixed in version 0.42.0

## References

- [https://discuss.hashicorp.com/t/hcsec-2026-12-consul-template-vulnerable-to-sandbox-path-bypass-in-file-helper-through-symlink-attack/77414](https://discuss.hashicorp.com/t/hcsec-2026-12-consul-template-vulnerable-to-sandbox-path-bypass-in-file-helper-through-symlink-attack/77414)

## Related threats

- [HashiCorp Consul-template information disclosure in error handling](https://junglewise.ai/threats/cve-2026-87993-hashicorp-consul-template-information-disclosure-in-error)
- [HashiCorp Consul-template path redirection in writeToFile helper](https://junglewise.ai/threats/cve-2026-14361-hashicorp-consul-template-path-redirection-in-writetofile-helper)
