Advisory Database
  • Advisories
  • Dependency Scanning
  1. gem
  2. ›
  3. vagrant
  4. ›
  5. CVE-2025-34075

CVE-2025-34075: HashiCorp Vagrant has code injection vulnerability through default synced folders

July 2, 2025 (updated July 5, 2025)

An authenticated virtual machine escape vulnerability exists in HashiCorp Vagrant versions 2.4.6 and below 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.

References

  • developer.hashicorp.com/vagrant
  • developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage
  • developer.hashicorp.com/vagrant/docs/vagrantfile
  • github.com/advisories/GHSA-hqp6-mjw3-f586
  • github.com/hashicorp/vagrant
  • github.com/hashicorp/vagrant/commit/abe87b2fdc124ef426c016d44d2f6f4792f0cbe3
  • github.com/hashicorp/vagrant/issues/13688
  • github.com/rubysec/ruby-advisory-db/blob/master/gems/vagrant/CVE-2025-34075.yml
  • nvd.nist.gov/vuln/detail/CVE-2025-34075
  • raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/multi/local/vagrant_synced_folder_vagrantfile_breakout.rb
  • vulncheck.com/advisories/hashicorp-vagrant-synced-folder-vagrantfile-breakout

Code Behaviors & Features

Detect and mitigate CVE-2025-34075 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.2.10 before 2.4.7

Fixed versions

  • 2.4.7

Solution

Upgrade to version 2.4.7 or above.

Weakness

  • CWE-276: Incorrect Default Permissions
  • CWE-668: Exposure of Resource to Wrong Sphere
  • CWE-94: Improper Control of Generation of Code ('Code Injection')

Source file

gem/vagrant/CVE-2025-34075.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 19 Aug 2025 12:19:51 +0000.