# CVE-2022-38149: HashiCorp Consul Template could reveal Vault secret contents in error messages

> Attackers can read Vault secrets via error messages when using Consul Template with incorrect templates, requiring an upgrade to fix.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Aug 2022
- **Updated:** 3 Aug 2024
- **Also known as:** CLEANSTART-2024-TM83377, GHSA-8449-7gc2-pwrp, GO-2022-0980

## What is CVE-2022-38149?

CVE-2022-38149 is a high-severity vulnerability in n/a, published on 17 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

HashiCorp Consul Template up to 0.27.2, 0.28.2, and 0.29.1 may expose the contents of Vault secrets in the error returned by the *template.Template.Execute method, when given a template using Vault secret contents incorrectly. Fixed in 0.27.3, 0.28.3, and 0.29.2.

Weakness: CWE-532 (Insertion of Sensitive Information into Log File)

## Which versions are affected by CVE-2022-38149?

7 open source packages ship an affected version, including github.com/hashicorp/consul-template. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/hashicorp/consul-template` | Go | All versions | 0.27.3, 0.28.3, 0.29.2 |
| `github.com/hashicorp/consul-template` | Go | All versions | 0.27.3 |
| `github.com/hashicorp/consul-template` | Go | All versions | 0.27.3 |
| `github.com/hashicorp/consul-template` | Go | From 0.28.0 | 0.28.3 |
| `github.com/hashicorp/consul-template` | Go | From 0.28.0 | 0.28.3 |
| `github.com/hashicorp/consul-template` | Go | From 0.29.0 | 0.29.2 |
| `github.com/hashicorp/consul-template` | Go | From 0.29.0 | 0.29.2 |

Products: Hashicorp Consul Template.

## How do I fix CVE-2022-38149?

Upgrade github.com/hashicorp/consul-template to a fixed version for your release line: 0.27.3, 0.28.3 or 0.29.2.

## Is CVE-2022-38149 being exploited?

There is no known exploitation of CVE-2022-38149 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-38149 and fix it if it is affected.

What it is: CVE-2022-38149 is a high-severity vulnerability in n/a, published on 17 Aug 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-38149 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/hashicorp/consul-template (Go): affected all versions; fixed in 0.27.3, 0.28.3, 0.29.2
- github.com/hashicorp/consul-template (Go): affected all versions; fixed in 0.27.3
- github.com/hashicorp/consul-template (Go): affected all versions; fixed in 0.27.3
- github.com/hashicorp/consul-template (Go): affected from 0.28.0; fixed in 0.28.3
- github.com/hashicorp/consul-template (Go): affected from 0.28.0; fixed in 0.28.3
- github.com/hashicorp/consul-template (Go): affected from 0.29.0; fixed in 0.29.2
- github.com/hashicorp/consul-template (Go): affected from 0.29.0; fixed in 0.29.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-38149/ (Markdown: https://insights.sbomify.com/CVE-2022-38149/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-38149
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-38149
- OSV: https://osv.dev/vulnerability/CVE-2022-38149

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-38149/
Summaries are generated and may contain mistakes; the official description above is the record.
