5.9medium
Infracost: Arbitrary file read via config-template readFile symlink traversal
- Severity
- 5.9medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.54% (higher than 39% of CVEs)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-mmg6-4qmv-6pc8GO-2026-6439
Description
Infracost provides cloud cost intelligence for engineers, AI coding agents, and CI/CD. Prior to 0.10.45, the readFile, pathExists, isDir, and matchPaths template functions in internal/config/template/parser.go use a lexical filepath.Rel check and a leaf-only os.Lstat check that do not resolve an intermediate directory symlink. A repository can contain a path such as evil/file where evil points outside the checkout, causing os.ReadFile and related operations to follow the symlink and read runner-accessible files. The resulting content is rendered into generated configuration and can be surfaced through the Infracost dashboard or pull request comment, with greater impact in workflows that provide repository secrets. This issue is fixed in version 0.10.45.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| infracost infracost | < 0.10.45 | CVE List |
| github.com/infracost/infracost (Go) | before 0.10.45 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 5.9medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N |
Classification
What each source says
CVE List
Infracost provides cloud cost intelligence for engineers, AI coding agents, and CI/CD. Prior to 0.10.45, the readFile, pathExists, isDir, and matchPaths template functions in internal/config/template/parser.go use a lexical filepath.Rel check and a leaf-only os.Lstat check that do not resolve an intermediate directory symlink. A repository can contain a path such as evil/file where evil points outside the checkout, causing os.ReadFile and related operations to follow the symlink and read runner-accessible files. The resulting content is rendered into generated configuration and can be surfaced through the Infracost dashboard or pull request comment, with greater impact in workflows that provide repository secrets. This issue is fixed in version 0.10.45.
GitHub Advisory Database
Impact
Path traversal via link following in the Infracost config-template parser. The readFile, pathExists, isDir, and matchPaths template functions confined repo-supplied paths with a lexical filepath.Rel check plus a leaf-only os.Lstat:
{{ readFile "evil/file" }}
With an intermediate directory symlink committed in the repo (evil -> /), the path is lexically clean and the leaf is a regular file, so both checks pass, but os.ReadFile follows the symlink and reads outside the checkout. The contents are rendered into the generated config and surfaced via the Infracost dashboard and PR comment, so anyone who can open a pull request can read files off the runner.
Affects infracost up to and including v0.10.44. Successful exploitation reads any file the CLI process can reach on the runner. Impact depends on what the run exposes: under on: pull_request (the configuration in Infracost's documentation) fork pull requests run without secrets and with a read-only token, so exposure is limited. If Infracost runs under pull_request_target, or is triggered by a same-repository pull request, the read reaches the repository's secrets, enabling secret theft. The patch confines all four functions regardless of trigger.
Patches
Fixed in v0.10.45 (#3586) by routing all four functions through security.IsPathAllowed, which resolves symlinks anywhere in the path before a segment-aware containment check. The same fix landed in config#14 and parser#144.
- Installed via the official script, a package manager, or the
latestDocker tag: upgrade tov0.10.45(or later) to receive the fix. - Pinned to a specific version or image digest: bump to
v0.10.45.
Workarounds
No full fix without upgrading. To limit exposure: run Infracost under on: pull_request rather than pull_request_target, and keep fork pull requests from receiving secrets (the defaults).
Go Vulnerability Database
Infracost: Arbitrary file read via config-template readFile symlink traversal in github.com/infracost/infracost
NVD (es)
Infracost proporciona inteligencia de costos en la nube para ingenieros, agentes de codificación de IA y CI/CD. Antes de la versión 0.10.45, las funciones de plantilla readFile, pathExists, isDir y matchPaths en internal/config/template/parser.go utilizan una verificación léxica filepath.Rel y una verificación os.Lstat solo de hoja que no resuelven un enlace simbólico de directorio intermedio. Un repositorio puede contener una ruta como evil/file donde evil apunta fuera del checkout, haciendo que os.ReadFile y operaciones relacionadas sigan el enlace simbólico y lean archivos accesibles para el ejecutor. El contenido resultante se renderiza en la configuración generada y puede mostrarse a través del panel de Infracost o un comentario de solicitud de extracción, con mayor impacto en flujos de trabajo que proporcionan secretos de repositorio. Este problema se corrige en la versión 0.10.45.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-71493 changed 2026-08-26 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-mmg6-4qmv-6pc8 changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-6439 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-71493 changed 2026-10-14 | Public domain |