The vulnerability is a path traversal issue in Helm's chart extraction process, triggered by a chart having a name of . or .. in its Chart.yaml file. When helm pull --untar is executed on such a chart, the Expand function is called. In vulnerable versions, this function did not sanitize the chart name before using it to construct the destination path for extraction. This resulted in the chart's contents being written to the parent directory, potentially overwriting existing files, instead of a new directory named after the chart.
The patch 4e7994d4467182f535b6797c94b5b0e994a91436 rectifies this by adding validation in two key locations. First, the Metadata.Validate method is updated to reject charts with these special names during the initial metadata parsing. Second, as a defense-in-depth measure, the Expand function itself now also checks for and disallows these names before proceeding with the extraction. Both v2 and v3 of the chart format were affected, and the fixes were applied to the corresponding packages (pkg/chart/v2 and internal/chart/v3). Therefore, the Expand and Metadata.Validate functions within these packages are the identified vulnerable functions.