Vulnerabilities in pkg:pypi/hyper-bump-it

PACKAGE
Advisory Identifier: GHSA-xc27-f9q3-4448
Advisory Summary

CVE-2023-41057 is a LOW (CVSS 3.3) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Hyper bump it libraries in the PyPI ecosystem. The issue involves improper limitation of a pathname to a restricted directory ('path traversal') in hyper-bump-it. Remediation is available by upgrading affected packages to version 0.5.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/hyper-bump-it

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/hyper-bump-it. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-xc27-f9q3-4448 CVE-2023-41057 LOW Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in hyper-bump-it

CVE-2023-41057 at a Glance

CVE Identifier CVE-2023-41057
GHSA Identifier GHSA-xc27-f9q3-4448
Severity LOW
CVSS v3.1 Base Score 3.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Hyper bump it
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-41057

To remediate this vulnerability, upgrade all affected Hyper bump it dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

hyper-bump-it fixed: 0.5.1
pip install hyper-bump-it>=0.5.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show hyper-bump-it

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-41057, inspect your installed packages using pip:

pip show hyper-bump-it

Analyze the terminal output to locate any version of Hyper bump it in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.5.1), your application is affected.

Note: The pip show hyper-bump-it command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Hyper bump it, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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-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`.

CVE-2023-41057 Affected Hyper bump it Versions

1 component(s)
Fixed Versions:
0.5.1
Product / Package Ecosystem Affected Versions Fixed Version
hyper-bump-it
PyPI
< 0.5.1
0.5.1

References

Frequently Asked Questions

What is CVE-2023-41057?
CVE-2023-41057 is a security vulnerability in Hyper bump it involving Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in hyper-bump-it under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Hyper bump it versions are affected?
Affected versions include releases prior to 0.5.1 across affected packages: hyper-bump-it.
What version fixes CVE-2023-41057?
Upgrading to 0.5.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is hyper-bump-it affected?
Yes, hyper-bump-it is affected in releases prior to 0.5.1. Upgrade your dependency to 0.5.1 or later.
What is the CVSS score of CVE-2023-41057?
CVE-2023-41057 has a CVSS v3.1 base score of 3.3 (LOW) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2023-41057?
CVE-2023-41057 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2023-41057?
Run the dependency tree command: 'pip show hyper-bump-it'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xc27-f9q3-4448",
  "modified" : "2023-10-09T19:51:02Z",
  "published" : "2023-09-04T17:02:36Z",
  "aliases" : [ "CVE-2023-41057" ],
  "summary" : "Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in hyper-bump-it",
  "details" : "### Summary\n`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.\n\nThe 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.\n\n### Details\n\nThe vulnerability is present in \n\nhttps://github.com/plannigan/hyper-bump-it/blob/49c726201bbdc02c052302e03fd907d2170e1f47/hyper_bump_it/_hyper_bump_it/files.py#L35\n\nThat 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.\n\nThe 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). \n\n```toml\n[hyper-bump-it]\ncurrent_version = \"1.2.3\"\nshow_confirm_prompt=false\n\n[[hyper-bump-it.files]]\nfile_glob = \"../*\"\nsearch_format_pattern = \"hello\"\nreplace_format_pattern = \"world\"\n```\n\n### Patches\nA fix that been released as part of v0.5.1. The changes can be view as part of  PR #307.\n\n### Workarounds\nUsers 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`.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "hyper-bump-it"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.5.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/plannigan/hyper-bump-it/security/advisories/GHSA-xc27-f9q3-4448"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-41057"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/plannigan/hyper-bump-it/pull/307"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/plannigan/hyper-bump-it"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-04T17:02:36Z",
    "nvd_published_at" : "2023-09-04T18:15:09Z"
  }
}