{"id":"CVE-2026-40090","aliases":["GHSA-pj97-4p9w-gx3q","GO-2026-5542"],"title":"Zarf has a Path Traversal via Malicious Package Metadata.Name — Arbitrary File Write","summary":"Zarf has a Path Traversal via Malicious Package Metadata.Name — Arbitrary File Write","severity":"high","cvss":7.1,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:L","vendor":"zarf-dev","product":"github.com/zarf-dev/zarf","ecosystem":"go","affected":["github.com/zarf-dev/zarf >= 0.23.0, < 0.74.2"],"patched":["github.com/zarf-dev/zarf 0.74.2"],"published":"2026-04-14","updated":"2026-07-23","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-pj97-4p9w-gx3q","references":[{"url":"https://github.com/zarf-dev/zarf/security/advisories/GHSA-pj97-4p9w-gx3q"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40090"},{"url":"https://github.com/zarf-dev/zarf/pull/4793"},{"url":"https://github.com/zarf-dev/zarf"}],"tags":["osv","go"],"epss":0.0032,"epssPercentile":0.25258,"ingestedAt":"2026-07-23T19:05:53.795Z","slug":"CVE-2026-40090","body":"## Overview\n\n### Impact\nThis vulnerability impacts users of `zarf package inspect sbom` or `zarf package inspect documentation` on untrusted packages.\n\n### Patches\n#4793, now fixed in version v0.74.2\n\n### Workarounds\nAvoid inspecting unsigned packages\n\n## Description\n\nThe `package inspect sbom` and `package inspect documentation` subcommands construct output file paths by joining a user-controlled output directory with the package's `Metadata.Name` field, which is attacker-controlled data read from the package archive. The `Metadata.Name` field is validated against a regex on create, `^[a-z0-9][a-z0-9\\-]*$`, however a malicious user could unarchive a package to change the `.Metadata.Name` field and the files inside the SBOMS.tar.  This would lead to arbitrary file write in a location of the attackers choosing. \n\nNeither location sanitizes or validates the package name before using it in the file path.\n\n**SBOM inspection:**\n```go\noutputPath := filepath.Join(o.outputDir, pkgLayout.Pkg.Metadata.Name)\nerr = pkgLayout.GetSBOM(ctx, outputPath)\n```\n\n**Documentation inspection (line 1219):**\n```go\noutputPath := filepath.Join(o.outputDir, fmt.Sprintf(\"%s-documentation\", pkgLayout.Pkg.Metadata.Name))\nreturn pkgLayout.GetDocumentation(ctx, outputPath, o.keys)\n```\n\n`pkgLayout.Pkg.Metadata.Name` is read directly from the untrusted package's `zarf.yaml` manifest. An attacker can craft a malicious Zarf package where `Metadata.Name` contains path traversal sequences or root paths such as `../../etc/cron.d/malicious` or `/home/user/.ssh/authorized_keys`.\n\n### CVSS Explainations\n#### Attack Vector\nVerdict: Network\nA malicious package could be published to OCI and inspected directly with `zarf package inspect sbom oci://<bad-package>`\n\n#### Attack Complexity \nVerdict: Low\nIt is not complicated to make and publish a malicious package. The Attacker only needs to edit the zarf.yaml and sboms.tar then edit the checksums.\n\n#### Privileges Required\nVerdict: None\nThe attacker is relying on the runner of `zarf package inspect sbom|documentation` and needs no other privileges.\n\n#### User Interaction\nVerdict: Required\nThe user must run the inspect command\n\n#### Scope\nVerdict: Unchanged\nThe vulnerability operates entirely within the permissions of the user running zarf package inspect. The file write can't escape the privilege boundary of that user \n\n#### Confidentiality\nVerdict: None\nThis is an arbitrary file write vulnerability. The attacker can place or overwrite files on the filesystem but the vulnerability does not provide any mechanism to read or exfiltrate data from the target system.\n\n#### Integrity\nVerdict: High\nThe attacker controls both the file path (via Metadata.Name) and the file content (via the SBOM or documentation files inside the archive). This allows writing attacker-controlled content to arbitrary locations on the filesystem, limited only by the permissions of the user running the inspect command. Realistic exploitation includes writing SSH authorized_keys, cron jobs, or shell profiles.\n\n### Availability\nVerdict: Low\nThe vulnerability does not directly target service availability. However, an attacker could overwrite files that cause system disruption.\n\n## Affected packages\n\n- `github.com/zarf-dev/zarf >= 0.23.0, < 0.74.2`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `github.com/zarf-dev/zarf 0.74.2`","depth":"twilight","depthScore":39,"depthScoreParts":{"impact":39.1,"likelihood":0.1,"exploitation":0,"ransomware":0},"changes":[]}