Skip to content
Heist/ feed
Back to feed
MediumFix available

python-git — security advisory

Type: advisorySources: OSVAdvisory ID: DEBIAN-CVE-2023-41040

GitPython is a python library used to interact with Git repositories. In order to resolve some git references, GitPython reads files from the `.git` directory, in some places the name of the file being read is provided by the user, GitPython doesn't check if this file is located outside the `.git` directory. This allows an attacker to make GitPython read any file from the system. This vulnerability is present in https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175. That code joins the base directory with a user given string without checking if the final path is located outside the base directory. This vulnerability cannot be used to read the contents of files but could in theory be used to trigger a denial of service for the program. This issue has been addressed in version 3.1.37.

Products
python-git
Affected versions
3.1.30-1
Fixed versions
3.1.30-1+deb12u2, 3.1.36-1
CVEs
CVE-2023-41040
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 16:05 UTC · Revision 1

Source evidence

DEBIAN-CVE-2023-41040

core-osv · Original source

Published 30 Aug 2023, 22:15 UTC

GitPython is a python library used to interact with Git repositories. In order to resolve some git references, GitPython reads files from the `.git` directory, in some places the name of the file being read is provided by the user, GitPython doesn't check if this file is located outside the `.git` directory. This allows an attacker to make GitPython read any file from the system. This vulnerability is present in https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175. That code joins the base directory with a user given string without checking if the final path is located outside the base directory. This vulnerability cannot be used to read the contents of files but could in theory be used to trigger a denial of service for the program. This issue has been addressed in version 3.1.37.

osv:DEBIAN-CVE-2023-41040

python-git

Fixed versions: 3.1.30-1+deb12u2

python-git

Fixed versions: 3.1.36-1

python-git

Fixed versions: 3.1.36-1

Complete source record
{
  "id": "a584df5a93095b63f25b6136a906123ac70bf5b04a914fe01ea56f573687fda6",
  "url": "https://osv.dev/vulnerability/DEBIAN-CVE-2023-41040",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DEBIAN-CVE-2023-41040",
    "summary": "GitPython is a python library used to interact with Git repositories. In order to resolve some git references, GitPython reads files from the `.git` directory, in some places the name of the file being read is provided by the user, GitPython doesn't check if this file is located outside the `.git` directory. This allows an attacker to make GitPython read any file from the system. This vulnerability is present in https://github.com/gitpython-developers/GitPython/blob/1c8310d7cae144f74a671cbe17e51f63a830adbf/git/refs/symbolic.py#L174-L175. That code joins the base directory with a user given string without checking if the final path is located outside the base directory. This vulnerability cannot be used to read the contents of files but could in theory be used to trigger a denial of service for the program. This issue has been addressed in version 3.1.37.",
    "evidence": "osv:DEBIAN-CVE-2023-41040",
    "products": [
      {
        "name": {
          "value": "python-git",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "3.1.30-1+deb12u2",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": [
          {
            "value": "3.1.30-1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "python-git",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "3.1.36-1",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      },
      {
        "name": {
          "value": "python-git",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "3.1.36-1",
            "evidence": "/affected/2/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "DEBIAN-CVE-2023-41040",
      "aliases": [
        "DEBIAN-CVE-2023-41040"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3.1.30-1+deb12u2"
                }
              ]
            }
          ],
          "package": {
            "name": "python-git",
            "purl": "pkg:deb/debian/python-git?arch=source&distro=bookworm",
            "ecosystem": "Debian:12"
          },
          "versions": [
            "3.1.30-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-41040.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3.1.36-1"
                }
              ]
            }
          ],
          "package": {
            "name": "python-git",
            "purl": "pkg:deb/debian/python-git?arch=source&distro=trixie",
            "ecosystem": "Debian:13"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-41040.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "3.1.36-1"
                }
              ]
            }
          ],
          "package": {
            "name": "python-git",
            "purl": "pkg:deb/debian/python-git?arch=source&distro=forky",
            "ecosystem": "Debian:14"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2023-41040.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        }
      ],
      "modified": "2026-10-26T18:02:41.528633594Z",
      "provider": "osv",
      "upstream": [
        "CVE-2023-41040"
      ],
      "references": [
        "https://security-tracker.debian.org/tracker/CVE-2023-41040"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2023-41040",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 456613,
  "published_at": "2023-08-30T22:15:09.857+00:00"
}