Skip to main content
Vulnerability Database/CVE-2025-61659

CVE-2025-61659: bash-git-prompt Information Disclosure

CVE-2025-61659 is an information disclosure vulnerability in bash-git-prompt versions 2.6.1 through 2.7.1 caused by insecure use of predictable temporary files. This article covers the technical details, security risks, and remediation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-61659 Overview

CVE-2025-61659 affects bash-git-prompt versions 2.6.1 through 2.7.1. The tool creates a temporary file at /tmp/git-index-private$$ using a predictable name derived from the shell process identifier. A local attacker who can predict or race the filename can exploit this insecure temporary file handling to influence shell behavior or disclose repository state. The weakness is categorized under CWE-377: Insecure Temporary File.

Critical Impact

Local attackers on multi-user systems can exploit the predictable /tmp filename to tamper with git index data, leak information, or escalate access through symlink attacks.

Affected Products

  • bash-git-prompt 2.6.1
  • bash-git-prompt 2.7.0
  • bash-git-prompt 2.7.1

Discovery Timeline

  • 2025-09-29 - CVE-2025-61659 published to NVD
  • 2026-10-09 - Last updated in NVD database

Technical Details for CVE-2025-61659

Vulnerability Analysis

bash-git-prompt is a shell prompt customization utility that displays git repository state. During prompt rendering, the tool writes to a temporary file at /tmp/git-index-private$$, where $$ expands to the current shell process ID (PID). Process IDs are not secrets and are enumerable through /proc or ps. An attacker on the same host can predict the filename before it is created.

The vulnerability enables classic insecure temporary file attacks. An unprivileged local user can pre-create the target path as a symbolic link pointing to a file owned by the victim. When the victim opens a shell and bash-git-prompt writes to the predictable path, the write follows the symlink and corrupts or truncates the target. Alternatively, the attacker can read the git index data staged in /tmp, exposing details of private repositories.

Root Cause

The root cause is the use of a non-random, PID-based filename in a world-writable directory without O_CREAT | O_EXCL semantics or secure temp-file APIs such as mktemp(1). Shared /tmp directories allow any local account to create files or symlinks at attacker-chosen paths. Without atomic creation checks, the application cannot distinguish between its own file and one planted by another user.

Attack Vector

Exploitation requires local access to the system where a victim runs an interactive bash shell with bash-git-prompt loaded. The attacker enumerates or predicts the victim's shell PID, pre-creates /tmp/git-index-private$$ as a symlink to a sensitive file, and waits for the prompt to execute. The resulting write operation can clobber arbitrary files writable by the victim user. Attack complexity is low, no privileges or user interaction beyond normal shell usage are required. Additional discussion is available in the upstream GitHub issue.

Detection Methods for CVE-2025-61659

Indicators of Compromise

  • Presence of /tmp/git-index-private* files owned by users other than the current shell owner.
  • Symbolic links in /tmp matching the git-index-private* pattern that point outside /tmp.
  • Unexpected modifications or truncations of files writable by users who regularly run bash-git-prompt.

Detection Strategies

  • Audit shared temporary directories for predictable filenames created by shell integrations.
  • Enable Linux audit rules (auditd) on /tmp to log open, symlink, and rename operations targeting git-index-private*.
  • Inventory installed versions of bash-git-prompt across managed Linux hosts and flag versions 2.6.1 through 2.7.1.

Monitoring Recommendations

  • Forward /tmp file-system telemetry and process execution events to a centralized data lake for correlation.
  • Alert on symlink creation in /tmp where the link target resides in a user home directory or system configuration path.
  • Track prompt-related shell initialization scripts for unexpected sourcing of bash-git-prompt on shared or jump hosts.

How to Mitigate CVE-2025-61659

Immediate Actions Required

  • Upgrade bash-git-prompt to a version released after 2.7.1 that implements secure temporary file creation.
  • Remove or unload bash-git-prompt from shell startup scripts on multi-user systems until patched.
  • Audit /tmp for existing git-index-private* artifacts and investigate any that are not owned by the active shell user.

Patch Information

No fixed version is listed in the NVD record at the time of publication. Track the upstream GitHub issue for the official remediation and release notes. Distribution package maintainers may publish backported fixes before an upstream release.

Workarounds

  • Mount /tmp with the nosymfollow option on Linux kernels that support it to block symlink-based attacks.
  • Enable per-user private temporary directories using systemdPrivateTmp=yes for services that invoke the prompt.
  • Restrict interactive shell access on shared hosts to trusted users to reduce exposure to local attackers.
bash
# Example: enforce per-user tmp isolation via pam_namespace
# /etc/security/namespace.conf
/tmp     /tmp-inst/        level      root,adm
/var/tmp /var/tmp/tmp-inst/ level      root,adm

# Enable pam_namespace in /etc/pam.d/login and /etc/pam.d/sshd
session    required     pam_namespace.so

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.