Skip to main content

CVE-2025-34075: CWE-276 Incorrect Default Permissions in HashiCorp Vagrant

Medium
VulnerabilityCVE-2025-34075cvecve-2025-34075cwe-276cwe-668cwe-94
Published: Wed Jul 02 2025 (07/02/2025, 19:26:01 UTC)
Source: CVE Database V5
Vendor/Project: HashiCorp
Product: Vagrant

Description

An authenticated virtual machine escape vulnerability exists in HashiCorp Vagrant when using the default synced folder configuration. By design, Vagrant automatically mounts the host system’s project directory into the guest VM under /vagrant (or C:\vagrant on Windows). This includes the Vagrantfile configuration file, which is a Ruby script evaluated by the host every time a vagrant command is executed in the project directory. If a low-privileged attacker obtains shell access to the guest VM, they can append arbitrary Ruby code to the mounted Vagrantfile. When a user on the host later runs any vagrant command, the injected code is executed on the host with that user’s privileges. While this shared-folder behavior is well-documented by Vagrant, the security implications of Vagrantfile execution from guest-writable storage are not explicitly addressed. This effectively enables guest-to-host code execution in multi-tenant or adversarial VM scenarios.

AI-Powered Analysis

AILast updated: 07/02/2025, 19:55:56 UTC

Technical Analysis

CVE-2025-34075 is a vulnerability in HashiCorp Vagrant involving incorrect default permissions that enable a virtual machine (VM) escape attack. Vagrant automatically mounts the host system's project directory into the guest VM using a synced folder, typically at /vagrant on Linux/macOS or C:\vagrant on Windows. This mount includes the Vagrantfile, a Ruby script that Vagrant evaluates on the host whenever a vagrant command is executed. The vulnerability arises because the guest VM has write access to this mounted directory, allowing a low-privileged attacker who gains shell access inside the guest VM to append arbitrary Ruby code to the Vagrantfile. When the host user subsequently runs any vagrant command in that project directory, the malicious Ruby code executes on the host with the privileges of the host user running Vagrant. This creates a guest-to-host code execution vector, effectively enabling VM escape in multi-tenant or adversarial environments where the guest VM is compromised. The vulnerability is rooted in CWE-276 (Incorrect Default Permissions), CWE-668 (Exposure of Resource to Wrong Sphere), and CWE-94 (Improper Control of Generation of Code). The CVSS 4.0 base score is 5.4 (medium severity), reflecting the requirement for authenticated access to the guest VM, user interaction on the host, and the local attack vector, but with high impact on confidentiality, integrity, and availability due to host code execution. No known exploits are currently reported in the wild, and no patches have been linked yet. This vulnerability highlights a design oversight in Vagrant’s default synced folder behavior, where guest-writable host configuration files are executed without sufficient security controls or warnings about the risks of guest modification.

Potential Impact

For European organizations using Vagrant for development, testing, or deployment automation, this vulnerability poses a significant risk especially in environments where multiple users or tenants share VMs or where untrusted code runs inside guest VMs. An attacker who compromises a guest VM with low privileges can escalate to execute arbitrary code on the host machine, potentially leading to full host compromise. This can result in data breaches, unauthorized access to sensitive information, disruption of development workflows, and lateral movement within corporate networks. Organizations relying on Vagrant in regulated industries such as finance, healthcare, or critical infrastructure may face compliance violations if this vulnerability is exploited. The risk is heightened in scenarios where the host user has elevated privileges or access to sensitive resources. Additionally, the requirement for user interaction on the host (running a vagrant command) means social engineering or insider threats could facilitate exploitation. The vulnerability undermines the isolation guarantees typically expected from VM environments, impacting trust in development and testing infrastructure.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should: 1) Immediately restrict write permissions on the synced folder, especially the Vagrantfile, from the guest VM side. This can be done by configuring Vagrant to use synced folder options that mount the directory as read-only for the guest or by using alternative synced folder mechanisms that do not allow guest write access to host configuration files. 2) Educate developers and users to avoid running vagrant commands in project directories if the guest VM is untrusted or potentially compromised. 3) Implement strict access controls and monitoring on guest VMs to prevent unauthorized shell access. 4) Use host-based intrusion detection and file integrity monitoring to detect unexpected modifications to the Vagrantfile. 5) Consider isolating Vagrant usage to dedicated, non-critical hosts or virtual machines that do not contain sensitive data or credentials. 6) Regularly update Vagrant and monitor for official patches addressing this vulnerability. 7) Employ multi-factor authentication and network segmentation to limit attacker movement from guest to host. 8) Review and harden the development environment security posture, including limiting user privileges on hosts running Vagrant.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
VulnCheck
Date Reserved
2025-04-15T19:15:22.550Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 68658af26f40f0eb7293bb18

Added to database: 7/2/2025, 7:39:30 PM

Last enriched: 7/2/2025, 7:55:56 PM

Last updated: 7/3/2025, 8:00:29 AM

Views: 7

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats