Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS14YzI3LWY5cTMtNDQ0OM4AA1rH

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in hyper-bump-it

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).

[hyper-bump-it]
current_version = "1.2.3"
show_confirm_prompt=false

[[hyper-bump-it.files]]
file_glob = "../*"
search_format_pattern = "hello"
replace_format_pattern = "world"

Patches

A fix that been released as part of v0.5.1. The changes can be view as part of PR #307.

Workarounds

Users that are unable to update from vulnerable versions, executing hyper-bump-it with the --interactive command line argument will ensure that all planned changes are displayed and prompt the user for confirmation before editing any files, even if the configuration file contains show_confirm_prompt=true.

Permalink: https://github.com/advisories/GHSA-xc27-f9q3-4448
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS14YzI3LWY5cTMtNDQ0OM4AA1rH
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Low
Classification: General
Published: 8 months ago
Updated: 6 months ago


CVSS Score: 3.3
CVSS vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N

Identifiers: GHSA-xc27-f9q3-4448, CVE-2023-41057
References: Repository: https://github.com/plannigan/hyper-bump-it
Blast Radius: 1.0

Affected Packages

pypi:hyper-bump-it
Dependent packages: 0
Dependent repositories: 0
Downloads: 496 last month
Affected Version Ranges: < 0.5.1
Fixed in: 0.5.1
All affected versions: 0.0.1, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.5.0
All unaffected versions: 0.5.1, 0.5.2, 0.5.3