Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in hyper-bump-it
Date: 2023-09
Affected: pip/hyper-bump-it
Attack vector: path-traversal
Category: vulnerability-disclosure
Severity: Low
CVE: CVE-2023-41057
CWE: CWE-22
CVSS: 3.3 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N)

### Summary `hyper-bump-it` reads a file glob pattern from the configuration file. That is combined with the project root directory to construct a full glob pattern that is used to find files that should be edited. These matched files should be contained within the project root directory, but that is not checked. This could result in changes being written to files outside of the project. The default behaviour of `hyper-bump-it` is to display the planned changes and prompt the user for confirmation before editing any files. However, the configuration file provides a field that can be used cause files to be edited without displaying the prompt. ### Details The vulnerability is present in https://github.com/plannigan/hyper-bump-it/blob/49c726201bbdc02c052302e03fd907d2170e1f47/hyper_bump_it/_hyper_bump_it/files.py#L35 That code joins the project root directory with a string read from the configuration file without checking if the final path is located outside the project root directory. The following configuration file contents would cause `hyper-bump-it` to replace every instance of "hello" in every file adjacent to the project root directory with "world". The line setting `show_confirm_prompt` to `false` is not required, but will result in the user file edits to occur without the user having a chance to reject the changes (The fact that changes happened would still be displayed). ```toml [hyper-bump-it] current_version = "1.2.3" show_confirm_prompt=false [[hyper-bump


Mitigations:

Architectural layers (MAESTRO):