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

CVE-2025-32797: Anaconda Conda-build Race Condition Flaw

CVE-2025-32797 is a race condition vulnerability in Anaconda Conda-build that allows attackers to exploit insecure file permissions and execute arbitrary code. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2025-32797 Overview

CVE-2025-32797 is a race condition vulnerability in conda-build, the tool used to build conda packages. The write_build_scripts function creates the temporary build script conda_build.sh with overly permissive file permissions (0o766), granting write access to all local users. Attackers with filesystem access can exploit the window between script creation and execution to overwrite its contents, leading to arbitrary code execution under the victim's privileges. The flaw is tracked as [CWE-277: Insecure Inherited Permissions] and was patched in version 25.3.1.

Critical Impact

Local attackers on shared build hosts can achieve arbitrary code execution as the user running conda-build, potentially leading to full system compromise.

Affected Products

  • Anaconda conda-build prior to version 25.3.1
  • Shared multi-user build systems using vulnerable conda-build versions
  • CI/CD pipelines invoking conda-build for package construction

Discovery Timeline

  • 2025-06-16 - CVE-2025-32797 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-32797

Vulnerability Analysis

The vulnerability resides in the write_build_scripts function in conda_build/build.py. When conda-build constructs a package, it writes the shell script conda_build.sh to disk and then invokes it. The script is created with mode 0o766, which grants read, write, and execute permissions to the owner and group, plus read and write permissions to all other users.

Because any local user can write to the file, a co-located attacker can overwrite the script during the brief window between creation and execution. When conda-build runs the script, it executes the attacker-supplied commands with the privileges of the build user. On shared servers and CI runners, this can lead to lateral movement or compromise of higher-privileged build accounts.

Root Cause

The root cause is the use of insecure file permissions when generating a script intended for the current user only. Build scripts should be restricted to the owner (0o700), and creation should be atomic to eliminate any time-of-check to time-of-use (TOCTOU) gap.

Attack Vector

An attacker requires local filesystem access to the host running conda-build. Even when output directories include randomized segments, the parent directory can be monitored for file creation events using inotify or equivalent kernel notification interfaces. Directory names are also inferable from timestamps, process listings, or build logs. Automated tooling can react within milliseconds of file creation, overwriting conda_build.sh before conda-build invokes it.

python
# Patch additions in conda_build/utils.py (version 25.3.1)
import mmap
import os
import re
import secrets
import shutil
import stat
import subprocess

# Patch additions in conda_build/build.py
from .utils import (
    CONDA_PACKAGE_EXTENSIONS,
    create_file_with_permissions,
    env_var,
    glob,
    on_mac,
)

Source: GitHub Conda Build Commit d246e49. The patch introduces a create_file_with_permissions helper and imports secrets for cryptographically secure randomized filenames, enabling atomic creation with restrictive permissions.

Detection Methods for CVE-2025-32797

Indicators of Compromise

  • Unexpected modifications to conda_build.sh files within active build directories during a build operation.
  • Local processes invoking inotify_add_watch or fanotify against conda-build working directories without legitimate justification.
  • Shell commands or binaries spawned by conda-build that do not match the expected recipe output.

Detection Strategies

  • Audit installed conda-build versions across build infrastructure and flag versions earlier than 25.3.1.
  • Monitor file integrity on conda_build.sh during build execution and alert on writes by users other than the build owner.
  • Enable Linux audit rules (auditd) on conda-build work directories to record open, write, and rename syscalls from non-build users.

Monitoring Recommendations

  • Forward audit and process telemetry from build hosts into a centralized data lake for correlation across CI jobs.
  • Track parent-child process relationships to detect unexpected command execution descending from conda-build.
  • Alert on file permission anomalies where build artifacts are created with world-writable modes such as 0o766.

How to Mitigate CVE-2025-32797

Immediate Actions Required

  • Upgrade conda-build to version 25.3.1 or later on every workstation, server, and CI runner.
  • Restrict access to shared build hosts so only trusted users can read or write to build directories.
  • Review existing build logs for evidence of unauthorized writes to conda_build.sh during recent builds.

Patch Information

The fix is published in conda-build version 25.3.1. Refer to the GitHub Security Advisory GHSA-vfp6-3v8g-vcmm and the upstream patch commit for full details. The patch introduces create_file_with_permissions and uses the secrets module to create files atomically with owner-only permissions.

Workarounds

  • Manually restrict permissions on generated conda_build.sh files from 0o766 to 0o700 so only the owner can read, write, or execute.
  • Use atomic file creation patterns: write to a randomized temporary filename and rename into place to close the TOCTOU window.
  • Run conda-build inside isolated single-tenant containers or per-user temporary directories to prevent local co-tenancy attacks.
bash
# Restrict conda_build.sh permissions to owner-only
umask 077
chmod 700 /path/to/build/work/conda_build.sh

# Verify installed conda-build version
conda-build --version  # must report 25.3.1 or newer

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

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.